install.texi: Remove i386-*-isc, i860-*-bsd, m68k-altos-sysv, m68k-isi-bsd, m68k...
[platform/upstream/gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2 @c 2000, 2001, 2002 Free Software Foundation, Inc.
3 @c This is part of the GCC manual.
4 @c For copying conditions, see the file gcc.texi.
5
6 @ignore
7 @c man begin COPYRIGHT
8 Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
9 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
10
11 Permission is granted to copy, distribute and/or modify this document
12 under the terms of the GNU Free Documentation License, Version 1.1 or
13 any later version published by the Free Software Foundation; with the
14 Invariant Sections being ``GNU General Public License'' and ``Funding
15 Free Software'', the Front-Cover texts being (a) (see below), and with
16 the Back-Cover Texts being (b) (see below).  A copy of the license is
17 included in the gfdl(7) man page.
18
19 (a) The FSF's Front-Cover Text is:
20
21      A GNU Manual
22
23 (b) The FSF's Back-Cover Text is:
24
25      You have freedom to copy and modify this GNU Manual, like GNU
26      software.  Copies published by the Free Software Foundation raise
27      funds for GNU development.
28 @c man end
29 @c Set file name and title for the man page.
30 @setfilename gcc
31 @settitle GNU project C and C++ compiler
32 @c man begin SYNOPSIS
33 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
34     [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
35     [@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
36     [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
37     [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
38     [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
39     [@option{-o} @var{outfile}] @var{infile}@dots{}
40
41 Only the most useful options are listed here; see below for the
42 remainder.  @samp{g++} accepts mostly the same options as @samp{gcc}.
43 @c man end
44 @c man begin SEEALSO
45 gpl(7), gfdl(7), fsf-funding(7),
46 cpp(1), gcov(1), g77(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
47 and the Info entries for @file{gcc}, @file{cpp}, @file{g77}, @file{as},
48 @file{ld}, @file{binutils} and @file{gdb}.
49 @c man end
50 @c man begin BUGS
51 For instructions on reporting bugs, see
52 @w{@uref{http://gcc.gnu.org/bugs.html}}.  Use of the @command{gccbug}
53 script to report bugs is recommended.
54 @c man end
55 @c man begin AUTHOR
56 See the Info entry for @command{gcc}, or
57 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
58 for contributors to GCC@.
59 @c man end
60 @end ignore
61
62 @node Invoking GCC
63 @chapter GCC Command Options
64 @cindex GCC command options
65 @cindex command options
66 @cindex options, GCC command
67
68 @c man begin DESCRIPTION
69
70 When you invoke GCC, it normally does preprocessing, compilation,
71 assembly and linking.  The ``overall options'' allow you to stop this
72 process at an intermediate stage.  For example, the @option{-c} option
73 says not to run the linker.  Then the output consists of object files
74 output by the assembler.
75
76 Other options are passed on to one stage of processing.  Some options
77 control the preprocessor and others the compiler itself.  Yet other
78 options control the assembler and linker; most of these are not
79 documented here, since you rarely need to use any of them.
80
81 @cindex C compilation options
82 Most of the command line options that you can use with GCC are useful
83 for C programs; when an option is only useful with another language
84 (usually C++), the explanation says so explicitly.  If the description
85 for a particular option does not mention a source language, you can use
86 that option with all supported languages.
87
88 @cindex C++ compilation options
89 @xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
90 options for compiling C++ programs.
91
92 @cindex grouping options
93 @cindex options, grouping
94 The @command{gcc} program accepts options and file names as operands.  Many
95 options have multi-letter names; therefore multiple single-letter options
96 may @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d
97 -r}}.
98
99 @cindex order of options
100 @cindex options, order
101 You can mix options and other arguments.  For the most part, the order
102 you use doesn't matter.  Order does matter when you use several options
103 of the same kind; for example, if you specify @option{-L} more than once,
104 the directories are searched in the order specified.
105
106 Many options have long names starting with @samp{-f} or with
107 @samp{-W}---for example, @option{-fforce-mem},
108 @option{-fstrength-reduce}, @option{-Wformat} and so on.  Most of
109 these have both positive and negative forms; the negative form of
110 @option{-ffoo} would be @option{-fno-foo}.  This manual documents
111 only one of these two forms, whichever one is not the default.
112
113 @c man end
114
115 @xref{Option Index}, for an index to GCC's options.
116
117 @menu
118 * Option Summary::      Brief list of all options, without explanations.
119 * Overall Options::     Controlling the kind of output:
120                         an executable, object files, assembler files,
121                         or preprocessed source.
122 * Invoking G++::        Compiling C++ programs.
123 * C Dialect Options::   Controlling the variant of C language compiled.
124 * C++ Dialect Options:: Variations on C++.
125 * Objective-C Dialect Options:: Variations on Objective-C.
126 * Language Independent Options:: Controlling how diagnostics should be
127                         formatted.
128 * Warning Options::     How picky should the compiler be?
129 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
130 * Optimize Options::    How much optimization?
131 * Preprocessor Options:: Controlling header files and macro definitions.
132                          Also, getting dependency information for Make.
133 * Assembler Options::   Passing options to the assembler.
134 * Link Options::        Specifying libraries and so on.
135 * Directory Options::   Where to find header files and libraries.
136                         Where to find the compiler executable files.
137 * Spec Files::          How to pass switches to sub-processes.
138 * Target Options::      Running a cross-compiler, or an old version of GCC.
139 * Submodel Options::    Specifying minor hardware or convention variations,
140                         such as 68010 vs 68020.
141 * Code Gen Options::    Specifying conventions for function calls, data layout
142                         and register usage.
143 * Environment Variables:: Env vars that affect GCC.
144 * Running Protoize::    Automatically adding or removing function prototypes.
145 @end menu
146
147 @c man begin OPTIONS
148
149 @node Option Summary
150 @section Option Summary
151
152 Here is a summary of all the options, grouped by type.  Explanations are
153 in the following sections.
154
155 @table @emph
156 @item Overall Options
157 @xref{Overall Options,,Options Controlling the Kind of Output}.
158 @gccoptlist{
159 -c  -S  -E  -o @var{file}  -pipe  -pass-exit-codes  -x @var{language} @gol
160 -v  -###  --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} -Xpreprocessor @var{option}}
309
310 @item Assembler Option
311 @xref{Assembler Options,,Passing Options to the Assembler}.
312 @gccoptlist{
313 -Wa,@var{option} -Xassembler @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{ARM Options}
371 @gccoptlist{
372 -mapcs-frame  -mno-apcs-frame @gol
373 -mapcs-26  -mapcs-32 @gol
374 -mapcs-stack-check  -mno-apcs-stack-check @gol
375 -mapcs-float  -mno-apcs-float @gol
376 -mapcs-reentrant  -mno-apcs-reentrant @gol
377 -msched-prolog  -mno-sched-prolog @gol
378 -mlittle-endian  -mbig-endian  -mwords-little-endian @gol
379 -malignment-traps  -mno-alignment-traps @gol
380 -msoft-float  -mhard-float  -mfpe @gol
381 -mthumb-interwork  -mno-thumb-interwork @gol
382 -mcpu=@var{name}  -march=@var{name}  -mfpe=@var{name}  @gol
383 -mstructure-size-boundary=@var{n} @gol
384 -mabort-on-noreturn @gol
385 -mlong-calls  -mno-long-calls @gol
386 -msingle-pic-base  -mno-single-pic-base @gol
387 -mpic-register=@var{reg} @gol
388 -mnop-fun-dllimport @gol
389 -mpoke-function-name @gol
390 -mthumb  -marm @gol
391 -mtpcs-frame  -mtpcs-leaf-frame @gol
392 -mcaller-super-interworking  -mcallee-super-interworking }
393
394 @emph{MN10200 Options}
395 @gccoptlist{
396 -mrelax}
397
398 @emph{MN10300 Options}
399 @gccoptlist{
400 -mmult-bug  -mno-mult-bug @gol
401 -mam33  -mno-am33 @gol
402 -mno-crt0  -mrelax}
403
404 @emph{M32R/D Options}
405 @gccoptlist{
406 -m32rx -m32r -mcode-model=@var{model-type}  -msdata=@var{sdata-type} @gol
407 -G @var{num}}
408
409 @emph{M88K Options}
410 @gccoptlist{
411 -m88000  -m88100  -m88110  -mbig-pic @gol
412 -mcheck-zero-division  -mhandle-large-shift @gol
413 -midentify-revision  -mno-check-zero-division @gol
414 -mno-ocs-debug-info  -mno-ocs-frame-position @gol
415 -mno-optimize-arg-area  -mno-serialize-volatile @gol
416 -mno-underscores  -mocs-debug-info @gol
417 -mocs-frame-position  -moptimize-arg-area @gol
418 -mserialize-volatile  -mshort-data-@var{num}  -msvr3 @gol
419 -msvr4  -mtrap-large-shift  -muse-div-instruction @gol
420 -mversion-03.00  -mwarn-passed-structs}
421
422 @emph{RS/6000 and PowerPC Options}
423 @gccoptlist{
424 -mcpu=@var{cpu-type} @gol
425 -mtune=@var{cpu-type} @gol
426 -mpower  -mno-power  -mpower2  -mno-power2 @gol
427 -mpowerpc  -mpowerpc64  -mno-powerpc @gol
428 -maltivec -mno-altivec @gol
429 -mpowerpc-gpopt  -mno-powerpc-gpopt @gol
430 -mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
431 -mnew-mnemonics  -mold-mnemonics @gol
432 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
433 -m64  -m32  -mxl-call  -mno-xl-call  -mpe @gol
434 -msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
435 -mstring  -mno-string  -mupdate  -mno-update @gol
436 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
437 -mstrict-align  -mno-strict-align  -mrelocatable @gol
438 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
439 -mtoc  -mno-toc -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
440 -mcall-aix -mcall-sysv -mcall-netbsd @gol
441 -maix-struct-return -msvr4-struct-return @gol
442 -mabi=altivec -mabi=no-altivec @gol
443 -mabi=spe -mabi=no-spe @gol
444 -misel=yes -misel=no @gol
445 -mprototype  -mno-prototype @gol
446 -msim  -mmvme  -mads  -myellowknife  -memb -msdata @gol
447 -msdata=@var{opt}  -mvxworks -mwindiss -G @var{num} -pthread}
448
449 @emph{Darwin Options}
450 @gccoptlist{
451 -all_load -allowable_client -arch -arch_errors_fatal @gol
452 -arch_only -bind_at_load -bundle -bundle_loader @gol
453 -client_name -compatibility_version -current_version @gol
454 -dependency-file -dylib_file -dylinker_install_name @gol
455 -dynamic -dynamiclib -exported_symbols_list @gol
456 -filelist -flat_namespace -force_cpusubtype_ALL @gol
457 -force_flat_namespace -headerpad_max_install_names @gol
458 -image_base -init -install_name -keep_private_externs @gol
459 -multi_module -multiply_defined -multiply_defined_unused @gol
460 -noall_load -nomultidefs -noprebind -noseglinkedit @gol
461 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
462 -private_bundle -read_only_relocs -sectalign @gol
463 -sectobjectsymbols -whyload -seg1addr @gol
464 -sectcreate -sectobjectsymbols -sectorder @gol
465 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
466 -segprot -segs_read_only_addr -segs_read_write_addr @gol
467 -single_module -static -sub_library -sub_umbrella @gol
468 -twolevel_namespace -umbrella -undefined @gol
469 -unexported_symbols_list -weak_reference_mismatches -whatsloaded}
470
471 @emph{RT Options}
472 @gccoptlist{
473 -mcall-lib-mul  -mfp-arg-in-fpregs  -mfp-arg-in-gregs @gol
474 -mfull-fp-blocks  -mhc-struct-return  -min-line-mul @gol
475 -mminimum-fp-blocks  -mnohc-struct-return}
476
477 @emph{MIPS Options}
478 @gccoptlist{
479 -mabicalls -march=@var{cpu-type} -mtune=@var{cpu=type} @gol
480 -mcpu=@var{cpu-type} -membedded-data  -muninit-const-in-rodata @gol
481 -membedded-pic  -mfp32  -mfp64  -mfused-madd  -mno-fused-madd @gol
482 -mgas  -mgp32  -mgp64 @gol
483 -mgpopt  -mhalf-pic  -mhard-float  -mint64  -mips1 @gol
484 -mips2  -mips3  -mips4  -mlong64  -mlong32  -mlong-calls  -mmemcpy @gol
485 -mmips-as  -mmips-tfile  -mno-abicalls @gol
486 -mno-embedded-data  -mno-uninit-const-in-rodata @gol
487 -mno-embedded-pic  -mno-gpopt  -mno-long-calls @gol
488 -mno-memcpy  -mno-mips-tfile  -mno-rnames  -mno-stats @gol
489 -mrnames  -msoft-float @gol
490 -m4650  -msingle-float  -mmad @gol
491 -mstats  -EL  -EB  -G @var{num}  -nocpp @gol
492 -mabi=32  -mabi=n32  -mabi=64  -mabi=eabi @gol
493 -mfix7000  -mno-crt0 -mflush-func=@var{func} -mno-flush-func @gol
494 -mbranch-likely -mno-branch-likely}
495
496 @emph{i386 and x86-64 Options}
497 @gccoptlist{
498 -mcpu=@var{cpu-type}  -march=@var{cpu-type} -mfpmath=@var{unit} @gol
499 -masm=@var{dialect}  -mno-fancy-math-387 @gol
500 -mno-fp-ret-in-387  -msoft-float  -msvr3-shlib @gol
501 -mno-wide-multiply  -mrtd  -malign-double @gol
502 -mpreferred-stack-boundary=@var{num} @gol
503 -mmmx  -msse -msse2 -m3dnow @gol
504 -mthreads  -mno-align-stringops  -minline-all-stringops @gol
505 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
506 -m96bit-long-double  -mregparm=@var{num}  -momit-leaf-frame-pointer @gol
507 -mno-red-zone@gol
508 -mcmodel=@var{code-model} @gol
509 -m32 -m64}
510
511 @emph{HPPA Options}
512 @gccoptlist{
513 -march=@var{architecture-type} @gol
514 -mbig-switch  -mdisable-fpregs  -mdisable-indexing @gol
515 -mfast-indirect-calls  -mgas  -mgnu-ld -mhp-ld @gol
516 -mjump-in-delay -mlinker-opt -mlong-calls @gol
517 -mlong-load-store  -mno-big-switch  -mno-disable-fpregs @gol
518 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
519 -mno-jump-in-delay  -mno-long-load-store @gol
520 -mno-portable-runtime  -mno-soft-float @gol
521 -mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
522 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
523 -mschedule=@var{cpu-type}  -mspace-regs -msio -mwsio}
524
525 @emph{Intel 960 Options}
526 @gccoptlist{
527 -m@var{cpu-type}  -masm-compat  -mclean-linkage @gol
528 -mcode-align  -mcomplex-addr  -mleaf-procedures @gol
529 -mic-compat  -mic2.0-compat  -mic3.0-compat @gol
530 -mintel-asm  -mno-clean-linkage  -mno-code-align @gol
531 -mno-complex-addr  -mno-leaf-procedures @gol
532 -mno-old-align  -mno-strict-align  -mno-tail-call @gol
533 -mnumerics  -mold-align  -msoft-float  -mstrict-align @gol
534 -mtail-call}
535
536 @emph{DEC Alpha Options}
537 @gccoptlist{
538 -mno-fp-regs  -msoft-float  -malpha-as  -mgas @gol
539 -mieee  -mieee-with-inexact  -mieee-conformant @gol
540 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
541 -mtrap-precision=@var{mode}  -mbuild-constants @gol
542 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
543 -mbwx  -mmax  -mfix  -mcix @gol
544 -mfloat-vax  -mfloat-ieee @gol
545 -mexplicit-relocs  -msmall-data  -mlarge-data -msmall-text -mlarge-text @gol
546 -mmemory-latency=@var{time}}
547
548 @emph{DEC Alpha/VMS Options}
549 @gccoptlist{
550 -mvms-return-codes}
551
552 @emph{H8/300 Options}
553 @gccoptlist{
554 -mrelax  -mh  -ms  -mn  -mint32  -malign-300}
555
556 @emph{SH Options}
557 @gccoptlist{
558 -m1  -m2  -m3  -m3e @gol
559 -m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
560 -m5-64media -m5-64media-nofpu @gol
561 -m5-32media -m5-32media-nofpu @gol
562 -m5-compact -m5-compact-nofpu @gol
563 -mb  -ml  -mdalign  -mrelax @gol
564 -mbigtable  -mfmovd  -mhitachi  -mnomacsave @gol
565 -mieee  -misize  -mpadstruct  -mspace @gol
566 -mprefergot  -musermode}
567
568 @emph{System V Options}
569 @gccoptlist{
570 -Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
571
572 @emph{ARC Options}
573 @gccoptlist{
574 -EB  -EL @gol
575 -mmangle-cpu  -mcpu=@var{cpu}  -mtext=@var{text-section} @gol
576 -mdata=@var{data-section}  -mrodata=@var{readonly-data-section}}
577
578 @emph{TMS320C3x/C4x Options}
579 @gccoptlist{
580 -mcpu=@var{cpu}  -mbig  -msmall  -mregparm  -mmemparm @gol
581 -mfast-fix  -mmpyi  -mbk  -mti  -mdp-isr-reload @gol
582 -mrpts=@var{count}  -mrptb  -mdb  -mloop-unsigned @gol
583 -mparallel-insns  -mparallel-mpy  -mpreserve-float}
584
585 @emph{V850 Options}
586 @gccoptlist{
587 -mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
588 -mprolog-function  -mno-prolog-function  -mspace @gol
589 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
590 -mapp-regs -mno-app-regs @gol
591 -mdisable-callt -mno-disable-callt @gol
592 -mv850e @gol
593 -mv850  -mbig-switch}
594
595 @emph{NS32K Options}
596 @gccoptlist{
597 -m32032  -m32332  -m32532  -m32081  -m32381 @gol
598 -mmult-add  -mnomult-add  -msoft-float  -mrtd  -mnortd @gol
599 -mregparam  -mnoregparam  -msb  -mnosb @gol
600 -mbitfield  -mnobitfield  -mhimem  -mnohimem}
601
602 @emph{AVR Options}
603 @gccoptlist{
604 -mmcu=@var{mcu}  -msize  -minit-stack=@var{n}  -mno-interrupts @gol
605 -mcall-prologues  -mno-tablejump  -mtiny-stack}
606
607 @emph{MCore Options}
608 @gccoptlist{
609 -mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
610 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
611 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
612 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
613 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
614
615 @emph{MMIX Options}
616 @gccoptlist{
617 -mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
618 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
619 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
620 -mno-base-addresses -msingle-exit -mno-single-exit}
621
622 @emph{IA-64 Options}
623 @gccoptlist{
624 -mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
625 -mvolatile-asm-stop  -mb-step  -mregister-names  -mno-sdata @gol
626 -mconstant-gp  -mauto-pic  -minline-float-divide-min-latency @gol
627 -minline-float-divide-max-throughput -minline-int-divide-min-latency @gol
628 -minline-int-divide-max-throughput -mno-dwarf2-asm @gol
629 -mfixed-range=@var{register-range}}
630
631 @emph{D30V Options}
632 @gccoptlist{
633 -mextmem  -mextmemory  -monchip  -mno-asm-optimize @gol
634 -masm-optimize -mbranch-cost=@var{n} -mcond-exec=@var{n}}
635
636 @emph{S/390 and zSeries Options}
637 @gccoptlist{
638 -mcpu=@var{cpu-type} -march=@var{cpu-type} @gol
639 -mhard-float  -msoft-float  -mbackchain  -mno-backchain @gol
640 -msmall-exec  -mno-small-exec  -mmvcle -mno-mvcle @gol
641 -m64 -m31 -mdebug -mno-debug -mesa -mzarch}
642
643 @emph{CRIS Options}
644 @gccoptlist{
645 -mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
646 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
647 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
648 -mstack-align -mdata-align -mconst-align @gol
649 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
650 -melf -maout -melinux -mlinux -sim -sim2}
651
652 @emph{PDP-11 Options}
653 @gccoptlist{
654 -mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
655 -mbcopy  -mbcopy-builtin  -mint32  -mno-int16 @gol
656 -mint16  -mno-int32  -mfloat32  -mno-float64 @gol
657 -mfloat64  -mno-float32  -mabshi  -mno-abshi @gol
658 -mbranch-expensive  -mbranch-cheap @gol
659 -msplit  -mno-split  -munix-asm  -mdec-asm}
660
661 @emph{Xstormy16 Options}
662 @gccoptlist{
663 -msim}
664
665 @emph{Xtensa Options}
666 @gccoptlist{
667 -mbig-endian -mlittle-endian @gol
668 -mdensity -mno-density @gol
669 -mmac16 -mno-mac16 @gol
670 -mmul16 -mno-mul16 @gol
671 -mmul32 -mno-mul32 @gol
672 -mnsa -mno-nsa @gol
673 -mminmax -mno-minmax @gol
674 -msext -mno-sext @gol
675 -mbooleans -mno-booleans @gol
676 -mhard-float -msoft-float @gol
677 -mfused-madd -mno-fused-madd @gol
678 -mserialize-volatile -mno-serialize-volatile @gol
679 -mtext-section-literals -mno-text-section-literals @gol
680 -mtarget-align -mno-target-align @gol
681 -mlongcalls -mno-longcalls}
682
683 @emph{FRV Options}
684 @gccoptlist{
685 -mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 -mhard-float -msoft-float @gol
686 -malloc-cc -mfixed-cc -mdword -mno-dword -mdouble -mno-double @gol
687 -mmedia -mno-media -mmuladd -mno-muladd -mlibrary-pic -macc-4 @gol
688 -macc-8 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
689 -mscc -mno-scc -mcond-exec -mno-cond-exec -mvliw-branch -mno-vliw-branch @gol
690 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
691 -mno-nested-cond-exec -mtomcat-stats @gol
692 -mcpu=@var{cpu}}
693
694
695
696 @item Code Generation Options
697 @xref{Code Gen Options,,Options for Code Generation Conventions}.
698 @gccoptlist{
699 -fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
700 -ffixed-@var{reg} -fexceptions @gol
701 -fnon-call-exceptions  -funwind-tables @gol
702 -fasynchronous-unwind-tables @gol
703 -finhibit-size-directive  -finstrument-functions @gol
704 -fno-common  -fno-ident  -fno-gnu-linker @gol
705 -fpcc-struct-return  -fpic  -fPIC @gol
706 -freg-struct-return  -fshared-data  -fshort-enums @gol
707 -fshort-double  -fshort-wchar -fvolatile @gol
708 -fvolatile-global  -fvolatile-static @gol
709 -fverbose-asm  -fpack-struct  -fstack-check @gol
710 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
711 -fargument-alias  -fargument-noalias @gol
712 -fargument-noalias-global  -fleading-underscore @gol
713 -ftls-model=@var{model}}
714 @end table
715
716 @menu
717 * Overall Options::     Controlling the kind of output:
718                         an executable, object files, assembler files,
719                         or preprocessed source.
720 * C Dialect Options::   Controlling the variant of C language compiled.
721 * C++ Dialect Options:: Variations on C++.
722 * Objective-C Dialect Options:: Variations on Objective-C.
723 * Language Independent Options:: Controlling how diagnostics should be
724                         formatted.
725 * Warning Options::     How picky should the compiler be?
726 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
727 * Optimize Options::    How much optimization?
728 * Preprocessor Options:: Controlling header files and macro definitions.
729                          Also, getting dependency information for Make.
730 * Assembler Options::   Passing options to the assembler.
731 * Link Options::        Specifying libraries and so on.
732 * Directory Options::   Where to find header files and libraries.
733                         Where to find the compiler executable files.
734 * Spec Files::          How to pass switches to sub-processes.
735 * Target Options::      Running a cross-compiler, or an old version of GCC.
736 @end menu
737
738 @node Overall Options
739 @section Options Controlling the Kind of Output
740
741 Compilation can involve up to four stages: preprocessing, compilation
742 proper, assembly and linking, always in that order.  The first three
743 stages apply to an individual source file, and end by producing an
744 object file; linking combines all the object files (those newly
745 compiled, and those specified as input) into an executable file.
746
747 @cindex file name suffix
748 For any given input file, the file name suffix determines what kind of
749 compilation is done:
750
751 @table @gcctabopt
752 @item @var{file}.c
753 C source code which must be preprocessed.
754
755 @item @var{file}.i
756 C source code which should not be preprocessed.
757
758 @item @var{file}.ii
759 C++ source code which should not be preprocessed.
760
761 @item @var{file}.m
762 Objective-C source code.  Note that you must link with the library
763 @file{libobjc.a} to make an Objective-C program work.
764
765 @item @var{file}.mi
766 Objective-C source code which should not be preprocessed.
767
768 @item @var{file}.h
769 C header file (not to be compiled or linked).
770
771 @item @var{file}.cc
772 @itemx @var{file}.cp
773 @itemx @var{file}.cxx
774 @itemx @var{file}.cpp
775 @itemx @var{file}.CPP
776 @itemx @var{file}.c++
777 @itemx @var{file}.C
778 C++ source code which must be preprocessed.  Note that in @samp{.cxx},
779 the last two letters must both be literally @samp{x}.  Likewise,
780 @samp{.C} refers to a literal capital C@.
781
782 @item @var{file}.f
783 @itemx @var{file}.for
784 @itemx @var{file}.FOR
785 Fortran source code which should not be preprocessed.
786
787 @item @var{file}.F
788 @itemx @var{file}.fpp
789 @itemx @var{file}.FPP
790 Fortran source code which must be preprocessed (with the traditional
791 preprocessor).
792
793 @item @var{file}.r
794 Fortran source code which must be preprocessed with a RATFOR
795 preprocessor (not included with GCC)@.
796
797 @xref{Overall Options,,Options Controlling the Kind of Output, g77,
798 Using and Porting GNU Fortran}, for more details of the handling of
799 Fortran input files.
800
801 @c FIXME: Descriptions of Java file types.
802 @c @var{file}.java
803 @c @var{file}.class
804 @c @var{file}.zip
805 @c @var{file}.jar
806
807 @item @var{file}.ads
808 Ada source code file which contains a library unit declaration (a
809 declaration of a package, subprogram, or generic, or a generic
810 instantiation), or a library unit renaming declaration (a package,
811 generic, or subprogram renaming declaration).  Such files are also
812 called @dfn{specs}.
813
814 @itemx @var{file}.adb
815 Ada source code file containing a library unit body (a subprogram or
816 package body).  Such files are also called @dfn{bodies}.
817
818 @c GCC also knows about some suffixes for languages not yet included:
819 @c Pascal:
820 @c @var{file}.p
821 @c @var{file}.pas
822
823 @item @var{file}.s
824 Assembler code.
825
826 @item @var{file}.S
827 Assembler code which must be preprocessed.
828
829 @item @var{other}
830 An object file to be fed straight into linking.
831 Any file name with no recognized suffix is treated this way.
832 @end table
833
834 @opindex x
835 You can specify the input language explicitly with the @option{-x} option:
836
837 @table @gcctabopt
838 @item -x @var{language}
839 Specify explicitly the @var{language} for the following input files
840 (rather than letting the compiler choose a default based on the file
841 name suffix).  This option applies to all following input files until
842 the next @option{-x} option.  Possible values for @var{language} are:
843 @example
844 c  c-header  cpp-output
845 c++  c++-cpp-output
846 objective-c  objc-cpp-output
847 assembler  assembler-with-cpp
848 ada
849 f77  f77-cpp-input  ratfor
850 java
851 treelang
852 @end example
853
854 @item -x none
855 Turn off any specification of a language, so that subsequent files are
856 handled according to their file name suffixes (as they are if @option{-x}
857 has not been used at all).
858
859 @item -pass-exit-codes
860 @opindex pass-exit-codes
861 Normally the @command{gcc} program will exit with the code of 1 if any
862 phase of the compiler returns a non-success return code.  If you specify
863 @option{-pass-exit-codes}, the @command{gcc} program will instead return with
864 numerically highest error produced by any phase that returned an error
865 indication.
866 @end table
867
868 If you only want some of the stages of compilation, you can use
869 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
870 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
871 @command{gcc} is to stop.  Note that some combinations (for example,
872 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
873
874 @table @gcctabopt
875 @item -c
876 @opindex c
877 Compile or assemble the source files, but do not link.  The linking
878 stage simply is not done.  The ultimate output is in the form of an
879 object file for each source file.
880
881 By default, the object file name for a source file is made by replacing
882 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
883
884 Unrecognized input files, not requiring compilation or assembly, are
885 ignored.
886
887 @item -S
888 @opindex S
889 Stop after the stage of compilation proper; do not assemble.  The output
890 is in the form of an assembler code file for each non-assembler input
891 file specified.
892
893 By default, the assembler file name for a source file is made by
894 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
895
896 Input files that don't require compilation are ignored.
897
898 @item -E
899 @opindex E
900 Stop after the preprocessing stage; do not run the compiler proper.  The
901 output is in the form of preprocessed source code, which is sent to the
902 standard output.
903
904 Input files which don't require preprocessing are ignored.
905
906 @cindex output file option
907 @item -o @var{file}
908 @opindex o
909 Place output in file @var{file}.  This applies regardless to whatever
910 sort of output is being produced, whether it be an executable file,
911 an object file, an assembler file or preprocessed C code.
912
913 Since only one output file can be specified, it does not make sense to
914 use @option{-o} when compiling more than one input file, unless you are
915 producing an executable file as output.
916
917 If @option{-o} is not specified, the default is to put an executable file
918 in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in
919 @file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and
920 all preprocessed C source on standard output.
921
922 @item -v
923 @opindex v
924 Print (on standard error output) the commands executed to run the stages
925 of compilation.  Also print the version number of the compiler driver
926 program and of the preprocessor and the compiler proper.
927
928 @item -###
929 @opindex ###
930 Like @option{-v} except the commands are not executed and all command
931 arguments are quoted.  This is useful for shell scripts to capture the
932 driver-generated command lines.
933
934 @item -pipe
935 @opindex pipe
936 Use pipes rather than temporary files for communication between the
937 various stages of compilation.  This fails to work on some systems where
938 the assembler is unable to read from a pipe; but the GNU assembler has
939 no trouble.
940
941 @item --help
942 @opindex help
943 Print (on the standard output) a description of the command line options
944 understood by @command{gcc}.  If the @option{-v} option is also specified
945 then @option{--help} will also be passed on to the various processes
946 invoked by @command{gcc}, so that they can display the command line options
947 they accept.  If the @option{-W} option is also specified then command
948 line options which have no documentation associated with them will also
949 be displayed.
950
951 @item --target-help
952 @opindex target-help
953 Print (on the standard output) a description of target specific command
954 line options for each tool.
955
956 @item --version
957 @opindex version
958 Display the version number and copyrights of the invoked GCC.
959 @end table
960
961 @node Invoking G++
962 @section Compiling C++ Programs
963
964 @cindex suffixes for C++ source
965 @cindex C++ source file suffixes
966 C++ source files conventionally use one of the suffixes @samp{.C},
967 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or @samp{.cxx};
968 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
969 files with these names and compiles them as C++ programs even if you
970 call the compiler the same way as for compiling C programs (usually with
971 the name @command{gcc}).
972
973 @findex g++
974 @findex c++
975 However, C++ programs often require class libraries as well as a
976 compiler that understands the C++ language---and under some
977 circumstances, you might want to compile programs from standard input,
978 or otherwise without a suffix that flags them as C++ programs.
979 @command{g++} is a program that calls GCC with the default language
980 set to C++, and automatically specifies linking against the C++
981 library.  On many systems, @command{g++} is also
982 installed with the name @command{c++}.
983
984 @cindex invoking @command{g++}
985 When you compile C++ programs, you may specify many of the same
986 command-line options that you use for compiling programs in any
987 language; or command-line options meaningful for C and related
988 languages; or options that are meaningful only for C++ programs.
989 @xref{C Dialect Options,,Options Controlling C Dialect}, for
990 explanations of options for languages related to C@.
991 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
992 explanations of options that are meaningful only for C++ programs.
993
994 @node C Dialect Options
995 @section Options Controlling C Dialect
996 @cindex dialect options
997 @cindex language dialect options
998 @cindex options, dialect
999
1000 The following options control the dialect of C (or languages derived
1001 from C, such as C++ and Objective-C) that the compiler accepts:
1002
1003 @table @gcctabopt
1004 @cindex ANSI support
1005 @cindex ISO support
1006 @item -ansi
1007 @opindex ansi
1008 In C mode, support all ISO C90 programs.  In C++ mode,
1009 remove GNU extensions that conflict with ISO C++.
1010
1011 This turns off certain features of GCC that are incompatible with ISO
1012 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1013 such as the @code{asm} and @code{typeof} keywords, and
1014 predefined macros such as @code{unix} and @code{vax} that identify the
1015 type of system you are using.  It also enables the undesirable and
1016 rarely used ISO trigraph feature.  For the C compiler,
1017 it disables recognition of C++ style @samp{//} comments as well as
1018 the @code{inline} keyword.
1019
1020 The alternate keywords @code{__asm__}, @code{__extension__},
1021 @code{__inline__} and @code{__typeof__} continue to work despite
1022 @option{-ansi}.  You would not want to use them in an ISO C program, of
1023 course, but it is useful to put them in header files that might be included
1024 in compilations done with @option{-ansi}.  Alternate predefined macros
1025 such as @code{__unix__} and @code{__vax__} are also available, with or
1026 without @option{-ansi}.
1027
1028 The @option{-ansi} option does not cause non-ISO programs to be
1029 rejected gratuitously.  For that, @option{-pedantic} is required in
1030 addition to @option{-ansi}.  @xref{Warning Options}.
1031
1032 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1033 option is used.  Some header files may notice this macro and refrain
1034 from declaring certain functions or defining certain macros that the
1035 ISO standard doesn't call for; this is to avoid interfering with any
1036 programs that might use these names for other things.
1037
1038 Functions which would normally be built in but do not have semantics
1039 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1040 functions with @option{-ansi} is used.  @xref{Other Builtins,,Other
1041 built-in functions provided by GCC}, for details of the functions
1042 affected.
1043
1044 @item -std=
1045 @opindex std
1046 Determine the language standard.  This option is currently only
1047 supported when compiling C or C++.  A value for this option must be
1048 provided; possible values are
1049
1050 @table @samp
1051 @item c89
1052 @itemx iso9899:1990
1053 ISO C90 (same as @option{-ansi}).
1054
1055 @item iso9899:199409
1056 ISO C90 as modified in amendment 1.
1057
1058 @item c99
1059 @itemx c9x
1060 @itemx iso9899:1999
1061 @itemx iso9899:199x
1062 ISO C99.  Note that this standard is not yet fully supported; see
1063 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information.  The
1064 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1065
1066 @item gnu89
1067 Default, ISO C90 plus GNU extensions (including some C99 features).
1068
1069 @item gnu99
1070 @item gnu9x
1071 ISO C99 plus GNU extensions.  When ISO C99 is fully implemented in GCC,
1072 this will become the default.  The name @samp{gnu9x} is deprecated.
1073
1074 @item c++98
1075 The 1998 ISO C++ standard plus amendments.
1076
1077 @item gnu++98
1078 The same as @option{-std=c++98} plus GNU extensions.  This is the
1079 default for C++ code.
1080 @end table
1081
1082 Even when this option is not specified, you can still use some of the
1083 features of newer standards in so far as they do not conflict with
1084 previous C standards.  For example, you may use @code{__restrict__} even
1085 when @option{-std=c99} is not specified.
1086
1087 The @option{-std} options specifying some version of ISO C have the same
1088 effects as @option{-ansi}, except that features that were not in ISO C90
1089 but are in the specified version (for example, @samp{//} comments and
1090 the @code{inline} keyword in ISO C99) are not disabled.
1091
1092 @xref{Standards,,Language Standards Supported by GCC}, for details of
1093 these standard versions.
1094
1095 @item -aux-info @var{filename}
1096 @opindex aux-info
1097 Output to the given filename prototyped declarations for all functions
1098 declared and/or defined in a translation unit, including those in header
1099 files.  This option is silently ignored in any language other than C@.
1100
1101 Besides declarations, the file indicates, in comments, the origin of
1102 each declaration (source file and line), whether the declaration was
1103 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1104 @samp{O} for old, respectively, in the first character after the line
1105 number and the colon), and whether it came from a declaration or a
1106 definition (@samp{C} or @samp{F}, respectively, in the following
1107 character).  In the case of function definitions, a K&R-style list of
1108 arguments followed by their declarations is also provided, inside
1109 comments, after the declaration.
1110
1111 @item -fno-asm
1112 @opindex fno-asm
1113 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1114 keyword, so that code can use these words as identifiers.  You can use
1115 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1116 instead.  @option{-ansi} implies @option{-fno-asm}.
1117
1118 In C++, this switch only affects the @code{typeof} keyword, since
1119 @code{asm} and @code{inline} are standard keywords.  You may want to
1120 use the @option{-fno-gnu-keywords} flag instead, which has the same
1121 effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1122 switch only affects the @code{asm} and @code{typeof} keywords, since
1123 @code{inline} is a standard keyword in ISO C99.
1124
1125 @item -fno-builtin
1126 @itemx -fno-builtin-@var{function}
1127 @opindex fno-builtin
1128 @cindex built-in functions
1129 Don't recognize built-in functions that do not begin with
1130 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
1131 functions provided by GCC}, for details of the functions affected,
1132 including those which are not built-in functions when @option{-ansi} or
1133 @option{-std} options for strict ISO C conformance are used because they
1134 do not have an ISO standard meaning.
1135
1136 GCC normally generates special code to handle certain built-in functions
1137 more efficiently; for instance, calls to @code{alloca} may become single
1138 instructions that adjust the stack directly, and calls to @code{memcpy}
1139 may become inline copy loops.  The resulting code is often both smaller
1140 and faster, but since the function calls no longer appear as such, you
1141 cannot set a breakpoint on those calls, nor can you change the behavior
1142 of the functions by linking with a different library.
1143
1144 With the @option{-fno-builtin-@var{function}} option
1145 only the built-in function @var{function} is
1146 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
1147 function is named this is not built-in in this version of GCC, this
1148 option is ignored.  There is no corresponding
1149 @option{-fbuiltin-@var{function}} option; if you wish to enable
1150 built-in functions selectively when using @option{-fno-builtin} or
1151 @option{-ffreestanding}, you may define macros such as:
1152
1153 @smallexample
1154 #define abs(n)          __builtin_abs ((n))
1155 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
1156 @end smallexample
1157
1158 @item -fhosted
1159 @opindex fhosted
1160 @cindex hosted environment
1161
1162 Assert that compilation takes place in a hosted environment.  This implies
1163 @option{-fbuiltin}.  A hosted environment is one in which the
1164 entire standard library is available, and in which @code{main} has a return
1165 type of @code{int}.  Examples are nearly everything except a kernel.
1166 This is equivalent to @option{-fno-freestanding}.
1167
1168 @item -ffreestanding
1169 @opindex ffreestanding
1170 @cindex hosted environment
1171
1172 Assert that compilation takes place in a freestanding environment.  This
1173 implies @option{-fno-builtin}.  A freestanding environment
1174 is one in which the standard library may not exist, and program startup may
1175 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
1176 This is equivalent to @option{-fno-hosted}.
1177
1178 @xref{Standards,,Language Standards Supported by GCC}, for details of
1179 freestanding and hosted environments.
1180
1181 @item -fms-extensions
1182 @opindex fms-extensions
1183 Accept some non-standard constructs used in Microsoft header files.
1184
1185 @item -trigraphs
1186 @opindex trigraphs
1187 Support ISO C trigraphs.  The @option{-ansi} option (and @option{-std}
1188 options for strict ISO C conformance) implies @option{-trigraphs}.
1189
1190 @cindex traditional C language
1191 @cindex C language, traditional
1192 @item -traditional
1193 @itemx -traditional-cpp
1194 @opindex traditional-cpp
1195 @opindex traditional
1196 Formerly, these options caused GCC to attempt to emulate a pre-standard
1197 C compiler.  They are now only supported with the @option{-E} switch.
1198 The preprocessor continues to support a pre-standard mode.  See the GNU
1199 CPP manual for details.
1200
1201 @item -fcond-mismatch
1202 @opindex fcond-mismatch
1203 Allow conditional expressions with mismatched types in the second and
1204 third arguments.  The value of such an expression is void.  This option
1205 is not supported for C++.
1206
1207 @item -funsigned-char
1208 @opindex funsigned-char
1209 Let the type @code{char} be unsigned, like @code{unsigned char}.
1210
1211 Each kind of machine has a default for what @code{char} should
1212 be.  It is either like @code{unsigned char} by default or like
1213 @code{signed char} by default.
1214
1215 Ideally, a portable program should always use @code{signed char} or
1216 @code{unsigned char} when it depends on the signedness of an object.
1217 But many programs have been written to use plain @code{char} and
1218 expect it to be signed, or expect it to be unsigned, depending on the
1219 machines they were written for.  This option, and its inverse, let you
1220 make such a program work with the opposite default.
1221
1222 The type @code{char} is always a distinct type from each of
1223 @code{signed char} or @code{unsigned char}, even though its behavior
1224 is always just like one of those two.
1225
1226 @item -fsigned-char
1227 @opindex fsigned-char
1228 Let the type @code{char} be signed, like @code{signed char}.
1229
1230 Note that this is equivalent to @option{-fno-unsigned-char}, which is
1231 the negative form of @option{-funsigned-char}.  Likewise, the option
1232 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1233
1234 @item -fsigned-bitfields
1235 @itemx -funsigned-bitfields
1236 @itemx -fno-signed-bitfields
1237 @itemx -fno-unsigned-bitfields
1238 @opindex fsigned-bitfields
1239 @opindex funsigned-bitfields
1240 @opindex fno-signed-bitfields
1241 @opindex fno-unsigned-bitfields
1242 These options control whether a bit-field is signed or unsigned, when the
1243 declaration does not use either @code{signed} or @code{unsigned}.  By
1244 default, such a bit-field is signed, because this is consistent: the
1245 basic integer types such as @code{int} are signed types.
1246
1247 @item -fwritable-strings
1248 @opindex fwritable-strings
1249 Store string constants in the writable data segment and don't uniquize
1250 them.  This is for compatibility with old programs which assume they can
1251 write into string constants.
1252
1253 Writing into string constants is a very bad idea; ``constants'' should
1254 be constant.
1255 @end table
1256
1257 @node C++ Dialect Options
1258 @section Options Controlling C++ Dialect
1259
1260 @cindex compiler options, C++
1261 @cindex C++ options, command line
1262 @cindex options, C++
1263 This section describes the command-line options that are only meaningful
1264 for C++ programs; but you can also use most of the GNU compiler options
1265 regardless of what language your program is in.  For example, you
1266 might compile a file @code{firstClass.C} like this:
1267
1268 @example
1269 g++ -g -frepo -O -c firstClass.C
1270 @end example
1271
1272 @noindent
1273 In this example, only @option{-frepo} is an option meant
1274 only for C++ programs; you can use the other options with any
1275 language supported by GCC@.
1276
1277 Here is a list of options that are @emph{only} for compiling C++ programs:
1278
1279 @table @gcctabopt
1280
1281 @item -fabi-version=@var{n}
1282 @opindex fabi-version
1283 Use version @var{n} of the C++ ABI.  Version 1 is the version of the C++
1284 ABI that first appeared in G++ 3.2.  Version 0 will always be the
1285 version that conforms most closely to the C++ ABI specification.
1286 Therefore, the ABI obtained using version 0 will change as ABI bugs are
1287 fixed.
1288
1289 The default is version 1.
1290
1291 @item -fno-access-control
1292 @opindex fno-access-control
1293 Turn off all access checking.  This switch is mainly useful for working
1294 around bugs in the access control code.
1295
1296 @item -fcheck-new
1297 @opindex fcheck-new
1298 Check that the pointer returned by @code{operator new} is non-null
1299 before attempting to modify the storage allocated.  The current Working
1300 Paper requires that @code{operator new} never return a null pointer, so
1301 this check is normally unnecessary.
1302
1303 An alternative to using this option is to specify that your
1304 @code{operator new} does not throw any exceptions; if you declare it
1305 @samp{throw()}, G++ will check the return value.  See also @samp{new
1306 (nothrow)}.
1307
1308 @item -fconserve-space
1309 @opindex fconserve-space
1310 Put uninitialized or runtime-initialized global variables into the
1311 common segment, as C does.  This saves space in the executable at the
1312 cost of not diagnosing duplicate definitions.  If you compile with this
1313 flag and your program mysteriously crashes after @code{main()} has
1314 completed, you may have an object that is being destroyed twice because
1315 two definitions were merged.
1316
1317 This option is no longer useful on most targets, now that support has
1318 been added for putting variables into BSS without making them common.
1319
1320 @item -fno-const-strings
1321 @opindex fno-const-strings
1322 Give string constants type @code{char *} instead of type @code{const
1323 char *}.  By default, G++ uses type @code{const char *} as required by
1324 the standard.  Even if you use @option{-fno-const-strings}, you cannot
1325 actually modify the value of a string constant, unless you also use
1326 @option{-fwritable-strings}.
1327
1328 This option might be removed in a future release of G++.  For maximum
1329 portability, you should structure your code so that it works with
1330 string constants that have type @code{const char *}.
1331
1332 @item -fdollars-in-identifiers
1333 @opindex fdollars-in-identifiers
1334 Accept @samp{$} in identifiers.  You can also explicitly prohibit use of
1335 @samp{$} with the option @option{-fno-dollars-in-identifiers}.  (GNU C allows
1336 @samp{$} by default on most target systems, but there are a few exceptions.)
1337 Traditional C allowed the character @samp{$} to form part of
1338 identifiers.  However, ISO C and C++ forbid @samp{$} in identifiers.
1339
1340 @item -fno-elide-constructors
1341 @opindex fno-elide-constructors
1342 The C++ standard allows an implementation to omit creating a temporary
1343 which is only used to initialize another object of the same type.
1344 Specifying this option disables that optimization, and forces G++ to
1345 call the copy constructor in all cases.
1346
1347 @item -fno-enforce-eh-specs
1348 @opindex fno-enforce-eh-specs
1349 Don't check for violation of exception specifications at runtime.  This
1350 option violates the C++ standard, but may be useful for reducing code
1351 size in production builds, much like defining @samp{NDEBUG}.  The compiler
1352 will still optimize based on the exception specifications.
1353
1354 @item -fexternal-templates
1355 @opindex fexternal-templates
1356
1357 Cause @samp{#pragma interface} and @samp{implementation} to apply to
1358 template instantiation; template instances are emitted or not according
1359 to the location of the template definition.  @xref{Template
1360 Instantiation}, for more information.
1361
1362 This option is deprecated.
1363
1364 @item -falt-external-templates
1365 @opindex falt-external-templates
1366 Similar to @option{-fexternal-templates}, but template instances are
1367 emitted or not according to the place where they are first instantiated.
1368 @xref{Template Instantiation}, for more information.
1369
1370 This option is deprecated.
1371
1372 @item -ffor-scope
1373 @itemx -fno-for-scope
1374 @opindex ffor-scope
1375 @opindex fno-for-scope
1376 If @option{-ffor-scope} is specified, the scope of variables declared in
1377 a @i{for-init-statement} is limited to the @samp{for} loop itself,
1378 as specified by the C++ standard.
1379 If @option{-fno-for-scope} is specified, the scope of variables declared in
1380 a @i{for-init-statement} extends to the end of the enclosing scope,
1381 as was the case in old versions of G++, and other (traditional)
1382 implementations of C++.
1383
1384 The default if neither flag is given to follow the standard,
1385 but to allow and give a warning for old-style code that would
1386 otherwise be invalid, or have different behavior.
1387
1388 @item -fno-gnu-keywords
1389 @opindex fno-gnu-keywords
1390 Do not recognize @code{typeof} as a keyword, so that code can use this
1391 word as an identifier.  You can use the keyword @code{__typeof__} instead.
1392 @option{-ansi} implies @option{-fno-gnu-keywords}.
1393
1394 @item -fno-implicit-templates
1395 @opindex fno-implicit-templates
1396 Never emit code for non-inline templates which are instantiated
1397 implicitly (i.e.@: by use); only emit code for explicit instantiations.
1398 @xref{Template Instantiation}, for more information.
1399
1400 @item -fno-implicit-inline-templates
1401 @opindex fno-implicit-inline-templates
1402 Don't emit code for implicit instantiations of inline templates, either.
1403 The default is to handle inlines differently so that compiles with and
1404 without optimization will need the same set of explicit instantiations.
1405
1406 @item -fno-implement-inlines
1407 @opindex fno-implement-inlines
1408 To save space, do not emit out-of-line copies of inline functions
1409 controlled by @samp{#pragma implementation}.  This will cause linker
1410 errors if these functions are not inlined everywhere they are called.
1411
1412 @item -fms-extensions
1413 @opindex fms-extensions
1414 Disable pedantic warnings about constructs used in MFC, such as implicit
1415 int and getting a pointer to member function via non-standard syntax.
1416
1417 @item -fno-nonansi-builtins
1418 @opindex fno-nonansi-builtins
1419 Disable built-in declarations of functions that are not mandated by
1420 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
1421 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
1422
1423 @item -fno-operator-names
1424 @opindex fno-operator-names
1425 Do not treat the operator name keywords @code{and}, @code{bitand},
1426 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1427 synonyms as keywords.
1428
1429 @item -fno-optional-diags
1430 @opindex fno-optional-diags
1431 Disable diagnostics that the standard says a compiler does not need to
1432 issue.  Currently, the only such diagnostic issued by G++ is the one for
1433 a name having multiple meanings within a class.
1434
1435 @item -fpermissive
1436 @opindex fpermissive
1437 Downgrade messages about nonconformant code from errors to warnings.  By
1438 default, G++ effectively sets @option{-pedantic-errors} without
1439 @option{-pedantic}; this option reverses that.  This behavior and this
1440 option are superseded by @option{-pedantic}, which works as it does for GNU C@.
1441
1442 @item -frepo
1443 @opindex frepo
1444 Enable automatic template instantiation at link time.  This option also
1445 implies @option{-fno-implicit-templates}.  @xref{Template
1446 Instantiation}, for more information.
1447
1448 @item -fno-rtti
1449 @opindex fno-rtti
1450 Disable generation of information about every class with virtual
1451 functions for use by the C++ runtime type identification features
1452 (@samp{dynamic_cast} and @samp{typeid}).  If you don't use those parts
1453 of the language, you can save some space by using this flag.  Note that
1454 exception handling uses the same information, but it will generate it as
1455 needed.
1456
1457 @item -fstats
1458 @opindex fstats
1459 Emit statistics about front-end processing at the end of the compilation.
1460 This information is generally only useful to the G++ development team.
1461
1462 @item -ftemplate-depth-@var{n}
1463 @opindex ftemplate-depth
1464 Set the maximum instantiation depth for template classes to @var{n}.
1465 A limit on the template instantiation depth is needed to detect
1466 endless recursions during template class instantiation.  ANSI/ISO C++
1467 conforming programs must not rely on a maximum depth greater than 17.
1468
1469 @item -fuse-cxa-atexit
1470 @opindex fuse-cxa-atexit
1471 Register destructors for objects with static storage duration with the
1472 @code{__cxa_atexit} function rather than the @code{atexit} function.
1473 This option is required for fully standards-compliant handling of static
1474 destructors, but will only work if your C library supports
1475 @code{__cxa_atexit}.
1476
1477 @item -fvtable-gc
1478 @opindex fvtable-gc
1479 Emit special relocations for vtables and virtual function references
1480 so that the linker can identify unused virtual functions and zero out
1481 vtable slots that refer to them.  This is most useful with
1482 @option{-ffunction-sections} and @option{-Wl,--gc-sections}, in order to
1483 also discard the functions themselves.
1484
1485 This optimization requires GNU as and GNU ld.  Not all systems support
1486 this option.  @option{-Wl,--gc-sections} is ignored without @option{-static}.
1487
1488 @item -fno-weak
1489 @opindex fno-weak
1490 Do not use weak symbol support, even if it is provided by the linker.
1491 By default, G++ will use weak symbols if they are available.  This
1492 option exists only for testing, and should not be used by end-users;
1493 it will result in inferior code and has no benefits.  This option may
1494 be removed in a future release of G++.
1495
1496 @item -nostdinc++
1497 @opindex nostdinc++
1498 Do not search for header files in the standard directories specific to
1499 C++, but do still search the other standard directories.  (This option
1500 is used when building the C++ library.)
1501 @end table
1502
1503 In addition, these optimization, warning, and code generation options
1504 have meanings only for C++ programs:
1505
1506 @table @gcctabopt
1507 @item -fno-default-inline
1508 @opindex fno-default-inline
1509 Do not assume @samp{inline} for functions defined inside a class scope.
1510 @xref{Optimize Options,,Options That Control Optimization}.  Note that these
1511 functions will have linkage like inline functions; they just won't be
1512 inlined by default.
1513
1514 @item -Wabi @r{(C++ only)}
1515 @opindex Wabi
1516 Warn when G++ generates code that is probably not compatible with the
1517 vendor-neutral C++ ABI.  Although an effort has been made to warn about
1518 all such cases, there are probably some cases that are not warned about, 
1519 even though G++ is generating incompatible code.  There may also be
1520 cases where warnings are emitted even though the code that is generated
1521 will be compatible.
1522
1523 You should rewrite your code to avoid these warnings if you are
1524 concerned about the fact that code generated by G++ may not be binary
1525 compatible with code generated by other compilers.
1526
1527 The known incompatibilities at this point include:
1528
1529 @itemize @bullet
1530
1531 @item
1532 Incorrect handling of tail-padding for bit-fields.  G++ may attempt to
1533 pack data into the same byte as a base class.  For example:
1534
1535 @smallexample
1536 struct A @{ virtual void f(); int f1 : 1; @};
1537 struct B : public A @{ int f2 : 1; @};
1538 @end smallexample
1539
1540 @noindent
1541 In this case, G++ will place @code{B::f2} into the same byte
1542 as@code{A::f1}; other compilers will not.  You can avoid this problem 
1543 by explicitly padding @code{A} so that its size is a multiple of the
1544 byte size on your platform; that will cause G++ and other compilers to
1545 layout @code{B} identically.
1546
1547 @item
1548 Incorrect handling of tail-padding for virtual bases.  G++ does not use
1549 tail padding when laying out virtual bases.  For example:
1550
1551 @smallexample
1552 struct A @{ virtual void f(); char c1; @};
1553 struct B @{ B(); char c2; @};
1554 struct C : public A, public virtual B @{@};
1555 @end smallexample
1556
1557 @noindent
1558 In this case, G++ will not place @code{B} into the tail-padding for
1559 @code{A}; other compilers will.  You can avoid this problem by
1560 explicitly padding @code{A} so that its size is a multiple of its
1561 alignment (ignoring virtual base classes); that will cause G++ and other
1562 compilers to layout @code{C} identically.
1563
1564 @item
1565 Incorrect handling of bit-fields with declared widths greater than that
1566 of their underlying types, when the bit-fields appear in a union.  For
1567 example:
1568
1569 @smallexample
1570 union U @{ int i : 4096; @};
1571 @end smallexample
1572
1573 @noindent
1574 Assuming that an @code{int} does not have 4096 bits, G++ will make the
1575 union too small by the number of bits in an @code{int}.
1576
1577 @item
1578 Empty classes can be placed at incorrect offsets.  For example:
1579  
1580 @smallexample
1581 struct A @{@};
1582
1583 struct B @{
1584   A a;
1585   virtual void f ();
1586 @};
1587
1588 struct C : public B, public A @{@};
1589 @end smallexample
1590
1591 @noindent
1592 G++ will place the @code{A} base class of @code{C} at a nonzero offset;
1593 it should be placed at offset zero.  G++ mistakenly believes that the
1594 @code{A} data member of @code{B} is already at offset zero.
1595
1596 @item
1597 Names of template functions whose types involve @code{typename} or
1598 template template parameters can be mangled incorrectly.
1599
1600 @smallexample
1601 template <typename Q>
1602 void f(typename Q::X) @{@}
1603
1604 template <template <typename> class Q>
1605 void f(typename Q<int>::X) @{@}
1606 @end smallexample
1607
1608 @noindent
1609 Instantiations of these templates may be mangled incorrectly.
1610
1611 @end itemize
1612
1613 @item -Wctor-dtor-privacy @r{(C++ only)}
1614 @opindex Wctor-dtor-privacy
1615 Warn when a class seems unusable, because all the constructors or
1616 destructors in a class are private and the class has no friends or
1617 public static member functions.  This warning is enabled by default.
1618
1619 @item -Wnon-virtual-dtor @r{(C++ only)}
1620 @opindex Wnon-virtual-dtor
1621 Warn when a class declares a non-virtual destructor that should probably
1622 be virtual, because it looks like the class will be used polymorphically.
1623 This warning is enabled by @option{-Wall}.
1624
1625 @item -Wreorder @r{(C++ only)}
1626 @opindex Wreorder
1627 @cindex reordering, warning
1628 @cindex warning for reordering of member initializers
1629 Warn when the order of member initializers given in the code does not
1630 match the order in which they must be executed.  For instance:
1631
1632 @smallexample
1633 struct A @{
1634   int i;
1635   int j;
1636   A(): j (0), i (1) @{ @}
1637 @};
1638 @end smallexample
1639
1640 Here the compiler will warn that the member initializers for @samp{i}
1641 and @samp{j} will be rearranged to match the declaration order of the
1642 members.  This warning is enabled by @option{-Wall}.
1643 @end table
1644
1645 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
1646
1647 @table @gcctabopt
1648 @item -Weffc++ @r{(C++ only)}
1649 @opindex Weffc++
1650 Warn about violations of the following style guidelines from Scott Meyers'
1651 @cite{Effective C++} book:
1652
1653 @itemize @bullet
1654 @item
1655 Item 11:  Define a copy constructor and an assignment operator for classes
1656 with dynamically allocated memory.
1657
1658 @item
1659 Item 12:  Prefer initialization to assignment in constructors.
1660
1661 @item
1662 Item 14:  Make destructors virtual in base classes.
1663
1664 @item
1665 Item 15:  Have @code{operator=} return a reference to @code{*this}.
1666
1667 @item
1668 Item 23:  Don't try to return a reference when you must return an object.
1669
1670 @end itemize
1671
1672 and about violations of the following style guidelines from Scott Meyers'
1673 @cite{More Effective C++} book:
1674
1675 @itemize @bullet
1676 @item
1677 Item 6:  Distinguish between prefix and postfix forms of increment and
1678 decrement operators.
1679
1680 @item
1681 Item 7:  Never overload @code{&&}, @code{||}, or @code{,}.
1682
1683 @end itemize
1684
1685 If you use this option, you should be aware that the standard library
1686 headers do not obey all of these guidelines; you can use @samp{grep -v}
1687 to filter out those warnings.
1688
1689 @item -Wno-deprecated @r{(C++ only)}
1690 @opindex Wno-deprecated
1691 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
1692
1693 @item -Wno-non-template-friend @r{(C++ only)}
1694 @opindex Wno-non-template-friend
1695 Disable warnings when non-templatized friend functions are declared
1696 within a template.  With the advent of explicit template specification
1697 support in G++, if the name of the friend is an unqualified-id (i.e.,
1698 @samp{friend foo(int)}), the C++ language specification demands that the
1699 friend declare or define an ordinary, nontemplate function.  (Section
1700 14.5.3).  Before G++ implemented explicit specification, unqualified-ids
1701 could be interpreted as a particular specialization of a templatized
1702 function.  Because this non-conforming behavior is no longer the default
1703 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
1704 check existing code for potential trouble spots, and is on by default.
1705 This new compiler behavior can be turned off with
1706 @option{-Wno-non-template-friend} which keeps the conformant compiler code
1707 but disables the helpful warning.
1708
1709 @item -Wold-style-cast @r{(C++ only)}
1710 @opindex Wold-style-cast
1711 Warn if an old-style (C-style) cast to a non-void type is used within
1712 a C++ program.  The new-style casts (@samp{static_cast},
1713 @samp{reinterpret_cast}, and @samp{const_cast}) are less vulnerable to
1714 unintended effects, and much easier to grep for.
1715
1716 @item -Woverloaded-virtual @r{(C++ only)}
1717 @opindex Woverloaded-virtual
1718 @cindex overloaded virtual fn, warning
1719 @cindex warning for overloaded virtual fn
1720 Warn when a function declaration hides virtual functions from a
1721 base class.  For example, in:
1722
1723 @smallexample
1724 struct A @{
1725   virtual void f();
1726 @};
1727
1728 struct B: public A @{
1729   void f(int);
1730 @};
1731 @end smallexample
1732
1733 the @code{A} class version of @code{f} is hidden in @code{B}, and code
1734 like this:
1735
1736 @smallexample
1737 B* b;
1738 b->f();
1739 @end smallexample
1740
1741 will fail to compile.
1742
1743 @item -Wno-pmf-conversions @r{(C++ only)}
1744 @opindex Wno-pmf-conversions
1745 Disable the diagnostic for converting a bound pointer to member function
1746 to a plain pointer.
1747
1748 @item -Wsign-promo @r{(C++ only)}
1749 @opindex Wsign-promo
1750 Warn when overload resolution chooses a promotion from unsigned or
1751 enumeral type to a signed type over a conversion to an unsigned type of
1752 the same size.  Previous versions of G++ would try to preserve
1753 unsignedness, but the standard mandates the current behavior.
1754
1755 @item -Wsynth @r{(C++ only)}
1756 @opindex Wsynth
1757 @cindex warning for synthesized methods
1758 @cindex synthesized methods, warning
1759 Warn when G++'s synthesis behavior does not match that of cfront.  For
1760 instance:
1761
1762 @smallexample
1763 struct A @{
1764   operator int ();
1765   A& operator = (int);
1766 @};
1767
1768 main ()
1769 @{
1770   A a,b;
1771   a = b;
1772 @}
1773 @end smallexample
1774
1775 In this example, G++ will synthesize a default @samp{A& operator =
1776 (const A&);}, while cfront will use the user-defined @samp{operator =}.
1777 @end table
1778
1779 @node Objective-C Dialect Options
1780 @section Options Controlling Objective-C Dialect
1781
1782 @cindex compiler options, Objective-C
1783 @cindex Objective-C options, command line
1784 @cindex options, Objective-C
1785 This section describes the command-line options that are only meaningful
1786 for Objective-C programs; but you can also use most of the GNU compiler
1787 options regardless of what language your program is in.  For example,
1788 you might compile a file @code{some_class.m} like this:
1789
1790 @example
1791 gcc -g -fgnu-runtime -O -c some_class.m
1792 @end example
1793
1794 @noindent
1795 In this example, only @option{-fgnu-runtime} is an option meant only for
1796 Objective-C programs; you can use the other options with any language
1797 supported by GCC@.
1798
1799 Here is a list of options that are @emph{only} for compiling Objective-C
1800 programs:
1801
1802 @table @gcctabopt
1803 @item -fconstant-string-class=@var{class-name}
1804 @opindex fconstant-string-class
1805 Use @var{class-name} as the name of the class to instantiate for each
1806 literal string specified with the syntax @code{@@"@dots{}"}.  The default
1807 class name is @code{NXConstantString}.
1808
1809 @item -fgnu-runtime
1810 @opindex fgnu-runtime
1811 Generate object code compatible with the standard GNU Objective-C
1812 runtime.  This is the default for most types of systems.
1813
1814 @item -fnext-runtime
1815 @opindex fnext-runtime
1816 Generate output compatible with the NeXT runtime.  This is the default
1817 for NeXT-based systems, including Darwin and Mac OS X@.  The macro
1818 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
1819 used.
1820
1821 @item -gen-decls
1822 @opindex gen-decls
1823 Dump interface declarations for all classes seen in the source file to a
1824 file named @file{@var{sourcename}.decl}.
1825
1826 @item -Wno-protocol
1827 @opindex Wno-protocol
1828 If a class is declared to implement a protocol, a warning is issued for
1829 every method in the protocol that is not implemented by the class.  The
1830 default behavior is to issue a warning for every method not explicitly
1831 implemented in the class, even if a method implementation is inherited
1832 from the superclass.  If you use the @code{-Wno-protocol} option, then
1833 methods inherited from the superclass are considered to be implemented,
1834 and no warning is issued for them.
1835
1836 @item -Wselector
1837 @opindex Wselector
1838 Warn if multiple methods of different types for the same selector are
1839 found during compilation.  The check is performed on the list of methods
1840 in the final stage of compilation.  Additionally, a check is performed
1841 that for each selector appearing in a @code{@@selector(@dots{})}
1842 expression, a corresponding method with that selector has been found
1843 during compilation.  Because these checks scan the method table only at
1844 the end of compilation, these warnings are not produced if the final
1845 stage of compilation is not reached, for example because an error is
1846 found during compilation, or because the @code{-fsyntax-only} option is
1847 being used.
1848
1849 @item -Wundeclared-selector
1850 @opindex Wundeclared-selector
1851 Warn if a @code{@@selector(@dots{})} expression referring to an
1852 undeclared selector is found.  A selector is considered undeclared if no
1853 method with that name has been declared (explicitly, in an
1854 @code{@@interface} or @code{@@protocol} declaration, or implicitly, in
1855 an @code{@@implementation} section) before the
1856 @code{@@selector(@dots{})} expression.  This option always performs its
1857 checks as soon as a @code{@@selector(@dots{})} expression is found
1858 (while @code{-Wselector} only performs its checks in the final stage of
1859 compilation), and so additionally enforces the coding style convention
1860 that methods and selectors must be declared before being used.
1861
1862 @c not documented because only avail via -Wp
1863 @c @item -print-objc-runtime-info
1864
1865 @end table
1866
1867 @node Language Independent Options
1868 @section Options to Control Diagnostic Messages Formatting
1869 @cindex options to control diagnostics formatting
1870 @cindex diagnostic messages
1871 @cindex message formatting
1872
1873 Traditionally, diagnostic messages have been formatted irrespective of
1874 the output device's aspect (e.g.@: its width, @dots{}).  The options described
1875 below can be used to control the diagnostic messages formatting
1876 algorithm, e.g.@: how many characters per line, how often source location
1877 information should be reported.  Right now, only the C++ front end can
1878 honor these options.  However it is expected, in the near future, that
1879 the remaining front ends would be able to digest them correctly.
1880
1881 @table @gcctabopt
1882 @item -fmessage-length=@var{n}
1883 @opindex fmessage-length
1884 Try to format error messages so that they fit on lines of about @var{n}
1885 characters.  The default is 72 characters for @command{g++} and 0 for the rest of
1886 the front ends supported by GCC@.  If @var{n} is zero, then no
1887 line-wrapping will be done; each error message will appear on a single
1888 line.
1889
1890 @opindex fdiagnostics-show-location
1891 @item -fdiagnostics-show-location=once
1892 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
1893 reporter to emit @emph{once} source location information; that is, in
1894 case the message is too long to fit on a single physical line and has to
1895 be wrapped, the source location won't be emitted (as prefix) again,
1896 over and over, in subsequent continuation lines.  This is the default
1897 behavior.
1898
1899 @item -fdiagnostics-show-location=every-line
1900 Only meaningful in line-wrapping mode.  Instructs the diagnostic
1901 messages reporter to emit the same source location information (as
1902 prefix) for physical lines that result from the process of breaking
1903 a message which is too long to fit on a single line.
1904
1905 @end table
1906
1907 @node Warning Options
1908 @section Options to Request or Suppress Warnings
1909 @cindex options to control warnings
1910 @cindex warning messages
1911 @cindex messages, warning
1912 @cindex suppressing warnings
1913
1914 Warnings are diagnostic messages that report constructions which
1915 are not inherently erroneous but which are risky or suggest there
1916 may have been an error.
1917
1918 You can request many specific warnings with options beginning @samp{-W},
1919 for example @option{-Wimplicit} to request warnings on implicit
1920 declarations.  Each of these specific warning options also has a
1921 negative form beginning @samp{-Wno-} to turn off warnings;
1922 for example, @option{-Wno-implicit}.  This manual lists only one of the
1923 two forms, whichever is not the default.
1924
1925 The following options control the amount and kinds of warnings produced
1926 by GCC; for further, language-specific options also refer to
1927 @ref{C++ Dialect Options} and @ref{Objective-C Dialect Options}.
1928
1929 @table @gcctabopt
1930 @cindex syntax checking
1931 @item -fsyntax-only
1932 @opindex fsyntax-only
1933 Check the code for syntax errors, but don't do anything beyond that.
1934
1935 @item -pedantic
1936 @opindex pedantic
1937 Issue all the warnings demanded by strict ISO C and ISO C++;
1938 reject all programs that use forbidden extensions, and some other
1939 programs that do not follow ISO C and ISO C++.  For ISO C, follows the
1940 version of the ISO C standard specified by any @option{-std} option used.
1941
1942 Valid ISO C and ISO C++ programs should compile properly with or without
1943 this option (though a rare few will require @option{-ansi} or a
1944 @option{-std} option specifying the required version of ISO C)@.  However,
1945 without this option, certain GNU extensions and traditional C and C++
1946 features are supported as well.  With this option, they are rejected.
1947
1948 @option{-pedantic} does not cause warning messages for use of the
1949 alternate keywords whose names begin and end with @samp{__}.  Pedantic
1950 warnings are also disabled in the expression that follows
1951 @code{__extension__}.  However, only system header files should use
1952 these escape routes; application programs should avoid them.
1953 @xref{Alternate Keywords}.
1954
1955 Some users try to use @option{-pedantic} to check programs for strict ISO
1956 C conformance.  They soon find that it does not do quite what they want:
1957 it finds some non-ISO practices, but not all---only those for which
1958 ISO C @emph{requires} a diagnostic, and some others for which
1959 diagnostics have been added.
1960
1961 A feature to report any failure to conform to ISO C might be useful in
1962 some instances, but would require considerable additional work and would
1963 be quite different from @option{-pedantic}.  We don't have plans to
1964 support such a feature in the near future.
1965
1966 Where the standard specified with @option{-std} represents a GNU
1967 extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
1968 corresponding @dfn{base standard}, the version of ISO C on which the GNU
1969 extended dialect is based.  Warnings from @option{-pedantic} are given
1970 where they are required by the base standard.  (It would not make sense
1971 for such warnings to be given only for features not in the specified GNU
1972 C dialect, since by definition the GNU dialects of C include all
1973 features the compiler supports with the given option, and there would be
1974 nothing to warn about.)
1975
1976 @item -pedantic-errors
1977 @opindex pedantic-errors
1978 Like @option{-pedantic}, except that errors are produced rather than
1979 warnings.
1980
1981 @item -w
1982 @opindex w
1983 Inhibit all warning messages.
1984
1985 @item -Wno-import
1986 @opindex Wno-import
1987 Inhibit warning messages about the use of @samp{#import}.
1988
1989 @item -Wchar-subscripts
1990 @opindex Wchar-subscripts
1991 Warn if an array subscript has type @code{char}.  This is a common cause
1992 of error, as programmers often forget that this type is signed on some
1993 machines.
1994
1995 @item -Wcomment
1996 @opindex Wcomment
1997 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
1998 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
1999
2000 @item -Wformat
2001 @opindex Wformat
2002 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
2003 the arguments supplied have types appropriate to the format string
2004 specified, and that the conversions specified in the format string make
2005 sense.  This includes standard functions, and others specified by format
2006 attributes (@pxref{Function Attributes}), in the @code{printf},
2007 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
2008 not in the C standard) families.
2009
2010 The formats are checked against the format features supported by GNU
2011 libc version 2.2.  These include all ISO C90 and C99 features, as well
2012 as features from the Single Unix Specification and some BSD and GNU
2013 extensions.  Other library implementations may not support all these
2014 features; GCC does not support warning about features that go beyond a
2015 particular library's limitations.  However, if @option{-pedantic} is used
2016 with @option{-Wformat}, warnings will be given about format features not
2017 in the selected standard version (but not for @code{strfmon} formats,
2018 since those are not in any version of the C standard).  @xref{C Dialect
2019 Options,,Options Controlling C Dialect}.
2020
2021 Since @option{-Wformat} also checks for null format arguments for
2022 several functions, @option{-Wformat} also implies @option{-Wnonnull}.
2023
2024 @option{-Wformat} is included in @option{-Wall}.  For more control over some
2025 aspects of format checking, the options @option{-Wno-format-y2k},
2026 @option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
2027 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
2028 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
2029
2030 @item -Wno-format-y2k
2031 @opindex Wno-format-y2k
2032 If @option{-Wformat} is specified, do not warn about @code{strftime}
2033 formats which may yield only a two-digit year.
2034
2035 @item -Wno-format-extra-args
2036 @opindex Wno-format-extra-args
2037 If @option{-Wformat} is specified, do not warn about excess arguments to a
2038 @code{printf} or @code{scanf} format function.  The C standard specifies
2039 that such arguments are ignored.
2040
2041 Where the unused arguments lie between used arguments that are
2042 specified with @samp{$} operand number specifications, normally
2043 warnings are still given, since the implementation could not know what
2044 type to pass to @code{va_arg} to skip the unused arguments.  However,
2045 in the case of @code{scanf} formats, this option will suppress the
2046 warning if the unused arguments are all pointers, since the Single
2047 Unix Specification says that such unused arguments are allowed.
2048
2049 @item -Wno-format-zero-length
2050 @opindex Wno-format-zero-length
2051 If @option{-Wformat} is specified, do not warn about zero-length formats.
2052 The C standard specifies that zero-length formats are allowed.
2053
2054 @item -Wformat-nonliteral
2055 @opindex Wformat-nonliteral
2056 If @option{-Wformat} is specified, also warn if the format string is not a
2057 string literal and so cannot be checked, unless the format function
2058 takes its format arguments as a @code{va_list}.
2059
2060 @item -Wformat-security
2061 @opindex Wformat-security
2062 If @option{-Wformat} is specified, also warn about uses of format
2063 functions that represent possible security problems.  At present, this
2064 warns about calls to @code{printf} and @code{scanf} functions where the
2065 format string is not a string literal and there are no format arguments,
2066 as in @code{printf (foo);}.  This may be a security hole if the format
2067 string came from untrusted input and contains @samp{%n}.  (This is
2068 currently a subset of what @option{-Wformat-nonliteral} warns about, but
2069 in future warnings may be added to @option{-Wformat-security} that are not
2070 included in @option{-Wformat-nonliteral}.)
2071
2072 @item -Wformat=2
2073 @opindex Wformat=2
2074 Enable @option{-Wformat} plus format checks not included in
2075 @option{-Wformat}.  Currently equivalent to @samp{-Wformat
2076 -Wformat-nonliteral -Wformat-security}.
2077
2078 @item -Wnonnull
2079 @opindex Wnonnull
2080 Enable warning about passing a null pointer for arguments marked as
2081 requiring a non-null value by the @code{nonnull} function attribute.
2082
2083 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
2084 can be disabled with the @option{-Wno-nonnull} option.
2085
2086 @item -Wimplicit-int
2087 @opindex Wimplicit-int
2088 Warn when a declaration does not specify a type.
2089
2090 @item -Wimplicit-function-declaration
2091 @itemx -Werror-implicit-function-declaration
2092 @opindex Wimplicit-function-declaration
2093 @opindex Werror-implicit-function-declaration
2094 Give a warning (or error) whenever a function is used before being
2095 declared.
2096
2097 @item -Wimplicit
2098 @opindex Wimplicit
2099 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
2100
2101 @item -Wmain
2102 @opindex Wmain
2103 Warn if the type of @samp{main} is suspicious.  @samp{main} should be a
2104 function with external linkage, returning int, taking either zero
2105 arguments, two, or three arguments of appropriate types.
2106
2107 @item -Wmissing-braces
2108 @opindex Wmissing-braces
2109 Warn if an aggregate or union initializer is not fully bracketed.  In
2110 the following example, the initializer for @samp{a} is not fully
2111 bracketed, but that for @samp{b} is fully bracketed.
2112
2113 @smallexample
2114 int a[2][2] = @{ 0, 1, 2, 3 @};
2115 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
2116 @end smallexample
2117
2118 @item -Wparentheses
2119 @opindex Wparentheses
2120 Warn if parentheses are omitted in certain contexts, such
2121 as when there is an assignment in a context where a truth value
2122 is expected, or when operators are nested whose precedence people
2123 often get confused about.
2124
2125 Also warn about constructions where there may be confusion to which
2126 @code{if} statement an @code{else} branch belongs.  Here is an example of
2127 such a case:
2128
2129 @smallexample
2130 @group
2131 @{
2132   if (a)
2133     if (b)
2134       foo ();
2135   else
2136     bar ();
2137 @}
2138 @end group
2139 @end smallexample
2140
2141 In C, every @code{else} branch belongs to the innermost possible @code{if}
2142 statement, which in this example is @code{if (b)}.  This is often not
2143 what the programmer expected, as illustrated in the above example by
2144 indentation the programmer chose.  When there is the potential for this
2145 confusion, GCC will issue a warning when this flag is specified.
2146 To eliminate the warning, add explicit braces around the innermost
2147 @code{if} statement so there is no way the @code{else} could belong to
2148 the enclosing @code{if}.  The resulting code would look like this:
2149
2150 @smallexample
2151 @group
2152 @{
2153   if (a)
2154     @{
2155       if (b)
2156         foo ();
2157       else
2158         bar ();
2159     @}
2160 @}
2161 @end group
2162 @end smallexample
2163
2164 @item -Wsequence-point
2165 @opindex Wsequence-point
2166 Warn about code that may have undefined semantics because of violations
2167 of sequence point rules in the C standard.
2168
2169 The C standard defines the order in which expressions in a C program are
2170 evaluated in terms of @dfn{sequence points}, which represent a partial
2171 ordering between the execution of parts of the program: those executed
2172 before the sequence point, and those executed after it.  These occur
2173 after the evaluation of a full expression (one which is not part of a
2174 larger expression), after the evaluation of the first operand of a
2175 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
2176 function is called (but after the evaluation of its arguments and the
2177 expression denoting the called function), and in certain other places.
2178 Other than as expressed by the sequence point rules, the order of
2179 evaluation of subexpressions of an expression is not specified.  All
2180 these rules describe only a partial order rather than a total order,
2181 since, for example, if two functions are called within one expression
2182 with no sequence point between them, the order in which the functions
2183 are called is not specified.  However, the standards committee have
2184 ruled that function calls do not overlap.
2185
2186 It is not specified when between sequence points modifications to the
2187 values of objects take effect.  Programs whose behavior depends on this
2188 have undefined behavior; the C standard specifies that ``Between the
2189 previous and next sequence point an object shall have its stored value
2190 modified at most once by the evaluation of an expression.  Furthermore,
2191 the prior value shall be read only to determine the value to be
2192 stored.''.  If a program breaks these rules, the results on any
2193 particular implementation are entirely unpredictable.
2194
2195 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
2196 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
2197 diagnosed by this option, and it may give an occasional false positive
2198 result, but in general it has been found fairly effective at detecting
2199 this sort of problem in programs.
2200
2201 The present implementation of this option only works for C programs.  A
2202 future implementation may also work for C++ programs.
2203
2204 The C standard is worded confusingly, therefore there is some debate
2205 over the precise meaning of the sequence point rules in subtle cases.
2206 Links to discussions of the problem, including proposed formal
2207 definitions, may be found on our readings page, at
2208 @w{@uref{http://gcc.gnu.org/readings.html}}.
2209
2210 @item -Wreturn-type
2211 @opindex Wreturn-type
2212 Warn whenever a function is defined with a return-type that defaults to
2213 @code{int}.  Also warn about any @code{return} statement with no
2214 return-value in a function whose return-type is not @code{void}.
2215
2216 For C++, a function without return type always produces a diagnostic
2217 message, even when @option{-Wno-return-type} is specified.  The only
2218 exceptions are @samp{main} and functions defined in system headers.
2219
2220 @item -Wswitch
2221 @opindex Wswitch
2222 Warn whenever a @code{switch} statement has an index of enumeral type
2223 and lacks a @code{case} for one or more of the named codes of that
2224 enumeration.  (The presence of a @code{default} label prevents this
2225 warning.)  @code{case} labels outside the enumeration range also
2226 provoke warnings when this option is used.
2227
2228 @item -Wswitch-default
2229 @opindex Wswitch-switch
2230 Warn whenever a @code{switch} statement does not have a @code{default}
2231 case.
2232
2233 @item -Wswitch-enum
2234 @opindex Wswitch-enum
2235 Warn whenever a @code{switch} statement has an index of enumeral type
2236 and lacks a @code{case} for one or more of the named codes of that
2237 enumeration.  @code{case} labels outside the enumeration range also
2238 provoke warnings when this option is used.
2239
2240 @item -Wtrigraphs
2241 @opindex Wtrigraphs
2242 Warn if any trigraphs are encountered that might change the meaning of
2243 the program (trigraphs within comments are not warned about).
2244
2245 @item -Wunused-function
2246 @opindex Wunused-function
2247 Warn whenever a static function is declared but not defined or a
2248 non\-inline static function is unused.
2249
2250 @item -Wunused-label
2251 @opindex Wunused-label
2252 Warn whenever a label is declared but not used.
2253
2254 To suppress this warning use the @samp{unused} attribute
2255 (@pxref{Variable Attributes}).
2256
2257 @item -Wunused-parameter
2258 @opindex Wunused-parameter
2259 Warn whenever a function parameter is unused aside from its declaration.
2260
2261 To suppress this warning use the @samp{unused} attribute
2262 (@pxref{Variable Attributes}).
2263
2264 @item -Wunused-variable
2265 @opindex Wunused-variable
2266 Warn whenever a local variable or non-constant static variable is unused
2267 aside from its declaration
2268
2269 To suppress this warning use the @samp{unused} attribute
2270 (@pxref{Variable Attributes}).
2271
2272 @item -Wunused-value
2273 @opindex Wunused-value
2274 Warn whenever a statement computes a result that is explicitly not used.
2275
2276 To suppress this warning cast the expression to @samp{void}.
2277
2278 @item -Wunused
2279 @opindex Wunused
2280 All the above @option{-Wunused} options combined.
2281
2282 In order to get a warning about an unused function parameter, you must
2283 either specify @samp{-W -Wunused} or separately specify
2284 @option{-Wunused-parameter}.
2285
2286 @item -Wuninitialized
2287 @opindex Wuninitialized
2288 Warn if an automatic variable is used without first being initialized or
2289 if a variable may be clobbered by a @code{setjmp} call.
2290
2291 These warnings are possible only in optimizing compilation,
2292 because they require data flow information that is computed only
2293 when optimizing.  If you don't specify @option{-O}, you simply won't
2294 get these warnings.
2295
2296 These warnings occur only for variables that are candidates for
2297 register allocation.  Therefore, they do not occur for a variable that
2298 is declared @code{volatile}, or whose address is taken, or whose size
2299 is other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
2300 structures, unions or arrays, even when they are in registers.
2301
2302 Note that there may be no warning about a variable that is used only
2303 to compute a value that itself is never used, because such
2304 computations may be deleted by data flow analysis before the warnings
2305 are printed.
2306
2307 These warnings are made optional because GCC is not smart
2308 enough to see all the reasons why the code might be correct
2309 despite appearing to have an error.  Here is one example of how
2310 this can happen:
2311
2312 @smallexample
2313 @group
2314 @{
2315   int x;
2316   switch (y)
2317     @{
2318     case 1: x = 1;
2319       break;
2320     case 2: x = 4;
2321       break;
2322     case 3: x = 5;
2323     @}
2324   foo (x);
2325 @}
2326 @end group
2327 @end smallexample
2328
2329 @noindent
2330 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
2331 always initialized, but GCC doesn't know this.  Here is
2332 another common case:
2333
2334 @smallexample
2335 @{
2336   int save_y;
2337   if (change_y) save_y = y, y = new_y;
2338   @dots{}
2339   if (change_y) y = save_y;
2340 @}
2341 @end smallexample
2342
2343 @noindent
2344 This has no bug because @code{save_y} is used only if it is set.
2345
2346 @cindex @code{longjmp} warnings
2347 This option also warns when a non-volatile automatic variable might be
2348 changed by a call to @code{longjmp}.  These warnings as well are possible
2349 only in optimizing compilation.
2350
2351 The compiler sees only the calls to @code{setjmp}.  It cannot know
2352 where @code{longjmp} will be called; in fact, a signal handler could
2353 call it at any point in the code.  As a result, you may get a warning
2354 even when there is in fact no problem because @code{longjmp} cannot
2355 in fact be called at the place which would cause a problem.
2356
2357 Some spurious warnings can be avoided if you declare all the functions
2358 you use that never return as @code{noreturn}.  @xref{Function
2359 Attributes}.
2360
2361 @item -Wunknown-pragmas
2362 @opindex Wunknown-pragmas
2363 @cindex warning for unknown pragmas
2364 @cindex unknown pragmas, warning
2365 @cindex pragmas, warning of unknown
2366 Warn when a #pragma directive is encountered which is not understood by
2367 GCC@.  If this command line option is used, warnings will even be issued
2368 for unknown pragmas in system header files.  This is not the case if
2369 the warnings were only enabled by the @option{-Wall} command line option.
2370
2371 @item -Wstrict-aliasing
2372 @opindex Wstrict-aliasing
2373 This option is only active when @option{-fstrict-aliasing} is active.
2374 It warns about code which might break the strict aliasing rules that the
2375 compiler is using for optimization. The warning does not catch all
2376 cases, but does attempt to catch the more common pitfalls. It is
2377 included in @option{-Wall}.
2378
2379 @item -Wall
2380 @opindex Wall
2381 All of the above @samp{-W} options combined.  This enables all the
2382 warnings about constructions that some users consider questionable, and
2383 that are easy to avoid (or modify to prevent the warning), even in
2384 conjunction with macros.  This also enables some language-specific
2385 warnings described in @ref{C++ Dialect Options} and
2386 @ref{Objective-C Dialect Options}.
2387 @end table
2388
2389 The following @option{-W@dots{}} options are not implied by @option{-Wall}.
2390 Some of them warn about constructions that users generally do not
2391 consider questionable, but which occasionally you might wish to check
2392 for; others warn about constructions that are necessary or hard to avoid
2393 in some cases, and there is no simple way to modify the code to suppress
2394 the warning.
2395
2396 @table @gcctabopt
2397 @item -W
2398 @opindex W
2399 Print extra warning messages for these events:
2400
2401 @itemize @bullet
2402 @item
2403 A function can return either with or without a value.  (Falling
2404 off the end of the function body is considered returning without
2405 a value.)  For example, this function would evoke such a
2406 warning:
2407
2408 @smallexample
2409 @group
2410 foo (a)
2411 @{
2412   if (a > 0)
2413     return a;
2414 @}
2415 @end group
2416 @end smallexample
2417
2418 @item
2419 An expression-statement or the left-hand side of a comma expression
2420 contains no side effects.
2421 To suppress the warning, cast the unused expression to void.
2422 For example, an expression such as @samp{x[i,j]} will cause a warning,
2423 but @samp{x[(void)i,j]} will not.
2424
2425 @item
2426 An unsigned value is compared against zero with @samp{<} or @samp{<=}.
2427
2428 @item
2429 A comparison like @samp{x<=y<=z} appears; this is equivalent to
2430 @samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from
2431 that of ordinary mathematical notation.
2432
2433 @item
2434 Storage-class specifiers like @code{static} are not the first things in
2435 a declaration.  According to the C Standard, this usage is obsolescent.
2436
2437 @item
2438 The return type of a function has a type qualifier such as @code{const}.
2439 Such a type qualifier has no effect, since the value returned by a
2440 function is not an lvalue.  (But don't warn about the GNU extension of
2441 @code{volatile void} return types.  That extension will be warned about
2442 if @option{-pedantic} is specified.)
2443
2444 @item
2445 If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
2446 arguments.
2447
2448 @item
2449 A comparison between signed and unsigned values could produce an
2450 incorrect result when the signed value is converted to unsigned.
2451 (But don't warn if @option{-Wno-sign-compare} is also specified.)
2452
2453 @item
2454 An aggregate has a partly bracketed initializer.
2455 For example, the following code would evoke such a warning,
2456 because braces are missing around the initializer for @code{x.h}:
2457
2458 @smallexample
2459 struct s @{ int f, g; @};
2460 struct t @{ struct s h; int i; @};
2461 struct t x = @{ 1, 2, 3 @};
2462 @end smallexample
2463
2464 @item
2465 An aggregate has an initializer which does not initialize all members.
2466 For example, the following code would cause such a warning, because
2467 @code{x.h} would be implicitly initialized to zero:
2468
2469 @smallexample
2470 struct s @{ int f, g, h; @};
2471 struct s x = @{ 3, 4 @};
2472 @end smallexample
2473 @end itemize
2474
2475 @item -Wno-div-by-zero
2476 @opindex Wno-div-by-zero
2477 @opindex Wdiv-by-zero
2478 Do not warn about compile-time integer division by zero.  Floating point
2479 division by zero is not warned about, as it can be a legitimate way of
2480 obtaining infinities and NaNs.
2481
2482 @item -Wsystem-headers
2483 @opindex Wsystem-headers
2484 @cindex warnings from system headers
2485 @cindex system headers, warnings from
2486 Print warning messages for constructs found in system header files.
2487 Warnings from system headers are normally suppressed, on the assumption
2488 that they usually do not indicate real problems and would only make the
2489 compiler output harder to read.  Using this command line option tells
2490 GCC to emit warnings from system headers as if they occurred in user
2491 code.  However, note that using @option{-Wall} in conjunction with this
2492 option will @emph{not} warn about unknown pragmas in system
2493 headers---for that, @option{-Wunknown-pragmas} must also be used.
2494
2495 @item -Wfloat-equal
2496 @opindex Wfloat-equal
2497 Warn if floating point values are used in equality comparisons.
2498
2499 The idea behind this is that sometimes it is convenient (for the
2500 programmer) to consider floating-point values as approximations to
2501 infinitely precise real numbers.  If you are doing this, then you need
2502 to compute (by analyzing the code, or in some other way) the maximum or
2503 likely maximum error that the computation introduces, and allow for it
2504 when performing comparisons (and when producing output, but that's a
2505 different problem).  In particular, instead of testing for equality, you
2506 would check to see whether the two values have ranges that overlap; and
2507 this is done with the relational operators, so equality comparisons are
2508 probably mistaken.
2509
2510 @item -Wtraditional @r{(C only)}
2511 @opindex Wtraditional
2512 Warn about certain constructs that behave differently in traditional and
2513 ISO C@.  Also warn about ISO C constructs that have no traditional C
2514 equivalent, and/or problematic constructs which should be avoided.
2515
2516 @itemize @bullet
2517 @item
2518 Macro parameters that appear within string literals in the macro body.
2519 In traditional C macro replacement takes place within string literals,
2520 but does not in ISO C@.
2521
2522 @item
2523 In traditional C, some preprocessor directives did not exist.
2524 Traditional preprocessors would only consider a line to be a directive
2525 if the @samp{#} appeared in column 1 on the line.  Therefore
2526 @option{-Wtraditional} warns about directives that traditional C
2527 understands but would ignore because the @samp{#} does not appear as the
2528 first character on the line.  It also suggests you hide directives like
2529 @samp{#pragma} not understood by traditional C by indenting them.  Some
2530 traditional implementations would not recognize @samp{#elif}, so it
2531 suggests avoiding it altogether.
2532
2533 @item
2534 A function-like macro that appears without arguments.
2535
2536 @item
2537 The unary plus operator.
2538
2539 @item
2540 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
2541 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
2542 constants.)  Note, these suffixes appear in macros defined in the system
2543 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
2544 Use of these macros in user code might normally lead to spurious
2545 warnings, however gcc's integrated preprocessor has enough context to
2546 avoid warning in these cases.
2547
2548 @item
2549 A function declared external in one block and then used after the end of
2550 the block.
2551
2552 @item
2553 A @code{switch} statement has an operand of type @code{long}.
2554
2555 @item
2556 A non-@code{static} function declaration follows a @code{static} one.
2557 This construct is not accepted by some traditional C compilers.
2558
2559 @item
2560 The ISO type of an integer constant has a different width or
2561 signedness from its traditional type.  This warning is only issued if
2562 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
2563 typically represent bit patterns, are not warned about.
2564
2565 @item
2566 Usage of ISO string concatenation is detected.
2567
2568 @item
2569 Initialization of automatic aggregates.
2570
2571 @item
2572 Identifier conflicts with labels.  Traditional C lacks a separate
2573 namespace for labels.
2574
2575 @item
2576 Initialization of unions.  If the initializer is zero, the warning is
2577 omitted.  This is done under the assumption that the zero initializer in
2578 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
2579 initializer warnings and relies on default initialization to zero in the
2580 traditional C case.
2581
2582 @item
2583 Conversions by prototypes between fixed/floating point values and vice
2584 versa.  The absence of these prototypes when compiling with traditional
2585 C would cause serious problems.  This is a subset of the possible
2586 conversion warnings, for the full set use @option{-Wconversion}.
2587
2588 @item
2589 Use of ISO C style function definitions.  This warning intentionally is
2590 @emph{not} issued for prototype declarations or variadic functions
2591 because these ISO C features will appear in your code when using
2592 libiberty's traditional C compatibility macros, @code{PARAMS} and
2593 @code{VPARAMS}.  This warning is also bypassed for nested functions
2594 because that feature is already a gcc extension and thus not relevant to
2595 traditional C compatibility.
2596 @end itemize
2597
2598 @item -Wundef
2599 @opindex Wundef
2600 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
2601
2602 @item -Wendif-labels
2603 @opindex Wendif-labels
2604 Warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
2605
2606 @item -Wshadow
2607 @opindex Wshadow
2608 Warn whenever a local variable shadows another local variable, parameter or
2609 global variable or whenever a built-in function is shadowed.
2610
2611 @item -Wlarger-than-@var{len}
2612 @opindex Wlarger-than
2613 Warn whenever an object of larger than @var{len} bytes is defined.
2614
2615 @item -Wpointer-arith
2616 @opindex Wpointer-arith
2617 Warn about anything that depends on the ``size of'' a function type or
2618 of @code{void}.  GNU C assigns these types a size of 1, for
2619 convenience in calculations with @code{void *} pointers and pointers
2620 to functions.
2621
2622 @item -Wbad-function-cast @r{(C only)}
2623 @opindex Wbad-function-cast
2624 Warn whenever a function call is cast to a non-matching type.
2625 For example, warn if @code{int malloc()} is cast to @code{anything *}.
2626
2627 @item -Wcast-qual
2628 @opindex Wcast-qual
2629 Warn whenever a pointer is cast so as to remove a type qualifier from
2630 the target type.  For example, warn if a @code{const char *} is cast
2631 to an ordinary @code{char *}.
2632
2633 @item -Wcast-align
2634 @opindex Wcast-align
2635 Warn whenever a pointer is cast such that the required alignment of the
2636 target is increased.  For example, warn if a @code{char *} is cast to
2637 an @code{int *} on machines where integers can only be accessed at
2638 two- or four-byte boundaries.
2639
2640 @item -Wwrite-strings
2641 @opindex Wwrite-strings
2642 When compiling C, give string constants the type @code{const
2643 char[@var{length}]} so that
2644 copying the address of one into a non-@code{const} @code{char *}
2645 pointer will get a warning; when compiling C++, warn about the
2646 deprecated conversion from string constants to @code{char *}.
2647 These warnings will help you find at
2648 compile time code that can try to write into a string constant, but
2649 only if you have been very careful about using @code{const} in
2650 declarations and prototypes.  Otherwise, it will just be a nuisance;
2651 this is why we did not make @option{-Wall} request these warnings.
2652
2653 @item -Wconversion
2654 @opindex Wconversion
2655 Warn if a prototype causes a type conversion that is different from what
2656 would happen to the same argument in the absence of a prototype.  This
2657 includes conversions of fixed point to floating and vice versa, and
2658 conversions changing the width or signedness of a fixed point argument
2659 except when the same as the default promotion.
2660
2661 Also, warn if a negative integer constant expression is implicitly
2662 converted to an unsigned type.  For example, warn about the assignment
2663 @code{x = -1} if @code{x} is unsigned.  But do not warn about explicit
2664 casts like @code{(unsigned) -1}.
2665
2666 @item -Wsign-compare
2667 @opindex Wsign-compare
2668 @cindex warning for comparison of signed and unsigned values
2669 @cindex comparison of signed and unsigned values, warning
2670 @cindex signed and unsigned values, comparison warning
2671 Warn when a comparison between signed and unsigned values could produce
2672 an incorrect result when the signed value is converted to unsigned.
2673 This warning is also enabled by @option{-W}; to get the other warnings
2674 of @option{-W} without this warning, use @samp{-W -Wno-sign-compare}.
2675
2676 @item -Waggregate-return
2677 @opindex Waggregate-return
2678 Warn if any functions that return structures or unions are defined or
2679 called.  (In languages where you can return an array, this also elicits
2680 a warning.)
2681
2682 @item -Wstrict-prototypes @r{(C only)}
2683 @opindex Wstrict-prototypes
2684 Warn if a function is declared or defined without specifying the
2685 argument types.  (An old-style function definition is permitted without
2686 a warning if preceded by a declaration which specifies the argument
2687 types.)
2688
2689 @item -Wmissing-prototypes @r{(C only)}
2690 @opindex Wmissing-prototypes
2691 Warn if a global function is defined without a previous prototype
2692 declaration.  This warning is issued even if the definition itself
2693 provides a prototype.  The aim is to detect global functions that fail
2694 to be declared in header files.
2695
2696 @item -Wmissing-declarations
2697 @opindex Wmissing-declarations
2698 Warn if a global function is defined without a previous declaration.
2699 Do so even if the definition itself provides a prototype.
2700 Use this option to detect global functions that are not declared in
2701 header files.
2702
2703 @item -Wmissing-noreturn
2704 @opindex Wmissing-noreturn
2705 Warn about functions which might be candidates for attribute @code{noreturn}.
2706 Note these are only possible candidates, not absolute ones.  Care should
2707 be taken to manually verify functions actually do not ever return before
2708 adding the @code{noreturn} attribute, otherwise subtle code generation
2709 bugs could be introduced.  You will not get a warning for @code{main} in
2710 hosted C environments.
2711
2712 @item -Wmissing-format-attribute
2713 @opindex Wmissing-format-attribute
2714 @opindex Wformat
2715 If @option{-Wformat} is enabled, also warn about functions which might be
2716 candidates for @code{format} attributes.  Note these are only possible
2717 candidates, not absolute ones.  GCC will guess that @code{format}
2718 attributes might be appropriate for any function that calls a function
2719 like @code{vprintf} or @code{vscanf}, but this might not always be the
2720 case, and some functions for which @code{format} attributes are
2721 appropriate may not be detected.  This option has no effect unless
2722 @option{-Wformat} is enabled (possibly by @option{-Wall}).
2723
2724 @item -Wno-multichar
2725 @opindex Wno-multichar
2726 @opindex Wmultichar
2727 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
2728 Usually they indicate a typo in the user's code, as they have
2729 implementation-defined values, and should not be used in portable code.
2730
2731 @item -Wno-deprecated-declarations
2732 @opindex Wno-deprecated-declarations
2733 Do not warn about uses of functions, variables, and types marked as
2734 deprecated by using the @code{deprecated} attribute.
2735 (@pxref{Function Attributes}, @pxref{Variable Attributes},
2736 @pxref{Type Attributes}.)
2737
2738 @item -Wpacked
2739 @opindex Wpacked
2740 Warn if a structure is given the packed attribute, but the packed
2741 attribute has no effect on the layout or size of the structure.
2742 Such structures may be mis-aligned for little benefit.  For
2743 instance, in this code, the variable @code{f.x} in @code{struct bar}
2744 will be misaligned even though @code{struct bar} does not itself
2745 have the packed attribute:
2746
2747 @smallexample
2748 @group
2749 struct foo @{
2750   int x;
2751   char a, b, c, d;
2752 @} __attribute__((packed));
2753 struct bar @{
2754   char z;
2755   struct foo f;
2756 @};
2757 @end group
2758 @end smallexample
2759
2760 @item -Wpadded
2761 @opindex Wpadded
2762 Warn if padding is included in a structure, either to align an element
2763 of the structure or to align the whole structure.  Sometimes when this
2764 happens it is possible to rearrange the fields of the structure to
2765 reduce the padding and so make the structure smaller.
2766
2767 @item -Wredundant-decls
2768 @opindex Wredundant-decls
2769 Warn if anything is declared more than once in the same scope, even in
2770 cases where multiple declaration is valid and changes nothing.
2771
2772 @item -Wnested-externs @r{(C only)}
2773 @opindex Wnested-externs
2774 Warn if an @code{extern} declaration is encountered within a function.
2775
2776 @item -Wunreachable-code
2777 @opindex Wunreachable-code
2778 Warn if the compiler detects that code will never be executed.
2779
2780 This option is intended to warn when the compiler detects that at
2781 least a whole line of source code will never be executed, because
2782 some condition is never satisfied or because it is after a
2783 procedure that never returns.
2784
2785 It is possible for this option to produce a warning even though there
2786 are circumstances under which part of the affected line can be executed,
2787 so care should be taken when removing apparently-unreachable code.
2788
2789 For instance, when a function is inlined, a warning may mean that the
2790 line is unreachable in only one inlined copy of the function.
2791
2792 This option is not made part of @option{-Wall} because in a debugging
2793 version of a program there is often substantial code which checks
2794 correct functioning of the program and is, hopefully, unreachable
2795 because the program does work.  Another common use of unreachable
2796 code is to provide behavior which is selectable at compile-time.
2797
2798 @item -Winline
2799 @opindex Winline
2800 Warn if a function can not be inlined and it was declared as inline.
2801
2802 @item -Wlong-long
2803 @opindex Wlong-long
2804 @opindex Wno-long-long
2805 Warn if @samp{long long} type is used.  This is default.  To inhibit
2806 the warning messages, use @option{-Wno-long-long}.  Flags
2807 @option{-Wlong-long} and @option{-Wno-long-long} are taken into account
2808 only when @option{-pedantic} flag is used.
2809
2810 @item -Wdisabled-optimization
2811 @opindex Wdisabled-optimization
2812 Warn if a requested optimization pass is disabled.  This warning does
2813 not generally indicate that there is anything wrong with your code; it
2814 merely indicates that GCC's optimizers were unable to handle the code
2815 effectively.  Often, the problem is that your code is too big or too
2816 complex; GCC will refuse to optimize programs when the optimization
2817 itself is likely to take inordinate amounts of time.
2818
2819 @item -Werror
2820 @opindex Werror
2821 Make all warnings into errors.
2822 @end table
2823
2824 @node Debugging Options
2825 @section Options for Debugging Your Program or GCC
2826 @cindex options, debugging
2827 @cindex debugging information options
2828
2829 GCC has various special options that are used for debugging
2830 either your program or GCC:
2831
2832 @table @gcctabopt
2833 @item -g
2834 @opindex g
2835 Produce debugging information in the operating system's native format
2836 (stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
2837 information.
2838
2839 On most systems that use stabs format, @option{-g} enables use of extra
2840 debugging information that only GDB can use; this extra information
2841 makes debugging work better in GDB but will probably make other debuggers
2842 crash or
2843 refuse to read the program.  If you want to control for certain whether
2844 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
2845 @option{-gxcoff+}, @option{-gxcoff}, @option{-gdwarf-1+}, @option{-gdwarf-1},
2846 or @option{-gvms} (see below).
2847
2848 Unlike most other C compilers, GCC allows you to use @option{-g} with
2849 @option{-O}.  The shortcuts taken by optimized code may occasionally
2850 produce surprising results: some variables you declared may not exist
2851 at all; flow of control may briefly move where you did not expect it;
2852 some statements may not be executed because they compute constant
2853 results or their values were already at hand; some statements may
2854 execute in different places because they were moved out of loops.
2855
2856 Nevertheless it proves possible to debug optimized output.  This makes
2857 it reasonable to use the optimizer for programs that might have bugs.
2858
2859 The following options are useful when GCC is generated with the
2860 capability for more than one debugging format.
2861
2862 @item -ggdb
2863 @opindex ggdb
2864 Produce debugging information for use by GDB@.  This means to use the
2865 most expressive format available (DWARF 2, stabs, or the native format
2866 if neither of those are supported), including GDB extensions if at all
2867 possible.
2868
2869 @item -gstabs
2870 @opindex gstabs
2871 Produce debugging information in stabs format (if that is supported),
2872 without GDB extensions.  This is the format used by DBX on most BSD
2873 systems.  On MIPS, Alpha and System V Release 4 systems this option
2874 produces stabs debugging output which is not understood by DBX or SDB@.
2875 On System V Release 4 systems this option requires the GNU assembler.
2876
2877 @item -gstabs+
2878 @opindex gstabs+
2879 Produce debugging information in stabs format (if that is supported),
2880 using GNU extensions understood only by the GNU debugger (GDB)@.  The
2881 use of these extensions is likely to make other debuggers crash or
2882 refuse to read the program.
2883
2884 @item -gcoff
2885 @opindex gcoff
2886 Produce debugging information in COFF format (if that is supported).
2887 This is the format used by SDB on most System V systems prior to
2888 System V Release 4.
2889
2890 @item -gxcoff
2891 @opindex gxcoff
2892 Produce debugging information in XCOFF format (if that is supported).
2893 This is the format used by the DBX debugger on IBM RS/6000 systems.
2894
2895 @item -gxcoff+
2896 @opindex gxcoff+
2897 Produce debugging information in XCOFF format (if that is supported),
2898 using GNU extensions understood only by the GNU debugger (GDB)@.  The
2899 use of these extensions is likely to make other debuggers crash or
2900 refuse to read the program, and may cause assemblers other than the GNU
2901 assembler (GAS) to fail with an error.
2902
2903 @item -gdwarf
2904 @opindex gdwarf
2905 Produce debugging information in DWARF version 1 format (if that is
2906 supported).  This is the format used by SDB on most System V Release 4
2907 systems.
2908
2909 This option is deprecated.
2910
2911 @item -gdwarf+
2912 @opindex gdwarf+
2913 Produce debugging information in DWARF version 1 format (if that is
2914 supported), using GNU extensions understood only by the GNU debugger
2915 (GDB)@.  The use of these extensions is likely to make other debuggers
2916 crash or refuse to read the program.
2917
2918 This option is deprecated.
2919
2920 @item -gdwarf-2
2921 @opindex gdwarf-2
2922 Produce debugging information in DWARF version 2 format (if that is
2923 supported).  This is the format used by DBX on IRIX 6.
2924
2925 @item -gvms
2926 @opindex gvms
2927 Produce debugging information in VMS debug format (if that is
2928 supported).  This is the format used by DEBUG on VMS systems.
2929
2930 @item -g@var{level}
2931 @itemx -ggdb@var{level}
2932 @itemx -gstabs@var{level}
2933 @itemx -gcoff@var{level}
2934 @itemx -gxcoff@var{level}
2935 @itemx -gvms@var{level}
2936 Request debugging information and also use @var{level} to specify how
2937 much information.  The default level is 2.
2938
2939 Level 1 produces minimal information, enough for making backtraces in
2940 parts of the program that you don't plan to debug.  This includes
2941 descriptions of functions and external variables, but no information
2942 about local variables and no line numbers.
2943
2944 Level 3 includes extra information, such as all the macro definitions
2945 present in the program.  Some debuggers support macro expansion when
2946 you use @option{-g3}.
2947
2948 Note that in order to avoid confusion between DWARF1 debug level 2,
2949 and DWARF2, neither @option{-gdwarf} nor @option{-gdwarf-2} accept
2950 a concatenated debug level.  Instead use an additional @option{-g@var{level}}
2951 option to change the debug level for DWARF1 or DWARF2.
2952
2953 @item -feliminate-dwarf2-dups
2954 @opindex feliminate-dwarf2-dups
2955 Compress DWARF2 debugging information by eliminating duplicated
2956 information about each symbol.  This option only makes sense when
2957 generating DWARF2 debugging information with @option{-gdwarf-2}.
2958
2959 @cindex @code{prof}
2960 @item -p
2961 @opindex p
2962 Generate extra code to write profile information suitable for the
2963 analysis program @code{prof}.  You must use this option when compiling
2964 the source files you want data about, and you must also use it when
2965 linking.
2966
2967 @cindex @code{gprof}
2968 @item -pg
2969 @opindex pg
2970 Generate extra code to write profile information suitable for the
2971 analysis program @code{gprof}.  You must use this option when compiling
2972 the source files you want data about, and you must also use it when
2973 linking.
2974
2975 @item -Q
2976 @opindex Q
2977 Makes the compiler print out each function name as it is compiled, and
2978 print some statistics about each pass when it finishes.
2979
2980 @item -ftime-report
2981 @opindex ftime-report
2982 Makes the compiler print some statistics about the time consumed by each
2983 pass when it finishes.
2984
2985 @item -fmem-report
2986 @opindex fmem-report
2987 Makes the compiler print some statistics about permanent memory
2988 allocation when it finishes.
2989
2990 @item -fprofile-arcs
2991 @opindex fprofile-arcs
2992 Instrument @dfn{arcs} during compilation to generate coverage data or
2993 for profile-directed block ordering.  During execution the program
2994 records how many times each branch is executed and how many times it is
2995 taken.  When the compiled program exits it saves this data to a file
2996 called @file{@var{auxname}.da} for each source file.  @var{auxname} is
2997 generated from the name of the output file, if explicitly specified and
2998 it is not the final executable, otherwise it is the basename of the
2999 source file. In both cases any suffix is removed (e.g.  @file{foo.da}
3000 for input file @file{dir/foo.c}, or @file{dir/foo.da} for output file
3001 specified as @option{-o dir/foo.o}).
3002
3003 For profile-directed block ordering, compile the program with
3004 @option{-fprofile-arcs} plus optimization and code generation options,
3005 generate the arc profile information by running the program on a
3006 selected workload, and then compile the program again with the same
3007 optimization and code generation options plus
3008 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
3009 Control Optimization}).
3010
3011 The other use of @option{-fprofile-arcs} is for use with @code{gcov},
3012 when it is used with the @option{-ftest-coverage} option.
3013
3014 With @option{-fprofile-arcs}, for each function of your program GCC
3015 creates a program flow graph, then finds a spanning tree for the graph.
3016 Only arcs that are not on the spanning tree have to be instrumented: the
3017 compiler adds code to count the number of times that these arcs are
3018 executed.  When an arc is the only exit or only entrance to a block, the
3019 instrumentation code can be added to the block; otherwise, a new basic
3020 block must be created to hold the instrumentation code.
3021
3022 @need 2000
3023 @item -ftest-coverage
3024 @opindex ftest-coverage
3025 Create data files for the @code{gcov} code-coverage utility
3026 (@pxref{Gcov,, @code{gcov}: a GCC Test Coverage Program}).  See
3027 @option{-fprofile-arcs} option above for a description of @var{auxname}.
3028
3029 @table @gcctabopt
3030 @item @var{auxname}.bb
3031 A mapping from basic blocks to line numbers, which @code{gcov} uses to
3032 associate basic block execution counts with line numbers.
3033
3034 @item @var{auxname}.bbg
3035 A list of all arcs in the program flow graph.  This allows @code{gcov}
3036 to reconstruct the program flow graph, so that it can compute all basic
3037 block and arc execution counts from the information in the
3038 @file{@var{auxname}.da} file.
3039 @end table
3040
3041 Use @option{-ftest-coverage} with @option{-fprofile-arcs}; the latter
3042 option adds instrumentation to the program, which then writes
3043 execution counts to another data file:
3044
3045 @table @gcctabopt
3046 @item @var{auxname}.da
3047 Runtime arc execution counts, used in conjunction with the arc
3048 information in the file @file{@var{auxname}.bbg}.
3049 @end table
3050
3051 Coverage data will map better to the source files if
3052 @option{-ftest-coverage} is used without optimization.
3053
3054 @item -d@var{letters}
3055 @opindex d
3056 Says to make debugging dumps during compilation at times specified by
3057 @var{letters}.  This is used for debugging the compiler.  The file names
3058 for most of the dumps are made by appending a pass number and a word to
3059 the @var{dumpname}. @var{dumpname} is generated from the name of the
3060 output file, if explicitly specified and it is not an executable,
3061 otherwise it is the basename of the source file. In both cases any
3062 suffix is removed (e.g.  @file{foo.00.rtl} or @file{foo.01.sibling}).
3063 Here are the possible letters for use in @var{letters}, and their
3064 meanings:
3065
3066 @table @samp
3067 @item A
3068 @opindex dA
3069 Annotate the assembler output with miscellaneous debugging information.
3070 @item b
3071 @opindex db
3072 Dump after computing branch probabilities, to @file{@var{file}.14.bp}.
3073 @item B
3074 @opindex dB
3075 Dump after block reordering, to @file{@var{file}.32.bbro}.
3076 @item c
3077 @opindex dc
3078 Dump after instruction combination, to the file @file{@var{file}.19.combine}.
3079 @item C
3080 @opindex dC
3081 Dump after the first if conversion, to the file @file{@var{file}.15.ce1}.
3082 @item d
3083 @opindex dd
3084 Dump after delayed branch scheduling, to @file{@var{file}.34.dbr}.
3085 @item D
3086 @opindex dD
3087 Dump all macro definitions, at the end of preprocessing, in addition to
3088 normal output.
3089 @item e
3090 @opindex de
3091 Dump after SSA optimizations, to @file{@var{file}.04.ssa} and
3092 @file{@var{file}.07.ussa}.
3093 @item E
3094 @opindex dE
3095 Dump after the second if conversion, to @file{@var{file}.29.ce3}.
3096 @item f
3097 @opindex df
3098 Dump after life analysis, to @file{@var{file}.18.life}.
3099 @item F
3100 @opindex dF
3101 Dump after purging @code{ADDRESSOF} codes, to @file{@var{file}.10.addressof}.
3102 @item g
3103 @opindex dg
3104 Dump after global register allocation, to @file{@var{file}.24.greg}.
3105 @item h
3106 @opindex dh
3107 Dump after finalization of EH handling code, to @file{@var{file}.02.eh}.
3108 @item k
3109 @opindex dk
3110 Dump after reg-to-stack conversion, to @file{@var{file}.31.stack}.
3111 @item o
3112 @opindex do
3113 Dump after post-reload optimizations, to @file{@var{file}.25.postreload}.
3114 @item G
3115 @opindex dG
3116 Dump after GCSE, to @file{@var{file}.11.gcse}.
3117 @item i
3118 @opindex di
3119 Dump after sibling call optimizations, to @file{@var{file}.01.sibling}.
3120 @item j
3121 @opindex dj
3122 Dump after the first jump optimization, to @file{@var{file}.03.jump}.
3123 @item k
3124 @opindex dk
3125 Dump after conversion from registers to stack, to @file{@var{file}.31.stack}.
3126 @item l
3127 @opindex dl
3128 Dump after local register allocation, to @file{@var{file}.23.lreg}.
3129 @item L
3130 @opindex dL
3131 Dump after loop optimization, to @file{@var{file}.12.loop}.
3132 @item M
3133 @opindex dM
3134 Dump after performing the machine dependent reorganization pass, to
3135 @file{@var{file}.33.mach}.
3136 @item n
3137 @opindex dn
3138 Dump after register renumbering, to @file{@var{file}.28.rnreg}.
3139 @item N
3140 @opindex dN
3141 Dump after the register move pass, to @file{@var{file}.21.regmove}.
3142 @item r
3143 @opindex dr
3144 Dump after RTL generation, to @file{@var{file}.00.rtl}.
3145 @item R
3146 @opindex dR
3147 Dump after the second scheduling pass, to @file{@var{file}.30.sched2}.
3148 @item s
3149 @opindex ds
3150 Dump after CSE (including the jump optimization that sometimes follows
3151 CSE), to @file{@var{file}.09.cse}.
3152 @item S
3153 @opindex dS
3154 Dump after the first scheduling pass, to @file{@var{file}.22.sched}.
3155 @item t
3156 @opindex dt
3157 Dump after the second CSE pass (including the jump optimization that
3158 sometimes follows CSE), to @file{@var{file}.17.cse2}.
3159 @item u
3160 @opindex du
3161 Dump after null pointer elimination pass to @file{@var{file}.08.null}.
3162 @item w
3163 @opindex dw
3164 Dump after the second flow pass, to @file{@var{file}.26.flow2}.
3165 @item X
3166 @opindex dX
3167 Dump after SSA dead code elimination, to @file{@var{file}.06.ssadce}.
3168 @item z
3169 @opindex dz
3170 Dump after the peephole pass, to @file{@var{file}.27.peephole2}.
3171 @item a
3172 @opindex da
3173 Produce all the dumps listed above.
3174 @item m
3175 @opindex dm
3176 Print statistics on memory usage, at the end of the run, to
3177 standard error.
3178 @item p
3179 @opindex dp
3180 Annotate the assembler output with a comment indicating which
3181 pattern and alternative was used.  The length of each instruction is
3182 also printed.
3183 @item P
3184 @opindex dP
3185 Dump the RTL in the assembler output as a comment before each instruction.
3186 Also turns on @option{-dp} annotation.
3187 @item v
3188 @opindex dv
3189 For each of the other indicated dump files (except for
3190 @file{@var{file}.00.rtl}), dump a representation of the control flow graph
3191 suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
3192 @item x
3193 @opindex dx
3194 Just generate RTL for a function instead of compiling it.  Usually used
3195 with @samp{r}.
3196 @item y
3197 @opindex dy
3198 Dump debugging information during parsing, to standard error.
3199 @end table
3200
3201 @item -fdump-unnumbered
3202 @opindex fdump-unnumbered
3203 When doing debugging dumps (see @option{-d} option above), suppress instruction
3204 numbers and line number note output.  This makes it more feasible to
3205 use diff on debugging dumps for compiler invocations with different
3206 options, in particular with and without @option{-g}.
3207
3208 @item -fdump-translation-unit @r{(C and C++ only)}
3209 @itemx -fdump-translation-unit-@var{options} @r{(C and C++ only)}
3210 @opindex fdump-translation-unit
3211 Dump a representation of the tree structure for the entire translation
3212 unit to a file.  The file name is made by appending @file{.tu} to the
3213 source file name.  If the @samp{-@var{options}} form is used, @var{options}
3214 controls the details of the dump as described for the
3215 @option{-fdump-tree} options.
3216
3217 @item -fdump-class-hierarchy @r{(C++ only)}
3218 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
3219 @opindex fdump-class-hierarchy
3220 Dump a representation of each class's hierarchy and virtual function
3221 table layout to a file.  The file name is made by appending @file{.class}
3222 to the source file name.  If the @samp{-@var{options}} form is used,
3223 @var{options} controls the details of the dump as described for the
3224 @option{-fdump-tree} options.
3225
3226 @item -fdump-tree-@var{switch} @r{(C++ only)}
3227 @itemx -fdump-tree-@var{switch}-@var{options} @r{(C++ only)}
3228 @opindex fdump-tree
3229 Control the dumping at various stages of processing the intermediate
3230 language tree to a file.  The file name is generated by appending a switch
3231 specific suffix to the source file name.  If the @samp{-@var{options}}
3232 form is used, @var{options} is a list of @samp{-} separated options that
3233 control the details of the dump. Not all options are applicable to all
3234 dumps, those which are not meaningful will be ignored. The following
3235 options are available
3236
3237 @table @samp
3238 @item address
3239 Print the address of each node.  Usually this is not meaningful as it
3240 changes according to the environment and source file. Its primary use
3241 is for tying up a dump file with a debug environment.
3242 @item slim
3243 Inhibit dumping of members of a scope or body of a function merely
3244 because that scope has been reached. Only dump such items when they
3245 are directly reachable by some other path.
3246 @item all
3247 Turn on all options.
3248 @end table
3249
3250 The following tree dumps are possible:
3251 @table @samp
3252 @item original
3253 Dump before any tree based optimization, to @file{@var{file}.original}.
3254 @item optimized
3255 Dump after all tree based optimization, to @file{@var{file}.optimized}.
3256 @item inlined
3257 Dump after function inlining, to @file{@var{file}.inlined}.
3258 @end table
3259
3260 @item -fsched-verbose=@var{n}
3261 @opindex fsched-verbose
3262 On targets that use instruction scheduling, this option controls the
3263 amount of debugging output the scheduler prints.  This information is
3264 written to standard error, unless @option{-dS} or @option{-dR} is
3265 specified, in which case it is output to the usual dump
3266 listing file, @file{.sched} or @file{.sched2} respectively.  However
3267 for @var{n} greater than nine, the output is always printed to standard
3268 error.
3269
3270 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
3271 same information as @option{-dRS}.  For @var{n} greater than one, it
3272 also output basic block probabilities, detailed ready list information
3273 and unit/insn info.  For @var{n} greater than two, it includes RTL
3274 at abort point, control-flow and regions info.  And for @var{n} over
3275 four, @option{-fsched-verbose} also includes dependence info.
3276
3277 @item -save-temps
3278 @opindex save-temps
3279 Store the usual ``temporary'' intermediate files permanently; place them
3280 in the current directory and name them based on the source file.  Thus,
3281 compiling @file{foo.c} with @samp{-c -save-temps} would produce files
3282 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
3283 preprocessed @file{foo.i} output file even though the compiler now
3284 normally uses an integrated preprocessor.
3285
3286 @item -time
3287 @opindex time
3288 Report the CPU time taken by each subprocess in the compilation
3289 sequence.  For C source files, this is the compiler proper and assembler
3290 (plus the linker if linking is done).  The output looks like this:
3291
3292 @smallexample
3293 # cc1 0.12 0.01
3294 # as 0.00 0.01
3295 @end smallexample
3296
3297 The first number on each line is the ``user time,'' that is time spent
3298 executing the program itself.  The second number is ``system time,''
3299 time spent executing operating system routines on behalf of the program.
3300 Both numbers are in seconds.
3301
3302 @item -print-file-name=@var{library}
3303 @opindex print-file-name
3304 Print the full absolute name of the library file @var{library} that
3305 would be used when linking---and don't do anything else.  With this
3306 option, GCC does not compile or link anything; it just prints the
3307 file name.
3308
3309 @item -print-multi-directory
3310 @opindex print-multi-directory
3311 Print the directory name corresponding to the multilib selected by any
3312 other switches present in the command line.  This directory is supposed
3313 to exist in @env{GCC_EXEC_PREFIX}.
3314
3315 @item -print-multi-lib
3316 @opindex print-multi-lib
3317 Print the mapping from multilib directory names to compiler switches
3318 that enable them.  The directory name is separated from the switches by
3319 @samp{;}, and each switch starts with an @samp{@@} instead of the
3320 @samp{-}, without spaces between multiple switches.  This is supposed to
3321 ease shell-processing.
3322
3323 @item -print-prog-name=@var{program}
3324 @opindex print-prog-name
3325 Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
3326
3327 @item -print-libgcc-file-name
3328 @opindex print-libgcc-file-name
3329 Same as @option{-print-file-name=libgcc.a}.
3330
3331 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
3332 but you do want to link with @file{libgcc.a}.  You can do
3333
3334 @example
3335 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
3336 @end example
3337
3338 @item -print-search-dirs
3339 @opindex print-search-dirs
3340 Print the name of the configured installation directory and a list of
3341 program and library directories gcc will search---and don't do anything else.
3342
3343 This is useful when gcc prints the error message
3344 @samp{installation problem, cannot exec cpp0: No such file or directory}.
3345 To resolve this you either need to put @file{cpp0} and the other compiler
3346 components where gcc expects to find them, or you can set the environment
3347 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
3348 Don't forget the trailing '/'.
3349 @xref{Environment Variables}.
3350
3351 @item -dumpmachine
3352 @opindex dumpmachine
3353 Print the compiler's target machine (for example,
3354 @samp{i686-pc-linux-gnu})---and don't do anything else.
3355
3356 @item -dumpversion
3357 @opindex dumpversion
3358 Print the compiler version (for example, @samp{3.0})---and don't do
3359 anything else.
3360
3361 @item -dumpspecs
3362 @opindex dumpspecs
3363 Print the compiler's built-in specs---and don't do anything else.  (This
3364 is used when GCC itself is being built.)  @xref{Spec Files}.
3365 @end table
3366
3367 @node Optimize Options
3368 @section Options That Control Optimization
3369 @cindex optimize options
3370 @cindex options, optimization
3371
3372 These options control various sorts of optimizations:
3373
3374 @table @gcctabopt
3375 @item -O
3376 @itemx -O1
3377 @opindex O
3378 @opindex O1
3379 Optimize.  Optimizing compilation takes somewhat more time, and a lot
3380 more memory for a large function.
3381
3382 Without @option{-O}, the compiler's goal is to reduce the cost of
3383 compilation and to make debugging produce the expected results.
3384 Statements are independent: if you stop the program with a breakpoint
3385 between statements, you can then assign a new value to any variable or
3386 change the program counter to any other statement in the function and
3387 get exactly the results you would expect from the source code.
3388
3389 With @option{-O}, the compiler tries to reduce code size and execution
3390 time, without performing any optimizations that take a great deal of
3391 compilation time.
3392
3393 @item -O2
3394 @opindex O2
3395 Optimize even more.  GCC performs nearly all supported optimizations
3396 that do not involve a space-speed tradeoff.  The compiler does not
3397 perform loop unrolling or function inlining when you specify @option{-O2}.
3398 As compared to @option{-O}, this option increases both compilation time
3399 and the performance of the generated code.
3400
3401 @option{-O2} turns on all optional optimizations except for loop
3402 unrolling, function inlining, and register renaming.  It also turns on
3403 the @option{-fforce-mem} and @option{-fstrict-aliasing} option on all
3404 machines and frame pointer elimination on machines where doing so does
3405 not interfere with debugging.
3406
3407 Please note the warning under @option{-fgcse} about
3408 invoking @option{-O2} on programs that use computed gotos.
3409
3410 @item -O3
3411 @opindex O3
3412 Optimize yet more.  @option{-O3} turns on all optimizations specified by
3413 @option{-O2} and also turns on the @option{-finline-functions} and
3414 @option{-frename-registers} options.
3415
3416 @item -O0
3417 @opindex O0
3418 Do not optimize.
3419
3420 @item -Os
3421 @opindex Os
3422 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations that
3423 do not typically increase code size.  It also performs further
3424 optimizations designed to reduce code size.
3425
3426 If you use multiple @option{-O} options, with or without level numbers,
3427 the last such option is the one that is effective.
3428 @end table
3429
3430 Options of the form @option{-f@var{flag}} specify machine-independent
3431 flags.  Most flags have both positive and negative forms; the negative
3432 form of @option{-ffoo} would be @option{-fno-foo}.  In the table below,
3433 only one of the forms is listed---the one which is not the default.
3434 You can figure out the other form by either removing @samp{no-} or
3435 adding it.
3436
3437 @table @gcctabopt
3438 @item -ffloat-store
3439 @opindex ffloat-store
3440 Do not store floating point variables in registers, and inhibit other
3441 options that might change whether a floating point value is taken from a
3442 register or memory.
3443
3444 @cindex floating point precision
3445 This option prevents undesirable excess precision on machines such as
3446 the 68000 where the floating registers (of the 68881) keep more
3447 precision than a @code{double} is supposed to have.  Similarly for the
3448 x86 architecture.  For most programs, the excess precision does only
3449 good, but a few programs rely on the precise definition of IEEE floating
3450 point.  Use @option{-ffloat-store} for such programs, after modifying
3451 them to store all pertinent intermediate computations into variables.
3452
3453 @item -fno-default-inline
3454 @opindex fno-default-inline
3455 Do not make member functions inline by default merely because they are
3456 defined inside the class scope (C++ only).  Otherwise, when you specify
3457 @w{@option{-O}}, member functions defined inside class scope are compiled
3458 inline by default; i.e., you don't need to add @samp{inline} in front of
3459 the member function name.
3460
3461 @item -fno-defer-pop
3462 @opindex fno-defer-pop
3463 Always pop the arguments to each function call as soon as that function
3464 returns.  For machines which must pop arguments after a function call,
3465 the compiler normally lets arguments accumulate on the stack for several
3466 function calls and pops them all at once.
3467
3468 @item -fforce-mem
3469 @opindex fforce-mem
3470 Force memory operands to be copied into registers before doing
3471 arithmetic on them.  This produces better code by making all memory
3472 references potential common subexpressions.  When they are not common
3473 subexpressions, instruction combination should eliminate the separate
3474 register-load.  The @option{-O2} option turns on this option.
3475
3476 @item -fforce-addr
3477 @opindex fforce-addr
3478 Force memory address constants to be copied into registers before
3479 doing arithmetic on them.  This may produce better code just as
3480 @option{-fforce-mem} may.
3481
3482 @item -fomit-frame-pointer
3483 @opindex fomit-frame-pointer
3484 Don't keep the frame pointer in a register for functions that
3485 don't need one.  This avoids the instructions to save, set up and
3486 restore frame pointers; it also makes an extra register available
3487 in many functions.  @strong{It also makes debugging impossible on
3488 some machines.}
3489
3490 On some machines, such as the VAX, this flag has no effect, because
3491 the standard calling sequence automatically handles the frame pointer
3492 and nothing is saved by pretending it doesn't exist.  The
3493 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
3494 whether a target machine supports this flag.  @xref{Registers,,Register
3495 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
3496
3497 @item -foptimize-sibling-calls
3498 @opindex foptimize-sibling-calls
3499 Optimize sibling and tail recursive calls.
3500
3501 @item -ftrapv
3502 @opindex ftrapv
3503 This option generates traps for signed overflow on addition, subtraction,
3504 multiplication operations.
3505
3506 @item -fno-inline
3507 @opindex fno-inline
3508 Don't pay attention to the @code{inline} keyword.  Normally this option
3509 is used to keep the compiler from expanding any functions inline.
3510 Note that if you are not optimizing, no functions can be expanded inline.
3511
3512 @item -finline-functions
3513 @opindex finline-functions
3514 Integrate all simple functions into their callers.  The compiler
3515 heuristically decides which functions are simple enough to be worth
3516 integrating in this way.
3517
3518 If all calls to a given function are integrated, and the function is
3519 declared @code{static}, then the function is normally not output as
3520 assembler code in its own right.
3521
3522 @item -finline-limit=@var{n}
3523 @opindex finline-limit
3524 By default, gcc limits the size of functions that can be inlined.  This flag
3525 allows the control of this limit for functions that are explicitly marked as
3526 inline (i.e., marked with the inline keyword or defined within the class
3527 definition in c++).  @var{n} is the size of functions that can be inlined in
3528 number of pseudo instructions (not counting parameter handling).  The default
3529 value of @var{n} is 600.
3530 Increasing this value can result in more inlined code at
3531 the cost of compilation time and memory consumption.  Decreasing usually makes
3532 the compilation faster and less code will be inlined (which presumably
3533 means slower programs).  This option is particularly useful for programs that
3534 use inlining heavily such as those based on recursive templates with C++.
3535
3536 @emph{Note:} pseudo instruction represents, in this particular context, an
3537 abstract measurement of function's size.  In no way, it represents a count
3538 of assembly instructions and as such its exact meaning might change from one
3539 release to an another.
3540
3541 @item -fkeep-inline-functions
3542 @opindex fkeep-inline-functions
3543 Even if all calls to a given function are integrated, and the function
3544 is declared @code{static}, nevertheless output a separate run-time
3545 callable version of the function.  This switch does not affect
3546 @code{extern inline} functions.
3547
3548 @item -fkeep-static-consts
3549 @opindex fkeep-static-consts
3550 Emit variables declared @code{static const} when optimization isn't turned
3551 on, even if the variables aren't referenced.
3552
3553 GCC enables this option by default.  If you want to force the compiler to
3554 check if the variable was referenced, regardless of whether or not
3555 optimization is turned on, use the @option{-fno-keep-static-consts} option.
3556
3557 @item -fmerge-constants
3558 Attempt to merge identical constants (string constants and floating point
3559 constants) across compilation units.
3560
3561 This option is the default for optimized compilation if the assembler and
3562 linker support it.  Use @option{-fno-merge-constants} to inhibit this
3563 behavior.
3564
3565 @item -fmerge-all-constants
3566 Attempt to merge identical constants and identical variables.
3567
3568 This option implies @option{-fmerge-constants}.  In addition to
3569 @option{-fmerge-constants} this considers e.g. even constant initialized
3570 arrays or initialized constant variables with integral or floating point
3571 types.  Languages like C or C++ require each non-automatic variable to
3572 have distinct location, so using this option will result in non-conforming
3573 behavior.
3574
3575 @item -fnew-ra
3576 @opindex fnew-ra
3577 Use a graph coloring register allocator.  Currently this option is meant
3578 for testing, so we are interested to hear about miscompilations with
3579 @option{-fnew-ra}.
3580
3581 @item -fno-branch-count-reg
3582 @opindex fno-branch-count-reg
3583 Do not use ``decrement and branch'' instructions on a count register,
3584 but instead generate a sequence of instructions that decrement a
3585 register, compare it against zero, then branch based upon the result.
3586 This option is only meaningful on architectures that support such
3587 instructions, which include x86, PowerPC, IA-64 and S/390.
3588
3589 @item -fno-function-cse
3590 @opindex fno-function-cse
3591 Do not put function addresses in registers; make each instruction that
3592 calls a constant function contain the function's address explicitly.
3593
3594 This option results in less efficient code, but some strange hacks
3595 that alter the assembler output may be confused by the optimizations
3596 performed when this option is not used.
3597
3598 @item -ffast-math
3599 @opindex ffast-math
3600 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @*
3601 @option{-fno-trapping-math}, @option{-ffinite-math-only} and @*
3602 @option{-fno-signaling-nans}.
3603
3604 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
3605
3606 This option should never be turned on by any @option{-O} option since
3607 it can result in incorrect output for programs which depend on
3608 an exact implementation of IEEE or ISO rules/specifications for
3609 math functions.
3610
3611 @item -fno-math-errno
3612 @opindex fno-math-errno
3613 Do not set ERRNO after calling math functions that are executed
3614 with a single instruction, e.g., sqrt.  A program that relies on
3615 IEEE exceptions for math error handling may want to use this flag
3616 for speed while maintaining IEEE arithmetic compatibility.
3617
3618 This option should never be turned on by any @option{-O} option since
3619 it can result in incorrect output for programs which depend on
3620 an exact implementation of IEEE or ISO rules/specifications for
3621 math functions.
3622
3623 The default is @option{-fmath-errno}.
3624
3625 @item -funsafe-math-optimizations
3626 @opindex funsafe-math-optimizations
3627 Allow optimizations for floating-point arithmetic that (a) assume
3628 that arguments and results are valid and (b) may violate IEEE or
3629 ANSI standards.  When used at link-time, it may include libraries
3630 or startup files that change the default FPU control word or other
3631 similar optimizations.
3632
3633 This option should never be turned on by any @option{-O} option since
3634 it can result in incorrect output for programs which depend on
3635 an exact implementation of IEEE or ISO rules/specifications for
3636 math functions.
3637
3638 The default is @option{-fno-unsafe-math-optimizations}.
3639
3640 @item -ffinite-math-only
3641 @opindex ffinite-math-only
3642 Allow optimizations for floating-point arithmetic that assume
3643 that arguments and results are not NaNs or +-Infs.
3644
3645 This option should never be turned on by any @option{-O} option since
3646 it can result in incorrect output for programs which depend on
3647 an exact implementation of IEEE or ISO rules/specifications.
3648
3649 The default is @option{-fno-finite-math-only}.
3650
3651 @item -fno-trapping-math
3652 @opindex fno-trapping-math
3653 Compile code assuming that floating-point operations cannot generate
3654 user-visible traps.  These traps include division by zero, overflow,
3655 underflow, inexact result and invalid operation.  This option implies
3656 @option{-fno-signaling-nans}.  Setting this option may allow faster
3657 code if one relies on ``non-stop'' IEEE arithmetic, for example.
3658
3659 This option should never be turned on by any @option{-O} option since
3660 it can result in incorrect output for programs which depend on
3661 an exact implementation of IEEE or ISO rules/specifications for
3662 math functions.
3663
3664 The default is @option{-ftrapping-math}.
3665
3666 @item -fsignaling-nans
3667 @opindex fsignaling-nans
3668 Compile code assuming that IEEE signaling NaNs may generate user-visible
3669 traps during floating-point operations.  Setting this option disables
3670 optimizations that may change the number of exceptions visible with
3671 signaling NaNs.  This option implies @option{-ftrapping-math}.
3672
3673 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
3674 be defined.
3675
3676 The default is @option{-fno-signaling-nans}.
3677
3678 This option is experimental and does not currently guarantee to
3679 disable all GCC optimizations that affect signaling NaN behavior.
3680
3681 @item -fno-zero-initialized-in-bss
3682 @opindex fno-zero-initialized-in-bss
3683 If the target supports a BSS section, GCC by default puts variables that
3684 are initialized to zero into BSS@.  This can save space in the resulting
3685 code.
3686
3687 This option turns off this behavior because some programs explicitly
3688 rely on variables going to the data section.  E.g., so that the
3689 resulting executable can find the beginning of that section and/or make
3690 assumptions based on that.
3691
3692 The default is @option{-fzero-initialized-in-bss}.
3693
3694 @item -fbounds-check
3695 @opindex fbounds-check
3696 For front-ends that support it, generate additional code to check that
3697 indices used to access arrays are within the declared range.  This is
3698 currently only supported by the Java and Fortran 77 front-ends, where
3699 this option defaults to true and false respectively.
3700
3701 @end table
3702
3703 The following options control specific optimizations.  The @option{-O2}
3704 option turns on all of these optimizations except @option{-funroll-loops}
3705 and @option{-funroll-all-loops}.  On most machines, the @option{-O} option
3706 turns on the @option{-fthread-jumps} and @option{-fdelayed-branch} options,
3707 but specific machines may handle it differently.
3708
3709 You can use the following flags in the rare cases when ``fine-tuning''
3710 of optimizations to be performed is desired.
3711
3712 Not all of the optimizations performed by GCC have @option{-f} options
3713 to control them.
3714
3715 @table @gcctabopt
3716 @item -fstrength-reduce
3717 @opindex fstrength-reduce
3718 Perform the optimizations of loop strength reduction and
3719 elimination of iteration variables.
3720
3721 @item -fthread-jumps
3722 @opindex fthread-jumps
3723 Perform optimizations where we check to see if a jump branches to a
3724 location where another comparison subsumed by the first is found.  If
3725 so, the first branch is redirected to either the destination of the
3726 second branch or a point immediately following it, depending on whether
3727 the condition is known to be true or false.
3728
3729 @item -fcse-follow-jumps
3730 @opindex fcse-follow-jumps
3731 In common subexpression elimination, scan through jump instructions
3732 when the target of the jump is not reached by any other path.  For
3733 example, when CSE encounters an @code{if} statement with an
3734 @code{else} clause, CSE will follow the jump when the condition
3735 tested is false.
3736
3737 @item -fcse-skip-blocks
3738 @opindex fcse-skip-blocks
3739 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
3740 follow jumps which conditionally skip over blocks.  When CSE
3741 encounters a simple @code{if} statement with no else clause,
3742 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
3743 body of the @code{if}.
3744
3745 @item -frerun-cse-after-loop
3746 @opindex frerun-cse-after-loop
3747 Re-run common subexpression elimination after loop optimizations has been
3748 performed.
3749
3750 @item -frerun-loop-opt
3751 @opindex frerun-loop-opt
3752 Run the loop optimizer twice.
3753
3754 @item -fgcse
3755 @opindex fgcse
3756 Perform a global common subexpression elimination pass.
3757 This pass also performs global constant and copy propagation.
3758
3759 @emph{Note:} When compiling a program using computed gotos, a GCC
3760 extension, you may get better runtime performance if you disable
3761 the global common subexpression elimination pass by adding
3762 @option{-fno-gcse} to the command line.
3763
3764 @item -fgcse-lm
3765 @opindex fgcse-lm
3766 When @option{-fgcse-lm} is enabled, global common subexpression elimination will
3767 attempt to move loads which are only killed by stores into themselves.  This
3768 allows a loop containing a load/store sequence to be changed to a load outside
3769 the loop, and a copy/store within the loop.
3770
3771 @item -fgcse-sm
3772 @opindex fgcse-sm
3773 When @option{-fgcse-sm} is enabled, A store motion pass is run after global common
3774 subexpression elimination.  This pass will attempt to move stores out of loops.
3775 When used in conjunction with @option{-fgcse-lm}, loops containing a load/store sequence
3776 can be changed to a load before the loop and a store after the loop.
3777
3778 @item -floop-optimize
3779 @opindex floop-optimize
3780 Perform loop optimizations: move constant expressions out of loops, simplify
3781 exit test conditions and optionally do strength-reduction and loop unrolling as
3782 well.
3783
3784 @item -fcrossjumping
3785 @opindex crossjumping
3786 Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The
3787 resulting code may or may not perform better than without cross-jumping.
3788
3789 @item -fif-conversion
3790 @opindex if-conversion
3791 Attempt to transform conditional jumps into branch-less equivalents.  This
3792 include use of conditional moves, min, max, set flags and abs instructions, and
3793 some tricks doable by standard arithmetics.  The use of conditional execution
3794 on chips where it is available is controlled by @code{if-conversion2}.
3795
3796 @item -fif-conversion2
3797 @opindex if-conversion2
3798 Use conditional execution (where available) to transform conditional jumps into
3799 branch-less equivalents.
3800
3801 @item -fdelete-null-pointer-checks
3802 @opindex fdelete-null-pointer-checks
3803 Use global dataflow analysis to identify and eliminate useless checks
3804 for null pointers.  The compiler assumes that dereferencing a null
3805 pointer would have halted the program.  If a pointer is checked after
3806 it has already been dereferenced, it cannot be null.
3807
3808 In some environments, this assumption is not true, and programs can
3809 safely dereference null pointers.  Use
3810 @option{-fno-delete-null-pointer-checks} to disable this optimization
3811 for programs which depend on that behavior.
3812
3813 @item -fexpensive-optimizations
3814 @opindex fexpensive-optimizations
3815 Perform a number of minor optimizations that are relatively expensive.
3816
3817 @item -foptimize-register-move
3818 @itemx -fregmove
3819 @opindex foptimize-register-move
3820 @opindex fregmove
3821 Attempt to reassign register numbers in move instructions and as
3822 operands of other simple instructions in order to maximize the amount of
3823 register tying.  This is especially helpful on machines with two-operand
3824 instructions.  GCC enables this optimization by default with @option{-O2}
3825 or higher.
3826
3827 Note @option{-fregmove} and @option{-foptimize-register-move} are the same
3828 optimization.
3829
3830 @item -fdelayed-branch
3831 @opindex fdelayed-branch
3832 If supported for the target machine, attempt to reorder instructions
3833 to exploit instruction slots available after delayed branch
3834 instructions.
3835
3836 @item -fschedule-insns
3837 @opindex fschedule-insns
3838 If supported for the target machine, attempt to reorder instructions to
3839 eliminate execution stalls due to required data being unavailable.  This
3840 helps machines that have slow floating point or memory load instructions
3841 by allowing other instructions to be issued until the result of the load
3842 or floating point instruction is required.
3843
3844 @item -fschedule-insns2
3845 @opindex fschedule-insns2
3846 Similar to @option{-fschedule-insns}, but requests an additional pass of
3847 instruction scheduling after register allocation has been done.  This is
3848 especially useful on machines with a relatively small number of
3849 registers and where memory load instructions take more than one cycle.
3850
3851 @item -fno-sched-interblock
3852 @opindex fno-sched-interblock
3853 Don't schedule instructions across basic blocks.  This is normally
3854 enabled by default when scheduling before register allocation, i.e.@:
3855 with @option{-fschedule-insns} or at @option{-O2} or higher.
3856
3857 @item -fno-sched-spec
3858 @opindex fno-sched-spec
3859 Don't allow speculative motion of non-load instructions.  This is normally
3860 enabled by default when scheduling before register allocation, i.e.@:
3861 with @option{-fschedule-insns} or at @option{-O2} or higher.
3862
3863 @item -fsched-spec-load
3864 @opindex fsched-spec-load
3865 Allow speculative motion of some load instructions.  This only makes
3866 sense when scheduling before register allocation, i.e.@: with
3867 @option{-fschedule-insns} or at @option{-O2} or higher.
3868
3869 @item -fsched-spec-load-dangerous
3870 @opindex fsched-spec-load-dangerous
3871 Allow speculative motion of more load instructions.  This only makes
3872 sense when scheduling before register allocation, i.e.@: with
3873 @option{-fschedule-insns} or at @option{-O2} or higher.
3874
3875 @item -ffunction-sections
3876 @itemx -fdata-sections
3877 @opindex ffunction-sections
3878 @opindex fdata-sections
3879 Place each function or data item into its own section in the output
3880 file if the target supports arbitrary sections.  The name of the
3881 function or the name of the data item determines the section's name
3882 in the output file.
3883
3884 Use these options on systems where the linker can perform optimizations
3885 to improve locality of reference in the instruction space.  HPPA
3886 processors running HP-UX and SPARC processors running Solaris 2 have
3887 linkers with such optimizations.  Other systems using the ELF object format
3888 as well as AIX may have these optimizations in the future.
3889
3890 Only use these options when there are significant benefits from doing
3891 so.  When you specify these options, the assembler and linker will
3892 create larger object and executable files and will also be slower.
3893 You will not be able to use @code{gprof} on all systems if you
3894 specify this option and you may have problems with debugging if
3895 you specify both this option and @option{-g}.
3896
3897 @item -fcaller-saves
3898 @opindex fcaller-saves
3899 Enable values to be allocated in registers that will be clobbered by
3900 function calls, by emitting extra instructions to save and restore the
3901 registers around such calls.  Such allocation is done only when it
3902 seems to result in better code than would otherwise be produced.
3903
3904 This option is always enabled by default on certain machines, usually
3905 those which have no call-preserved registers to use instead.
3906
3907 For all machines, optimization level 2 and higher enables this flag by
3908 default.
3909
3910 @item -ftracer
3911 @opindex ftracer
3912 Perform tail duplication to enlarge superblock size. This transformation
3913 simplifies the control flow of the function allowing other optimizations to do
3914 better job.
3915
3916 @item -funroll-loops
3917 @opindex funroll-loops
3918 Unroll loops whose number of iterations can be determined at compile
3919 time or upon entry to the loop.  @option{-funroll-loops} implies both
3920 @option{-fstrength-reduce} and @option{-frerun-cse-after-loop}.  This
3921 option makes code larger, and may or may not make it run faster.
3922
3923 @item -funroll-all-loops
3924 @opindex funroll-all-loops
3925 Unroll all loops, even if their number of iterations is uncertain when
3926 the loop is entered.  This usually makes programs run more slowly.
3927 @option{-funroll-all-loops} implies the same options as
3928 @option{-funroll-loops},
3929
3930 @item -fprefetch-loop-arrays
3931 @opindex fprefetch-loop-arrays
3932 If supported by the target machine, generate instructions to prefetch
3933 memory to improve the performance of loops that access large arrays.
3934
3935 @item -fmove-all-movables
3936 @opindex fmove-all-movables
3937 Forces all invariant computations in loops to be moved
3938 outside the loop.
3939
3940 @item -freduce-all-givs
3941 @opindex freduce-all-givs
3942 Forces all general-induction variables in loops to be
3943 strength-reduced.
3944
3945 @emph{Note:} When compiling programs written in Fortran,
3946 @option{-fmove-all-movables} and @option{-freduce-all-givs} are enabled
3947 by default when you use the optimizer.
3948
3949 These options may generate better or worse code; results are highly
3950 dependent on the structure of loops within the source code.
3951
3952 These two options are intended to be removed someday, once
3953 they have helped determine the efficacy of various
3954 approaches to improving loop optimizations.
3955
3956 Please let us (@w{@email{gcc@@gcc.gnu.org}} and @w{@email{fortran@@gnu.org}})
3957 know how use of these options affects
3958 the performance of your production code.
3959 We're very interested in code that runs @emph{slower}
3960 when these options are @emph{enabled}.
3961
3962 @item -fno-peephole
3963 @itemx -fno-peephole2
3964 @opindex fno-peephole
3965 @opindex fno-peephole2
3966 Disable any machine-specific peephole optimizations.  The difference
3967 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
3968 are implemented in the compiler; some targets use one, some use the
3969 other, a few use both.
3970
3971 @item -fbranch-probabilities
3972 @opindex fbranch-probabilities
3973 After running a program compiled with @option{-fprofile-arcs}
3974 (@pxref{Debugging Options,, Options for Debugging Your Program or
3975 @command{gcc}}), you can compile it a second time using
3976 @option{-fbranch-probabilities}, to improve optimizations based on
3977 the number of times each branch was taken.  When the program
3978 compiled with @option{-fprofile-arcs} exits it saves arc execution
3979 counts to a file called @file{@var{sourcename}.da} for each source
3980 file  The information in this data file is very dependent on the
3981 structure of the generated code, so you must use the same source code
3982 and the same optimization options for both compilations.
3983
3984 With @option{-fbranch-probabilities}, GCC puts a @samp{REG_EXEC_COUNT}
3985 note on the first instruction of each basic block, and a
3986 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
3987 These can be used to improve optimization.  Currently, they are only
3988 used in one place: in @file{reorg.c}, instead of guessing which path a
3989 branch is mostly to take, the @samp{REG_BR_PROB} values are used to
3990 exactly determine which path is taken more often.
3991
3992 @item -fno-guess-branch-probability
3993 @opindex fno-guess-branch-probability
3994 Do not guess branch probabilities using a randomized model.
3995
3996 Sometimes gcc will opt to use a randomized model to guess branch
3997 probabilities, when none are available from either profiling feedback
3998 (@option{-fprofile-arcs}) or @samp{__builtin_expect}.  This means that
3999 different runs of the compiler on the same program may produce different
4000 object code.
4001
4002 In a hard real-time system, people don't want different runs of the
4003 compiler to produce code that has different behavior; minimizing
4004 non-determinism is of paramount import.  This switch allows users to
4005 reduce non-determinism, possibly at the expense of inferior
4006 optimization.
4007
4008 @item -freorder-blocks
4009 @opindex freorder-blocks
4010 Reorder basic blocks in the compiled function in order to reduce number of
4011 taken branches and improve code locality.
4012
4013 @item -freorder-functions
4014 @opindex freorder-functions
4015 Reorder basic blocks in the compiled function in order to reduce number of
4016 taken branches and improve code locality. This is implemented by using special
4017 subsections @code{text.hot} for most frequently executed functions and
4018 @code{text.unlikely} for unlikely executed functions.  Reordering is done by
4019 the linker so object file format must support named sections and linker must
4020 place them in a reasonable way.
4021
4022 Also profile feedback must be available in to make this option effective.  See
4023 @option{-fprofile-arcs} for details.
4024
4025 @item -fstrict-aliasing
4026 @opindex fstrict-aliasing
4027 Allows the compiler to assume the strictest aliasing rules applicable to
4028 the language being compiled.  For C (and C++), this activates
4029 optimizations based on the type of expressions.  In particular, an
4030 object of one type is assumed never to reside at the same address as an
4031 object of a different type, unless the types are almost the same.  For
4032 example, an @code{unsigned int} can alias an @code{int}, but not a
4033 @code{void*} or a @code{double}.  A character type may alias any other
4034 type.
4035
4036 Pay special attention to code like this:
4037 @example
4038 union a_union @{
4039   int i;
4040   double d;
4041 @};
4042
4043 int f() @{
4044   a_union t;
4045   t.d = 3.0;
4046   return t.i;
4047 @}
4048 @end example
4049 The practice of reading from a different union member than the one most
4050 recently written to (called ``type-punning'') is common.  Even with
4051 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
4052 is accessed through the union type.  So, the code above will work as
4053 expected.  However, this code might not:
4054 @example
4055 int f() @{
4056   a_union t;
4057   int* ip;
4058   t.d = 3.0;
4059   ip = &t.i;
4060   return *ip;
4061 @}
4062 @end example
4063
4064 Every language that wishes to perform language-specific alias analysis
4065 should define a function that computes, given an @code{tree}
4066 node, an alias set for the node.  Nodes in different alias sets are not
4067 allowed to alias.  For an example, see the C front-end function
4068 @code{c_get_alias_set}.
4069
4070 For all machines, optimization level 2 and higher enables this flag by
4071 default.
4072
4073 @item -falign-functions
4074 @itemx -falign-functions=@var{n}
4075 @opindex falign-functions
4076 Align the start of functions to the next power-of-two greater than
4077 @var{n}, skipping up to @var{n} bytes.  For instance,
4078 @option{-falign-functions=32} aligns functions to the next 32-byte
4079 boundary, but @option{-falign-functions=24} would align to the next
4080 32-byte boundary only if this can be done by skipping 23 bytes or less.
4081
4082 @option{-fno-align-functions} and @option{-falign-functions=1} are
4083 equivalent and mean that functions will not be aligned.
4084
4085 Some assemblers only support this flag when @var{n} is a power of two;
4086 in that case, it is rounded up.
4087
4088 If @var{n} is not specified, use a machine-dependent default.
4089
4090 @item -falign-labels
4091 @itemx -falign-labels=@var{n}
4092 @opindex falign-labels
4093 Align all branch targets to a power-of-two boundary, skipping up to
4094 @var{n} bytes like @option{-falign-functions}.  This option can easily
4095 make code slower, because it must insert dummy operations for when the
4096 branch target is reached in the usual flow of the code.
4097
4098 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
4099 are greater than this value, then their values are used instead.
4100
4101 If @var{n} is not specified, use a machine-dependent default which is
4102 very likely to be @samp{1}, meaning no alignment.
4103
4104 @item -falign-loops
4105 @itemx -falign-loops=@var{n}
4106 @opindex falign-loops
4107 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
4108 like @option{-falign-functions}.  The hope is that the loop will be
4109 executed many times, which will make up for any execution of the dummy
4110 operations.
4111
4112 If @var{n} is not specified, use a machine-dependent default.
4113
4114 @item -falign-jumps
4115 @itemx -falign-jumps=@var{n}
4116 @opindex falign-jumps
4117 Align branch targets to a power-of-two boundary, for branch targets
4118 where the targets can only be reached by jumping, skipping up to @var{n}
4119 bytes like @option{-falign-functions}.  In this case, no dummy operations
4120 need be executed.
4121
4122 If @var{n} is not specified, use a machine-dependent default.
4123
4124 @item -fssa
4125 @opindex fssa
4126 Perform optimizations in static single assignment form.  Each function's
4127 flow graph is translated into SSA form, optimizations are performed, and
4128 the flow graph is translated back from SSA form.  Users should not
4129 specify this option, since it is not yet ready for production use.
4130
4131 @item -fssa-ccp
4132 @opindex fssa-ccp
4133 Perform Sparse Conditional Constant Propagation in SSA form.  Requires
4134 @option{-fssa}.  Like @option{-fssa}, this is an experimental feature.
4135
4136 @item -fssa-dce
4137 @opindex fssa-dce
4138 Perform aggressive dead-code elimination in SSA form.  Requires @option{-fssa}.
4139 Like @option{-fssa}, this is an experimental feature.
4140
4141 @item -fsingle-precision-constant
4142 @opindex fsingle-precision-constant
4143 Treat floating point constant as single precision constant instead of
4144 implicitly converting it to double precision constant.
4145
4146 @item -frename-registers
4147 @opindex frename-registers
4148 Attempt to avoid false dependencies in scheduled code by making use
4149 of registers left over after register allocation.  This optimization
4150 will most benefit processors with lots of registers.  It can, however,
4151 make debugging impossible, since variables will no longer stay in
4152 a ``home register''.
4153
4154 @item -fno-cprop-registers
4155 @opindex fno-cprop-registers
4156 After register allocation and post-register allocation instruction splitting,
4157 we perform a copy-propagation pass to try to reduce scheduling dependencies
4158 and occasionally eliminate the copy.
4159
4160 @item --param @var{name}=@var{value}
4161 @opindex param
4162 In some places, GCC uses various constants to control the amount of
4163 optimization that is done.  For example, GCC will not inline functions
4164 that contain more that a certain number of instructions.  You can
4165 control some of these constants on the command-line using the
4166 @option{--param} option.
4167
4168 In each case, the @var{value} is an integer.  The allowable choices for
4169 @var{name} are given in the following table:
4170
4171 @table @gcctabopt
4172 @item max-delay-slot-insn-search
4173 The maximum number of instructions to consider when looking for an
4174 instruction to fill a delay slot.  If more than this arbitrary number of
4175 instructions is searched, the time savings from filling the delay slot
4176 will be minimal so stop searching.  Increasing values mean more
4177 aggressive optimization, making the compile time increase with probably
4178 small improvement in executable run time.
4179
4180 @item max-delay-slot-live-search
4181 When trying to fill delay slots, the maximum number of instructions to
4182 consider when searching for a block with valid live register
4183 information.  Increasing this arbitrarily chosen value means more
4184 aggressive optimization, increasing the compile time.  This parameter
4185 should be removed when the delay slot code is rewritten to maintain the
4186 control-flow graph.
4187
4188 @item max-gcse-memory
4189 The approximate maximum amount of memory that will be allocated in
4190 order to perform the global common subexpression elimination
4191 optimization.  If more memory than specified is required, the
4192 optimization will not be done.
4193
4194 @item max-gcse-passes
4195 The maximum number of passes of GCSE to run.
4196
4197 @item max-pending-list-length
4198 The maximum number of pending dependencies scheduling will allow
4199 before flushing the current state and starting over.  Large functions
4200 with few branches or calls can create excessively large lists which
4201 needlessly consume memory and resources.
4202
4203 @item max-inline-insns
4204 If an function contains more than this many instructions, it
4205 will not be inlined.  This option is precisely equivalent to
4206 @option{-finline-limit}.
4207
4208 @item max-unrolled-insns
4209 The maximum number of instructions that a loop should have if that loop
4210 is unrolled, and if the loop is unrolled, it determines how many times
4211 the loop code is unrolled.
4212
4213 @item hot-bb-count-fraction
4214 Select fraction of the maximal count of repetitions of basic block in program
4215 given basic block needs to have to be considered hot.
4216
4217 @item hot-bb-frequency-fraction
4218 Select fraction of the maximal frequency of executions of basic block in
4219 function given basic block needs to have to be considered hot
4220
4221 @item tracer-dynamic-coverage
4222 @itemx tracer-dynamic-coverage-feedback
4223
4224 This value is used to limit superblock formation once the given percentage of
4225 executed instructions is covered.  This limits unnecessary code size
4226 expansion.
4227
4228 The @option{tracer-dynamic-coverage-feedback} is used only when profile
4229 feedback is available.  The real profiles (as opposed to statically estimated
4230 ones) are much less balanced allowing the threshold to be larger value.
4231
4232 @item tracer-max-code-growth
4233 Stop tail duplication once code growth has reached given percentage.  This is
4234 rather hokey argument, as most of the duplicates will be eliminated later in
4235 cross jumping, so it may be set to much higher values than is the desired code
4236 growth.
4237
4238 @item tracer-min-branch-ratio
4239
4240 Stop reverse growth when the reverse probability of best edge is less than this
4241 threshold (in percent).
4242
4243 @item tracer-min-branch-ratio
4244 @itemx tracer-min-branch-ratio-feedback
4245
4246 Stop forward growth if the best edge do have probability lower than this
4247 threshold.
4248
4249 Similarly to @option{tracer-dynamic-coverage} two values are present, one for
4250 compilation for profile feedback and one for compilation without.  The value
4251 for compilation with profile feedback needs to be more conservative (higher) in
4252 order to make tracer effective.
4253
4254 @item ggc-min-expand
4255
4256 GCC uses a garbage collector to manage its own memory allocation.  This
4257 parameter specifies the minimum percentage by which the garbage
4258 collector's heap should be allowed to expand between collections.
4259 Tuning this may improve compilation speed; it has no effect on code
4260 generation.
4261
4262 The default is 30%.  Setting this parameter and
4263 @option{ggc-min-heapsize} to zero causes a full collection to occur at
4264 every opportunity.  This is extremely slow, but can be useful for
4265 debugging.
4266
4267 @item ggc-min-heapsize
4268
4269 Minimum size of the garbage collector's heap before it begins bothering
4270 to collect garbage.  The first collection occurs after the heap expands
4271 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
4272 tuning this may improve compilation speed, and has no effect on code
4273 generation.
4274
4275 The default is 4096 (four megabytes).  Setting this parameter very large
4276 effectively disables garbage collection.  Setting this parameter and
4277 @option{ggc-min-expand} to zero causes a full collection to occur at
4278 every opportunity.  
4279
4280 @end table
4281 @end table
4282
4283 @node Preprocessor Options
4284 @section Options Controlling the Preprocessor
4285 @cindex preprocessor options
4286 @cindex options, preprocessor
4287
4288 These options control the C preprocessor, which is run on each C source
4289 file before actual compilation.
4290
4291 If you use the @option{-E} option, nothing is done except preprocessing.
4292 Some of these options make sense only together with @option{-E} because
4293 they cause the preprocessor output to be unsuitable for actual
4294 compilation.
4295
4296 @table @gcctabopt
4297 @opindex Wp
4298 You can use @option{-Wp,@var{option}} to bypass the compiler driver
4299 and pass @var{option} directly through to the preprocessor.  If
4300 @var{option} contains commas, it is split into multiple options at the
4301 commas.  However, many options are modified, translated or interpreted
4302 by the compiler driver before being passed to the preprocessor, and
4303 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
4304 interface is undocumented and subject to change, so whenever possible
4305 you should avoid using @option{-Wp} and let the driver handle the
4306 options instead.
4307
4308 @item -Xpreprocessor @var{option}
4309 @opindex preprocessor
4310 Pass @var{option} as an option to the preprocessor.  You can use this to
4311 supply system-specific preprocessor options which GCC does not know how to
4312 recognize.
4313
4314 If you want to pass an option that takes an argument, you must use
4315 @option{-Xpreprocessor} twice, once for the option and once for the argument.
4316 @end table
4317
4318 @include cppopts.texi
4319
4320 @node Assembler Options
4321 @section Passing Options to the Assembler
4322
4323 @c prevent bad page break with this line
4324 You can pass options to the assembler.
4325
4326 @table @gcctabopt
4327 @item -Wa,@var{option}
4328 @opindex Wa
4329 Pass @var{option} as an option to the assembler.  If @var{option}
4330 contains commas, it is split into multiple options at the commas.
4331
4332 @item -Xassembler @var{option}
4333 @opindex Xassembler
4334 Pass @var{option} as an option to the assembler.  You can use this to
4335 supply system-specific assembler options which GCC does not know how to
4336 recognize.
4337
4338 If you want to pass an option that takes an argument, you must use
4339 @option{-Xassembler} twice, once for the option and once for the argument.
4340
4341 @end table
4342
4343 @node Link Options
4344 @section Options for Linking
4345 @cindex link options
4346 @cindex options, linking
4347
4348 These options come into play when the compiler links object files into
4349 an executable output file.  They are meaningless if the compiler is
4350 not doing a link step.
4351
4352 @table @gcctabopt
4353 @cindex file names
4354 @item @var{object-file-name}
4355 A file name that does not end in a special recognized suffix is
4356 considered to name an object file or library.  (Object files are
4357 distinguished from libraries by the linker according to the file
4358 contents.)  If linking is done, these object files are used as input
4359 to the linker.
4360
4361 @item -c
4362 @itemx -S
4363 @itemx -E
4364 @opindex c
4365 @opindex S
4366 @opindex E
4367 If any of these options is used, then the linker is not run, and
4368 object file names should not be used as arguments.  @xref{Overall
4369 Options}.
4370
4371 @cindex Libraries
4372 @item -l@var{library}
4373 @itemx -l @var{library}
4374 @opindex l
4375 Search the library named @var{library} when linking.  (The second
4376 alternative with the library as a separate argument is only for
4377 POSIX compliance and is not recommended.)
4378
4379 It makes a difference where in the command you write this option; the
4380 linker searches and processes libraries and object files in the order they
4381 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
4382 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
4383 to functions in @samp{z}, those functions may not be loaded.
4384
4385 The linker searches a standard list of directories for the library,
4386 which is actually a file named @file{lib@var{library}.a}.  The linker
4387 then uses this file as if it had been specified precisely by name.
4388
4389 The directories searched include several standard system directories
4390 plus any that you specify with @option{-L}.
4391
4392 Normally the files found this way are library files---archive files
4393 whose members are object files.  The linker handles an archive file by
4394 scanning through it for members which define symbols that have so far
4395 been referenced but not defined.  But if the file that is found is an
4396 ordinary object file, it is linked in the usual fashion.  The only
4397 difference between using an @option{-l} option and specifying a file name
4398 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
4399 and searches several directories.
4400
4401 @item -lobjc
4402 @opindex lobjc
4403 You need this special case of the @option{-l} option in order to
4404 link an Objective-C program.
4405
4406 @item -nostartfiles
4407 @opindex nostartfiles
4408 Do not use the standard system startup files when linking.
4409 The standard system libraries are used normally, unless @option{-nostdlib}
4410 or @option{-nodefaultlibs} is used.
4411
4412 @item -nodefaultlibs
4413 @opindex nodefaultlibs
4414 Do not use the standard system libraries when linking.
4415 Only the libraries you specify will be passed to the linker.
4416 The standard startup files are used normally, unless @option{-nostartfiles}
4417 is used.  The compiler may generate calls to memcmp, memset, and memcpy
4418 for System V (and ISO C) environments or to bcopy and bzero for
4419 BSD environments.  These entries are usually resolved by entries in
4420 libc.  These entry points should be supplied through some other
4421 mechanism when this option is specified.
4422
4423 @item -nostdlib
4424 @opindex nostdlib
4425 Do not use the standard system startup files or libraries when linking.
4426 No startup files and only the libraries you specify will be passed to
4427 the linker.  The compiler may generate calls to memcmp, memset, and memcpy
4428 for System V (and ISO C) environments or to bcopy and bzero for
4429 BSD environments.  These entries are usually resolved by entries in
4430 libc.  These entry points should be supplied through some other
4431 mechanism when this option is specified.
4432
4433 @cindex @option{-lgcc}, use with @option{-nostdlib}
4434 @cindex @option{-nostdlib} and unresolved references
4435 @cindex unresolved references and @option{-nostdlib}
4436 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
4437 @cindex @option{-nodefaultlibs} and unresolved references
4438 @cindex unresolved references and @option{-nodefaultlibs}
4439 One of the standard libraries bypassed by @option{-nostdlib} and
4440 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
4441 that GCC uses to overcome shortcomings of particular machines, or special
4442 needs for some languages.
4443 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
4444 Collection (GCC) Internals},
4445 for more discussion of @file{libgcc.a}.)
4446 In most cases, you need @file{libgcc.a} even when you want to avoid
4447 other standard libraries.  In other words, when you specify @option{-nostdlib}
4448 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
4449 This ensures that you have no unresolved references to internal GCC
4450 library subroutines.  (For example, @samp{__main}, used to ensure C++
4451 constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
4452 GNU Compiler Collection (GCC) Internals}.)
4453
4454 @item -s
4455 @opindex s
4456 Remove all symbol table and relocation information from the executable.
4457
4458 @item -static
4459 @opindex static
4460 On systems that support dynamic linking, this prevents linking with the shared
4461 libraries.  On other systems, this option has no effect.
4462
4463 @item -shared
4464 @opindex shared
4465 Produce a shared object which can then be linked with other objects to
4466 form an executable.  Not all systems support this option.  For predictable
4467 results, you must also specify the same set of options that were used to
4468 generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
4469 when you specify this option.@footnote{On some systems, @samp{gcc -shared}
4470 needs to build supplementary stub code for constructors to work.  On
4471 multi-libbed systems, @samp{gcc -shared} must select the correct support
4472 libraries to link against.  Failing to supply the correct flags may lead
4473 to subtle defects.  Supplying them in cases where they are not necessary
4474 is innocuous.}
4475
4476 @item -shared-libgcc
4477 @itemx -static-libgcc
4478 @opindex shared-libgcc
4479 @opindex static-libgcc
4480 On systems that provide @file{libgcc} as a shared library, these options
4481 force the use of either the shared or static version respectively.
4482 If no shared version of @file{libgcc} was built when the compiler was
4483 configured, these options have no effect.
4484
4485 There are several situations in which an application should use the
4486 shared @file{libgcc} instead of the static version.  The most common
4487 of these is when the application wishes to throw and catch exceptions
4488 across different shared libraries.  In that case, each of the libraries
4489 as well as the application itself should use the shared @file{libgcc}.
4490
4491 Therefore, the G++ and GCJ drivers automatically add
4492 @option{-shared-libgcc} whenever you build a shared library or a main
4493 executable, because C++ and Java programs typically use exceptions, so
4494 this is the right thing to do.
4495
4496 If, instead, you use the GCC driver to create shared libraries, you may
4497 find that they will not always be linked with the shared @file{libgcc}.
4498 If GCC finds, at its configuration time, that you have a GNU linker that
4499 does not support option @option{--eh-frame-hdr}, it will link the shared
4500 version of @file{libgcc} into shared libraries by default.  Otherwise,
4501 it will take advantage of the linker and optimize away the linking with
4502 the shared version of @file{libgcc}, linking with the static version of
4503 libgcc by default.  This allows exceptions to propagate through such
4504 shared libraries, without incurring relocation costs at library load
4505 time.
4506
4507 However, if a library or main executable is supposed to throw or catch
4508 exceptions, you must link it using the G++ or GCJ driver, as appropriate
4509 for the languages used in the program, or using the option
4510 @option{-shared-libgcc}, such that it is linked with the shared
4511 @file{libgcc}.
4512
4513 @item -symbolic
4514 @opindex symbolic
4515 Bind references to global symbols when building a shared object.  Warn
4516 about any unresolved references (unless overridden by the link editor
4517 option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
4518 this option.
4519
4520 @item -Xlinker @var{option}
4521 @opindex Xlinker
4522 Pass @var{option} as an option to the linker.  You can use this to
4523 supply system-specific linker options which GCC does not know how to
4524 recognize.
4525
4526 If you want to pass an option that takes an argument, you must use
4527 @option{-Xlinker} twice, once for the option and once for the argument.
4528 For example, to pass @option{-assert definitions}, you must write
4529 @samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
4530 @option{-Xlinker "-assert definitions"}, because this passes the entire
4531 string as a single argument, which is not what the linker expects.
4532
4533 @item -Wl,@var{option}
4534 @opindex Wl
4535 Pass @var{option} as an option to the linker.  If @var{option} contains
4536 commas, it is split into multiple options at the commas.
4537
4538 @item -u @var{symbol}
4539 @opindex u
4540 Pretend the symbol @var{symbol} is undefined, to force linking of
4541 library modules to define it.  You can use @option{-u} multiple times with
4542 different symbols to force loading of additional library modules.
4543 @end table
4544
4545 @node Directory Options
4546 @section Options for Directory Search
4547 @cindex directory options
4548 @cindex options, directory search
4549 @cindex search path
4550
4551 These options specify directories to search for header files, for
4552 libraries and for parts of the compiler:
4553
4554 @table @gcctabopt
4555 @item -I@var{dir}
4556 @opindex I
4557 Add the directory @var{dir} to the head of the list of directories to be
4558 searched for header files.  This can be used to override a system header
4559 file, substituting your own version, since these directories are
4560 searched before the system header file directories.  However, you should
4561 not use this option to add directories that contain vendor-supplied
4562 system header files (use @option{-isystem} for that).  If you use more than
4563 one @option{-I} option, the directories are scanned in left-to-right
4564 order; the standard system directories come after.
4565
4566 If a standard system include directory, or a directory specified with
4567 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
4568 option will be ignored.  The directory will still be searched but as a
4569 system directory at its normal position in the system include chain.
4570 This is to ensure that GCC's procedure to fix buggy system headers and
4571 the ordering for the include_next directive are not inadvertently changed.
4572 If you really need to change the search order for system directories,
4573 use the @option{-nostdinc} and/or @option{-isystem} options.
4574
4575 @item -I-
4576 @opindex I-
4577 Any directories you specify with @option{-I} options before the @option{-I-}
4578 option are searched only for the case of @samp{#include "@var{file}"};
4579 they are not searched for @samp{#include <@var{file}>}.
4580
4581 If additional directories are specified with @option{-I} options after
4582 the @option{-I-}, these directories are searched for all @samp{#include}
4583 directives.  (Ordinarily @emph{all} @option{-I} directories are used
4584 this way.)
4585
4586 In addition, the @option{-I-} option inhibits the use of the current
4587 directory (where the current input file came from) as the first search
4588 directory for @samp{#include "@var{file}"}.  There is no way to
4589 override this effect of @option{-I-}.  With @option{-I.} you can specify
4590 searching the directory which was current when the compiler was
4591 invoked.  That is not exactly the same as what the preprocessor does
4592 by default, but it is often satisfactory.
4593
4594 @option{-I-} does not inhibit the use of the standard system directories
4595 for header files.  Thus, @option{-I-} and @option{-nostdinc} are
4596 independent.
4597
4598 @item -L@var{dir}
4599 @opindex L
4600 Add directory @var{dir} to the list of directories to be searched
4601 for @option{-l}.
4602
4603 @item -B@var{prefix}
4604 @opindex B
4605 This option specifies where to find the executables, libraries,
4606 include files, and data files of the compiler itself.
4607
4608 The compiler driver program runs one or more of the subprograms
4609 @file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
4610 @var{prefix} as a prefix for each program it tries to run, both with and
4611 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
4612
4613 For each subprogram to be run, the compiler driver first tries the
4614 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
4615 was not specified, the driver tries two standard prefixes, which are
4616 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc-lib/}.  If neither of
4617 those results in a file name that is found, the unmodified program
4618 name is searched for using the directories specified in your
4619 @env{PATH} environment variable.
4620
4621 The compiler will check to see if the path provided by the @option{-B}
4622 refers to a directory, and if necessary it will add a directory
4623 separator character at the end of the path.
4624
4625 @option{-B} prefixes that effectively specify directory names also apply
4626 to libraries in the linker, because the compiler translates these
4627 options into @option{-L} options for the linker.  They also apply to
4628 includes files in the preprocessor, because the compiler translates these
4629 options into @option{-isystem} options for the preprocessor.  In this case,
4630 the compiler appends @samp{include} to the prefix.
4631
4632 The run-time support file @file{libgcc.a} can also be searched for using
4633 the @option{-B} prefix, if needed.  If it is not found there, the two
4634 standard prefixes above are tried, and that is all.  The file is left
4635 out of the link if it is not found by those means.
4636
4637 Another way to specify a prefix much like the @option{-B} prefix is to use
4638 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
4639 Variables}.
4640
4641 As a special kludge, if the path provided by @option{-B} is
4642 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
4643 9, then it will be replaced by @file{[dir/]include}.  This is to help
4644 with boot-strapping the compiler.
4645
4646 @item -specs=@var{file}
4647 @opindex specs
4648 Process @var{file} after the compiler reads in the standard @file{specs}
4649 file, in order to override the defaults that the @file{gcc} driver
4650 program uses when determining what switches to pass to @file{cc1},
4651 @file{cc1plus}, @file{as}, @file{ld}, etc.  More than one
4652 @option{-specs=@var{file}} can be specified on the command line, and they
4653 are processed in order, from left to right.
4654 @end table
4655
4656 @c man end
4657
4658 @node Spec Files
4659 @section Specifying subprocesses and the switches to pass to them
4660 @cindex Spec Files
4661 @command{gcc} is a driver program.  It performs its job by invoking a
4662 sequence of other programs to do the work of compiling, assembling and
4663 linking.  GCC interprets its command-line parameters and uses these to
4664 deduce which programs it should invoke, and which command-line options
4665 it ought to place on their command lines.  This behavior is controlled
4666 by @dfn{spec strings}.  In most cases there is one spec string for each
4667 program that GCC can invoke, but a few programs have multiple spec
4668 strings to control their behavior.  The spec strings built into GCC can
4669 be overridden by using the @option{-specs=} command-line switch to specify
4670 a spec file.
4671
4672 @dfn{Spec files} are plaintext files that are used to construct spec
4673 strings.  They consist of a sequence of directives separated by blank
4674 lines.  The type of directive is determined by the first non-whitespace
4675 character on the line and it can be one of the following:
4676
4677 @table @code
4678 @item %@var{command}
4679 Issues a @var{command} to the spec file processor.  The commands that can
4680 appear here are:
4681
4682 @table @code
4683 @item %include <@var{file}>
4684 @cindex %include
4685 Search for @var{file} and insert its text at the current point in the
4686 specs file.
4687
4688 @item %include_noerr <@var{file}>
4689 @cindex %include_noerr
4690 Just like @samp{%include}, but do not generate an error message if the include
4691 file cannot be found.
4692
4693 @item %rename @var{old_name} @var{new_name}
4694 @cindex %rename
4695 Rename the spec string @var{old_name} to @var{new_name}.
4696
4697 @end table
4698
4699 @item *[@var{spec_name}]:
4700 This tells the compiler to create, override or delete the named spec
4701 string.  All lines after this directive up to the next directive or
4702 blank line are considered to be the text for the spec string.  If this
4703 results in an empty string then the spec will be deleted.  (Or, if the
4704 spec did not exist, then nothing will happened.)  Otherwise, if the spec
4705 does not currently exist a new spec will be created.  If the spec does
4706 exist then its contents will be overridden by the text of this
4707 directive, unless the first character of that text is the @samp{+}
4708 character, in which case the text will be appended to the spec.
4709
4710 @item [@var{suffix}]:
4711 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
4712 and up to the next directive or blank line are considered to make up the
4713 spec string for the indicated suffix.  When the compiler encounters an
4714 input file with the named suffix, it will processes the spec string in
4715 order to work out how to compile that file.  For example:
4716
4717 @smallexample
4718 .ZZ:
4719 z-compile -input %i
4720 @end smallexample
4721
4722 This says that any input file whose name ends in @samp{.ZZ} should be
4723 passed to the program @samp{z-compile}, which should be invoked with the
4724 command-line switch @option{-input} and with the result of performing the
4725 @samp{%i} substitution.  (See below.)
4726
4727 As an alternative to providing a spec string, the text that follows a
4728 suffix directive can be one of the following:
4729
4730 @table @code
4731 @item @@@var{language}
4732 This says that the suffix is an alias for a known @var{language}.  This is
4733 similar to using the @option{-x} command-line switch to GCC to specify a
4734 language explicitly.  For example:
4735
4736 @smallexample
4737 .ZZ:
4738 @@c++
4739 @end smallexample
4740
4741 Says that .ZZ files are, in fact, C++ source files.
4742
4743 @item #@var{name}
4744 This causes an error messages saying:
4745
4746 @smallexample
4747 @var{name} compiler not installed on this system.
4748 @end smallexample
4749 @end table
4750
4751 GCC already has an extensive list of suffixes built into it.
4752 This directive will add an entry to the end of the list of suffixes, but
4753 since the list is searched from the end backwards, it is effectively
4754 possible to override earlier entries using this technique.
4755
4756 @end table
4757
4758 GCC has the following spec strings built into it.  Spec files can
4759 override these strings or create their own.  Note that individual
4760 targets can also add their own spec strings to this list.
4761
4762 @smallexample
4763 asm          Options to pass to the assembler
4764 asm_final    Options to pass to the assembler post-processor
4765 cpp          Options to pass to the C preprocessor
4766 cc1          Options to pass to the C compiler
4767 cc1plus      Options to pass to the C++ compiler
4768 endfile      Object files to include at the end of the link
4769 link         Options to pass to the linker
4770 lib          Libraries to include on the command line to the linker
4771 libgcc       Decides which GCC support library to pass to the linker
4772 linker       Sets the name of the linker
4773 predefines   Defines to be passed to the C preprocessor
4774 signed_char  Defines to pass to CPP to say whether @code{char} is signed
4775              by default
4776 startfile    Object files to include at the start of the link
4777 @end smallexample
4778
4779 Here is a small example of a spec file:
4780
4781 @smallexample
4782 %rename lib                 old_lib
4783
4784 *lib:
4785 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
4786 @end smallexample
4787
4788 This example renames the spec called @samp{lib} to @samp{old_lib} and
4789 then overrides the previous definition of @samp{lib} with a new one.
4790 The new definition adds in some extra command-line options before
4791 including the text of the old definition.
4792
4793 @dfn{Spec strings} are a list of command-line options to be passed to their
4794 corresponding program.  In addition, the spec strings can contain
4795 @samp{%}-prefixed sequences to substitute variable text or to
4796 conditionally insert text into the command line.  Using these constructs
4797 it is possible to generate quite complex command lines.
4798
4799 Here is a table of all defined @samp{%}-sequences for spec
4800 strings.  Note that spaces are not generated automatically around the
4801 results of expanding these sequences.  Therefore you can concatenate them
4802 together or combine them with constant text in a single argument.
4803
4804 @table @code
4805 @item %%
4806 Substitute one @samp{%} into the program name or argument.
4807
4808 @item %i
4809 Substitute the name of the input file being processed.
4810
4811 @item %b
4812 Substitute the basename of the input file being processed.
4813 This is the substring up to (and not including) the last period
4814 and not including the directory.
4815
4816 @item %B
4817 This is the same as @samp{%b}, but include the file suffix (text after
4818 the last period).
4819
4820 @item %d
4821 Marks the argument containing or following the @samp{%d} as a
4822 temporary file name, so that that file will be deleted if GCC exits
4823 successfully.  Unlike @samp{%g}, this contributes no text to the
4824 argument.
4825
4826 @item %g@var{suffix}
4827 Substitute a file name that has suffix @var{suffix} and is chosen
4828 once per compilation, and mark the argument in the same way as
4829 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
4830 name is now chosen in a way that is hard to predict even when previously
4831 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
4832 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
4833 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
4834 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
4835 was simply substituted with a file name chosen once per compilation,
4836 without regard to any appended suffix (which was therefore treated
4837 just like ordinary text), making such attacks more likely to succeed.
4838
4839 @item %u@var{suffix}
4840 Like @samp{%g}, but generates a new temporary file name even if
4841 @samp{%u@var{suffix}} was already seen.
4842
4843 @item %U@var{suffix}
4844 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
4845 new one if there is no such last file name.  In the absence of any
4846 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
4847 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
4848 would involve the generation of two distinct file names, one
4849 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
4850 simply substituted with a file name chosen for the previous @samp{%u},
4851 without regard to any appended suffix.
4852
4853 @item %j@var{suffix}
4854 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
4855 writable, and if save-temps is off; otherwise, substitute the name
4856 of a temporary file, just like @samp{%u}.  This temporary file is not
4857 meant for communication between processes, but rather as a junk
4858 disposal mechanism.
4859
4860 @item %|@var{suffix}
4861 @itemx %m@var{suffix}
4862 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
4863 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
4864 all.  These are the two most common ways to instruct a program that it
4865 should read from standard input or write to standard output.  If you
4866 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
4867 construct: see for example @file{f/lang-specs.h}.
4868
4869 @item %.@var{SUFFIX}
4870 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
4871 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
4872 terminated by the next space or %.
4873
4874 @item %w
4875 Marks the argument containing or following the @samp{%w} as the
4876 designated output file of this compilation.  This puts the argument
4877 into the sequence of arguments that @samp{%o} will substitute later.
4878
4879 @item %o
4880 Substitutes the names of all the output files, with spaces
4881 automatically placed around them.  You should write spaces
4882 around the @samp{%o} as well or the results are undefined.
4883 @samp{%o} is for use in the specs for running the linker.
4884 Input files whose names have no recognized suffix are not compiled
4885 at all, but they are included among the output files, so they will
4886 be linked.
4887
4888 @item %O
4889 Substitutes the suffix for object files.  Note that this is
4890 handled specially when it immediately follows @samp{%g, %u, or %U},
4891 because of the need for those to form complete file names.  The
4892 handling is such that @samp{%O} is treated exactly as if it had already
4893 been substituted, except that @samp{%g, %u, and %U} do not currently
4894 support additional @var{suffix} characters following @samp{%O} as they would
4895 following, for example, @samp{.o}.
4896
4897 @item %p
4898 Substitutes the standard macro predefinitions for the
4899 current target machine.  Use this when running @code{cpp}.
4900
4901 @item %P
4902 Like @samp{%p}, but puts @samp{__} before and after the name of each
4903 predefined macro, except for macros that start with @samp{__} or with
4904 @samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
4905 C@.
4906
4907 @item %I
4908 Substitute a @option{-iprefix} option made from @env{GCC_EXEC_PREFIX}.
4909
4910 @item %s
4911 Current argument is the name of a library or startup file of some sort.
4912 Search for that file in a standard list of directories and substitute
4913 the full name found.
4914
4915 @item %e@var{str}
4916 Print @var{str} as an error message.  @var{str} is terminated by a newline.
4917 Use this when inconsistent options are detected.
4918
4919 @item %(@var{name})
4920 Substitute the contents of spec string @var{name} at this point.
4921
4922 @item %[@var{name}]
4923 Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
4924
4925 @item %x@{@var{option}@}
4926 Accumulate an option for @samp{%X}.
4927
4928 @item %X
4929 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
4930 spec string.
4931
4932 @item %Y
4933 Output the accumulated assembler options specified by @option{-Wa}.
4934
4935 @item %Z
4936 Output the accumulated preprocessor options specified by @option{-Wp}.
4937
4938 @item %v1
4939 Substitute the major version number of GCC@.
4940 (For version 2.9.5, this is 2.)
4941
4942 @item %v2
4943 Substitute the minor version number of GCC@.
4944 (For version 2.9.5, this is 9.)
4945
4946 @item %v3
4947 Substitute the patch level number of GCC@.
4948 (For version 2.9.5, this is 5.)
4949
4950 @item %a
4951 Process the @code{asm} spec.  This is used to compute the
4952 switches to be passed to the assembler.
4953
4954 @item %A
4955 Process the @code{asm_final} spec.  This is a spec string for
4956 passing switches to an assembler post-processor, if such a program is
4957 needed.
4958
4959 @item %l
4960 Process the @code{link} spec.  This is the spec for computing the
4961 command line passed to the linker.  Typically it will make use of the
4962 @samp{%L %G %S %D and %E} sequences.
4963
4964 @item %D
4965 Dump out a @option{-L} option for each directory that GCC believes might
4966 contain startup files.  If the target supports multilibs then the
4967 current multilib directory will be prepended to each of these paths.
4968
4969 @item %M
4970 Output the multilib directory with directory separators replaced with
4971 @samp{_}.  If multilib directories are not set, or the multilib directory is
4972 @file{.} then this option emits nothing.
4973
4974 @item %L
4975 Process the @code{lib} spec.  This is a spec string for deciding which
4976 libraries should be included on the command line to the linker.
4977
4978 @item %G
4979 Process the @code{libgcc} spec.  This is a spec string for deciding
4980 which GCC support library should be included on the command line to the linker.
4981
4982 @item %S
4983 Process the @code{startfile} spec.  This is a spec for deciding which
4984 object files should be the first ones passed to the linker.  Typically
4985 this might be a file named @file{crt0.o}.
4986
4987 @item %E
4988 Process the @code{endfile} spec.  This is a spec string that specifies
4989 the last object files that will be passed to the linker.
4990
4991 @item %C
4992 Process the @code{cpp} spec.  This is used to construct the arguments
4993 to be passed to the C preprocessor.
4994
4995 @item %c
4996 Process the @code{signed_char} spec.  This is intended to be used
4997 to tell cpp whether a char is signed.  It typically has the definition:
4998 @smallexample
4999 %@{funsigned-char:-D__CHAR_UNSIGNED__@}
5000 @end smallexample
5001
5002 @item %1
5003 Process the @code{cc1} spec.  This is used to construct the options to be
5004 passed to the actual C compiler (@samp{cc1}).
5005
5006 @item %2
5007 Process the @code{cc1plus} spec.  This is used to construct the options to be
5008 passed to the actual C++ compiler (@samp{cc1plus}).
5009
5010 @item %*
5011 Substitute the variable part of a matched option.  See below.
5012 Note that each comma in the substituted string is replaced by
5013 a single space.
5014
5015 @item %<@code{S}
5016 Remove all occurrences of @code{-S} from the command line.  Note---this
5017 command is position dependent.  @samp{%} commands in the spec string
5018 before this one will see @code{-S}, @samp{%} commands in the spec string
5019 after this one will not.
5020
5021 @item %:@var{function}(@var{args})
5022 Call the named function @var{function}, passing it @var{args}.
5023 @var{args} is first processed as a nested spec string, then split
5024 into an argument vector in the usual fashion.  The function returns
5025 a string which is processed as if it had appeared literally as part
5026 of the current spec.
5027
5028 The following built-in spec functions are provided:
5029
5030 @table @code
5031 @item @code{if-exists}
5032 The @code{if-exists} spec function takes one argument, an absolute
5033 pathname to a file.  If the file exists, @code{if-exists} returns the
5034 pathname.  Here is a small example of its usage:
5035
5036 @smallexample
5037 *startfile:
5038 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
5039 @end smallexample
5040
5041 @item @code{if-exists-else}
5042 The @code{if-exists-else} spec function is similar to the @code{if-exists}
5043 spec function, except that it takes two arguments.  The first argument is
5044 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
5045 returns the pathname.  If it does not exist, it returns the second argument.
5046 This way, @code{if-exists-else} can be used to select one file or another,
5047 based on the existence of the first.  Here is a small example of its usage:
5048
5049 @smallexample 
5050 *startfile:
5051 crt0%O%s %:if-exists(crti%O%s) %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
5052 @end smallexample
5053 @end table 
5054
5055 @item %@{@code{S}@}
5056 Substitutes the @code{-S} switch, if that switch was given to GCC@.
5057 If that switch was not specified, this substitutes nothing.  Note that
5058 the leading dash is omitted when specifying this option, and it is
5059 automatically inserted if the substitution is performed.  Thus the spec
5060 string @samp{%@{foo@}} would match the command-line option @option{-foo}
5061 and would output the command line option @option{-foo}.
5062
5063 @item %W@{@code{S}@}
5064 Like %@{@code{S}@} but mark last argument supplied within as a file to be
5065 deleted on failure.
5066
5067 @item %@{@code{S}*@}
5068 Substitutes all the switches specified to GCC whose names start
5069 with @code{-S}, but which also take an argument.  This is used for
5070 switches like @option{-o}, @option{-D}, @option{-I}, etc.
5071 GCC considers @option{-o foo} as being
5072 one switch whose names starts with @samp{o}.  %@{o*@} would substitute this
5073 text, including the space.  Thus two arguments would be generated.
5074
5075 @item %@{@code{S}*&@code{T}*@}
5076 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
5077 (the order of @code{S} and @code{T} in the spec is not significant).
5078 There can be any number of ampersand-separated variables; for each the
5079 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
5080
5081 @item %@{@code{S}:@code{X}@}
5082 Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
5083
5084 @item %@{!@code{S}:@code{X}@}
5085 Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
5086
5087 @item %@{@code{S}*:@code{X}@}
5088 Substitutes @code{X} if one or more switches whose names start with
5089 @code{-S} are specified to GCC@.  Normally @code{X} is substituted only
5090 once, no matter how many such switches appeared.  However, if @code{%*}
5091 appears somewhere in @code{X}, then @code{X} will be substituted once
5092 for each matching switch, with the @code{%*} replaced by the part of
5093 that switch that matched the @code{*}.
5094
5095 @item %@{.@code{S}:@code{X}@}
5096 Substitutes @code{X}, if processing a file with suffix @code{S}.
5097
5098 @item %@{!.@code{S}:@code{X}@}
5099 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
5100
5101 @item %@{@code{S}|@code{P}:@code{X}@}
5102 Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@.
5103 This may be combined with @samp{!}, @samp{.}, and @code{*} sequences as well,
5104 although they have a stronger binding than the @samp{|}.  If @code{%*}
5105 appears in @code{X}, all of the alternatives must be starred, and only
5106 the first matching alternative is substituted.
5107
5108 For example, a spec string like this:
5109
5110 @smallexample
5111 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
5112 @end smallexample
5113
5114 will output the following command-line options from the following input
5115 command-line options:
5116
5117 @smallexample
5118 fred.c        -foo -baz
5119 jim.d         -bar -boggle
5120 -d fred.c     -foo -baz -boggle
5121 -d jim.d      -bar -baz -boggle
5122 @end smallexample
5123
5124 @item %@{S:X; T:Y; :D@}
5125
5126 If @code{S} was given to GCC, substitues @code{X}; else if @code{T} was
5127 given to GCC, substitues @code{Y}; else substitutes @code{D}.  There can
5128 be as many clauses as you need.  This may be combined with @code{.}, 
5129 @code{!}, @code{|}, and @code{*} as needed.
5130
5131
5132 @end table
5133
5134 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
5135 construct may contain other nested @samp{%} constructs or spaces, or
5136 even newlines.  They are processed as usual, as described above.
5137 Trailing white space in @code{X} is ignored.  White space may also
5138 appear anywhere on the left side of the colon in these constructs,
5139 except between @code{.} or @code{*} and the corresponding word.
5140
5141 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
5142 handled specifically in these constructs.  If another value of
5143 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
5144 @option{-W} switch is found later in the command line, the earlier
5145 switch value is ignored, except with @{@code{S}*@} where @code{S} is
5146 just one letter, which passes all matching options.
5147
5148 The character @samp{|} at the beginning of the predicate text is used to
5149 indicate that a command should be piped to the following command, but
5150 only if @option{-pipe} is specified.
5151
5152 It is built into GCC which switches take arguments and which do not.
5153 (You might think it would be useful to generalize this to allow each
5154 compiler's spec to say which switches take arguments.  But this cannot
5155 be done in a consistent fashion.  GCC cannot even decide which input
5156 files have been specified without knowing which switches take arguments,
5157 and it must know which input files to compile in order to tell which
5158 compilers to run).
5159
5160 GCC also knows implicitly that arguments starting in @option{-l} are to be
5161 treated as compiler output files, and passed to the linker in their
5162 proper position among the other output files.
5163
5164 @c man begin OPTIONS
5165
5166 @node Target Options
5167 @section Specifying Target Machine and Compiler Version
5168 @cindex target options
5169 @cindex cross compiling
5170 @cindex specifying machine version
5171 @cindex specifying compiler version and target machine
5172 @cindex compiler version, specifying
5173 @cindex target machine, specifying
5174
5175 The usual way to run GCC is to run the executable called @file{gcc}, or
5176 @file{<machine>-gcc} when cross-compiling, or
5177 @file{<machine>-gcc-<version>} to run a version other than the one that
5178 was installed last.  Sometimes this is inconvenient, so GCC provides
5179 options that will switch to another cross-compiler or version.
5180
5181 @table @gcctabopt
5182 @item -b @var{machine}
5183 @opindex b
5184 The argument @var{machine} specifies the target machine for compilation.
5185
5186 The value to use for @var{machine} is the same as was specified as the
5187 machine type when configuring GCC as a cross-compiler.  For
5188 example, if a cross-compiler was configured with @samp{configure
5189 i386v}, meaning to compile for an 80386 running System V, then you
5190 would specify @option{-b i386v} to run that cross compiler.
5191
5192 @item -V @var{version}
5193 @opindex V
5194 The argument @var{version} specifies which version of GCC to run.
5195 This is useful when multiple versions are installed.  For example,
5196 @var{version} might be @samp{2.0}, meaning to run GCC version 2.0.
5197 @end table
5198
5199 The @option{-V} and @option{-b} options work by running the
5200 @file{<machine>-gcc-<version>} executable, so there's no real reason to
5201 use them if you can just run that directly.
5202
5203 @node Submodel Options
5204 @section Hardware Models and Configurations
5205 @cindex submodel options
5206 @cindex specifying hardware config
5207 @cindex hardware models and configurations, specifying
5208 @cindex machine dependent options
5209
5210 Earlier we discussed the standard option @option{-b} which chooses among
5211 different installed compilers for completely different target
5212 machines, such as VAX vs.@: 68000 vs.@: 80386.
5213
5214 In addition, each of these target machine types can have its own
5215 special options, starting with @samp{-m}, to choose among various
5216 hardware models or configurations---for example, 68010 vs 68020,
5217 floating coprocessor or none.  A single installed version of the
5218 compiler can compile for any model or configuration, according to the
5219 options specified.
5220
5221 Some configurations of the compiler also support additional special
5222 options, usually for compatibility with other compilers on the same
5223 platform.
5224
5225 These options are defined by the macro @code{TARGET_SWITCHES} in the
5226 machine description.  The default for the options is also defined by
5227 that macro, which enables you to change the defaults.
5228
5229 @menu
5230 * M680x0 Options::
5231 * M68hc1x Options::
5232 * VAX Options::
5233 * SPARC Options::
5234 * ARM Options::
5235 * MN10200 Options::
5236 * MN10300 Options::
5237 * M32R/D Options::
5238 * M88K Options::
5239 * RS/6000 and PowerPC Options::
5240 * Darwin Options::
5241 * RT Options::
5242 * MIPS Options::
5243 * i386 and x86-64 Options::
5244 * HPPA Options::
5245 * Intel 960 Options::
5246 * DEC Alpha Options::
5247 * DEC Alpha/VMS Options::
5248 * H8/300 Options::
5249 * SH Options::
5250 * System V Options::
5251 * TMS320C3x/C4x Options::
5252 * V850 Options::
5253 * ARC Options::
5254 * NS32K Options::
5255 * AVR Options::
5256 * MCore Options::
5257 * IA-64 Options::
5258 * D30V Options::
5259 * S/390 and zSeries Options::
5260 * CRIS Options::
5261 * MMIX Options::
5262 * PDP-11 Options::
5263 * Xstormy16 Options::
5264 * Xtensa Options::
5265 * FRV Options::
5266 @end menu
5267
5268 @node M680x0 Options
5269 @subsection M680x0 Options
5270 @cindex M680x0 options
5271
5272 These are the @samp{-m} options defined for the 68000 series.  The default
5273 values for these options depends on which style of 68000 was selected when
5274 the compiler was configured; the defaults for the most common choices are
5275 given below.
5276
5277 @table @gcctabopt
5278 @item -m68000
5279 @itemx -mc68000
5280 @opindex m68000
5281 @opindex mc68000
5282 Generate output for a 68000.  This is the default
5283 when the compiler is configured for 68000-based systems.
5284
5285 Use this option for microcontrollers with a 68000 or EC000 core,
5286 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
5287
5288 @item -m68020
5289 @itemx -mc68020
5290 @opindex m68020
5291 @opindex mc68020
5292 Generate output for a 68020.  This is the default
5293 when the compiler is configured for 68020-based systems.
5294
5295 @item -m68881
5296 @opindex m68881
5297 Generate output containing 68881 instructions for floating point.
5298 This is the default for most 68020 systems unless @option{--nfp} was
5299 specified when the compiler was configured.
5300
5301 @item -m68030
5302 @opindex m68030
5303 Generate output for a 68030.  This is the default when the compiler is
5304 configured for 68030-based systems.
5305
5306 @item -m68040
5307 @opindex m68040
5308 Generate output for a 68040.  This is the default when the compiler is
5309 configured for 68040-based systems.
5310
5311 This option inhibits the use of 68881/68882 instructions that have to be
5312 emulated by software on the 68040.  Use this option if your 68040 does not
5313 have code to emulate those instructions.
5314
5315 @item -m68060
5316 @opindex m68060
5317 Generate output for a 68060.  This is the default when the compiler is
5318 configured for 68060-based systems.
5319
5320 This option inhibits the use of 68020 and 68881/68882 instructions that
5321 have to be emulated by software on the 68060.  Use this option if your 68060
5322 does not have code to emulate those instructions.
5323
5324 @item -mcpu32
5325 @opindex mcpu32
5326 Generate output for a CPU32.  This is the default
5327 when the compiler is configured for CPU32-based systems.
5328
5329 Use this option for microcontrollers with a
5330 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
5331 68336, 68340, 68341, 68349 and 68360.
5332
5333 @item -m5200
5334 @opindex m5200
5335 Generate output for a 520X ``coldfire'' family cpu.  This is the default
5336 when the compiler is configured for 520X-based systems.
5337
5338 Use this option for microcontroller with a 5200 core, including
5339 the MCF5202, MCF5203, MCF5204 and MCF5202.
5340
5341
5342 @item -m68020-40
5343 @opindex m68020-40
5344 Generate output for a 68040, without using any of the new instructions.
5345 This results in code which can run relatively efficiently on either a
5346 68020/68881 or a 68030 or a 68040.  The generated code does use the
5347 68881 instructions that are emulated on the 68040.
5348
5349 @item -m68020-60
5350 @opindex m68020-60
5351 Generate output for a 68060, without using any of the new instructions.
5352 This results in code which can run relatively efficiently on either a
5353 68020/68881 or a 68030 or a 68040.  The generated code does use the
5354 68881 instructions that are emulated on the 68060.
5355
5356 @item -mfpa
5357 @opindex mfpa
5358 Generate output containing Sun FPA instructions for floating point.
5359
5360 @item -msoft-float
5361 @opindex msoft-float
5362 Generate output containing library calls for floating point.
5363 @strong{Warning:} the requisite libraries are not available for all m68k
5364 targets.  Normally the facilities of the machine's usual C compiler are
5365 used, but this can't be done directly in cross-compilation.  You must
5366 make your own arrangements to provide suitable library functions for
5367 cross-compilation.  The embedded targets @samp{m68k-*-aout} and
5368 @samp{m68k-*-coff} do provide software floating point support.
5369
5370 @item -mshort
5371 @opindex mshort
5372 Consider type @code{int} to be 16 bits wide, like @code{short int}.
5373
5374 @item -mnobitfield
5375 @opindex mnobitfield
5376 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
5377 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
5378
5379 @item -mbitfield
5380 @opindex mbitfield
5381 Do use the bit-field instructions.  The @option{-m68020} option implies
5382 @option{-mbitfield}.  This is the default if you use a configuration
5383 designed for a 68020.
5384
5385 @item -mrtd
5386 @opindex mrtd
5387 Use a different function-calling convention, in which functions
5388 that take a fixed number of arguments return with the @code{rtd}
5389 instruction, which pops their arguments while returning.  This
5390 saves one instruction in the caller since there is no need to pop
5391 the arguments there.
5392
5393 This calling convention is incompatible with the one normally
5394 used on Unix, so you cannot use it if you need to call libraries
5395 compiled with the Unix compiler.
5396
5397 Also, you must provide function prototypes for all functions that
5398 take variable numbers of arguments (including @code{printf});
5399 otherwise incorrect code will be generated for calls to those
5400 functions.
5401
5402 In addition, seriously incorrect code will result if you call a
5403 function with too many arguments.  (Normally, extra arguments are
5404 harmlessly ignored.)
5405
5406 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
5407 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
5408
5409 @item -malign-int
5410 @itemx -mno-align-int
5411 @opindex malign-int
5412 @opindex mno-align-int
5413 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
5414 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
5415 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
5416 Aligning variables on 32-bit boundaries produces code that runs somewhat
5417 faster on processors with 32-bit busses at the expense of more memory.
5418
5419 @strong{Warning:} if you use the @option{-malign-int} switch, GCC will
5420 align structures containing the above types  differently than
5421 most published application binary interface specifications for the m68k.
5422
5423 @item -mpcrel
5424 @opindex mpcrel
5425 Use the pc-relative addressing mode of the 68000 directly, instead of
5426 using a global offset table.  At present, this option implies @option{-fpic},
5427 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
5428 not presently supported with @option{-mpcrel}, though this could be supported for
5429 68020 and higher processors.
5430
5431 @item -mno-strict-align
5432 @itemx -mstrict-align
5433 @opindex mno-strict-align
5434 @opindex mstrict-align
5435 Do not (do) assume that unaligned memory references will be handled by
5436 the system.
5437
5438 @end table
5439
5440 @node M68hc1x Options
5441 @subsection M68hc1x Options
5442 @cindex M68hc1x options
5443
5444 These are the @samp{-m} options defined for the 68hc11 and 68hc12
5445 microcontrollers.  The default values for these options depends on
5446 which style of microcontroller was selected when the compiler was configured;
5447 the defaults for the most common choices are given below.
5448
5449 @table @gcctabopt
5450 @item -m6811
5451 @itemx -m68hc11
5452 @opindex m6811
5453 @opindex m68hc11
5454 Generate output for a 68HC11.  This is the default
5455 when the compiler is configured for 68HC11-based systems.
5456
5457 @item -m6812
5458 @itemx -m68hc12
5459 @opindex m6812
5460 @opindex m68hc12
5461 Generate output for a 68HC12.  This is the default
5462 when the compiler is configured for 68HC12-based systems.
5463
5464 @item -mauto-incdec
5465 @opindex mauto-incdec
5466 Enable the use of 68HC12 pre and post auto-increment and auto-decrement
5467 addressing modes.
5468
5469 @item -minmax
5470 @itemx -nominmax
5471 @opindex minmax
5472 @opindex mnominmax
5473 Enable the use of 68HC12 min and max instructions.
5474
5475 @item -mlong-calls
5476 @itemx -mno-long-calls
5477 @opindex mlong-calls
5478 @opindex mno-long-calls
5479 Treat all calls as being far away (near).  If calls are assumed to be
5480 far away, the compiler will use the @code{call} instruction to
5481 call a function and the @code{rtc} instruction for returning.
5482
5483 @item -mshort
5484 @opindex mshort
5485 Consider type @code{int} to be 16 bits wide, like @code{short int}.
5486
5487 @item -msoft-reg-count=@var{count}
5488 @opindex msoft-reg-count
5489 Specify the number of pseudo-soft registers which are used for the
5490 code generation.  The maximum number is 32.  Using more pseudo-soft
5491 register may or may not result in better code depending on the program.
5492 The default is 4 for 68HC11 and 2 for 68HC12.
5493
5494 @end table
5495
5496 @node VAX Options
5497 @subsection VAX Options
5498 @cindex VAX options
5499
5500 These @samp{-m} options are defined for the VAX:
5501
5502 @table @gcctabopt
5503 @item -munix
5504 @opindex munix
5505 Do not output certain jump instructions (@code{aobleq} and so on)
5506 that the Unix assembler for the VAX cannot handle across long
5507 ranges.
5508
5509 @item -mgnu
5510 @opindex mgnu
5511 Do output those jump instructions, on the assumption that you
5512 will assemble with the GNU assembler.
5513
5514 @item -mg
5515 @opindex mg
5516 Output code for g-format floating point numbers instead of d-format.
5517 @end table
5518
5519 @node SPARC Options
5520 @subsection SPARC Options
5521 @cindex SPARC options
5522
5523 These @samp{-m} switches are supported on the SPARC:
5524
5525 @table @gcctabopt
5526 @item -mno-app-regs
5527 @itemx -mapp-regs
5528 @opindex mno-app-regs
5529 @opindex mapp-regs
5530 Specify @option{-mapp-regs} to generate output using the global registers
5531 2 through 4, which the SPARC SVR4 ABI reserves for applications.  This
5532 is the default.
5533
5534 To be fully SVR4 ABI compliant at the cost of some performance loss,
5535 specify @option{-mno-app-regs}.  You should compile libraries and system
5536 software with this option.
5537
5538 @item -mfpu
5539 @itemx -mhard-float
5540 @opindex mfpu
5541 @opindex mhard-float
5542 Generate output containing floating point instructions.  This is the
5543 default.
5544
5545 @item -mno-fpu
5546 @itemx -msoft-float
5547 @opindex mno-fpu
5548 @opindex msoft-float
5549 Generate output containing library calls for floating point.
5550 @strong{Warning:} the requisite libraries are not available for all SPARC
5551 targets.  Normally the facilities of the machine's usual C compiler are
5552 used, but this cannot be done directly in cross-compilation.  You must make
5553 your own arrangements to provide suitable library functions for
5554 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
5555 @samp{sparclite-*-*} do provide software floating point support.
5556
5557 @option{-msoft-float} changes the calling convention in the output file;
5558 therefore, it is only useful if you compile @emph{all} of a program with
5559 this option.  In particular, you need to compile @file{libgcc.a}, the
5560 library that comes with GCC, with @option{-msoft-float} in order for
5561 this to work.
5562
5563 @item -mhard-quad-float
5564 @opindex mhard-quad-float
5565 Generate output containing quad-word (long double) floating point
5566 instructions.
5567
5568 @item -msoft-quad-float
5569 @opindex msoft-quad-float
5570 Generate output containing library calls for quad-word (long double)
5571 floating point instructions.  The functions called are those specified
5572 in the SPARC ABI@.  This is the default.
5573
5574 As of this writing, there are no sparc implementations that have hardware
5575 support for the quad-word floating point instructions.  They all invoke
5576 a trap handler for one of these instructions, and then the trap handler
5577 emulates the effect of the instruction.  Because of the trap handler overhead,
5578 this is much slower than calling the ABI library routines.  Thus the
5579 @option{-msoft-quad-float} option is the default.
5580
5581 @item -mno-flat
5582 @itemx -mflat
5583 @opindex mno-flat
5584 @opindex mflat
5585 With @option{-mflat}, the compiler does not generate save/restore instructions
5586 and will use a ``flat'' or single register window calling convention.
5587 This model uses %i7 as the frame pointer and is compatible with the normal
5588 register window model.  Code from either may be intermixed.
5589 The local registers and the input registers (0--5) are still treated as
5590 ``call saved'' registers and will be saved on the stack as necessary.
5591
5592 With @option{-mno-flat} (the default), the compiler emits save/restore
5593 instructions (except for leaf functions) and is the normal mode of operation.
5594
5595 @item -mno-unaligned-doubles
5596 @itemx -munaligned-doubles
5597 @opindex mno-unaligned-doubles
5598 @opindex munaligned-doubles
5599 Assume that doubles have 8 byte alignment.  This is the default.
5600
5601 With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
5602 alignment only if they are contained in another type, or if they have an
5603 absolute address.  Otherwise, it assumes they have 4 byte alignment.
5604 Specifying this option avoids some rare compatibility problems with code
5605 generated by other compilers.  It is not the default because it results
5606 in a performance loss, especially for floating point code.
5607
5608 @item -mno-faster-structs
5609 @itemx -mfaster-structs
5610 @opindex mno-faster-structs
5611 @opindex mfaster-structs
5612 With @option{-mfaster-structs}, the compiler assumes that structures
5613 should have 8 byte alignment.  This enables the use of pairs of
5614 @code{ldd} and @code{std} instructions for copies in structure
5615 assignment, in place of twice as many @code{ld} and @code{st} pairs.
5616 However, the use of this changed alignment directly violates the SPARC
5617 ABI@.  Thus, it's intended only for use on targets where the developer
5618 acknowledges that their resulting code will not be directly in line with
5619 the rules of the ABI@.
5620
5621 @item -mv8
5622 @itemx -msparclite
5623 @opindex mv8
5624 @opindex msparclite
5625 These two options select variations on the SPARC architecture.
5626
5627 By default (unless specifically configured for the Fujitsu SPARClite),
5628 GCC generates code for the v7 variant of the SPARC architecture.
5629
5630 @option{-mv8} will give you SPARC v8 code.  The only difference from v7
5631 code is that the compiler emits the integer multiply and integer
5632 divide instructions which exist in SPARC v8 but not in SPARC v7.
5633
5634 @option{-msparclite} will give you SPARClite code.  This adds the integer
5635 multiply, integer divide step and scan (@code{ffs}) instructions which
5636 exist in SPARClite but not in SPARC v7.
5637
5638 These options are deprecated and will be deleted in a future GCC release.
5639 They have been replaced with @option{-mcpu=xxx}.
5640
5641 @item -mcypress
5642 @itemx -msupersparc
5643 @opindex mcypress
5644 @opindex msupersparc
5645 These two options select the processor for which the code is optimized.
5646
5647 With @option{-mcypress} (the default), the compiler optimizes code for the
5648 Cypress CY7C602 chip, as used in the SPARCStation/SPARCServer 3xx series.
5649 This is also appropriate for the older SPARCStation 1, 2, IPX etc.
5650
5651 With @option{-msupersparc} the compiler optimizes code for the SuperSPARC cpu, as
5652 used in the SPARCStation 10, 1000 and 2000 series.  This flag also enables use
5653 of the full SPARC v8 instruction set.
5654
5655 These options are deprecated and will be deleted in a future GCC release.
5656 They have been replaced with @option{-mcpu=xxx}.
5657
5658 @item -mcpu=@var{cpu_type}
5659 @opindex mcpu
5660 Set the instruction set, register set, and instruction scheduling parameters
5661 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
5662 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
5663 @samp{hypersparc}, @samp{sparclite86x}, @samp{f930}, @samp{f934},
5664 @samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc}, and
5665 @samp{ultrasparc3}.
5666
5667 Default instruction scheduling parameters are used for values that select
5668 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
5669 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
5670
5671 Here is a list of each supported architecture and their supported
5672 implementations.
5673
5674 @smallexample
5675     v7:             cypress
5676     v8:             supersparc, hypersparc
5677     sparclite:      f930, f934, sparclite86x
5678     sparclet:       tsc701
5679     v9:             ultrasparc, ultrasparc3
5680 @end smallexample
5681
5682 @item -mtune=@var{cpu_type}
5683 @opindex mtune
5684 Set the instruction scheduling parameters for machine type
5685 @var{cpu_type}, but do not set the instruction set or register set that the
5686 option @option{-mcpu=@var{cpu_type}} would.
5687
5688 The same values for @option{-mcpu=@var{cpu_type}} can be used for
5689 @option{-mtune=@var{cpu_type}}, but the only useful values are those
5690 that select a particular cpu implementation.  Those are @samp{cypress},
5691 @samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
5692 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, and
5693 @samp{ultrasparc3}.
5694
5695 @end table
5696
5697 These @samp{-m} switches are supported in addition to the above
5698 on the SPARCLET processor.
5699
5700 @table @gcctabopt
5701 @item -mlittle-endian
5702 @opindex mlittle-endian
5703 Generate code for a processor running in little-endian mode.
5704
5705 @item -mlive-g0
5706 @opindex mlive-g0
5707 Treat register @code{%g0} as a normal register.
5708 GCC will continue to clobber it as necessary but will not assume
5709 it always reads as 0.
5710
5711 @item -mbroken-saverestore
5712 @opindex mbroken-saverestore
5713 Generate code that does not use non-trivial forms of the @code{save} and
5714 @code{restore} instructions.  Early versions of the SPARCLET processor do
5715 not correctly handle @code{save} and @code{restore} instructions used with
5716 arguments.  They correctly handle them used without arguments.  A @code{save}
5717 instruction used without arguments increments the current window pointer
5718 but does not allocate a new stack frame.  It is assumed that the window
5719 overflow trap handler will properly handle this case as will interrupt
5720 handlers.
5721 @end table
5722
5723 These @samp{-m} switches are supported in addition to the above
5724 on SPARC V9 processors in 64-bit environments.
5725
5726 @table @gcctabopt
5727 @item -mlittle-endian
5728 @opindex mlittle-endian
5729 Generate code for a processor running in little-endian mode.
5730
5731 @item -m32
5732 @itemx -m64
5733 @opindex m32
5734 @opindex m64
5735 Generate code for a 32-bit or 64-bit environment.
5736 The 32-bit environment sets int, long and pointer to 32 bits.
5737 The 64-bit environment sets int to 32 bits and long and pointer
5738 to 64 bits.
5739
5740 @item -mcmodel=medlow
5741 @opindex mcmodel=medlow
5742 Generate code for the Medium/Low code model: the program must be linked
5743 in the low 32 bits of the address space.  Pointers are 64 bits.
5744 Programs can be statically or dynamically linked.
5745
5746 @item -mcmodel=medmid
5747 @opindex mcmodel=medmid
5748 Generate code for the Medium/Middle code model: the program must be linked
5749 in the low 44 bits of the address space, the text segment must be less than
5750 2G bytes, and data segment must be within 2G of the text segment.
5751 Pointers are 64 bits.
5752
5753 @item -mcmodel=medany
5754 @opindex mcmodel=medany
5755 Generate code for the Medium/Anywhere code model: the program may be linked
5756 anywhere in the address space, the text segment must be less than
5757 2G bytes, and data segment must be within 2G of the text segment.
5758 Pointers are 64 bits.
5759
5760 @item -mcmodel=embmedany
5761 @opindex mcmodel=embmedany
5762 Generate code for the Medium/Anywhere code model for embedded systems:
5763 assume a 32-bit text and a 32-bit data segment, both starting anywhere
5764 (determined at link time).  Register %g4 points to the base of the
5765 data segment.  Pointers are still 64 bits.
5766 Programs are statically linked, PIC is not supported.
5767
5768 @item -mstack-bias
5769 @itemx -mno-stack-bias
5770 @opindex mstack-bias
5771 @opindex mno-stack-bias
5772 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
5773 frame pointer if present, are offset by @minus{}2047 which must be added back
5774 when making stack frame references.
5775 Otherwise, assume no such offset is present.
5776 @end table
5777
5778 @node ARM Options
5779 @subsection ARM Options
5780 @cindex ARM options
5781
5782 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
5783 architectures:
5784
5785 @table @gcctabopt
5786 @item -mapcs-frame
5787 @opindex mapcs-frame
5788 Generate a stack frame that is compliant with the ARM Procedure Call
5789 Standard for all functions, even if this is not strictly necessary for
5790 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
5791 with this option will cause the stack frames not to be generated for
5792 leaf functions.  The default is @option{-mno-apcs-frame}.
5793
5794 @item -mapcs
5795 @opindex mapcs
5796 This is a synonym for @option{-mapcs-frame}.
5797
5798 @item -mapcs-26
5799 @opindex mapcs-26
5800 Generate code for a processor running with a 26-bit program counter,
5801 and conforming to the function calling standards for the APCS 26-bit
5802 option.  This option replaces the @option{-m2} and @option{-m3} options
5803 of previous releases of the compiler.
5804
5805 @item -mapcs-32
5806 @opindex mapcs-32
5807 Generate code for a processor running with a 32-bit program counter,
5808 and conforming to the function calling standards for the APCS 32-bit
5809 option.  This option replaces the @option{-m6} option of previous releases
5810 of the compiler.
5811
5812 @ignore
5813 @c not currently implemented
5814 @item -mapcs-stack-check
5815 @opindex mapcs-stack-check
5816 Generate code to check the amount of stack space available upon entry to
5817 every function (that actually uses some stack space).  If there is
5818 insufficient space available then either the function
5819 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
5820 called, depending upon the amount of stack space required.  The run time
5821 system is required to provide these functions.  The default is
5822 @option{-mno-apcs-stack-check}, since this produces smaller code.
5823
5824 @c not currently implemented
5825 @item -mapcs-float
5826 @opindex mapcs-float
5827 Pass floating point arguments using the float point registers.  This is
5828 one of the variants of the APCS@.  This option is recommended if the
5829 target hardware has a floating point unit or if a lot of floating point
5830 arithmetic is going to be performed by the code.  The default is
5831 @option{-mno-apcs-float}, since integer only code is slightly increased in
5832 size if @option{-mapcs-float} is used.
5833
5834 @c not currently implemented
5835 @item -mapcs-reentrant
5836 @opindex mapcs-reentrant
5837 Generate reentrant, position independent code.  The default is
5838 @option{-mno-apcs-reentrant}.
5839 @end ignore
5840
5841 @item -mthumb-interwork
5842 @opindex mthumb-interwork
5843 Generate code which supports calling between the ARM and Thumb
5844 instruction sets.  Without this option the two instruction sets cannot
5845 be reliably used inside one program.  The default is
5846 @option{-mno-thumb-interwork}, since slightly larger code is generated
5847 when @option{-mthumb-interwork} is specified.
5848
5849 @item -mno-sched-prolog
5850 @opindex mno-sched-prolog
5851 Prevent the reordering of instructions in the function prolog, or the
5852 merging of those instruction with the instructions in the function's
5853 body.  This means that all functions will start with a recognizable set
5854 of instructions (or in fact one of a choice from a small set of
5855 different function prologues), and this information can be used to
5856 locate the start if functions inside an executable piece of code.  The
5857 default is @option{-msched-prolog}.
5858
5859 @item -mhard-float
5860 @opindex mhard-float
5861 Generate output containing floating point instructions.  This is the
5862 default.
5863
5864 @item -msoft-float
5865 @opindex msoft-float
5866 Generate output containing library calls for floating point.
5867 @strong{Warning:} the requisite libraries are not available for all ARM
5868 targets.  Normally the facilities of the machine's usual C compiler are
5869 used, but this cannot be done directly in cross-compilation.  You must make
5870 your own arrangements to provide suitable library functions for
5871 cross-compilation.
5872
5873 @option{-msoft-float} changes the calling convention in the output file;
5874 therefore, it is only useful if you compile @emph{all} of a program with
5875 this option.  In particular, you need to compile @file{libgcc.a}, the
5876 library that comes with GCC, with @option{-msoft-float} in order for
5877 this to work.
5878
5879 @item -mlittle-endian
5880 @opindex mlittle-endian
5881 Generate code for a processor running in little-endian mode.  This is
5882 the default for all standard configurations.
5883
5884 @item -mbig-endian
5885 @opindex mbig-endian
5886 Generate code for a processor running in big-endian mode; the default is
5887 to compile code for a little-endian processor.
5888
5889 @item -mwords-little-endian
5890 @opindex mwords-little-endian
5891 This option only applies when generating code for big-endian processors.
5892 Generate code for a little-endian word order but a big-endian byte
5893 order.  That is, a byte order of the form @samp{32107654}.  Note: this
5894 option should only be used if you require compatibility with code for
5895 big-endian ARM processors generated by versions of the compiler prior to
5896 2.8.
5897
5898 @item -malignment-traps
5899 @opindex malignment-traps
5900 Generate code that will not trap if the MMU has alignment traps enabled.
5901 On ARM architectures prior to ARMv4, there were no instructions to
5902 access half-word objects stored in memory.  However, when reading from
5903 memory a feature of the ARM architecture allows a word load to be used,
5904 even if the address is unaligned, and the processor core will rotate the
5905 data as it is being loaded.  This option tells the compiler that such
5906 misaligned accesses will cause a MMU trap and that it should instead
5907 synthesize the access as a series of byte accesses.  The compiler can
5908 still use word accesses to load half-word data if it knows that the
5909 address is aligned to a word boundary.
5910
5911 This option is ignored when compiling for ARM architecture 4 or later,
5912 since these processors have instructions to directly access half-word
5913 objects in memory.
5914
5915 @item -mno-alignment-traps
5916 @opindex mno-alignment-traps
5917 Generate code that assumes that the MMU will not trap unaligned
5918 accesses.  This produces better code when the target instruction set
5919 does not have half-word memory operations (i.e.@: implementations prior to
5920 ARMv4).
5921
5922 Note that you cannot use this option to access unaligned word objects,
5923 since the processor will only fetch one 32-bit aligned object from
5924 memory.
5925
5926 The default setting for most targets is @option{-mno-alignment-traps}, since
5927 this produces better code when there are no half-word memory
5928 instructions available.
5929
5930 @item -mshort-load-bytes
5931 @itemx -mno-short-load-words
5932 @opindex mshort-load-bytes
5933 @opindex mno-short-load-words
5934 These are deprecated aliases for @option{-malignment-traps}.
5935
5936 @item -mno-short-load-bytes
5937 @itemx -mshort-load-words
5938 @opindex mno-short-load-bytes
5939 @opindex mshort-load-words
5940 This are deprecated aliases for @option{-mno-alignment-traps}.
5941
5942 @item -mcpu=@var{name}
5943 @opindex mcpu
5944 This specifies the name of the target ARM processor.  GCC uses this name
5945 to determine what kind of instructions it can emit when generating
5946 assembly code.  Permissible names are: @samp{arm2}, @samp{arm250},
5947 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
5948 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
5949 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
5950 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
5951 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm8},
5952 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
5953 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
5954 @samp{arm920t}, @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi},
5955 @samp{arm1020t}, @samp{xscale}.
5956
5957 @itemx -mtune=@var{name}
5958 @opindex mtune
5959 This option is very similar to the @option{-mcpu=} option, except that
5960 instead of specifying the actual target processor type, and hence
5961 restricting which instructions can be used, it specifies that GCC should
5962 tune the performance of the code as if the target were of the type
5963 specified in this option, but still choosing the instructions that it
5964 will generate based on the cpu specified by a @option{-mcpu=} option.
5965 For some ARM implementations better performance can be obtained by using
5966 this option.
5967
5968 @item -march=@var{name}
5969 @opindex march
5970 This specifies the name of the target ARM architecture.  GCC uses this
5971 name to determine what kind of instructions it can emit when generating
5972 assembly code.  This option can be used in conjunction with or instead
5973 of the @option{-mcpu=} option.  Permissible names are: @samp{armv2},
5974 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
5975 @samp{armv5}, @samp{armv5t}, @samp{armv5te}.
5976
5977 @item -mfpe=@var{number}
5978 @itemx -mfp=@var{number}
5979 @opindex mfpe
5980 @opindex mfp
5981 This specifies the version of the floating point emulation available on
5982 the target.  Permissible values are 2 and 3.  @option{-mfp=} is a synonym
5983 for @option{-mfpe=}, for compatibility with older versions of GCC@.
5984
5985 @item -mstructure-size-boundary=@var{n}
5986 @opindex mstructure-size-boundary
5987 The size of all structures and unions will be rounded up to a multiple
5988 of the number of bits set by this option.  Permissible values are 8 and
5989 32.  The default value varies for different toolchains.  For the COFF
5990 targeted toolchain the default value is 8.  Specifying the larger number
5991 can produce faster, more efficient code, but can also increase the size
5992 of the program.  The two values are potentially incompatible.  Code
5993 compiled with one value cannot necessarily expect to work with code or
5994 libraries compiled with the other value, if they exchange information
5995 using structures or unions.
5996
5997 @item -mabort-on-noreturn
5998 @opindex mabort-on-noreturn
5999 Generate a call to the function @code{abort} at the end of a
6000 @code{noreturn} function.  It will be executed if the function tries to
6001 return.
6002
6003 @item -mlong-calls
6004 @itemx -mno-long-calls
6005 @opindex mlong-calls
6006 @opindex mno-long-calls
6007 Tells the compiler to perform function calls by first loading the
6008 address of the function into a register and then performing a subroutine
6009 call on this register.  This switch is needed if the target function
6010 will lie outside of the 64 megabyte addressing range of the offset based
6011 version of subroutine call instruction.
6012
6013 Even if this switch is enabled, not all function calls will be turned
6014 into long calls.  The heuristic is that static functions, functions
6015 which have the @samp{short-call} attribute, functions that are inside
6016 the scope of a @samp{#pragma no_long_calls} directive and functions whose
6017 definitions have already been compiled within the current compilation
6018 unit, will not be turned into long calls.  The exception to this rule is
6019 that weak function definitions, functions with the @samp{long-call}
6020 attribute or the @samp{section} attribute, and functions that are within
6021 the scope of a @samp{#pragma long_calls} directive, will always be
6022 turned into long calls.
6023
6024 This feature is not enabled by default.  Specifying
6025 @option{-mno-long-calls} will restore the default behavior, as will
6026 placing the function calls within the scope of a @samp{#pragma
6027 long_calls_off} directive.  Note these switches have no effect on how
6028 the compiler generates code to handle function calls via function
6029 pointers.
6030
6031 @item -mnop-fun-dllimport
6032 @opindex mnop-fun-dllimport
6033 Disable support for the @code{dllimport} attribute.
6034
6035 @item -msingle-pic-base
6036 @opindex msingle-pic-base
6037 Treat the register used for PIC addressing as read-only, rather than
6038 loading it in the prologue for each function.  The run-time system is
6039 responsible for initializing this register with an appropriate value
6040 before execution begins.
6041
6042 @item -mpic-register=@var{reg}
6043 @opindex mpic-register
6044 Specify the register to be used for PIC addressing.  The default is R10
6045 unless stack-checking is enabled, when R9 is used.
6046
6047 @item -mpoke-function-name
6048 @opindex mpoke-function-name
6049 Write the name of each function into the text section, directly
6050 preceding the function prologue.  The generated code is similar to this:
6051
6052 @smallexample
6053      t0
6054          .ascii "arm_poke_function_name", 0
6055          .align
6056      t1
6057          .word 0xff000000 + (t1 - t0)
6058      arm_poke_function_name
6059          mov     ip, sp
6060          stmfd   sp!, @{fp, ip, lr, pc@}
6061          sub     fp, ip, #4
6062 @end smallexample
6063
6064 When performing a stack backtrace, code can inspect the value of
6065 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
6066 location @code{pc - 12} and the top 8 bits are set, then we know that
6067 there is a function name embedded immediately preceding this location
6068 and has length @code{((pc[-3]) & 0xff000000)}.
6069
6070 @item -mthumb
6071 @opindex mthumb
6072 Generate code for the 16-bit Thumb instruction set.  The default is to
6073 use the 32-bit ARM instruction set.
6074
6075 @item -mtpcs-frame
6076 @opindex mtpcs-frame
6077 Generate a stack frame that is compliant with the Thumb Procedure Call
6078 Standard for all non-leaf functions.  (A leaf function is one that does
6079 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
6080
6081 @item -mtpcs-leaf-frame
6082 @opindex mtpcs-leaf-frame
6083 Generate a stack frame that is compliant with the Thumb Procedure Call
6084 Standard for all leaf functions.  (A leaf function is one that does
6085 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
6086
6087 @item -mcallee-super-interworking
6088 @opindex mcallee-super-interworking
6089 Gives all externally visible functions in the file being compiled an ARM
6090 instruction set header which switches to Thumb mode before executing the
6091 rest of the function.  This allows these functions to be called from
6092 non-interworking code.
6093
6094 @item -mcaller-super-interworking
6095 @opindex mcaller-super-interworking
6096 Allows calls via function pointers (including virtual functions) to
6097 execute correctly regardless of whether the target code has been
6098 compiled for interworking or not.  There is a small overhead in the cost
6099 of executing a function pointer if this option is enabled.
6100
6101 @end table
6102
6103 @node MN10200 Options
6104 @subsection MN10200 Options
6105 @cindex MN10200 options
6106 These @option{-m} options are defined for Matsushita MN10200 architectures:
6107 @table @gcctabopt
6108
6109 @item -mrelax
6110 @opindex mrelax
6111 Indicate to the linker that it should perform a relaxation optimization pass
6112 to shorten branches, calls and absolute memory addresses.  This option only
6113 has an effect when used on the command line for the final link step.
6114
6115 This option makes symbolic debugging impossible.
6116 @end table
6117
6118 @node MN10300 Options
6119 @subsection MN10300 Options
6120 @cindex MN10300 options
6121 These @option{-m} options are defined for Matsushita MN10300 architectures:
6122
6123 @table @gcctabopt
6124 @item -mmult-bug
6125 @opindex mmult-bug
6126 Generate code to avoid bugs in the multiply instructions for the MN10300
6127 processors.  This is the default.
6128
6129 @item -mno-mult-bug
6130 @opindex mno-mult-bug
6131 Do not generate code to avoid bugs in the multiply instructions for the
6132 MN10300 processors.
6133
6134 @item -mam33
6135 @opindex mam33
6136 Generate code which uses features specific to the AM33 processor.
6137
6138 @item -mno-am33
6139 @opindex mno-am33
6140 Do not generate code which uses features specific to the AM33 processor.  This
6141 is the default.
6142
6143 @item -mno-crt0
6144 @opindex mno-crt0
6145 Do not link in the C run-time initialization object file.
6146
6147 @item -mrelax
6148 @opindex mrelax
6149 Indicate to the linker that it should perform a relaxation optimization pass
6150 to shorten branches, calls and absolute memory addresses.  This option only
6151 has an effect when used on the command line for the final link step.
6152
6153 This option makes symbolic debugging impossible.
6154 @end table
6155
6156
6157 @node M32R/D Options
6158 @subsection M32R/D Options
6159 @cindex M32R/D options
6160
6161 These @option{-m} options are defined for Mitsubishi M32R/D architectures:
6162
6163 @table @gcctabopt
6164 @item -m32rx
6165 @opindex m32rx
6166 Generate code for the M32R/X@.
6167
6168 @item -m32r
6169 @opindex m32r
6170 Generate code for the M32R@.  This is the default.
6171
6172 @item -mcode-model=small
6173 @opindex mcode-model=small
6174 Assume all objects live in the lower 16MB of memory (so that their addresses
6175 can be loaded with the @code{ld24} instruction), and assume all subroutines
6176 are reachable with the @code{bl} instruction.
6177 This is the default.
6178
6179 The addressability of a particular object can be set with the
6180 @code{model} attribute.
6181
6182 @item -mcode-model=medium
6183 @opindex mcode-model=medium
6184 Assume objects may be anywhere in the 32-bit address space (the compiler
6185 will generate @code{seth/add3} instructions to load their addresses), and
6186 assume all subroutines are reachable with the @code{bl} instruction.
6187
6188 @item -mcode-model=large
6189 @opindex mcode-model=large
6190 Assume objects may be anywhere in the 32-bit address space (the compiler
6191 will generate @code{seth/add3} instructions to load their addresses), and
6192 assume subroutines may not be reachable with the @code{bl} instruction
6193 (the compiler will generate the much slower @code{seth/add3/jl}
6194 instruction sequence).
6195
6196 @item -msdata=none
6197 @opindex msdata=none
6198 Disable use of the small data area.  Variables will be put into
6199 one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
6200 @code{section} attribute has been specified).
6201 This is the default.
6202
6203 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
6204 Objects may be explicitly put in the small data area with the
6205 @code{section} attribute using one of these sections.
6206
6207 @item -msdata=sdata
6208 @opindex msdata=sdata
6209 Put small global and static data in the small data area, but do not
6210 generate special code to reference them.
6211
6212 @item -msdata=use
6213 @opindex msdata=use
6214 Put small global and static data in the small data area, and generate
6215 special instructions to reference them.
6216
6217 @item -G @var{num}
6218 @opindex G
6219 @cindex smaller data references
6220 Put global and static objects less than or equal to @var{num} bytes
6221 into the small data or bss sections instead of the normal data or bss
6222 sections.  The default value of @var{num} is 8.
6223 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
6224 for this option to have any effect.
6225
6226 All modules should be compiled with the same @option{-G @var{num}} value.
6227 Compiling with different values of @var{num} may or may not work; if it
6228 doesn't the linker will give an error message---incorrect code will not be
6229 generated.
6230
6231 @end table
6232
6233 @node M88K Options
6234 @subsection M88K Options
6235 @cindex M88k options
6236
6237 These @samp{-m} options are defined for Motorola 88k architectures:
6238
6239 @table @gcctabopt
6240 @item -m88000
6241 @opindex m88000
6242 Generate code that works well on both the m88100 and the
6243 m88110.
6244
6245 @item -m88100
6246 @opindex m88100
6247 Generate code that works best for the m88100, but that also
6248 runs on the m88110.
6249
6250 @item -m88110
6251 @opindex m88110
6252 Generate code that works best for the m88110, and may not run
6253 on the m88100.
6254
6255 @item -mbig-pic
6256 @opindex mbig-pic
6257 Obsolete option to be removed from the next revision.
6258 Use @option{-fPIC}.
6259
6260 @item -midentify-revision
6261 @opindex midentify-revision
6262 @cindex identifying source, compiler (88k)
6263 Include an @code{ident} directive in the assembler output recording the
6264 source file name, compiler name and version, timestamp, and compilation
6265 flags used.
6266
6267 @item -mno-underscores
6268 @opindex mno-underscores
6269 @cindex underscores, avoiding (88k)
6270 In assembler output, emit symbol names without adding an underscore
6271 character at the beginning of each name.  The default is to use an
6272 underscore as prefix on each name.
6273
6274 @item -mocs-debug-info
6275 @itemx -mno-ocs-debug-info
6276 @opindex mocs-debug-info
6277 @opindex mno-ocs-debug-info
6278 @cindex OCS (88k)
6279 @cindex debugging, 88k OCS
6280 Include (or omit) additional debugging information (about registers used
6281 in each stack frame) as specified in the 88open Object Compatibility
6282 Standard, ``OCS''@.  This extra information allows debugging of code that
6283 has had the frame pointer eliminated.  The default for SVr4 and Delta 88
6284 SVr3.2 is to include this information; other 88k configurations omit this
6285 information by default.
6286
6287 @item -mocs-frame-position
6288 @opindex mocs-frame-position
6289 @cindex register positions in frame (88k)
6290 When emitting COFF debugging information for automatic variables and
6291 parameters stored on the stack, use the offset from the canonical frame
6292 address, which is the stack pointer (register 31) on entry to the
6293 function.  The SVr4 and Delta88 SVr3.2, and BCS configurations use
6294 @option{-mocs-frame-position}; other 88k configurations have the default
6295 @option{-mno-ocs-frame-position}.
6296
6297 @item -mno-ocs-frame-position
6298 @opindex mno-ocs-frame-position
6299 @cindex register positions in frame (88k)
6300 When emitting COFF debugging information for automatic variables and
6301 parameters stored on the stack, use the offset from the frame pointer
6302 register (register 30).  When this option is in effect, the frame
6303 pointer is not eliminated when debugging information is selected by the
6304 -g switch.
6305
6306 @item -moptimize-arg-area
6307 @opindex moptimize-arg-area
6308 @cindex arguments in frame (88k)
6309 Save space by reorganizing the stack frame.  This option generates code
6310 that does not agree with the 88open specifications, but uses less
6311 memory.
6312
6313 @itemx -mno-optimize-arg-area
6314 @opindex mno-optimize-arg-area
6315 Do not reorganize the stack frame to save space.  This is the default.
6316 The generated conforms to the specification, but uses more memory.
6317
6318 @item -mshort-data-@var{num}
6319 @opindex mshort-data
6320 @cindex smaller data references (88k)
6321 @cindex r0-relative references (88k)
6322 Generate smaller data references by making them relative to @code{r0},
6323 which allows loading a value using a single instruction (rather than the
6324 usual two).  You control which data references are affected by
6325 specifying @var{num} with this option.  For example, if you specify
6326 @option{-mshort-data-512}, then the data references affected are those
6327 involving displacements of less than 512 bytes.
6328 @option{-mshort-data-@var{num}} is not effective for @var{num} greater
6329 than 64k.
6330
6331 @item -mserialize-volatile
6332 @opindex mserialize-volatile
6333 @itemx -mno-serialize-volatile
6334 @opindex mno-serialize-volatile
6335 @cindex sequential consistency on 88k
6336 Do, or don't, generate code to guarantee sequential consistency
6337 of volatile memory references.  By default, consistency is
6338 guaranteed.
6339
6340 The order of memory references made by the MC88110 processor does
6341 not always match the order of the instructions requesting those
6342 references.  In particular, a load instruction may execute before
6343 a preceding store instruction.  Such reordering violates
6344 sequential consistency of volatile memory references, when there
6345 are multiple processors.   When consistency must be guaranteed,
6346 GCC generates special instructions, as needed, to force
6347 execution in the proper order.
6348
6349 The MC88100 processor does not reorder memory references and so
6350 always provides sequential consistency.  However, by default, GCC
6351 generates the special instructions to guarantee consistency
6352 even when you use @option{-m88100}, so that the code may be run on an
6353 MC88110 processor.  If you intend to run your code only on the
6354 MC88100 processor, you may use @option{-mno-serialize-volatile}.
6355
6356 The extra code generated to guarantee consistency may affect the
6357 performance of your application.  If you know that you can safely
6358 forgo this guarantee, you may use @option{-mno-serialize-volatile}.
6359
6360 @item -msvr4
6361 @itemx -msvr3
6362 @opindex msvr4
6363 @opindex msvr3
6364 @cindex assembler syntax, 88k
6365 @cindex SVr4
6366 Turn on (@option{-msvr4}) or off (@option{-msvr3}) compiler extensions
6367 related to System V release 4 (SVr4).  This controls the following:
6368
6369 @enumerate
6370 @item
6371 Which variant of the assembler syntax to emit.
6372 @item
6373 @option{-msvr4} makes the C preprocessor recognize @samp{#pragma weak}
6374 that is used on System V release 4.
6375 @item
6376 @option{-msvr4} makes GCC issue additional declaration directives used in
6377 SVr4.
6378 @end enumerate
6379
6380 @option{-msvr4} is the default for the m88k-motorola-sysv4 configuration.
6381 @option{-msvr3} is the default for all other m88k configurations.
6382
6383 @item -mversion-03.00
6384 @opindex mversion-03.00
6385 This option is obsolete, and is ignored.
6386 @c ??? which asm syntax better for GAS?  option there too?
6387
6388 @item -mno-check-zero-division
6389 @itemx -mcheck-zero-division
6390 @opindex mno-check-zero-division
6391 @opindex mcheck-zero-division
6392 @cindex zero division on 88k
6393 Do, or don't, generate code to guarantee that integer division by
6394 zero will be detected.  By default, detection is guaranteed.
6395
6396 Some models of the MC88100 processor fail to trap upon integer
6397 division by zero under certain conditions.  By default, when
6398 compiling code that might be run on such a processor, GCC
6399 generates code that explicitly checks for zero-valued divisors
6400 and traps with exception number 503 when one is detected.  Use of
6401 @option{-mno-check-zero-division} suppresses such checking for code
6402 generated to run on an MC88100 processor.
6403
6404 GCC assumes that the MC88110 processor correctly detects all instances
6405 of integer division by zero.  When @option{-m88110} is specified, no
6406 explicit checks for zero-valued divisors are generated, and both
6407 @option{-mcheck-zero-division} and @option{-mno-check-zero-division} are
6408 ignored.
6409
6410 @item -muse-div-instruction
6411 @opindex muse-div-instruction
6412 @cindex divide instruction, 88k
6413 Use the div instruction for signed integer division on the
6414 MC88100 processor.  By default, the div instruction is not used.
6415
6416 On the MC88100 processor the signed integer division instruction
6417 div) traps to the operating system on a negative operand.  The
6418 operating system transparently completes the operation, but at a
6419 large cost in execution time.  By default, when compiling code
6420 that might be run on an MC88100 processor, GCC emulates signed
6421 integer division using the unsigned integer division instruction
6422 divu), thereby avoiding the large penalty of a trap to the
6423 operating system.  Such emulation has its own, smaller, execution
6424 cost in both time and space.  To the extent that your code's
6425 important signed integer division operations are performed on two
6426 nonnegative operands, it may be desirable to use the div
6427 instruction directly.
6428
6429 On the MC88110 processor the div instruction (also known as the
6430 divs instruction) processes negative operands without trapping to
6431 the operating system.  When @option{-m88110} is specified,
6432 @option{-muse-div-instruction} is ignored, and the div instruction is used
6433 for signed integer division.
6434
6435 Note that the result of dividing @code{INT_MIN} by @minus{}1 is undefined.  In
6436 particular, the behavior of such a division with and without
6437 @option{-muse-div-instruction} may differ.
6438
6439 @item -mtrap-large-shift
6440 @itemx -mhandle-large-shift
6441 @opindex mtrap-large-shift
6442 @opindex mhandle-large-shift
6443 @cindex bit shift overflow (88k)
6444 @cindex large bit shifts (88k)
6445 Include code to detect bit-shifts of more than 31 bits; respectively,
6446 trap such shifts or emit code to handle them properly.  By default GCC
6447 makes no special provision for large bit shifts.
6448
6449 @item -mwarn-passed-structs
6450 @opindex mwarn-passed-structs
6451 @cindex structure passing (88k)
6452 Warn when a function passes a struct as an argument or result.
6453 Structure-passing conventions have changed during the evolution of the C
6454 language, and are often the source of portability problems.  By default,
6455 GCC issues no such warning.
6456 @end table
6457
6458 @c break page here to avoid unsightly interparagraph stretch.
6459 @c -zw, 2001-8-17
6460 @page
6461
6462 @node RS/6000 and PowerPC Options
6463 @subsection IBM RS/6000 and PowerPC Options
6464 @cindex RS/6000 and PowerPC Options
6465 @cindex IBM RS/6000 and PowerPC Options
6466
6467 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
6468 @table @gcctabopt
6469 @item -mpower
6470 @itemx -mno-power
6471 @itemx -mpower2
6472 @itemx -mno-power2
6473 @itemx -mpowerpc
6474 @itemx -mno-powerpc
6475 @itemx -mpowerpc-gpopt
6476 @itemx -mno-powerpc-gpopt
6477 @itemx -mpowerpc-gfxopt
6478 @itemx -mno-powerpc-gfxopt
6479 @itemx -mpowerpc64
6480 @itemx -mno-powerpc64
6481 @opindex mpower
6482 @opindex mno-power
6483 @opindex mpower2
6484 @opindex mno-power2
6485 @opindex mpowerpc
6486 @opindex mno-powerpc
6487 @opindex mpowerpc-gpopt
6488 @opindex mno-powerpc-gpopt
6489 @opindex mpowerpc-gfxopt
6490 @opindex mno-powerpc-gfxopt
6491 @opindex mpowerpc64
6492 @opindex mno-powerpc64
6493 GCC supports two related instruction set architectures for the
6494 RS/6000 and PowerPC@.  The @dfn{POWER} instruction set are those
6495 instructions supported by the @samp{rios} chip set used in the original
6496 RS/6000 systems and the @dfn{PowerPC} instruction set is the
6497 architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and
6498 the IBM 4xx microprocessors.
6499
6500 Neither architecture is a subset of the other.  However there is a
6501 large common subset of instructions supported by both.  An MQ
6502 register is included in processors supporting the POWER architecture.
6503
6504 You use these options to specify which instructions are available on the
6505 processor you are using.  The default value of these options is
6506 determined when configuring GCC@.  Specifying the
6507 @option{-mcpu=@var{cpu_type}} overrides the specification of these
6508 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
6509 rather than the options listed above.
6510
6511 The @option{-mpower} option allows GCC to generate instructions that
6512 are found only in the POWER architecture and to use the MQ register.
6513 Specifying @option{-mpower2} implies @option{-power} and also allows GCC
6514 to generate instructions that are present in the POWER2 architecture but
6515 not the original POWER architecture.
6516
6517 The @option{-mpowerpc} option allows GCC to generate instructions that
6518 are found only in the 32-bit subset of the PowerPC architecture.
6519 Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
6520 GCC to use the optional PowerPC architecture instructions in the
6521 General Purpose group, including floating-point square root.  Specifying
6522 @option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
6523 use the optional PowerPC architecture instructions in the Graphics
6524 group, including floating-point select.
6525
6526 The @option{-mpowerpc64} option allows GCC to generate the additional
6527 64-bit instructions that are found in the full PowerPC64 architecture
6528 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
6529 @option{-mno-powerpc64}.
6530
6531 If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
6532 will use only the instructions in the common subset of both
6533 architectures plus some special AIX common-mode calls, and will not use
6534 the MQ register.  Specifying both @option{-mpower} and @option{-mpowerpc}
6535 permits GCC to use any instruction from either architecture and to
6536 allow use of the MQ register; specify this for the Motorola MPC601.
6537
6538 @item -mnew-mnemonics
6539 @itemx -mold-mnemonics
6540 @opindex mnew-mnemonics
6541 @opindex mold-mnemonics
6542 Select which mnemonics to use in the generated assembler code.  With
6543 @option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
6544 the PowerPC architecture.  With @option{-mold-mnemonics} it uses the
6545 assembler mnemonics defined for the POWER architecture.  Instructions
6546 defined in only one architecture have only one mnemonic; GCC uses that
6547 mnemonic irrespective of which of these options is specified.
6548
6549 GCC defaults to the mnemonics appropriate for the architecture in
6550 use.  Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
6551 value of these option.  Unless you are building a cross-compiler, you
6552 should normally not specify either @option{-mnew-mnemonics} or
6553 @option{-mold-mnemonics}, but should instead accept the default.
6554
6555 @item -mcpu=@var{cpu_type}
6556 @opindex mcpu
6557 Set architecture type, register usage, choice of mnemonics, and
6558 instruction scheduling parameters for machine type @var{cpu_type}.
6559 Supported values for @var{cpu_type} are @samp{rios}, @samp{rios1},
6560 @samp{rsc}, @samp{rios2}, @samp{rs64a}, @samp{601}, @samp{602},
6561 @samp{603}, @samp{603e}, @samp{604}, @samp{604e}, @samp{620},
6562 @samp{630}, @samp{740}, @samp{7400}, @samp{7450}, @samp{750},
6563 @samp{power}, @samp{power2}, @samp{powerpc}, @samp{403}, @samp{505},
6564 @samp{801}, @samp{821}, @samp{823}, and @samp{860} and @samp{common}.
6565
6566 @option{-mcpu=common} selects a completely generic processor.  Code
6567 generated under this option will run on any POWER or PowerPC processor.
6568 GCC will use only the instructions in the common subset of both
6569 architectures, and will not use the MQ register.  GCC assumes a generic
6570 processor model for scheduling purposes.
6571
6572 @option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
6573 @option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
6574 PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
6575 types, with an appropriate, generic processor model assumed for
6576 scheduling purposes.
6577
6578 The other options specify a specific processor.  Code generated under
6579 those options will run best on that processor, and may not run at all on
6580 others.
6581
6582 The @option{-mcpu} options automatically enable or disable other
6583 @option{-m} options as follows:
6584
6585 @table @samp
6586 @item common
6587 @option{-mno-power}, @option{-mno-powerpc}
6588
6589 @item power
6590 @itemx power2
6591 @itemx rios1
6592 @itemx rios2
6593 @itemx rsc
6594 @option{-mpower}, @option{-mno-powerpc}, @option{-mno-new-mnemonics}
6595
6596 @item powerpc
6597 @itemx rs64a
6598 @itemx 602
6599 @itemx 603
6600 @itemx 603e
6601 @itemx 604
6602 @itemx 620
6603 @itemx 630
6604 @itemx 740
6605 @itemx 7400
6606 @itemx 7450
6607 @itemx 750
6608 @itemx 505
6609 @option{-mno-power}, @option{-mpowerpc}, @option{-mnew-mnemonics}
6610
6611 @item 601
6612 @option{-mpower}, @option{-mpowerpc}, @option{-mnew-mnemonics}
6613
6614 @item 403
6615 @itemx 821
6616 @itemx 860
6617 @option{-mno-power}, @option{-mpowerpc}, @option{-mnew-mnemonics}, @option{-msoft-float}
6618 @end table
6619
6620 @item -mtune=@var{cpu_type}
6621 @opindex mtune
6622 Set the instruction scheduling parameters for machine type
6623 @var{cpu_type}, but do not set the architecture type, register usage, or
6624 choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would.  The same
6625 values for @var{cpu_type} are used for @option{-mtune} as for
6626 @option{-mcpu}.  If both are specified, the code generated will use the
6627 architecture, registers, and mnemonics set by @option{-mcpu}, but the
6628 scheduling parameters set by @option{-mtune}.
6629
6630 @item -maltivec
6631 @itemx -mno-altivec
6632 @opindex maltivec
6633 @opindex mno-altivec
6634 These switches enable or disable the use of built-in functions that
6635 allow access to the AltiVec instruction set.  You may also need to set
6636 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
6637 enhancements.
6638
6639 @item -mabi=spe
6640 @opindex mabi=spe
6641 Extend the current ABI with SPE ABI extensions.  This does not change
6642 the default ABI, instead it adds the SPE ABI extensions to the current
6643 ABI@.
6644
6645 @item -mabi=no-spe
6646 @opindex mabi=no-spe
6647 Disable Booke SPE ABI extensions for the current ABI.
6648
6649 @item -misel=@var{yes/no}
6650 @itemx -misel
6651 @opindex misel
6652 This switch enables or disables the generation of ISEL instructions.
6653
6654 @item -mfull-toc
6655 @itemx -mno-fp-in-toc
6656 @itemx -mno-sum-in-toc
6657 @itemx -mminimal-toc
6658 @opindex mfull-toc
6659 @opindex mno-fp-in-toc
6660 @opindex mno-sum-in-toc
6661 @opindex mminimal-toc
6662 Modify generation of the TOC (Table Of Contents), which is created for
6663 every executable file.  The @option{-mfull-toc} option is selected by
6664 default.  In that case, GCC will allocate at least one TOC entry for
6665 each unique non-automatic variable reference in your program.  GCC
6666 will also place floating-point constants in the TOC@.  However, only
6667 16,384 entries are available in the TOC@.
6668
6669 If you receive a linker error message that saying you have overflowed
6670 the available TOC space, you can reduce the amount of TOC space used
6671 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
6672 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
6673 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
6674 generate code to calculate the sum of an address and a constant at
6675 run-time instead of putting that sum into the TOC@.  You may specify one
6676 or both of these options.  Each causes GCC to produce very slightly
6677 slower and larger code at the expense of conserving TOC space.
6678
6679 If you still run out of space in the TOC even when you specify both of
6680 these options, specify @option{-mminimal-toc} instead.  This option causes
6681 GCC to make only one TOC entry for every file.  When you specify this
6682 option, GCC will produce code that is slower and larger but which
6683 uses extremely little TOC space.  You may wish to use this option
6684 only on files that contain less frequently executed code.
6685
6686 @item -maix64
6687 @itemx -maix32
6688 @opindex maix64
6689 @opindex maix32
6690 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
6691 @code{long} type, and the infrastructure needed to support them.
6692 Specifying @option{-maix64} implies @option{-mpowerpc64} and
6693 @option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
6694 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
6695
6696 @item -mxl-call
6697 @itemx -mno-xl-call
6698 @opindex mxl-call
6699 @opindex mno-xl-call
6700 On AIX, pass floating-point arguments to prototyped functions beyond the
6701 register save area (RSA) on the stack in addition to argument FPRs.  The
6702 AIX calling convention was extended but not initially documented to
6703 handle an obscure K&R C case of calling a function that takes the
6704 address of its arguments with fewer arguments than declared.  AIX XL
6705 compilers access floating point arguments which do not fit in the
6706 RSA from the stack when a subroutine is compiled without
6707 optimization.  Because always storing floating-point arguments on the
6708 stack is inefficient and rarely needed, this option is not enabled by
6709 default and only is necessary when calling subroutines compiled by AIX
6710 XL compilers without optimization.
6711
6712 @item -mpe
6713 @opindex mpe
6714 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
6715 application written to use message passing with special startup code to
6716 enable the application to run.  The system must have PE installed in the
6717 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
6718 must be overridden with the @option{-specs=} option to specify the
6719 appropriate directory location.  The Parallel Environment does not
6720 support threads, so the @option{-mpe} option and the @option{-pthread}
6721 option are incompatible.
6722
6723 @item -msoft-float
6724 @itemx -mhard-float
6725 @opindex msoft-float
6726 @opindex mhard-float
6727 Generate code that does not use (uses) the floating-point register set.
6728 Software floating point emulation is provided if you use the
6729 @option{-msoft-float} option, and pass the option to GCC when linking.
6730
6731 @item -mmultiple
6732 @itemx -mno-multiple
6733 @opindex mmultiple
6734 @opindex mno-multiple
6735 Generate code that uses (does not use) the load multiple word
6736 instructions and the store multiple word instructions.  These
6737 instructions are generated by default on POWER systems, and not
6738 generated on PowerPC systems.  Do not use @option{-mmultiple} on little
6739 endian PowerPC systems, since those instructions do not work when the
6740 processor is in little endian mode.  The exceptions are PPC740 and
6741 PPC750 which permit the instructions usage in little endian mode.
6742
6743 @item -mstring
6744 @itemx -mno-string
6745 @opindex mstring
6746 @opindex mno-string
6747 Generate code that uses (does not use) the load string instructions
6748 and the store string word instructions to save multiple registers and
6749 do small block moves.  These instructions are generated by default on
6750 POWER systems, and not generated on PowerPC systems.  Do not use
6751 @option{-mstring} on little endian PowerPC systems, since those
6752 instructions do not work when the processor is in little endian mode.
6753 The exceptions are PPC740 and PPC750 which permit the instructions
6754 usage in little endian mode.
6755
6756 @item -mupdate
6757 @itemx -mno-update
6758 @opindex mupdate
6759 @opindex mno-update
6760 Generate code that uses (does not use) the load or store instructions
6761 that update the base register to the address of the calculated memory
6762 location.  These instructions are generated by default.  If you use
6763 @option{-mno-update}, there is a small window between the time that the
6764 stack pointer is updated and the address of the previous frame is
6765 stored, which means code that walks the stack frame across interrupts or
6766 signals may get corrupted data.
6767
6768 @item -mfused-madd
6769 @itemx -mno-fused-madd
6770 @opindex mfused-madd
6771 @opindex mno-fused-madd
6772 Generate code that uses (does not use) the floating point multiply and
6773 accumulate instructions.  These instructions are generated by default if
6774 hardware floating is used.
6775
6776 @item -mno-bit-align
6777 @itemx -mbit-align
6778 @opindex mno-bit-align
6779 @opindex mbit-align
6780 On System V.4 and embedded PowerPC systems do not (do) force structures
6781 and unions that contain bit-fields to be aligned to the base type of the
6782 bit-field.
6783
6784 For example, by default a structure containing nothing but 8
6785 @code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
6786 boundary and have a size of 4 bytes.  By using @option{-mno-bit-align},
6787 the structure would be aligned to a 1 byte boundary and be one byte in
6788 size.
6789
6790 @item -mno-strict-align
6791 @itemx -mstrict-align
6792 @opindex mno-strict-align
6793 @opindex mstrict-align
6794 On System V.4 and embedded PowerPC systems do not (do) assume that
6795 unaligned memory references will be handled by the system.
6796
6797 @item -mrelocatable
6798 @itemx -mno-relocatable
6799 @opindex mrelocatable
6800 @opindex mno-relocatable
6801 On embedded PowerPC systems generate code that allows (does not allow)
6802 the program to be relocated to a different address at runtime.  If you
6803 use @option{-mrelocatable} on any module, all objects linked together must
6804 be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
6805
6806 @item -mrelocatable-lib
6807 @itemx -mno-relocatable-lib
6808 @opindex mrelocatable-lib
6809 @opindex mno-relocatable-lib
6810 On embedded PowerPC systems generate code that allows (does not allow)
6811 the program to be relocated to a different address at runtime.  Modules
6812 compiled with @option{-mrelocatable-lib} can be linked with either modules
6813 compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
6814 with modules compiled with the @option{-mrelocatable} options.
6815
6816 @item -mno-toc
6817 @itemx -mtoc
6818 @opindex mno-toc
6819 @opindex mtoc
6820 On System V.4 and embedded PowerPC systems do not (do) assume that
6821 register 2 contains a pointer to a global area pointing to the addresses
6822 used in the program.
6823
6824 @item -mlittle
6825 @itemx -mlittle-endian
6826 @opindex mlittle
6827 @opindex mlittle-endian
6828 On System V.4 and embedded PowerPC systems compile code for the
6829 processor in little endian mode.  The @option{-mlittle-endian} option is
6830 the same as @option{-mlittle}.
6831
6832 @item -mbig
6833 @itemx -mbig-endian
6834 @opindex mbig
6835 @opindex mbig-endian
6836 On System V.4 and embedded PowerPC systems compile code for the
6837 processor in big endian mode.  The @option{-mbig-endian} option is
6838 the same as @option{-mbig}.
6839
6840 @item -mcall-sysv
6841 @opindex mcall-sysv
6842 On System V.4 and embedded PowerPC systems compile code using calling
6843 conventions that adheres to the March 1995 draft of the System V
6844 Application Binary Interface, PowerPC processor supplement.  This is the
6845 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
6846
6847 @item -mcall-sysv-eabi
6848 @opindex mcall-sysv-eabi
6849 Specify both @option{-mcall-sysv} and @option{-meabi} options.
6850
6851 @item -mcall-sysv-noeabi
6852 @opindex mcall-sysv-noeabi
6853 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
6854
6855 @item -mcall-aix
6856 @opindex mcall-aix
6857 On System V.4 and embedded PowerPC systems compile code using calling
6858 conventions that are similar to those used on AIX@.  This is the
6859 default if you configured GCC using @samp{powerpc-*-eabiaix}.
6860
6861 @item -mcall-solaris
6862 @opindex mcall-solaris
6863 On System V.4 and embedded PowerPC systems compile code for the Solaris
6864 operating system.
6865
6866 @item -mcall-linux
6867 @opindex mcall-linux
6868 On System V.4 and embedded PowerPC systems compile code for the
6869 Linux-based GNU system.
6870
6871 @item -mcall-gnu
6872 @opindex mcall-gnu
6873 On System V.4 and embedded PowerPC systems compile code for the
6874 Hurd-based GNU system.
6875
6876 @item -mcall-netbsd
6877 @opindex mcall-netbsd
6878 On System V.4 and embedded PowerPC systems compile code for the
6879 NetBSD operating system.
6880
6881 @item -maix-struct-return
6882 @opindex maix-struct-return
6883 Return all structures in memory (as specified by the AIX ABI)@.
6884
6885 @item -msvr4-struct-return
6886 @opindex msvr4-struct-return
6887 Return structures smaller than 8 bytes in registers (as specified by the
6888 SVR4 ABI)@.
6889
6890 @item -mabi=altivec
6891 @opindex mabi=altivec
6892 Extend the current ABI with AltiVec ABI extensions.  This does not
6893 change the default ABI, instead it adds the AltiVec ABI extensions to
6894 the current ABI@.
6895
6896 @item -mabi=no-altivec
6897 @opindex mabi=no-altivec
6898 Disable AltiVec ABI extensions for the current ABI.
6899
6900 @item -mprototype
6901 @itemx -mno-prototype
6902 @opindex mprototype
6903 @opindex mno-prototype
6904 On System V.4 and embedded PowerPC systems assume that all calls to
6905 variable argument functions are properly prototyped.  Otherwise, the
6906 compiler must insert an instruction before every non prototyped call to
6907 set or clear bit 6 of the condition code register (@var{CR}) to
6908 indicate whether floating point values were passed in the floating point
6909 registers in case the function takes a variable arguments.  With
6910 @option{-mprototype}, only calls to prototyped variable argument functions
6911 will set or clear the bit.
6912
6913 @item -msim
6914 @opindex msim
6915 On embedded PowerPC systems, assume that the startup module is called
6916 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
6917 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}.
6918 configurations.
6919
6920 @item -mmvme
6921 @opindex mmvme
6922 On embedded PowerPC systems, assume that the startup module is called
6923 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
6924 @file{libc.a}.
6925
6926 @item -mads
6927 @opindex mads
6928 On embedded PowerPC systems, assume that the startup module is called
6929 @file{crt0.o} and the standard C libraries are @file{libads.a} and
6930 @file{libc.a}.
6931
6932 @item -myellowknife
6933 @opindex myellowknife
6934 On embedded PowerPC systems, assume that the startup module is called
6935 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
6936 @file{libc.a}.
6937
6938 @item -mvxworks
6939 @opindex mvxworks
6940 On System V.4 and embedded PowerPC systems, specify that you are
6941 compiling for a VxWorks system.
6942
6943 @item -mwindiss
6944 @opindex mwindiss
6945 Specify that you are compiling for the WindISS simulation environment.
6946
6947 @item -memb
6948 @opindex memb
6949 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
6950 header to indicate that @samp{eabi} extended relocations are used.
6951
6952 @item -meabi
6953 @itemx -mno-eabi
6954 @opindex meabi
6955 @opindex mno-eabi
6956 On System V.4 and embedded PowerPC systems do (do not) adhere to the
6957 Embedded Applications Binary Interface (eabi) which is a set of
6958 modifications to the System V.4 specifications.  Selecting @option{-meabi}
6959 means that the stack is aligned to an 8 byte boundary, a function
6960 @code{__eabi} is called to from @code{main} to set up the eabi
6961 environment, and the @option{-msdata} option can use both @code{r2} and
6962 @code{r13} to point to two separate small data areas.  Selecting
6963 @option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
6964 do not call an initialization function from @code{main}, and the
6965 @option{-msdata} option will only use @code{r13} to point to a single
6966 small data area.  The @option{-meabi} option is on by default if you
6967 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
6968
6969 @item -msdata=eabi
6970 @opindex msdata=eabi
6971 On System V.4 and embedded PowerPC systems, put small initialized
6972 @code{const} global and static data in the @samp{.sdata2} section, which
6973 is pointed to by register @code{r2}.  Put small initialized
6974 non-@code{const} global and static data in the @samp{.sdata} section,
6975 which is pointed to by register @code{r13}.  Put small uninitialized
6976 global and static data in the @samp{.sbss} section, which is adjacent to
6977 the @samp{.sdata} section.  The @option{-msdata=eabi} option is
6978 incompatible with the @option{-mrelocatable} option.  The
6979 @option{-msdata=eabi} option also sets the @option{-memb} option.
6980
6981 @item -msdata=sysv
6982 @opindex msdata=sysv
6983 On System V.4 and embedded PowerPC systems, put small global and static
6984 data in the @samp{.sdata} section, which is pointed to by register
6985 @code{r13}.  Put small uninitialized global and static data in the
6986 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
6987 The @option{-msdata=sysv} option is incompatible with the
6988 @option{-mrelocatable} option.
6989
6990 @item -msdata=default
6991 @itemx -msdata
6992 @opindex msdata=default
6993 @opindex msdata
6994 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
6995 compile code the same as @option{-msdata=eabi}, otherwise compile code the
6996 same as @option{-msdata=sysv}.
6997
6998 @item -msdata-data
6999 @opindex msdata-data
7000 On System V.4 and embedded PowerPC systems, put small global and static
7001 data in the @samp{.sdata} section.  Put small uninitialized global and
7002 static data in the @samp{.sbss} section.  Do not use register @code{r13}
7003 to address small data however.  This is the default behavior unless
7004 other @option{-msdata} options are used.
7005
7006 @item -msdata=none
7007 @itemx -mno-sdata
7008 @opindex msdata=none
7009 @opindex mno-sdata
7010 On embedded PowerPC systems, put all initialized global and static data
7011 in the @samp{.data} section, and all uninitialized data in the
7012 @samp{.bss} section.
7013
7014 @item -G @var{num}
7015 @opindex G
7016 @cindex smaller data references (PowerPC)
7017 @cindex .sdata/.sdata2 references (PowerPC)
7018 On embedded PowerPC systems, put global and static items less than or
7019 equal to @var{num} bytes into the small data or bss sections instead of
7020 the normal data or bss section.  By default, @var{num} is 8.  The
7021 @option{-G @var{num}} switch is also passed to the linker.
7022 All modules should be compiled with the same @option{-G @var{num}} value.
7023
7024 @item -mregnames
7025 @itemx -mno-regnames
7026 @opindex mregnames
7027 @opindex mno-regnames
7028 On System V.4 and embedded PowerPC systems do (do not) emit register
7029 names in the assembly language output using symbolic forms.
7030
7031 @item -mlongcall
7032 @itemx -mno-longcall
7033 @opindex mlongcall
7034 @opindex mno-longcall
7035 Default to making all function calls via pointers, so that functions
7036 which reside further than 64 megabytes (67,108,864 bytes) from the
7037 current location can be called.  This setting can be overridden by the
7038 @code{shortcall} function attribute, or by @code{#pragma longcall(0)}.
7039
7040 Some linkers are capable of detecting out-of-range calls and generating
7041 glue code on the fly.  On these systems, long calls are unnecessary and
7042 generate slower code.  As of this writing, the AIX linker can do this,
7043 as can the GNU linker for PowerPC/64.  It is planned to add this feature
7044 to the GNU linker for 32-bit PowerPC systems as well.
7045
7046 In the future, we may cause GCC to ignore all longcall specifications
7047 when the linker is known to generate glue.
7048
7049 @item -pthread
7050 @opindex pthread
7051 Adds support for multithreading with the @dfn{pthreads} library.
7052 This option sets flags for both the preprocessor and linker.
7053
7054 @end table
7055
7056 @node Darwin Options
7057 @subsection Darwin Options
7058 @cindex Darwin options
7059 @table @gcctabopt
7060 @item -all_load    
7061 @opindex all_load   
7062 Loads all members of static archive libraries.
7063 See man ld(1) for more information.
7064
7065 @item -arch_errors_fatal
7066 @opindex arch_errors_fatal
7067 Cause the errors having to do with files that have the wrong architecture
7068 to be fatal.
7069
7070 @item -bind_at_load
7071 @opindex bind_at_load
7072 Causes the output file to be marked such that the dynamic linker will
7073 bind all undefined references when the file is loaded or launched.
7074
7075 @item -bundle     
7076 @opindex bundle
7077 Produce a Mach-o bundle format file.
7078 See man ld(1) for more information.
7079
7080 @item -bundle_loader @var{executable}
7081 @opindex bundle_loader
7082 This specifies the @var{executable} that will be loading the build
7083 output file being linked. See man ld(1) for more information.
7084
7085 @item -allowable_client  @var{client_name}
7086 @item -arch_only
7087
7088 @item -client_name       
7089 @item -compatibility_version
7090 @item -current_version    
7091 @item -dependency-file
7092 @item -dylib_file    
7093 @item -dylinker_install_name
7094 @item -dynamic
7095 @item -dynamiclib   
7096 @item -exported_symbols_list  
7097 @item -filelist
7098 @item -flat_namespace   
7099 @item -force_cpusubtype_ALL
7100 @item -force_flat_namespace   
7101 @item -headerpad_max_install_names
7102 @item -image_base  
7103 @item -init
7104 @item -install_name
7105 @item -keep_private_externs
7106 @item -multi_module
7107 @item -multiply_defined      
7108 @item -multiply_defined_unused      
7109 @item -noall_load  
7110 @item -nomultidefs
7111 @item -noprebind     
7112 @item -noseglinkedit
7113 @item -pagezero_size    
7114 @item -prebind
7115 @item -prebind_all_twolevel_modules
7116 @item -private_bundle
7117 @item -read_only_relocs
7118 @item -sectalign  
7119 @item -sectobjectsymbols    
7120 @item -whyload
7121 @item -seg1addr 
7122 @item -sectcreate
7123 @item -sectobjectsymbols
7124 @item -sectorder
7125 @item -seg_addr_table
7126 @item -seg_addr_table_filename
7127 @item -seglinkedit
7128 @item -segprot   
7129 @item -segs_read_only_addr
7130 @item -segs_read_write_addr
7131 @item -single_module   
7132 @item -static
7133 @item -sub_library
7134 @item -sub_umbrella 
7135 @item -twolevel_namespace
7136 @item -umbrella
7137 @item -undefined
7138 @item -unexported_symbols_list
7139 @item -weak_reference_mismatches
7140 @item -whatsloaded  
7141
7142 @opindex allowable_client
7143 @opindex arch_only    
7144 @opindex client_name
7145 @opindex compatibility_version
7146 @opindex current_version
7147 @opindex dependency-file
7148 @opindex dylib_file
7149 @opindex dylinker_install_name
7150 @opindex dynamic
7151 @opindex dynamiclib
7152 @opindex exported_symbols_list
7153 @opindex filelist  
7154 @opindex flat_namespace    
7155 @opindex force_cpusubtype_ALL
7156 @opindex force_flat_namespace
7157 @opindex headerpad_max_install_names
7158 @opindex image_base
7159 @opindex init     
7160 @opindex install_name
7161 @opindex keep_private_externs
7162 @opindex multi_module   
7163 @opindex multiply_defined
7164 @opindex multiply_defined_unused   
7165 @opindex noall_load  
7166 @opindex nomultidefs   
7167 @opindex noprebind
7168 @opindex noseglinkedit      
7169 @opindex pagezero_size
7170 @opindex prebind
7171 @opindex prebind_all_twolevel_modules
7172 @opindex private_bundle 
7173 @opindex read_only_relocs
7174 @opindex sectalign   
7175 @opindex sectobjectsymbols    
7176 @opindex whyload  
7177 @opindex seg1addr
7178 @opindex sectcreate       
7179 @opindex sectobjectsymbols 
7180 @opindex sectorder     
7181 @opindex seg_addr_table
7182 @opindex seg_addr_table_filename
7183 @opindex seglinkedit
7184 @opindex segprot
7185 @opindex segs_read_only_addr
7186 @opindex segs_read_write_addr
7187 @opindex single_module
7188 @opindex static
7189 @opindex sub_library
7190 @opindex sub_umbrella
7191 @opindex twolevel_namespace
7192 @opindex umbrella
7193 @opindex undefined
7194 @opindex unexported_symbols_list
7195 @opindex weak_reference_mismatches
7196 @opindex whatsloaded
7197
7198 This options are available for Darwin linker. Darwin linker man page
7199 describes them in detail.
7200 @end table
7201
7202
7203 @node RT Options
7204 @subsection IBM RT Options
7205 @cindex RT options
7206 @cindex IBM RT options
7207
7208 These @samp{-m} options are defined for the IBM RT PC:
7209
7210 @table @gcctabopt
7211 @item -min-line-mul
7212 @opindex min-line-mul
7213 Use an in-line code sequence for integer multiplies.  This is the
7214 default.
7215
7216 @item -mcall-lib-mul
7217 @opindex mcall-lib-mul
7218 Call @code{lmul$$} for integer multiples.
7219
7220 @item -mfull-fp-blocks
7221 @opindex mfull-fp-blocks
7222 Generate full-size floating point data blocks, including the minimum
7223 amount of scratch space recommended by IBM@.  This is the default.
7224
7225 @item -mminimum-fp-blocks
7226 @opindex mminimum-fp-blocks
7227 Do not include extra scratch space in floating point data blocks.  This
7228 results in smaller code, but slower execution, since scratch space must
7229 be allocated dynamically.
7230
7231 @cindex @file{stdarg.h} and RT PC
7232 @item -mfp-arg-in-fpregs
7233 @opindex mfp-arg-in-fpregs
7234 Use a calling sequence incompatible with the IBM calling convention in
7235 which floating point arguments are passed in floating point registers.
7236 Note that @code{stdarg.h} will not work with floating point operands
7237 if this option is specified.
7238
7239 @item -mfp-arg-in-gregs
7240 @opindex mfp-arg-in-gregs
7241 Use the normal calling convention for floating point arguments.  This is
7242 the default.
7243
7244 @item -mhc-struct-return
7245 @opindex mhc-struct-return
7246 Return structures of more than one word in memory, rather than in a
7247 register.  This provides compatibility with the MetaWare HighC (hc)
7248 compiler.  Use the option @option{-fpcc-struct-return} for compatibility
7249 with the Portable C Compiler (pcc).
7250
7251 @item -mnohc-struct-return
7252 @opindex mnohc-struct-return
7253 Return some structures of more than one word in registers, when
7254 convenient.  This is the default.  For compatibility with the
7255 IBM-supplied compilers, use the option @option{-fpcc-struct-return} or the
7256 option @option{-mhc-struct-return}.
7257 @end table
7258
7259 @node MIPS Options
7260 @subsection MIPS Options
7261 @cindex MIPS options
7262
7263 These @samp{-m} options are defined for the MIPS family of computers:
7264
7265 @table @gcctabopt
7266
7267 @item -march=@var{arch}
7268 @opindex march
7269 Generate code that will run on @var{arch}, which can be the name of a
7270 generic MIPS ISA, or the name of a particular processor.  The ISA names
7271 are: @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4}, @samp{mips32}
7272 and @samp{mips64}.  The processor names are: @samp{r2000},
7273 @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{vr4100}, @samp{vr4300},
7274 @samp{r4400}, @samp{r4600}, @samp{r4650}, @samp{vr5000}, @samp{r6000},
7275 @samp{r8000}, @samp{4kc}, @samp{4kp}, @samp{5kc}, @samp{20kc},
7276 @samp{orion}, and @samp{sb1}.  The special value @samp{from-abi} selects the
7277 most compatible architecture for the selected ABI (that is,
7278 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
7279
7280 In processor names, a final @samp{000} can be abbreviated as @samp{k}
7281 (for example, @samp{-march=r2k}).  Prefixes are optional, and
7282 @samp{vr} may be written @samp{r}.
7283
7284 GCC defines two macros based on the value of this option.  The first
7285 is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
7286 a string.  The second has the form @samp{_MIPS_ARCH_@var{foo}},
7287 where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
7288 For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
7289 to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
7290
7291 Note that the @samp{_MIPS_ARCH} macro uses the processor names given
7292 above.  In other words, it will have the full prefix and will not
7293 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
7294 the macro names the resolved architecture (either @samp{"mips1"} or
7295 @samp{"mips3"}).  It names the default architecture when no
7296 @option{-march} option is given.
7297
7298 @item -mtune=@var{arch}
7299 @opindex mtune
7300 Optimize for @var{arch}.  Among other things, this option controls
7301 the way instructions are scheduled, and the perceived cost of arithmetic
7302 operations.  The list of @var{arch} values is the same as for
7303 @option{-march}.
7304
7305 When this option is not used, GCC will optimize for the processor
7306 specified by @option{-march}.  By using @option{-march} and
7307 @option{-mtune} together, it is possible to generate code that will
7308 run on a family of processors, but optimize the code for one
7309 particular member of that family.
7310
7311 @samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
7312 @samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
7313 @samp{-march} ones described above.
7314
7315 @item -mips1
7316 @opindex mips1
7317 Equivalent to @samp{-march=mips1}.
7318
7319 @item -mips2
7320 @opindex mips2
7321 Equivalent to @samp{-march=mips2}.
7322
7323 @item -mips3
7324 @opindex mips3
7325 Equivalent to @samp{-march=mips3}.
7326
7327 @item -mips4
7328 @opindex mips4
7329 Equivalent to @samp{-march=mips4}.
7330
7331 @item -mips32
7332 @opindex mips32
7333 Equivalent to @samp{-march=mips32}.
7334
7335 @item -mips64
7336 @opindex mips64
7337 Equivalent to @samp{-march=mips64}.
7338
7339 @item -mfused-madd
7340 @itemx -mno-fused-madd
7341 @opindex mfused-madd
7342 @opindex mno-fused-madd
7343 Generate code that uses (does not use) the floating point multiply and
7344 accumulate instructions, when they are available.  These instructions
7345 are generated by default if they are available, but this may be
7346 undesirable if the extra precision causes problems or on certain chips
7347 in the mode where denormals are rounded to zero where denormals
7348 generated by multiply and accumulate instructions cause exceptions
7349 anyway.
7350
7351 @item -mfp32
7352 @opindex mfp32
7353 Assume that floating point registers are 32 bits wide.
7354
7355 @item -mfp64
7356 @opindex mfp64
7357 Assume that floating point registers are 64 bits wide.
7358
7359 @item -mgp32
7360 @opindex mgp32
7361 Assume that general purpose registers are 32 bits wide.
7362
7363 @item -mgp64
7364 @opindex mgp64
7365 Assume that general purpose registers are 64 bits wide.
7366
7367 @item -mint64
7368 @opindex mint64
7369 Force int and long types to be 64 bits wide.  See @option{-mlong32} for an
7370 explanation of the default, and the width of pointers.
7371
7372 @item -mlong64
7373 @opindex mlong64
7374 Force long types to be 64 bits wide.  See @option{-mlong32} for an
7375 explanation of the default, and the width of pointers.
7376
7377 @item -mlong32
7378 @opindex mlong32
7379 Force long, int, and pointer types to be 32 bits wide.
7380
7381 The default size of ints, longs and pointers depends on the ABI@.  All
7382 the supported ABIs use 32-bit ints.  The n64 ABI uses 64-bit longs, as
7383 does the 64-bit Cygnus EABI; the others use 32-bit longs.  Pointers
7384 are the same size as longs, or the same size as integer registers,
7385 whichever is smaller.
7386
7387 @item -mabi=32
7388 @itemx -mabi=o64
7389 @itemx -mabi=n32
7390 @itemx -mabi=64
7391 @itemx -mabi=eabi
7392 @itemx -mabi=meabi
7393 @opindex mabi=32
7394 @opindex mabi=o64
7395 @opindex mabi=n32
7396 @opindex mabi=64
7397 @opindex mabi=eabi
7398 @opindex mabi=meabi
7399 Generate code for the given ABI@.
7400
7401 Note that there are two embedded ABIs: @option{-mabi=eabi}
7402 selects the one defined by Cygnus while @option{-meabi=meabi}
7403 selects the one defined by MIPS@.  Both these ABIs have
7404 32-bit and 64-bit variants.  Normally, GCC will generate
7405 64-bit code when you select a 64-bit architecture, but you
7406 can use @option{-mgp32} to get 32-bit code instead.
7407
7408 @item -mmips-as
7409 @opindex mmips-as
7410 Generate code for the MIPS assembler, and invoke @file{mips-tfile} to
7411 add normal debug information.  This is the default for all
7412 platforms except for the OSF/1 reference platform, using the OSF/rose
7413 object format.  If the either of the @option{-gstabs} or @option{-gstabs+}
7414 switches are used, the @file{mips-tfile} program will encapsulate the
7415 stabs within MIPS ECOFF@.
7416
7417 @item -mgas
7418 @opindex mgas
7419 Generate code for the GNU assembler.  This is the default on the OSF/1
7420 reference platform, using the OSF/rose object format.  Also, this is
7421 the default if the configure option @option{--with-gnu-as} is used.
7422
7423 @item -msplit-addresses
7424 @itemx -mno-split-addresses
7425 @opindex msplit-addresses
7426 @opindex mno-split-addresses
7427 Generate code to load the high and low parts of address constants separately.
7428 This allows GCC to optimize away redundant loads of the high order
7429 bits of addresses.  This optimization requires GNU as and GNU ld.
7430 This optimization is enabled by default for some embedded targets where
7431 GNU as and GNU ld are standard.
7432
7433 @item -mrnames
7434 @itemx -mno-rnames
7435 @opindex mrnames
7436 @opindex mno-rnames
7437 The @option{-mrnames} switch says to output code using the MIPS software
7438 names for the registers, instead of the hardware names (ie, @var{a0}
7439 instead of @var{$4}).  The only known assembler that supports this option
7440 is the Algorithmics assembler.
7441
7442 @item -mgpopt
7443 @itemx -mno-gpopt
7444 @opindex mgpopt
7445 @opindex mno-gpopt
7446 The @option{-mgpopt} switch says to write all of the data declarations
7447 before the instructions in the text section, this allows the MIPS
7448 assembler to generate one word memory references instead of using two
7449 words for short global or static data items.  This is on by default if
7450 optimization is selected.
7451
7452 @item -mstats
7453 @itemx -mno-stats
7454 @opindex mstats
7455 @opindex mno-stats
7456 For each non-inline function processed, the @option{-mstats} switch
7457 causes the compiler to emit one line to the standard error file to
7458 print statistics about the program (number of registers saved, stack
7459 size, etc.).
7460
7461 @item -mmemcpy
7462 @itemx -mno-memcpy
7463 @opindex mmemcpy
7464 @opindex mno-memcpy
7465 The @option{-mmemcpy} switch makes all block moves call the appropriate
7466 string function (@samp{memcpy} or @samp{bcopy}) instead of possibly
7467 generating inline code.
7468
7469 @item -mmips-tfile
7470 @itemx -mno-mips-tfile
7471 @opindex mmips-tfile
7472 @opindex mno-mips-tfile
7473 The @option{-mno-mips-tfile} switch causes the compiler not
7474 postprocess the object file with the @file{mips-tfile} program,
7475 after the MIPS assembler has generated it to add debug support.  If
7476 @file{mips-tfile} is not run, then no local variables will be
7477 available to the debugger.  In addition, @file{stage2} and
7478 @file{stage3} objects will have the temporary file names passed to the
7479 assembler embedded in the object file, which means the objects will
7480 not compare the same.  The @option{-mno-mips-tfile} switch should only
7481 be used when there are bugs in the @file{mips-tfile} program that
7482 prevents compilation.
7483
7484 @item -msoft-float
7485 @opindex msoft-float
7486 Generate output containing library calls for floating point.
7487 @strong{Warning:} the requisite libraries are not part of GCC@.
7488 Normally the facilities of the machine's usual C compiler are used, but
7489 this can't be done directly in cross-compilation.  You must make your
7490 own arrangements to provide suitable library functions for
7491 cross-compilation.
7492
7493 @item -mhard-float
7494 @opindex mhard-float
7495 Generate output containing floating point instructions.  This is the
7496 default if you use the unmodified sources.
7497
7498 @item -mabicalls
7499 @itemx -mno-abicalls
7500 @opindex mabicalls
7501 @opindex mno-abicalls
7502 Emit (or do not emit) the pseudo operations @samp{.abicalls},
7503 @samp{.cpload}, and @samp{.cprestore} that some System V.4 ports use for
7504 position independent code.
7505
7506 @item -mlong-calls
7507 @itemx -mno-long-calls
7508 @opindex mlong-calls
7509 @opindex mno-long-calls
7510 Do all calls with the @samp{JALR} instruction, which requires
7511 loading up a function's address into a register before the call.
7512 You need to use this switch, if you call outside of the current
7513 512 megabyte segment to functions that are not through pointers.
7514
7515 @item -mhalf-pic
7516 @itemx -mno-half-pic
7517 @opindex mhalf-pic
7518 @opindex mno-half-pic
7519 Put pointers to extern references into the data section and load them
7520 up, rather than put the references in the text section.
7521
7522 @item -membedded-pic
7523 @itemx -mno-embedded-pic
7524 @opindex membedded-pic
7525 @opindex mno-embedded-pic
7526 Generate PIC code suitable for some embedded systems.  All calls are
7527 made using PC relative address, and all data is addressed using the $gp
7528 register.  No more than 65536 bytes of global data may be used.  This
7529 requires GNU as and GNU ld which do most of the work.  This currently
7530 only works on targets which use ECOFF; it does not work with ELF@.
7531
7532 @item -membedded-data
7533 @itemx -mno-embedded-data
7534 @opindex membedded-data
7535 @opindex mno-embedded-data
7536 Allocate variables to the read-only data section first if possible, then
7537 next in the small data section if possible, otherwise in data.  This gives
7538 slightly slower code than the default, but reduces the amount of RAM required
7539 when executing, and thus may be preferred for some embedded systems.
7540
7541 @item -muninit-const-in-rodata
7542 @itemx -mno-uninit-const-in-rodata
7543 @opindex muninit-const-in-rodata
7544 @opindex mno-uninit-const-in-rodata
7545 When used together with @option{-membedded-data}, it will always store uninitialized
7546 const variables in the read-only data section.
7547
7548 @item -msingle-float
7549 @itemx -mdouble-float
7550 @opindex msingle-float
7551 @opindex mdouble-float
7552 The @option{-msingle-float} switch tells gcc to assume that the floating
7553 point coprocessor only supports single precision operations, as on the
7554 @samp{r4650} chip.  The @option{-mdouble-float} switch permits gcc to use
7555 double precision operations.  This is the default.
7556
7557 @item -mmad
7558 @itemx -mno-mad
7559 @opindex mmad
7560 @opindex mno-mad
7561 Permit use of the @samp{mad}, @samp{madu} and @samp{mul} instructions,
7562 as on the @samp{r4650} chip.
7563
7564 @item -m4650
7565 @opindex m4650
7566 Turns on @option{-msingle-float}, @option{-mmad}, and, at least for now,
7567 @option{-mcpu=r4650}.
7568
7569 @item -mips16
7570 @itemx -mno-mips16
7571 @opindex mips16
7572 @opindex mno-mips16
7573 Enable 16-bit instructions.
7574
7575 @item -mentry
7576 @opindex mentry
7577 Use the entry and exit pseudo ops.  This option can only be used with
7578 @option{-mips16}.
7579
7580 @item -EL
7581 @opindex EL
7582 Compile code for the processor in little endian mode.
7583 The requisite libraries are assumed to exist.
7584
7585 @item -EB
7586 @opindex EB
7587 Compile code for the processor in big endian mode.
7588 The requisite libraries are assumed to exist.
7589
7590 @item -G @var{num}
7591 @opindex G
7592 @cindex smaller data references (MIPS)
7593 @cindex gp-relative references (MIPS)
7594 Put global and static items less than or equal to @var{num} bytes into
7595 the small data or bss sections instead of the normal data or bss
7596 section.  This allows the assembler to emit one word memory reference
7597 instructions based on the global pointer (@var{gp} or @var{$28}),
7598 instead of the normal two words used.  By default, @var{num} is 8 when
7599 the MIPS assembler is used, and 0 when the GNU assembler is used.  The
7600 @option{-G @var{num}} switch is also passed to the assembler and linker.
7601 All modules should be compiled with the same @option{-G @var{num}}
7602 value.
7603
7604 @item -nocpp
7605 @opindex nocpp
7606 Tell the MIPS assembler to not run its preprocessor over user
7607 assembler files (with a @samp{.s} suffix) when assembling them.
7608
7609 @item -mfix7000
7610 @opindex mfix7000
7611 Pass an option to gas which will cause nops to be inserted if
7612 the read of the destination register of an mfhi or mflo instruction
7613 occurs in the following two instructions.
7614
7615 @item -no-crt0
7616 @opindex no-crt0
7617 Do not include the default crt0.
7618
7619 @item -mflush-func=@var{func}
7620 @itemx -mno-flush-func
7621 @opindex mflush-func
7622 Specifies the function to call to flush the I and D caches, or to not
7623 call any such function.  If called, the function must take the same
7624 arguments as the common @code{_flush_func()}, that is, the address of the
7625 memory range for which the cache is being flushed, the size of the
7626 memory range, and the number 3 (to flush both caches).  The default
7627 depends on the target gcc was configured for, but commonly is either
7628 @samp{_flush_func} or @samp{__cpu_flush}.
7629
7630 @item -mbranch-likely
7631 @itemx -mno-branch-likely
7632 @opindex mbranch-likely
7633 @opindex mno-branch-likely
7634 Enable or disable use of Branch Likely instructions, regardless of the
7635 default for the selected architecture.  By default, Branch Likely
7636 instructions may be generated if they are supported by the selected
7637 architecture.  An exception is for the MIPS32 and MIPS64 architectures
7638 and processors which implement those architectures; for those, Branch
7639 Likely instructions will not be generated by default because the MIPS32
7640 and MIPS64 architectures specifically deprecate their use.
7641 @end table
7642
7643 @node i386 and x86-64 Options
7644 @subsection Intel 386 and AMD x86-64 Options
7645 @cindex i386 Options
7646 @cindex x86-64 Options
7647 @cindex Intel 386 Options
7648 @cindex AMD x86-64 Options
7649
7650 These @samp{-m} options are defined for the i386 and x86-64 family of
7651 computers:
7652
7653 @table @gcctabopt
7654 @item -mcpu=@var{cpu-type}
7655 @opindex mcpu
7656 Tune to @var{cpu-type} everything applicable about the generated code, except
7657 for the ABI and the set of available instructions.  The choices for
7658 @var{cpu-type} are @samp{i386}, @samp{i486}, @samp{i586}, @samp{i686},
7659 @samp{pentium}, @samp{pentium-mmx}, @samp{pentiumpro}, @samp{pentium2},
7660 @samp{pentium3}, @samp{pentium4}, @samp{k6}, @samp{k6-2}, @samp{k6-3},
7661 @samp{athlon}, @samp{athlon-tbird}, @samp{athlon-4}, @samp{athlon-xp},
7662 @samp{athlon-mp}, @samp{winchip-c6}, @samp{winchip2}, @samp{k8} and @samp{c3}.
7663
7664 While picking a specific @var{cpu-type} will schedule things appropriately
7665 for that particular chip, the compiler will not generate any code that
7666 does not run on the i386 without the @option{-march=@var{cpu-type}} option
7667 being used.  @samp{i586} is equivalent to @samp{pentium} and @samp{i686}
7668 is equivalent to @samp{pentiumpro}.  @samp{k6} and @samp{athlon} are the
7669 AMD chips as opposed to the Intel ones.
7670
7671 @item -march=@var{cpu-type}
7672 @opindex march
7673 Generate instructions for the machine type @var{cpu-type}.  The choices
7674 for @var{cpu-type} are the same as for @option{-mcpu}.  Moreover,
7675 specifying @option{-march=@var{cpu-type}} implies @option{-mcpu=@var{cpu-type}}.
7676
7677 @item -m386
7678 @itemx -m486
7679 @itemx -mpentium
7680 @itemx -mpentiumpro
7681 @opindex m386
7682 @opindex m486
7683 @opindex mpentium
7684 @opindex mpentiumpro
7685 These options are synonyms for @option{-mcpu=i386}, @option{-mcpu=i486},
7686 @option{-mcpu=pentium}, and @option{-mcpu=pentiumpro} respectively.
7687 These synonyms are deprecated.
7688
7689 @item -mfpmath=@var{unit}
7690 @opindex march
7691 generate floating point arithmetics for selected unit @var{unit}.  the choices
7692 for @var{unit} are:
7693
7694 @table @samp
7695 @item 387
7696 Use the standard 387 floating point coprocessor present majority of chips and
7697 emulated otherwise.  Code compiled with this option will run almost everywhere.
7698 The temporary results are computed in 80bit precision instead of precision
7699 specified by the type resulting in slightly different results compared to most
7700 of other chips. See @option{-ffloat-store} for more detailed description.
7701
7702 This is the default choice for i386 compiler.
7703
7704 @item sse
7705 Use scalar floating point instructions present in the SSE instruction set.
7706 This instruction set is supported by Pentium3 and newer chips, in the AMD line
7707 by Athlon-4, Athlon-xp and Athlon-mp chips.  The earlier version of SSE
7708 instruction set supports only single precision arithmetics, thus the double and
7709 extended precision arithmetics is still done using 387.  Later version, present
7710 only in Pentium4 and the future AMD x86-64 chips supports double precision
7711 arithmetics too.
7712
7713 For i387 you need to use @option{-march=@var{cpu-type}}, @option{-msse} or
7714 @option{-msse2} switches to enable SSE extensions and make this option
7715 effective.  For x86-64 compiler, these extensions are enabled by default.
7716
7717 The resulting code should be considerably faster in majority of cases and avoid
7718 the numerical instability problems of 387 code, but may break some existing
7719 code that expects temporaries to be 80bit.
7720
7721 This is the default choice for x86-64 compiler.
7722
7723 @item sse,387
7724 Attempt to utilize both instruction sets at once.  This effectively double the
7725 amount of available registers and on chips with separate execution units for
7726 387 and SSE the execution resources too.  Use this option with care, as it is
7727 still experimental, because gcc register allocator does not model separate
7728 functional units well resulting in instable performance.
7729 @end table
7730
7731 @item -masm=@var{dialect}
7732 @opindex masm=@var{dialect}
7733 Output asm instructions using selected @var{dialect}. Supported choices are
7734 @samp{intel} or @samp{att} (the default one).
7735
7736 @item -mieee-fp
7737 @itemx -mno-ieee-fp
7738 @opindex mieee-fp
7739 @opindex mno-ieee-fp
7740 Control whether or not the compiler uses IEEE floating point
7741 comparisons.  These handle correctly the case where the result of a
7742 comparison is unordered.
7743
7744 @item -msoft-float
7745 @opindex msoft-float
7746 Generate output containing library calls for floating point.
7747 @strong{Warning:} the requisite libraries are not part of GCC@.
7748 Normally the facilities of the machine's usual C compiler are used, but
7749 this can't be done directly in cross-compilation.  You must make your
7750 own arrangements to provide suitable library functions for
7751 cross-compilation.
7752
7753 On machines where a function returns floating point results in the 80387
7754 register stack, some floating point opcodes may be emitted even if
7755 @option{-msoft-float} is used.
7756
7757 @item -mno-fp-ret-in-387
7758 @opindex mno-fp-ret-in-387
7759 Do not use the FPU registers for return values of functions.
7760
7761 The usual calling convention has functions return values of types
7762 @code{float} and @code{double} in an FPU register, even if there
7763 is no FPU@.  The idea is that the operating system should emulate
7764 an FPU@.
7765
7766 The option @option{-mno-fp-ret-in-387} causes such values to be returned
7767 in ordinary CPU registers instead.
7768
7769 @item -mno-fancy-math-387
7770 @opindex mno-fancy-math-387
7771 Some 387 emulators do not support the @code{sin}, @code{cos} and
7772 @code{sqrt} instructions for the 387.  Specify this option to avoid
7773 generating those instructions.  This option is the default on FreeBSD,
7774 OpenBSD and NetBSD@.  This option is overridden when @option{-march}
7775 indicates that the target cpu will always have an FPU and so the
7776 instruction will not need emulation.  As of revision 2.6.1, these
7777 instructions are not generated unless you also use the
7778 @option{-funsafe-math-optimizations} switch.
7779
7780 @item -malign-double
7781 @itemx -mno-align-double
7782 @opindex malign-double
7783 @opindex mno-align-double
7784 Control whether GCC aligns @code{double}, @code{long double}, and
7785 @code{long long} variables on a two word boundary or a one word
7786 boundary.  Aligning @code{double} variables on a two word boundary will
7787 produce code that runs somewhat faster on a @samp{Pentium} at the
7788 expense of more memory.
7789
7790 @strong{Warning:} if you use the @samp{-malign-double} switch,
7791 structures containing the above types will be aligned differently than
7792 the published application binary interface specifications for the 386.
7793
7794 @item -m128bit-long-double
7795 @opindex m128bit-long-double
7796 Control the size of @code{long double} type. i386 application binary interface
7797 specify the size to be 12 bytes, while modern architectures (Pentium and newer)
7798 prefer @code{long double} aligned to 8 or 16 byte boundary.  This is
7799 impossible to reach with 12 byte long doubles in the array accesses.
7800
7801 @strong{Warning:} if you use the @option{-m128bit-long-double} switch, the
7802 structures and arrays containing @code{long double} will change their size as
7803 well as function calling convention for function taking @code{long double}
7804 will be modified.
7805
7806 @item -m96bit-long-double
7807 @opindex m96bit-long-double
7808 Set the size of @code{long double} to 96 bits as required by the i386
7809 application binary interface.  This is the default.
7810
7811 @item -msvr3-shlib
7812 @itemx -mno-svr3-shlib
7813 @opindex msvr3-shlib
7814 @opindex mno-svr3-shlib
7815 Control whether GCC places uninitialized local variables into the
7816 @code{bss} or @code{data} segments.  @option{-msvr3-shlib} places them
7817 into @code{bss}.  These options are meaningful only on System V Release 3.
7818
7819 @item -mrtd
7820 @opindex mrtd
7821 Use a different function-calling convention, in which functions that
7822 take a fixed number of arguments return with the @code{ret} @var{num}
7823 instruction, which pops their arguments while returning.  This saves one
7824 instruction in the caller since there is no need to pop the arguments
7825 there.
7826
7827 You can specify that an individual function is called with this calling
7828 sequence with the function attribute @samp{stdcall}.  You can also
7829 override the @option{-mrtd} option by using the function attribute
7830 @samp{cdecl}.  @xref{Function Attributes}.
7831
7832 @strong{Warning:} this calling convention is incompatible with the one
7833 normally used on Unix, so you cannot use it if you need to call
7834 libraries compiled with the Unix compiler.
7835
7836 Also, you must provide function prototypes for all functions that
7837 take variable numbers of arguments (including @code{printf});
7838 otherwise incorrect code will be generated for calls to those
7839 functions.
7840
7841 In addition, seriously incorrect code will result if you call a
7842 function with too many arguments.  (Normally, extra arguments are
7843 harmlessly ignored.)
7844
7845 @item -mregparm=@var{num}
7846 @opindex mregparm
7847 Control how many registers are used to pass integer arguments.  By
7848 default, no registers are used to pass arguments, and at most 3
7849 registers can be used.  You can control this behavior for a specific
7850 function by using the function attribute @samp{regparm}.
7851 @xref{Function Attributes}.
7852
7853 @strong{Warning:} if you use this switch, and
7854 @var{num} is nonzero, then you must build all modules with the same
7855 value, including any libraries.  This includes the system libraries and
7856 startup modules.
7857
7858 @item -mpreferred-stack-boundary=@var{num}
7859 @opindex mpreferred-stack-boundary
7860 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
7861 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
7862 the default is 4 (16 bytes or 128 bits), except when optimizing for code
7863 size (@option{-Os}), in which case the default is the minimum correct
7864 alignment (4 bytes for x86, and 8 bytes for x86-64).
7865
7866 On Pentium and PentiumPro, @code{double} and @code{long double} values
7867 should be aligned to an 8 byte boundary (see @option{-malign-double}) or
7868 suffer significant run time performance penalties.  On Pentium III, the
7869 Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar
7870 penalties if it is not 16 byte aligned.
7871
7872 To ensure proper alignment of this values on the stack, the stack boundary
7873 must be as aligned as that required by any value stored on the stack.
7874 Further, every function must be generated such that it keeps the stack
7875 aligned.  Thus calling a function compiled with a higher preferred
7876 stack boundary from a function compiled with a lower preferred stack
7877 boundary will most likely misalign the stack.  It is recommended that
7878 libraries that use callbacks always use the default setting.
7879
7880 This extra alignment does consume extra stack space, and generally
7881 increases code size.  Code that is sensitive to stack space usage, such
7882 as embedded systems and operating system kernels, may want to reduce the
7883 preferred alignment to @option{-mpreferred-stack-boundary=2}.
7884
7885 @item -mmmx
7886 @itemx -mno-mmx
7887 @item -msse
7888 @itemx -mno-sse
7889 @item -msse2
7890 @itemx -mno-sse2
7891 @item -m3dnow
7892 @itemx -mno-3dnow
7893 @opindex mmmx
7894 @opindex mno-mmx
7895 @opindex msse
7896 @opindex mno-sse
7897 @opindex m3dnow
7898 @opindex mno-3dnow
7899 These switches enable or disable the use of built-in functions that allow
7900 direct access to the MMX, SSE and 3Dnow extensions of the instruction set.
7901
7902 @xref{X86 Built-in Functions}, for details of the functions enabled
7903 and disabled by these switches.
7904
7905 To have SSE/SSE2 instructions generated automatically from floating-point
7906 code, see @option{-mfpmath=sse}.
7907
7908 @item -mpush-args
7909 @itemx -mno-push-args
7910 @opindex mpush-args
7911 @opindex mno-push-args
7912 Use PUSH operations to store outgoing parameters.  This method is shorter
7913 and usually equally fast as method using SUB/MOV operations and is enabled
7914 by default.  In some cases disabling it may improve performance because of
7915 improved scheduling and reduced dependencies.
7916
7917 @item -maccumulate-outgoing-args
7918 @opindex maccumulate-outgoing-args
7919 If enabled, the maximum amount of space required for outgoing arguments will be
7920 computed in the function prologue.  This is faster on most modern CPUs
7921 because of reduced dependencies, improved scheduling and reduced stack usage
7922 when preferred stack boundary is not equal to 2.  The drawback is a notable
7923 increase in code size.  This switch implies @option{-mno-push-args}.
7924
7925 @item -mthreads
7926 @opindex mthreads
7927 Support thread-safe exception handling on @samp{Mingw32}.  Code that relies
7928 on thread-safe exception handling must compile and link all code with the
7929 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
7930 @option{-D_MT}; when linking, it links in a special thread helper library
7931 @option{-lmingwthrd} which cleans up per thread exception handling data.
7932
7933 @item -mno-align-stringops
7934 @opindex mno-align-stringops
7935 Do not align destination of inlined string operations.  This switch reduces
7936 code size and improves performance in case the destination is already aligned,
7937 but gcc don't know about it.
7938
7939 @item -minline-all-stringops
7940 @opindex minline-all-stringops
7941 By default GCC inlines string operations only when destination is known to be
7942 aligned at least to 4 byte boundary.  This enables more inlining, increase code
7943 size, but may improve performance of code that depends on fast memcpy, strlen
7944 and memset for short lengths.
7945
7946 @item -momit-leaf-frame-pointer
7947 @opindex momit-leaf-frame-pointer
7948 Don't keep the frame pointer in a register for leaf functions.  This
7949 avoids the instructions to save, set up and restore frame pointers and
7950 makes an extra register available in leaf functions.  The option
7951 @option{-fomit-frame-pointer} removes the frame pointer for all functions
7952 which might make debugging harder.
7953 @end table
7954
7955 These @samp{-m} switches are supported in addition to the above
7956 on AMD x86-64 processors in 64-bit environments.
7957
7958 @table @gcctabopt
7959 @item -m32
7960 @itemx -m64
7961 @opindex m32
7962 @opindex m64
7963 Generate code for a 32-bit or 64-bit environment.
7964 The 32-bit environment sets int, long and pointer to 32 bits and
7965 generates code that runs on any i386 system.
7966 The 64-bit environment sets int to 32 bits and long and pointer
7967 to 64 bits and generates code for AMD's x86-64 architecture.
7968
7969 @item -mno-red-zone
7970 @opindex no-red-zone
7971 Do not use a so called red zone for x86-64 code.  The red zone is mandated
7972 by the x86-64 ABI, it is a 128-byte area beyond the location of the
7973 stack pointer that will not be modified by signal or interrupt handlers
7974 and therefore can be used for temporary data without adjusting the stack
7975 pointer.  The flag @option{-mno-red-zone} disables this red zone.
7976
7977 @item -mcmodel=small
7978 @opindex mcmodel=small
7979 Generate code for the small code model: the program and its symbols must
7980 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
7981 Programs can be statically or dynamically linked.  This is the default
7982 code model.
7983
7984 @item -mcmodel=kernel
7985 @opindex mcmodel=kernel
7986 Generate code for the kernel code model.  The kernel runs in the
7987 negative 2 GB of the address space.
7988 This model has to be used for Linux kernel code.
7989
7990 @item -mcmodel=medium
7991 @opindex mcmodel=medium
7992 Generate code for the medium model: The program is linked in the lower 2
7993 GB of the address space but symbols can be located anywhere in the
7994 address space.  Programs can be statically or dynamically linked, but
7995 building of shared libraries are not supported with the medium model.
7996
7997 @item -mcmodel=large
7998 @opindex mcmodel=large
7999 Generate code for the large model: This model makes no assumptions
8000 about addresses and sizes of sections.  Currently GCC does not implement
8001 this model.
8002 @end table
8003
8004 @node HPPA Options
8005 @subsection HPPA Options
8006 @cindex HPPA Options
8007
8008 These @samp{-m} options are defined for the HPPA family of computers:
8009
8010 @table @gcctabopt
8011 @item -march=@var{architecture-type}
8012 @opindex march
8013 Generate code for the specified architecture.  The choices for
8014 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
8015 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
8016 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
8017 architecture option for your machine.  Code compiled for lower numbered
8018 architectures will run on higher numbered architectures, but not the
8019 other way around.
8020
8021 PA 2.0 support currently requires gas snapshot 19990413 or later.  The
8022 next release of binutils (current is 2.9.1) will probably contain PA 2.0
8023 support.
8024
8025 @item -mpa-risc-1-0
8026 @itemx -mpa-risc-1-1
8027 @itemx -mpa-risc-2-0
8028 @opindex mpa-risc-1-0
8029 @opindex mpa-risc-1-1
8030 @opindex mpa-risc-2-0
8031 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
8032
8033 @item -mbig-switch
8034 @opindex mbig-switch
8035 Generate code suitable for big switch tables.  Use this option only if
8036 the assembler/linker complain about out of range branches within a switch
8037 table.
8038
8039 @item -mjump-in-delay
8040 @opindex mjump-in-delay
8041 Fill delay slots of function calls with unconditional jump instructions
8042 by modifying the return pointer for the function call to be the target
8043 of the conditional jump.
8044
8045 @item -mdisable-fpregs
8046 @opindex mdisable-fpregs
8047 Prevent floating point registers from being used in any manner.  This is
8048 necessary for compiling kernels which perform lazy context switching of
8049 floating point registers.  If you use this option and attempt to perform
8050 floating point operations, the compiler will abort.
8051
8052 @item -mdisable-indexing
8053 @opindex mdisable-indexing
8054 Prevent the compiler from using indexing address modes.  This avoids some
8055 rather obscure problems when compiling MIG generated code under MACH@.
8056
8057 @item -mno-space-regs
8058 @opindex mno-space-regs
8059 Generate code that assumes the target has no space registers.  This allows
8060 GCC to generate faster indirect calls and use unscaled index address modes.
8061
8062 Such code is suitable for level 0 PA systems and kernels.
8063
8064 @item -mfast-indirect-calls
8065 @opindex mfast-indirect-calls
8066 Generate code that assumes calls never cross space boundaries.  This
8067 allows GCC to emit code which performs faster indirect calls.
8068
8069 This option will not work in the presence of shared libraries or nested
8070 functions.
8071
8072 @item -mlong-load-store
8073 @opindex mlong-load-store
8074 Generate 3-instruction load and store sequences as sometimes required by
8075 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
8076 the HP compilers.
8077
8078 @item -mportable-runtime
8079 @opindex mportable-runtime
8080 Use the portable calling conventions proposed by HP for ELF systems.
8081
8082 @item -mgas
8083 @opindex mgas
8084 Enable the use of assembler directives only GAS understands.
8085
8086 @item -mschedule=@var{cpu-type}
8087 @opindex mschedule
8088 Schedule code according to the constraints for the machine type
8089 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
8090 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
8091 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
8092 proper scheduling option for your machine.  The default scheduling is
8093 @samp{8000}.
8094
8095 @item -mlinker-opt
8096 @opindex mlinker-opt
8097 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
8098 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
8099 linkers in which they give bogus error messages when linking some programs.
8100
8101 @item -msoft-float
8102 @opindex msoft-float
8103 Generate output containing library calls for floating point.
8104 @strong{Warning:} the requisite libraries are not available for all HPPA
8105 targets.  Normally the facilities of the machine's usual C compiler are
8106 used, but this cannot be done directly in cross-compilation.  You must make
8107 your own arrangements to provide suitable library functions for
8108 cross-compilation.  The embedded target @samp{hppa1.1-*-pro}
8109 does provide software floating point support.
8110
8111 @option{-msoft-float} changes the calling convention in the output file;
8112 therefore, it is only useful if you compile @emph{all} of a program with
8113 this option.  In particular, you need to compile @file{libgcc.a}, the
8114 library that comes with GCC, with @option{-msoft-float} in order for
8115 this to work.
8116
8117 @item -msio
8118 @opindex msio
8119 Generate the predefine, @code{_SIO}, for server IO.  The default is
8120 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
8121 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO.  These
8122 options are available under HP-UX and HI-UX.
8123
8124 @item -mgnu-ld
8125 @opindex gnu-ld
8126 Use GNU ld specific options.  This passes @option{-shared} to ld when
8127 building a shared library.  It is the default when GCC is configured,
8128 explicitly or implicitly, with the GNU linker.  This option does not
8129 have any affect on which ld is called, it only changes what parameters
8130 are passed to that ld.  The ld that is called is determined by the
8131 @option{--with-ld} configure option, gcc's program search path, and
8132 finally by the user's @env{PATH}.  The linker used by GCC can be printed
8133 using @samp{which `gcc -print-prog-name=ld`}.
8134
8135 @item -mhp-ld
8136 @opindex hp-ld
8137 Use HP ld specific options.  This passes @option{-b} to ld when building
8138 a shared library and passes @option{+Accept TypeMismatch} to ld on all
8139 links.  It is the default when GCC is configured, explicitly or
8140 implicitly, with the HP linker.  This option does not have any affect on
8141 which ld is called, it only changes what parameters are passed to that
8142 ld.  The ld that is called is determined by the @option{--with-ld}
8143 configure option, gcc's program search path, and finally by the user's
8144 @env{PATH}.  The linker used by GCC can be printed using @samp{which
8145 `gcc -print-prog-name=ld`}.
8146
8147 @item -mlong-calls
8148 @opindex mno-long-calls
8149 Generate code that uses long call sequences.  This ensures that a call
8150 is always able to reach linker generated stubs.  The default is to generate
8151 long calls only when the distance from the call site to the beginning
8152 of the function or translation unit, as the case may be, exceeds a
8153 predefined limit set by the branch type being used.  The limits for
8154 normal calls are 7,600,000 and 240,000 bytes, respectively for the
8155 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
8156 240,000 bytes.
8157
8158 Distances are measured from the beginning of functions when using the
8159 @option{-ffunction-sections} option, or when using the @option{-mgas}
8160 and @option{-mno-portable-runtime} options together under HP-UX with
8161 the SOM linker.
8162
8163 It is normally not desirable to use this option as it will degrade
8164 performance.  However, it may be useful in large applications,
8165 particularly when partial linking is used to build the application.
8166
8167 The types of long calls used depends on the capabilities of the
8168 assembler and linker, and the type of code being generated.  The
8169 impact on systems that support long absolute calls, and long pic
8170 symbol-difference or pc-relative calls should be relatively small.
8171 However, an indirect call is used on 32-bit ELF systems in pic code
8172 and it is quite long.
8173
8174 @end table
8175
8176 @node Intel 960 Options
8177 @subsection Intel 960 Options
8178
8179 These @samp{-m} options are defined for the Intel 960 implementations:
8180
8181 @table @gcctabopt
8182 @item -m@var{cpu-type}
8183 @opindex mka
8184 @opindex mkb
8185 @opindex mmc
8186 @opindex mca
8187 @opindex mcf
8188 @opindex msa
8189 @opindex msb
8190 Assume the defaults for the machine type @var{cpu-type} for some of
8191 the other options, including instruction scheduling, floating point
8192 support, and addressing modes.  The choices for @var{cpu-type} are
8193 @samp{ka}, @samp{kb}, @samp{mc}, @samp{ca}, @samp{cf},
8194 @samp{sa}, and @samp{sb}.
8195 The default is
8196 @samp{kb}.
8197
8198 @item -mnumerics
8199 @itemx -msoft-float
8200 @opindex mnumerics
8201 @opindex msoft-float
8202 The @option{-mnumerics} option indicates that the processor does support
8203 floating-point instructions.  The @option{-msoft-float} option indicates
8204 that floating-point support should not be assumed.
8205
8206 @item -mleaf-procedures
8207 @itemx -mno-leaf-procedures
8208 @opindex mleaf-procedures
8209 @opindex mno-leaf-procedures
8210 Do (or do not) attempt to alter leaf procedures to be callable with the
8211 @code{bal} instruction as well as @code{call}.  This will result in more
8212 efficient code for explicit calls when the @code{bal} instruction can be
8213 substituted by the assembler or linker, but less efficient code in other
8214 cases, such as calls via function pointers, or using a linker that doesn't
8215 support this optimization.
8216
8217 @item -mtail-call
8218 @itemx -mno-tail-call
8219 @opindex mtail-call
8220 @opindex mno-tail-call
8221 Do (or do not) make additional attempts (beyond those of the
8222 machine-independent portions of the compiler) to optimize tail-recursive
8223 calls into branches.  You may not want to do this because the detection of
8224 cases where this is not valid is not totally complete.  The default is
8225 @option{-mno-tail-call}.
8226
8227 @item -mcomplex-addr
8228 @itemx -mno-complex-addr
8229 @opindex mcomplex-addr
8230 @opindex mno-complex-addr
8231 Assume (or do not assume) that the use of a complex addressing mode is a
8232 win on this implementation of the i960.  Complex addressing modes may not
8233 be worthwhile on the K-series, but they definitely are on the C-series.
8234 The default is currently @option{-mcomplex-addr} for all processors except
8235 the CB and CC@.
8236
8237 @item -mcode-align
8238 @itemx -mno-code-align
8239 @opindex mcode-align
8240 @opindex mno-code-align
8241 Align code to 8-byte boundaries for faster fetching (or don't bother).
8242 Currently turned on by default for C-series implementations only.
8243
8244 @ignore
8245 @item -mclean-linkage
8246 @itemx -mno-clean-linkage
8247 @opindex mclean-linkage
8248 @opindex mno-clean-linkage
8249 These options are not fully implemented.
8250 @end ignore
8251
8252 @item -mic-compat
8253 @itemx -mic2.0-compat
8254 @itemx -mic3.0-compat
8255 @opindex mic-compat
8256 @opindex mic2.0-compat
8257 @opindex mic3.0-compat
8258 Enable compatibility with iC960 v2.0 or v3.0.
8259
8260 @item -masm-compat
8261 @itemx -mintel-asm
8262 @opindex masm-compat
8263 @opindex mintel-asm
8264 Enable compatibility with the iC960 assembler.
8265
8266 @item -mstrict-align
8267 @itemx -mno-strict-align
8268 @opindex mstrict-align
8269 @opindex mno-strict-align
8270 Do not permit (do permit) unaligned accesses.
8271
8272 @item -mold-align
8273 @opindex mold-align
8274 Enable structure-alignment compatibility with Intel's gcc release version
8275 1.3 (based on gcc 1.37).  This option implies @option{-mstrict-align}.
8276
8277 @item -mlong-double-64
8278 @opindex mlong-double-64
8279 Implement type @samp{long double} as 64-bit floating point numbers.
8280 Without the option @samp{long double} is implemented by 80-bit
8281 floating point numbers.  The only reason we have it because there is
8282 no 128-bit @samp{long double} support in @samp{fp-bit.c} yet.  So it
8283 is only useful for people using soft-float targets.  Otherwise, we
8284 should recommend against use of it.
8285
8286 @end table
8287
8288 @node DEC Alpha Options
8289 @subsection DEC Alpha Options
8290
8291 These @samp{-m} options are defined for the DEC Alpha implementations:
8292
8293 @table @gcctabopt
8294 @item -mno-soft-float
8295 @itemx -msoft-float
8296 @opindex mno-soft-float
8297 @opindex msoft-float
8298 Use (do not use) the hardware floating-point instructions for
8299 floating-point operations.  When @option{-msoft-float} is specified,
8300 functions in @file{libgcc.a} will be used to perform floating-point
8301 operations.  Unless they are replaced by routines that emulate the
8302 floating-point operations, or compiled in such a way as to call such
8303 emulations routines, these routines will issue floating-point
8304 operations.   If you are compiling for an Alpha without floating-point
8305 operations, you must ensure that the library is built so as not to call
8306 them.
8307
8308 Note that Alpha implementations without floating-point operations are
8309 required to have floating-point registers.
8310
8311 @item -mfp-reg
8312 @itemx -mno-fp-regs
8313 @opindex mfp-reg
8314 @opindex mno-fp-regs
8315 Generate code that uses (does not use) the floating-point register set.
8316 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
8317 register set is not used, floating point operands are passed in integer
8318 registers as if they were integers and floating-point results are passed
8319 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
8320 so any function with a floating-point argument or return value called by code
8321 compiled with @option{-mno-fp-regs} must also be compiled with that
8322 option.
8323
8324 A typical use of this option is building a kernel that does not use,
8325 and hence need not save and restore, any floating-point registers.
8326
8327 @item -mieee
8328 @opindex mieee
8329 The Alpha architecture implements floating-point hardware optimized for
8330 maximum performance.  It is mostly compliant with the IEEE floating
8331 point standard.  However, for full compliance, software assistance is
8332 required.  This option generates code fully IEEE compliant code
8333 @emph{except} that the @var{inexact-flag} is not maintained (see below).
8334 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
8335 defined during compilation.  The resulting code is less efficient but is
8336 able to correctly support denormalized numbers and exceptional IEEE
8337 values such as not-a-number and plus/minus infinity.  Other Alpha
8338 compilers call this option @option{-ieee_with_no_inexact}.
8339
8340 @item -mieee-with-inexact
8341 @opindex mieee-with-inexact
8342 This is like @option{-mieee} except the generated code also maintains
8343 the IEEE @var{inexact-flag}.  Turning on this option causes the
8344 generated code to implement fully-compliant IEEE math.  In addition to
8345 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
8346 macro.  On some Alpha implementations the resulting code may execute
8347 significantly slower than the code generated by default.  Since there is
8348 very little code that depends on the @var{inexact-flag}, you should
8349 normally not specify this option.  Other Alpha compilers call this
8350 option @option{-ieee_with_inexact}.
8351
8352 @item -mfp-trap-mode=@var{trap-mode}
8353 @opindex mfp-trap-mode
8354 This option controls what floating-point related traps are enabled.
8355 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
8356 The trap mode can be set to one of four values:
8357
8358 @table @samp
8359 @item n
8360 This is the default (normal) setting.  The only traps that are enabled
8361 are the ones that cannot be disabled in software (e.g., division by zero
8362 trap).
8363
8364 @item u
8365 In addition to the traps enabled by @samp{n}, underflow traps are enabled
8366 as well.
8367
8368 @item su
8369 Like @samp{su}, but the instructions are marked to be safe for software
8370 completion (see Alpha architecture manual for details).
8371
8372 @item sui
8373 Like @samp{su}, but inexact traps are enabled as well.
8374 @end table
8375
8376 @item -mfp-rounding-mode=@var{rounding-mode}
8377 @opindex mfp-rounding-mode
8378 Selects the IEEE rounding mode.  Other Alpha compilers call this option
8379 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
8380 of:
8381
8382 @table @samp
8383 @item n
8384 Normal IEEE rounding mode.  Floating point numbers are rounded towards
8385 the nearest machine number or towards the even machine number in case
8386 of a tie.
8387
8388 @item m
8389 Round towards minus infinity.
8390
8391 @item c
8392 Chopped rounding mode.  Floating point numbers are rounded towards zero.
8393
8394 @item d
8395 Dynamic rounding mode.  A field in the floating point control register
8396 (@var{fpcr}, see Alpha architecture reference manual) controls the
8397 rounding mode in effect.  The C library initializes this register for
8398 rounding towards plus infinity.  Thus, unless your program modifies the
8399 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
8400 @end table
8401
8402 @item -mtrap-precision=@var{trap-precision}
8403 @opindex mtrap-precision
8404 In the Alpha architecture, floating point traps are imprecise.  This
8405 means without software assistance it is impossible to recover from a
8406 floating trap and program execution normally needs to be terminated.
8407 GCC can generate code that can assist operating system trap handlers
8408 in determining the exact location that caused a floating point trap.
8409 Depending on the requirements of an application, different levels of
8410 precisions can be selected:
8411
8412 @table @samp
8413 @item p
8414 Program precision.  This option is the default and means a trap handler
8415 can only identify which program caused a floating point exception.
8416
8417 @item f
8418 Function precision.  The trap handler can determine the function that
8419 caused a floating point exception.
8420
8421 @item i
8422 Instruction precision.  The trap handler can determine the exact
8423 instruction that caused a floating point exception.
8424 @end table
8425
8426 Other Alpha compilers provide the equivalent options called
8427 @option{-scope_safe} and @option{-resumption_safe}.
8428
8429 @item -mieee-conformant
8430 @opindex mieee-conformant
8431 This option marks the generated code as IEEE conformant.  You must not
8432 use this option unless you also specify @option{-mtrap-precision=i} and either
8433 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
8434 is to emit the line @samp{.eflag 48} in the function prologue of the
8435 generated assembly file.  Under DEC Unix, this has the effect that
8436 IEEE-conformant math library routines will be linked in.
8437
8438 @item -mbuild-constants
8439 @opindex mbuild-constants
8440 Normally GCC examines a 32- or 64-bit integer constant to
8441 see if it can construct it from smaller constants in two or three
8442 instructions.  If it cannot, it will output the constant as a literal and
8443 generate code to load it from the data segment at runtime.
8444
8445 Use this option to require GCC to construct @emph{all} integer constants
8446 using code, even if it takes more instructions (the maximum is six).
8447
8448 You would typically use this option to build a shared library dynamic
8449 loader.  Itself a shared library, it must relocate itself in memory
8450 before it can find the variables and constants in its own data segment.
8451
8452 @item -malpha-as
8453 @itemx -mgas
8454 @opindex malpha-as
8455 @opindex mgas
8456 Select whether to generate code to be assembled by the vendor-supplied
8457 assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
8458
8459 @item -mbwx
8460 @itemx -mno-bwx
8461 @itemx -mcix
8462 @itemx -mno-cix
8463 @itemx -mfix
8464 @itemx -mno-fix
8465 @itemx -mmax
8466 @itemx -mno-max
8467 @opindex mbwx
8468 @opindex mno-bwx
8469 @opindex mcix
8470 @opindex mno-cix
8471 @opindex mfix
8472 @opindex mno-fix
8473 @opindex mmax
8474 @opindex mno-max
8475 Indicate whether GCC should generate code to use the optional BWX,
8476 CIX, FIX and MAX instruction sets.  The default is to use the instruction
8477 sets supported by the CPU type specified via @option{-mcpu=} option or that
8478 of the CPU on which GCC was built if none was specified.
8479
8480 @item -mfloat-vax
8481 @itemx -mfloat-ieee
8482 @opindex mfloat-vax
8483 @opindex mfloat-ieee
8484 Generate code that uses (does not use) VAX F and G floating point
8485 arithmetic instead of IEEE single and double precision.
8486
8487 @item -mexplicit-relocs
8488 @itemx -mno-explicit-relocs
8489 @opindex mexplicit-relocs
8490 @opindex mno-explicit-relocs
8491 Older Alpha assemblers provided no way to generate symbol relocations
8492 except via assembler macros.  Use of these macros does not allow
8493 optimal instruction scheduling.  GNU binutils as of version 2.12
8494 supports a new syntax that allows the compiler to explicitly mark
8495 which relocations should apply to which instructions.  This option
8496 is mostly useful for debugging, as GCC detects the capabilities of
8497 the assembler when it is built and sets the default accordingly.
8498
8499 @item -msmall-data
8500 @itemx -mlarge-data
8501 @opindex msmall-data
8502 @opindex mlarge-data
8503 When @option{-mexplicit-relocs} is in effect, static data is
8504 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
8505 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
8506 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
8507 16-bit relocations off of the @code{$gp} register.  This limits the
8508 size of the small data area to 64KB, but allows the variables to be
8509 directly accessed via a single instruction.
8510
8511 The default is @option{-mlarge-data}.  With this option the data area
8512 is limited to just below 2GB.  Programs that require more than 2GB of
8513 data must use @code{malloc} or @code{mmap} to allocate the data in the
8514 heap instead of in the program's data segment.
8515
8516 When generating code for shared libraries, @option{-fpic} implies
8517 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
8518
8519 @item -msmall-text
8520 @itemx -mlarge-text
8521 @opindex msmall-text
8522 @opindex mlarge-text
8523 When @option{-msmall-text} is used, the compiler assumes that the
8524 code of the entire program (or shared library) fits in 4MB, and is
8525 thus reachable with a branch instruction.  When @option{-msmall-data}
8526 is used, the compiler can assume that all local symbols share the
8527 same @code{$gp} value, and thus reduce the number of instructions
8528 required for a function call from 4 to 1.
8529
8530 The default is @option{-mlarge-text}.
8531
8532 @item -mcpu=@var{cpu_type}
8533 @opindex mcpu
8534 Set the instruction set and instruction scheduling parameters for
8535 machine type @var{cpu_type}.  You can specify either the @samp{EV}
8536 style name or the corresponding chip number.  GCC supports scheduling
8537 parameters for the EV4, EV5 and EV6 family of processors and will
8538 choose the default values for the instruction set from the processor
8539 you specify.  If you do not specify a processor type, GCC will default
8540 to the processor on which the compiler was built.
8541
8542 Supported values for @var{cpu_type} are
8543
8544 @table @samp
8545 @item ev4
8546 @item ev45
8547 @itemx 21064
8548 Schedules as an EV4 and has no instruction set extensions.
8549
8550 @item ev5
8551 @itemx 21164
8552 Schedules as an EV5 and has no instruction set extensions.
8553
8554 @item ev56
8555 @itemx 21164a
8556 Schedules as an EV5 and supports the BWX extension.
8557
8558 @item pca56
8559 @itemx 21164pc
8560 @itemx 21164PC
8561 Schedules as an EV5 and supports the BWX and MAX extensions.
8562
8563 @item ev6
8564 @itemx 21264
8565 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
8566
8567 @item ev67
8568 @item 21264a
8569 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
8570 @end table
8571
8572 @item -mtune=@var{cpu_type}
8573 @opindex mtune
8574 Set only the instruction scheduling parameters for machine type
8575 @var{cpu_type}.  The instruction set is not changed.
8576
8577 @item -mmemory-latency=@var{time}
8578 @opindex mmemory-latency
8579 Sets the latency the scheduler should assume for typical memory
8580 references as seen by the application.  This number is highly
8581 dependent on the memory access patterns used by the application
8582 and the size of the external cache on the machine.
8583
8584 Valid options for @var{time} are
8585
8586 @table @samp
8587 @item @var{number}
8588 A decimal number representing clock cycles.
8589
8590 @item L1
8591 @itemx L2
8592 @itemx L3
8593 @itemx main
8594 The compiler contains estimates of the number of clock cycles for
8595 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
8596 (also called Dcache, Scache, and Bcache), as well as to main memory.
8597 Note that L3 is only valid for EV5.
8598
8599 @end table
8600 @end table
8601
8602 @node DEC Alpha/VMS Options
8603 @subsection DEC Alpha/VMS Options
8604
8605 These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
8606
8607 @table @gcctabopt
8608 @item -mvms-return-codes
8609 @opindex mvms-return-codes
8610 Return VMS condition codes from main.  The default is to return POSIX
8611 style condition (e.g.@ error) codes.
8612 @end table
8613
8614 @node H8/300 Options
8615 @subsection H8/300 Options
8616
8617 These @samp{-m} options are defined for the H8/300 implementations:
8618
8619 @table @gcctabopt
8620 @item -mrelax
8621 @opindex mrelax
8622 Shorten some address references at link time, when possible; uses the
8623 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
8624 ld.info, Using ld}, for a fuller description.
8625
8626 @item -mh
8627 @opindex mh
8628 Generate code for the H8/300H@.
8629
8630 @item -ms
8631 @opindex ms
8632 Generate code for the H8S@.
8633
8634 @item -mn
8635 @opindex mn
8636 Generate code for the H8S and H8/300H in the normal mode.  This switch
8637 must be used either with -mh or -ms.
8638
8639 @item -ms2600
8640 @opindex ms2600
8641 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
8642
8643 @item -mint32
8644 @opindex mint32
8645 Make @code{int} data 32 bits by default.
8646
8647 @item -malign-300
8648 @opindex malign-300
8649 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
8650 The default for the H8/300H and H8S is to align longs and floats on 4
8651 byte boundaries.
8652 @option{-malign-300} causes them to be aligned on 2 byte boundaries.
8653 This option has no effect on the H8/300.
8654 @end table
8655
8656 @node SH Options
8657 @subsection SH Options
8658
8659 These @samp{-m} options are defined for the SH implementations:
8660
8661 @table @gcctabopt
8662 @item -m1
8663 @opindex m1
8664 Generate code for the SH1.
8665
8666 @item -m2
8667 @opindex m2
8668 Generate code for the SH2.
8669
8670 @item -m3
8671 @opindex m3
8672 Generate code for the SH3.
8673
8674 @item -m3e
8675 @opindex m3e
8676 Generate code for the SH3e.
8677
8678 @item -m4-nofpu
8679 @opindex m4-nofpu
8680 Generate code for the SH4 without a floating-point unit.
8681
8682 @item -m4-single-only
8683 @opindex m4-single-only
8684 Generate code for the SH4 with a floating-point unit that only
8685 supports single-precision arithmetic.
8686
8687 @item -m4-single
8688 @opindex m4-single
8689 Generate code for the SH4 assuming the floating-point unit is in
8690 single-precision mode by default.
8691
8692 @item -m4
8693 @opindex m4
8694 Generate code for the SH4.
8695
8696 @item -mb
8697 @opindex mb
8698 Compile code for the processor in big endian mode.
8699
8700 @item -ml
8701 @opindex ml
8702 Compile code for the processor in little endian mode.
8703
8704 @item -mdalign
8705 @opindex mdalign
8706 Align doubles at 64-bit boundaries.  Note that this changes the calling
8707 conventions, and thus some functions from the standard C library will
8708 not work unless you recompile it first with @option{-mdalign}.
8709
8710 @item -mrelax
8711 @opindex mrelax
8712 Shorten some address references at link time, when possible; uses the
8713 linker option @option{-relax}.
8714
8715 @item -mbigtable
8716 @opindex mbigtable
8717 Use 32-bit offsets in @code{switch} tables.  The default is to use
8718 16-bit offsets.
8719
8720 @item -mfmovd
8721 @opindex mfmovd
8722 Enable the use of the instruction @code{fmovd}.
8723
8724 @item -mhitachi
8725 @opindex mhitachi
8726 Comply with the calling conventions defined by Hitachi.
8727
8728 @item -mnomacsave
8729 @opindex mnomacsave
8730 Mark the @code{MAC} register as call-clobbered, even if
8731 @option{-mhitachi} is given.
8732
8733 @item -mieee
8734 @opindex mieee
8735 Increase IEEE-compliance of floating-point code.
8736
8737 @item -misize
8738 @opindex misize
8739 Dump instruction size and location in the assembly code.
8740
8741 @item -mpadstruct
8742 @opindex mpadstruct
8743 This option is deprecated.  It pads structures to multiple of 4 bytes,
8744 which is incompatible with the SH ABI@.
8745
8746 @item -mspace
8747 @opindex mspace
8748 Optimize for space instead of speed.  Implied by @option{-Os}.
8749
8750 @item -mprefergot
8751 @opindex mprefergot
8752 When generating position-independent code, emit function calls using
8753 the Global Offset Table instead of the Procedure Linkage Table.
8754
8755 @item -musermode
8756 @opindex musermode
8757 Generate a library function call to invalidate instruction cache
8758 entries, after fixing up a trampoline.  This library function call
8759 doesn't assume it can write to the whole memory address space.  This
8760 is the default when the target is @code{sh-*-linux*}.
8761 @end table
8762
8763 @node System V Options
8764 @subsection Options for System V
8765
8766 These additional options are available on System V Release 4 for
8767 compatibility with other compilers on those systems:
8768
8769 @table @gcctabopt
8770 @item -G
8771 @opindex G
8772 Create a shared object.
8773 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
8774
8775 @item -Qy
8776 @opindex Qy
8777 Identify the versions of each tool used by the compiler, in a
8778 @code{.ident} assembler directive in the output.
8779
8780 @item -Qn
8781 @opindex Qn
8782 Refrain from adding @code{.ident} directives to the output file (this is
8783 the default).
8784
8785 @item -YP,@var{dirs}
8786 @opindex YP
8787 Search the directories @var{dirs}, and no others, for libraries
8788 specified with @option{-l}.
8789
8790 @item -Ym,@var{dir}
8791 @opindex Ym
8792 Look in the directory @var{dir} to find the M4 preprocessor.
8793 The assembler uses this option.
8794 @c This is supposed to go with a -Yd for predefined M4 macro files, but
8795 @c the generic assembler that comes with Solaris takes just -Ym.
8796 @end table
8797
8798 @node TMS320C3x/C4x Options
8799 @subsection TMS320C3x/C4x Options
8800 @cindex TMS320C3x/C4x Options
8801
8802 These @samp{-m} options are defined for TMS320C3x/C4x implementations:
8803
8804 @table @gcctabopt
8805
8806 @item -mcpu=@var{cpu_type}
8807 @opindex mcpu
8808 Set the instruction set, register set, and instruction scheduling
8809 parameters for machine type @var{cpu_type}.  Supported values for
8810 @var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
8811 @samp{c44}.  The default is @samp{c40} to generate code for the
8812 TMS320C40.
8813
8814 @item -mbig-memory
8815 @item -mbig
8816 @itemx -msmall-memory
8817 @itemx -msmall
8818 @opindex mbig-memory
8819 @opindex mbig
8820 @opindex msmall-memory
8821 @opindex msmall
8822 Generates code for the big or small memory model.  The small memory
8823 model assumed that all data fits into one 64K word page.  At run-time
8824 the data page (DP) register must be set to point to the 64K page
8825 containing the .bss and .data program sections.  The big memory model is
8826 the default and requires reloading of the DP register for every direct
8827 memory access.
8828
8829 @item -mbk
8830 @itemx -mno-bk
8831 @opindex mbk
8832 @opindex mno-bk
8833 Allow (disallow) allocation of general integer operands into the block
8834 count register BK@.
8835
8836 @item -mdb
8837 @itemx -mno-db
8838 @opindex mdb
8839 @opindex mno-db
8840 Enable (disable) generation of code using decrement and branch,
8841 DBcond(D), instructions.  This is enabled by default for the C4x.  To be
8842 on the safe side, this is disabled for the C3x, since the maximum
8843 iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than
8844 @math{2^{23}} times on the C3x?).  Note that GCC will try to reverse a loop so
8845 that it can utilize the decrement and branch instruction, but will give
8846 up if there is more than one memory reference in the loop.  Thus a loop
8847 where the loop counter is decremented can generate slightly more
8848 efficient code, in cases where the RPTB instruction cannot be utilized.
8849
8850 @item -mdp-isr-reload
8851 @itemx -mparanoid
8852 @opindex mdp-isr-reload
8853 @opindex mparanoid
8854 Force the DP register to be saved on entry to an interrupt service
8855 routine (ISR), reloaded to point to the data section, and restored on
8856 exit from the ISR@.  This should not be required unless someone has
8857 violated the small memory model by modifying the DP register, say within
8858 an object library.
8859
8860 @item -mmpyi
8861 @itemx -mno-mpyi
8862 @opindex mmpyi
8863 @opindex mno-mpyi
8864 For the C3x use the 24-bit MPYI instruction for integer multiplies
8865 instead of a library call to guarantee 32-bit results.  Note that if one
8866 of the operands is a constant, then the multiplication will be performed
8867 using shifts and adds.  If the @option{-mmpyi} option is not specified for the C3x,
8868 then squaring operations are performed inline instead of a library call.
8869
8870 @item -mfast-fix
8871 @itemx -mno-fast-fix
8872 @opindex mfast-fix
8873 @opindex mno-fast-fix
8874 The C3x/C4x FIX instruction to convert a floating point value to an
8875 integer value chooses the nearest integer less than or equal to the
8876 floating point value rather than to the nearest integer.  Thus if the
8877 floating point number is negative, the result will be incorrectly
8878 truncated an additional code is necessary to detect and correct this
8879 case.  This option can be used to disable generation of the additional
8880 code required to correct the result.
8881
8882 @item -mrptb
8883 @itemx -mno-rptb
8884 @opindex mrptb
8885 @opindex mno-rptb
8886 Enable (disable) generation of repeat block sequences using the RPTB
8887 instruction for zero overhead looping.  The RPTB construct is only used
8888 for innermost loops that do not call functions or jump across the loop
8889 boundaries.  There is no advantage having nested RPTB loops due to the
8890 overhead required to save and restore the RC, RS, and RE registers.
8891 This is enabled by default with @option{-O2}.
8892
8893 @item -mrpts=@var{count}
8894 @itemx -mno-rpts
8895 @opindex mrpts
8896 @opindex mno-rpts
8897 Enable (disable) the use of the single instruction repeat instruction
8898 RPTS@.  If a repeat block contains a single instruction, and the loop
8899 count can be guaranteed to be less than the value @var{count}, GCC will
8900 emit a RPTS instruction instead of a RPTB@.  If no value is specified,
8901 then a RPTS will be emitted even if the loop count cannot be determined
8902 at compile time.  Note that the repeated instruction following RPTS does
8903 not have to be reloaded from memory each iteration, thus freeing up the
8904 CPU buses for operands.  However, since interrupts are blocked by this
8905 instruction, it is disabled by default.
8906
8907 @item -mloop-unsigned
8908 @itemx -mno-loop-unsigned
8909 @opindex mloop-unsigned
8910 @opindex mno-loop-unsigned
8911 The maximum iteration count when using RPTS and RPTB (and DB on the C40)
8912 is @math{2^{31} + 1} since these instructions test if the iteration count is
8913 negative to terminate the loop.  If the iteration count is unsigned
8914 there is a possibility than the @math{2^{31} + 1} maximum iteration count may be
8915 exceeded.  This switch allows an unsigned iteration count.
8916
8917 @item -mti
8918 @opindex mti
8919 Try to emit an assembler syntax that the TI assembler (asm30) is happy
8920 with.  This also enforces compatibility with the API employed by the TI
8921 C3x C compiler.  For example, long doubles are passed as structures
8922 rather than in floating point registers.
8923
8924 @item -mregparm
8925 @itemx -mmemparm
8926 @opindex mregparm
8927 @opindex mmemparm
8928 Generate code that uses registers (stack) for passing arguments to functions.
8929 By default, arguments are passed in registers where possible rather
8930 than by pushing arguments on to the stack.
8931
8932 @item -mparallel-insns
8933 @itemx -mno-parallel-insns
8934 @opindex mparallel-insns
8935 @opindex mno-parallel-insns
8936 Allow the generation of parallel instructions.  This is enabled by
8937 default with @option{-O2}.
8938
8939 @item -mparallel-mpy
8940 @itemx -mno-parallel-mpy
8941 @opindex mparallel-mpy
8942 @opindex mno-parallel-mpy
8943 Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
8944 provided @option{-mparallel-insns} is also specified.  These instructions have
8945 tight register constraints which can pessimize the code generation
8946 of large functions.
8947
8948 @end table
8949
8950 @node V850 Options
8951 @subsection V850 Options
8952 @cindex V850 Options
8953
8954 These @samp{-m} options are defined for V850 implementations:
8955
8956 @table @gcctabopt
8957 @item -mlong-calls
8958 @itemx -mno-long-calls
8959 @opindex mlong-calls
8960 @opindex mno-long-calls
8961 Treat all calls as being far away (near).  If calls are assumed to be
8962 far away, the compiler will always load the functions address up into a
8963 register, and call indirect through the pointer.
8964
8965 @item -mno-ep
8966 @itemx -mep
8967 @opindex mno-ep
8968 @opindex mep
8969 Do not optimize (do optimize) basic blocks that use the same index
8970 pointer 4 or more times to copy pointer into the @code{ep} register, and
8971 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
8972 option is on by default if you optimize.
8973
8974 @item -mno-prolog-function
8975 @itemx -mprolog-function
8976 @opindex mno-prolog-function
8977 @opindex mprolog-function
8978 Do not use (do use) external functions to save and restore registers at
8979 the prolog and epilog of a function.  The external functions are slower,
8980 but use less code space if more than one function saves the same number
8981 of registers.  The @option{-mprolog-function} option is on by default if
8982 you optimize.
8983
8984 @item -mspace
8985 @opindex mspace
8986 Try to make the code as small as possible.  At present, this just turns
8987 on the @option{-mep} and @option{-mprolog-function} options.
8988
8989 @item -mtda=@var{n}
8990 @opindex mtda
8991 Put static or global variables whose size is @var{n} bytes or less into
8992 the tiny data area that register @code{ep} points to.  The tiny data
8993 area can hold up to 256 bytes in total (128 bytes for byte references).
8994
8995 @item -msda=@var{n}
8996 @opindex msda
8997 Put static or global variables whose size is @var{n} bytes or less into
8998 the small data area that register @code{gp} points to.  The small data
8999 area can hold up to 64 kilobytes.
9000
9001 @item -mzda=@var{n}
9002 @opindex mzda
9003 Put static or global variables whose size is @var{n} bytes or less into
9004 the first 32 kilobytes of memory.
9005
9006 @item -mv850
9007 @opindex mv850
9008 Specify that the target processor is the V850.
9009
9010 @item -mbig-switch
9011 @opindex mbig-switch
9012 Generate code suitable for big switch tables.  Use this option only if
9013 the assembler/linker complain about out of range branches within a switch
9014 table.
9015
9016 @item -mapp-regs
9017 @opindex -mapp-regs
9018 This option will cause r2 and r5 to be used in the code generated by
9019 the compiler.  This setting is the default.
9020
9021 @item -mno-app-regs
9022 @opindex -mno-app-regs
9023 This option will cause r2 and r5 to be treated as fixed registers.
9024   
9025 @item -mv850e
9026 @opindex -mv850e
9027 Specify that the target processor is the V850E.  The preprocessor
9028 constant @samp{__v850e__} will be defined if this option is used.
9029
9030 If neither @option{-mv850} nor @option{-mv850e} are defined
9031 then a default target processor will be chosen and the relevant
9032 @samp{__v850*__} preprocessor constant will be defined.
9033
9034 The preprocessor constants @samp{__v850} and @samp{__v851__} are always
9035 defined, regardless of which processor variant is the target.
9036
9037 @item -mdisable-callt
9038 @opindex -mdisable-callt
9039 This option will suppress generation of the CALLT instruction for the
9040 v850e flavors of the v850 architecture.  The default is
9041 @option{-mno-disable-callt} which allows the CALLT instruction to be used.
9042
9043 @end table
9044
9045 @node ARC Options
9046 @subsection ARC Options
9047 @cindex ARC Options
9048
9049 These options are defined for ARC implementations:
9050
9051 @table @gcctabopt
9052 @item -EL
9053 @opindex EL
9054 Compile code for little endian mode.  This is the default.
9055
9056 @item -EB
9057 @opindex EB
9058 Compile code for big endian mode.
9059
9060 @item -mmangle-cpu
9061 @opindex mmangle-cpu
9062 Prepend the name of the cpu to all public symbol names.
9063 In multiple-processor systems, there are many ARC variants with different
9064 instruction and register set characteristics.  This flag prevents code
9065 compiled for one cpu to be linked with code compiled for another.
9066 No facility exists for handling variants that are ``almost identical''.
9067 This is an all or nothing option.
9068
9069 @item -mcpu=@var{cpu}
9070 @opindex mcpu
9071 Compile code for ARC variant @var{cpu}.
9072 Which variants are supported depend on the configuration.
9073 All variants support @option{-mcpu=base}, this is the default.
9074
9075 @item -mtext=@var{text-section}
9076 @itemx -mdata=@var{data-section}
9077 @itemx -mrodata=@var{readonly-data-section}
9078 @opindex mtext
9079 @opindex mdata
9080 @opindex mrodata
9081 Put functions, data, and readonly data in @var{text-section},
9082 @var{data-section}, and @var{readonly-data-section} respectively
9083 by default.  This can be overridden with the @code{section} attribute.
9084 @xref{Variable Attributes}.
9085
9086 @end table
9087
9088 @node NS32K Options
9089 @subsection NS32K Options
9090 @cindex NS32K options
9091
9092 These are the @samp{-m} options defined for the 32000 series.  The default
9093 values for these options depends on which style of 32000 was selected when
9094 the compiler was configured; the defaults for the most common choices are
9095 given below.
9096
9097 @table @gcctabopt
9098 @item -m32032
9099 @itemx -m32032
9100 @opindex m32032
9101 @opindex m32032
9102 Generate output for a 32032.  This is the default
9103 when the compiler is configured for 32032 and 32016 based systems.
9104
9105 @item -m32332
9106 @itemx -m32332
9107 @opindex m32332
9108 @opindex m32332
9109 Generate output for a 32332.  This is the default
9110 when the compiler is configured for 32332-based systems.
9111
9112 @item -m32532
9113 @itemx -m32532
9114 @opindex m32532
9115 @opindex m32532
9116 Generate output for a 32532.  This is the default
9117 when the compiler is configured for 32532-based systems.
9118
9119 @item -m32081
9120 @opindex m32081
9121 Generate output containing 32081 instructions for floating point.
9122 This is the default for all systems.
9123
9124 @item -m32381
9125 @opindex m32381
9126 Generate output containing 32381 instructions for floating point.  This
9127 also implies @option{-m32081}.  The 32381 is only compatible with the 32332
9128 and 32532 cpus.  This is the default for the pc532-netbsd configuration.
9129
9130 @item -mmulti-add
9131 @opindex mmulti-add
9132 Try and generate multiply-add floating point instructions @code{polyF}
9133 and @code{dotF}.  This option is only available if the @option{-m32381}
9134 option is in effect.  Using these instructions requires changes to
9135 register allocation which generally has a negative impact on
9136 performance.  This option should only be enabled when compiling code
9137 particularly likely to make heavy use of multiply-add instructions.
9138
9139 @item -mnomulti-add
9140 @opindex mnomulti-add
9141 Do not try and generate multiply-add floating point instructions
9142 @code{polyF} and @code{dotF}.  This is the default on all platforms.
9143
9144 @item -msoft-float
9145 @opindex msoft-float
9146 Generate output containing library calls for floating point.
9147 @strong{Warning:} the requisite libraries may not be available.
9148
9149 @item -mieee-compare
9150 @itemx -mno-ieee-compare
9151 @opindex mieee-compare
9152 @opindex mno-ieee-compare
9153 Control whether or not the compiler uses IEEE floating point
9154 comparisons.  These handle correctly the case where the result of a
9155 comparison is unordered.
9156 @strong{Warning:} the requisite kernel support may not be available.
9157
9158 @item -mnobitfield
9159 @opindex mnobitfield
9160 Do not use the bit-field instructions.  On some machines it is faster to
9161 use shifting and masking operations.  This is the default for the pc532.
9162
9163 @item -mbitfield
9164 @opindex mbitfield
9165 Do use the bit-field instructions.  This is the default for all platforms
9166 except the pc532.
9167
9168 @item -mrtd
9169 @opindex mrtd
9170 Use a different function-calling convention, in which functions
9171 that take a fixed number of arguments return pop their
9172 arguments on return with the @code{ret} instruction.
9173
9174 This calling convention is incompatible with the one normally
9175 used on Unix, so you cannot use it if you need to call libraries
9176 compiled with the Unix compiler.
9177
9178 Also, you must provide function prototypes for all functions that
9179 take variable numbers of arguments (including @code{printf});
9180 otherwise incorrect code will be generated for calls to those
9181 functions.
9182
9183 In addition, seriously incorrect code will result if you call a
9184 function with too many arguments.  (Normally, extra arguments are
9185 harmlessly ignored.)
9186
9187 This option takes its name from the 680x0 @code{rtd} instruction.
9188
9189
9190 @item -mregparam
9191 @opindex mregparam
9192 Use a different function-calling convention where the first two arguments
9193 are passed in registers.
9194
9195 This calling convention is incompatible with the one normally
9196 used on Unix, so you cannot use it if you need to call libraries
9197 compiled with the Unix compiler.
9198
9199 @item -mnoregparam
9200 @opindex mnoregparam
9201 Do not pass any arguments in registers.  This is the default for all
9202 targets.
9203
9204 @item -msb
9205 @opindex msb
9206 It is OK to use the sb as an index register which is always loaded with
9207 zero.  This is the default for the pc532-netbsd target.
9208
9209 @item -mnosb
9210 @opindex mnosb
9211 The sb register is not available for use or has not been initialized to
9212 zero by the run time system.  This is the default for all targets except
9213 the pc532-netbsd.  It is also implied whenever @option{-mhimem} or
9214 @option{-fpic} is set.
9215
9216 @item -mhimem
9217 @opindex mhimem
9218 Many ns32000 series addressing modes use displacements of up to 512MB@.
9219 If an address is above 512MB then displacements from zero can not be used.
9220 This option causes code to be generated which can be loaded above 512MB@.
9221 This may be useful for operating systems or ROM code.
9222
9223 @item -mnohimem
9224 @opindex mnohimem
9225 Assume code will be loaded in the first 512MB of virtual address space.
9226 This is the default for all platforms.
9227
9228
9229 @end table
9230
9231 @node AVR Options
9232 @subsection AVR Options
9233 @cindex AVR Options
9234
9235 These options are defined for AVR implementations:
9236
9237 @table @gcctabopt
9238 @item -mmcu=@var{mcu}
9239 @opindex mmcu
9240 Specify ATMEL AVR instruction set or MCU type.
9241
9242 Instruction set avr1 is for the minimal AVR core, not supported by the C
9243 compiler, only for assembler programs (MCU types: at90s1200, attiny10,
9244 attiny11, attiny12, attiny15, attiny28).
9245
9246 Instruction set avr2 (default) is for the classic AVR core with up to
9247 8K program memory space (MCU types: at90s2313, at90s2323, attiny22,
9248 at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
9249 at90c8534, at90s8535).
9250
9251 Instruction set avr3 is for the classic AVR core with up to 128K program
9252 memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
9253
9254 Instruction set avr4 is for the enhanced AVR core with up to 8K program
9255 memory space (MCU types: atmega8, atmega83, atmega85).
9256
9257 Instruction set avr5 is for the enhanced AVR core with up to 128K program
9258 memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
9259 atmega64, atmega128, at43usb355, at94k).
9260
9261 @item -msize
9262 @opindex msize
9263 Output instruction sizes to the asm file.
9264
9265 @item -minit-stack=@var{N}
9266 @opindex minit-stack
9267 Specify the initial stack address, which may be a symbol or numeric value,
9268 @samp{__stack} is the default.
9269
9270 @item -mno-interrupts
9271 @opindex mno-interrupts
9272 Generated code is not compatible with hardware interrupts.
9273 Code size will be smaller.
9274
9275 @item -mcall-prologues
9276 @opindex mcall-prologues
9277 Functions prologues/epilogues expanded as call to appropriate
9278 subroutines.  Code size will be smaller.
9279
9280 @item -mno-tablejump
9281 @opindex mno-tablejump
9282 Do not generate tablejump insns which sometimes increase code size.
9283
9284 @item -mtiny-stack
9285 @opindex mtiny-stack
9286 Change only the low 8 bits of the stack pointer.
9287 @end table
9288
9289 @node MCore Options
9290 @subsection MCore Options
9291 @cindex MCore options
9292
9293 These are the @samp{-m} options defined for the Motorola M*Core
9294 processors.
9295
9296 @table @gcctabopt
9297
9298 @item -mhardlit
9299 @itemx -mhardlit
9300 @itemx -mno-hardlit
9301 @opindex mhardlit
9302 @opindex mhardlit
9303 @opindex mno-hardlit
9304 Inline constants into the code stream if it can be done in two
9305 instructions or less.
9306
9307 @item -mdiv
9308 @itemx -mdiv
9309 @itemx -mno-div
9310 @opindex mdiv
9311 @opindex mdiv
9312 @opindex mno-div
9313 Use the divide instruction.  (Enabled by default).
9314
9315 @item -mrelax-immediate
9316 @itemx -mrelax-immediate
9317 @itemx -mno-relax-immediate
9318 @opindex mrelax-immediate
9319 @opindex mrelax-immediate
9320 @opindex mno-relax-immediate
9321 Allow arbitrary sized immediates in bit operations.
9322
9323 @item -mwide-bitfields
9324 @itemx -mwide-bitfields
9325 @itemx -mno-wide-bitfields
9326 @opindex mwide-bitfields
9327 @opindex mwide-bitfields
9328 @opindex mno-wide-bitfields
9329 Always treat bit-fields as int-sized.
9330
9331 @item -m4byte-functions
9332 @itemx -m4byte-functions
9333 @itemx -mno-4byte-functions
9334 @opindex m4byte-functions
9335 @opindex m4byte-functions
9336 @opindex mno-4byte-functions
9337 Force all functions to be aligned to a four byte boundary.
9338
9339 @item -mcallgraph-data
9340 @itemx -mcallgraph-data
9341 @itemx -mno-callgraph-data
9342 @opindex mcallgraph-data
9343 @opindex mcallgraph-data
9344 @opindex mno-callgraph-data
9345 Emit callgraph information.
9346
9347 @item -mslow-bytes
9348 @itemx -mslow-bytes
9349 @itemx -mno-slow-bytes
9350 @opindex mslow-bytes
9351 @opindex mslow-bytes
9352 @opindex mno-slow-bytes
9353 Prefer word access when reading byte quantities.
9354
9355 @item -mlittle-endian
9356 @itemx -mlittle-endian
9357 @itemx -mbig-endian
9358 @opindex mlittle-endian
9359 @opindex mlittle-endian
9360 @opindex mbig-endian
9361 Generate code for a little endian target.
9362
9363 @item -m210
9364 @itemx -m210
9365 @itemx -m340
9366 @opindex m210
9367 @opindex m210
9368 @opindex m340
9369 Generate code for the 210 processor.
9370 @end table
9371
9372 @node IA-64 Options
9373 @subsection IA-64 Options
9374 @cindex IA-64 Options
9375
9376 These are the @samp{-m} options defined for the Intel IA-64 architecture.
9377
9378 @table @gcctabopt
9379 @item -mbig-endian
9380 @opindex mbig-endian
9381 Generate code for a big endian target.  This is the default for HP-UX@.
9382
9383 @item -mlittle-endian
9384 @opindex mlittle-endian
9385 Generate code for a little endian target.  This is the default for AIX5
9386 and Linux.
9387
9388 @item -mgnu-as
9389 @itemx -mno-gnu-as
9390 @opindex mgnu-as
9391 @opindex mno-gnu-as
9392 Generate (or don't) code for the GNU assembler.  This is the default.
9393 @c Also, this is the default if the configure option @option{--with-gnu-as}
9394 @c is used.
9395
9396 @item -mgnu-ld
9397 @itemx -mno-gnu-ld
9398 @opindex mgnu-ld
9399 @opindex mno-gnu-ld
9400 Generate (or don't) code for the GNU linker.  This is the default.
9401 @c Also, this is the default if the configure option @option{--with-gnu-ld}
9402 @c is used.
9403
9404 @item -mno-pic
9405 @opindex mno-pic
9406 Generate code that does not use a global pointer register.  The result
9407 is not position independent code, and violates the IA-64 ABI@.
9408
9409 @item -mvolatile-asm-stop
9410 @itemx -mno-volatile-asm-stop
9411 @opindex mvolatile-asm-stop
9412 @opindex mno-volatile-asm-stop
9413 Generate (or don't) a stop bit immediately before and after volatile asm
9414 statements.
9415
9416 @item -mb-step
9417 @opindex mb-step
9418 Generate code that works around Itanium B step errata.
9419
9420 @item -mregister-names
9421 @itemx -mno-register-names
9422 @opindex mregister-names
9423 @opindex mno-register-names
9424 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
9425 the stacked registers.  This may make assembler output more readable.
9426
9427 @item -mno-sdata
9428 @itemx -msdata
9429 @opindex mno-sdata
9430 @opindex msdata
9431 Disable (or enable) optimizations that use the small data section.  This may
9432 be useful for working around optimizer bugs.
9433
9434 @item -mconstant-gp
9435 @opindex mconstant-gp
9436 Generate code that uses a single constant global pointer value.  This is
9437 useful when compiling kernel code.
9438
9439 @item -mauto-pic
9440 @opindex mauto-pic
9441 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
9442 This is useful when compiling firmware code.
9443
9444 @item -minline-float-divide-min-latency
9445 @opindex minline-float-divide-min-latency
9446 Generate code for inline divides of floating point values
9447 using the minimum latency algorithm.
9448
9449 @item -minline-float-divide-max-throughput
9450 @opindex minline-float-divide-max-throughput
9451 Generate code for inline divides of floating point values
9452 using the maximum throughput algorithm.
9453
9454 @item -minline-int-divide-min-latency
9455 @opindex minline-int-divide-min-latency
9456 Generate code for inline divides of integer values
9457 using the minimum latency algorithm.
9458
9459 @item -minline-int-divide-max-throughput
9460 @opindex minline-int-divide-max-throughput
9461 Generate code for inline divides of integer values
9462 using the maximum throughput algorithm.
9463
9464 @item -mno-dwarf2-asm
9465 @itemx -mdwarf2-asm
9466 @opindex mno-dwarf2-asm
9467 @opindex mdwarf2-asm
9468 Don't (or do) generate assembler code for the DWARF2 line number debugging
9469 info.  This may be useful when not using the GNU assembler.
9470
9471 @item -mfixed-range=@var{register-range}
9472 @opindex mfixed-range
9473 Generate code treating the given register range as fixed registers.
9474 A fixed register is one that the register allocator can not use.  This is
9475 useful when compiling kernel code.  A register range is specified as
9476 two registers separated by a dash.  Multiple register ranges can be
9477 specified separated by a comma.
9478 @end table
9479
9480 @node D30V Options
9481 @subsection D30V Options
9482 @cindex D30V Options
9483
9484 These @samp{-m} options are defined for D30V implementations:
9485
9486 @table @gcctabopt
9487 @item -mextmem
9488 @opindex mextmem
9489 Link the @samp{.text}, @samp{.data}, @samp{.bss}, @samp{.strings},
9490 @samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections into external
9491 memory, which starts at location @code{0x80000000}.
9492
9493 @item -mextmemory
9494 @opindex mextmemory
9495 Same as the @option{-mextmem} switch.
9496
9497 @item -monchip
9498 @opindex monchip
9499 Link the @samp{.text} section into onchip text memory, which starts at
9500 location @code{0x0}.  Also link @samp{.data}, @samp{.bss},
9501 @samp{.strings}, @samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections
9502 into onchip data memory, which starts at location @code{0x20000000}.
9503
9504 @item -mno-asm-optimize
9505 @itemx -masm-optimize
9506 @opindex mno-asm-optimize
9507 @opindex masm-optimize
9508 Disable (enable) passing @option{-O} to the assembler when optimizing.
9509 The assembler uses the @option{-O} option to automatically parallelize
9510 adjacent short instructions where possible.
9511
9512 @item -mbranch-cost=@var{n}
9513 @opindex mbranch-cost
9514 Increase the internal costs of branches to @var{n}.  Higher costs means
9515 that the compiler will issue more instructions to avoid doing a branch.
9516 The default is 2.
9517
9518 @item -mcond-exec=@var{n}
9519 @opindex mcond-exec
9520 Specify the maximum number of conditionally executed instructions that
9521 replace a branch.  The default is 4.
9522 @end table
9523
9524 @node S/390 and zSeries Options
9525 @subsection S/390 and zSeries Options
9526 @cindex S/390 and zSeries Options
9527
9528 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
9529
9530 @table @gcctabopt
9531 @item -mhard-float
9532 @itemx -msoft-float
9533 @opindex mhard-float
9534 @opindex msoft-float
9535 Use (do not use) the hardware floating-point instructions and registers
9536 for floating-point operations.  When @option{-msoft-float} is specified,
9537 functions in @file{libgcc.a} will be used to perform floating-point
9538 operations.  When @option{-mhard-float} is specified, the compiler
9539 generates IEEE floating-point instructions.  This is the default.
9540
9541 @item -mbackchain
9542 @itemx -mno-backchain
9543 @opindex mbackchain
9544 @opindex mno-backchain
9545 Generate (or do not generate) code which maintains an explicit
9546 backchain within the stack frame that points to the caller's frame.
9547 This is currently needed to allow debugging.  The default is to
9548 generate the backchain.
9549
9550 @item -msmall-exec
9551 @itemx -mno-small-exec
9552 @opindex msmall-exec
9553 @opindex mno-small-exec
9554 Generate (or do not generate) code using the @code{bras} instruction
9555 to do subroutine calls.
9556 This only works reliably if the total executable size does not
9557 exceed 64k.  The default is to use the @code{basr} instruction instead,
9558 which does not have this limitation.
9559
9560 @item -m64
9561 @itemx -m31
9562 @opindex m64
9563 @opindex m31
9564 When @option{-m31} is specified, generate code compliant to the
9565 Linux for S/390 ABI@.  When @option{-m64} is specified, generate
9566 code compliant to the Linux for zSeries ABI@.  This allows GCC in
9567 particular to generate 64-bit instructions.  For the @samp{s390}
9568 targets, the default is @option{-m31}, while the @samp{s390x}
9569 targets default to @option{-m64}.
9570
9571 @item -mzarch
9572 @itemx -mesa
9573 @opindex mzarch
9574 @opindex mesa
9575 When @option{-mzarch} is specified, generate code using the 
9576 instructions available on z/Architecture. 
9577 When @option{-mesa} is specified, generate code using the 
9578 instructions available on ESA/390. Note that @option{-mesa} is
9579 not possible with @option{-m64}.
9580 For the @samp{s390} targets, the default is @option{-mesa}, 
9581 while the @samp{s390x} targets default to @option{-mzarch}.
9582
9583 @item -mmvcle
9584 @itemx -mno-mvcle
9585 @opindex mmvcle
9586 @opindex mno-mvcle
9587 Generate (or do not generate) code using the @code{mvcle} instruction
9588 to perform block moves.  When @option{-mno-mvcle} is specified,
9589 use a @code{mvc} loop instead.  This is the default.
9590
9591 @item -mdebug
9592 @itemx -mno-debug
9593 @opindex mdebug
9594 @opindex mno-debug
9595 Print (or do not print) additional debug information when compiling.
9596 The default is to not print debug information.
9597
9598 @item -march=@var{arch}
9599 @opindex march
9600 Generate code that will run on @var{arch}, which is the name of system
9601 representing a certain processor type. Possible values for
9602 @var{cpu-type} are @samp{g5}, @samp{g6} and @samp{z900}. 
9603
9604 @item -mcpu=@var{arch}
9605 @opindex mcpu
9606 Tune to @var{cpu-type} everything applicable about the generated code,
9607  except for the ABI and the set of available instructions. 
9608 The list of @var{arch} values is the same as for @option{-march}.
9609
9610 @end table
9611
9612 @node CRIS Options
9613 @subsection CRIS Options
9614 @cindex CRIS Options
9615
9616 These options are defined specifically for the CRIS ports.
9617
9618 @table @gcctabopt
9619 @item -march=@var{architecture-type}
9620 @itemx -mcpu=@var{architecture-type}
9621 @opindex march
9622 @opindex mcpu
9623 Generate code for the specified architecture.  The choices for
9624 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
9625 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX.
9626 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
9627 @samp{v10}.
9628
9629 @item -mtune=@var{architecture-type}
9630 @opindex mtune
9631 Tune to @var{architecture-type} everything applicable about the generated
9632 code, except for the ABI and the set of available instructions.  The
9633 choices for @var{architecture-type} are the same as for
9634 @option{-march=@var{architecture-type}}.
9635
9636 @item -mmax-stack-frame=@var{n}
9637 @opindex mmax-stack-frame
9638 Warn when the stack frame of a function exceeds @var{n} bytes.
9639
9640 @item -melinux-stacksize=@var{n}
9641 @opindex melinux-stacksize
9642 Only available with the @samp{cris-axis-aout} target.  Arranges for
9643 indications in the program to the kernel loader that the stack of the
9644 program should be set to @var{n} bytes.
9645
9646 @item -metrax4
9647 @itemx -metrax100
9648 @opindex metrax4
9649 @opindex metrax100
9650 The options @option{-metrax4} and @option{-metrax100} are synonyms for
9651 @option{-march=v3} and @option{-march=v8} respectively.
9652
9653 @item -mpdebug
9654 @opindex mpdebug
9655 Enable CRIS-specific verbose debug-related information in the assembly
9656 code.  This option also has the effect to turn off the @samp{#NO_APP}
9657 formatted-code indicator to the assembler at the beginning of the
9658 assembly file.
9659
9660 @item -mcc-init
9661 @opindex mcc-init
9662 Do not use condition-code results from previous instruction; always emit
9663 compare and test instructions before use of condition codes.
9664
9665 @item -mno-side-effects
9666 @opindex mno-side-effects
9667 Do not emit instructions with side-effects in addressing modes other than
9668 post-increment.
9669
9670 @item -mstack-align
9671 @itemx -mno-stack-align
9672 @itemx -mdata-align
9673 @itemx -mno-data-align
9674 @itemx -mconst-align
9675 @itemx -mno-const-align
9676 @opindex mstack-align
9677 @opindex mno-stack-align
9678 @opindex mdata-align
9679 @opindex mno-data-align
9680 @opindex mconst-align
9681 @opindex mno-const-align
9682 These options (no-options) arranges (eliminate arrangements) for the
9683 stack-frame, individual data and constants to be aligned for the maximum
9684 single data access size for the chosen CPU model.  The default is to
9685 arrange for 32-bit alignment.  ABI details such as structure layout are
9686 not affected by these options.
9687
9688 @item -m32-bit
9689 @itemx -m16-bit
9690 @itemx -m8-bit
9691 @opindex m32-bit
9692 @opindex m16-bit
9693 @opindex m8-bit
9694 Similar to the stack- data- and const-align options above, these options
9695 arrange for stack-frame, writable data and constants to all be 32-bit,
9696 16-bit or 8-bit aligned.  The default is 32-bit alignment.
9697
9698 @item -mno-prologue-epilogue
9699 @itemx -mprologue-epilogue
9700 @opindex mno-prologue-epilogue
9701 @opindex mprologue-epilogue
9702 With @option{-mno-prologue-epilogue}, the normal function prologue and
9703 epilogue that sets up the stack-frame are omitted and no return
9704 instructions or return sequences are generated in the code.  Use this
9705 option only together with visual inspection of the compiled code: no
9706 warnings or errors are generated when call-saved registers must be saved,
9707 or storage for local variable needs to be allocated.
9708
9709 @item -mno-gotplt
9710 @itemx -mgotplt
9711 @opindex mno-gotplt
9712 @opindex mgotplt
9713 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
9714 instruction sequences that load addresses for functions from the PLT part
9715 of the GOT rather than (traditional on other architectures) calls to the
9716 PLT.  The default is @option{-mgotplt}.
9717
9718 @item -maout
9719 @opindex maout
9720 Legacy no-op option only recognized with the cris-axis-aout target.
9721
9722 @item -melf
9723 @opindex melf
9724 Legacy no-op option only recognized with the cris-axis-elf and
9725 cris-axis-linux-gnu targets.
9726
9727 @item -melinux
9728 @opindex melinux
9729 Only recognized with the cris-axis-aout target, where it selects a
9730 GNU/linux-like multilib, include files and instruction set for
9731 @option{-march=v8}.
9732
9733 @item -mlinux
9734 @opindex mlinux
9735 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
9736
9737 @item -sim
9738 @opindex sim
9739 This option, recognized for the cris-axis-aout and cris-axis-elf arranges
9740 to link with input-output functions from a simulator library.  Code,
9741 initialized data and zero-initialized data are allocated consecutively.
9742
9743 @item -sim2
9744 @opindex sim2
9745 Like @option{-sim}, but pass linker options to locate initialized data at
9746 0x40000000 and zero-initialized data at 0x80000000.
9747 @end table
9748
9749 @node MMIX Options
9750 @subsection MMIX Options
9751 @cindex MMIX Options
9752
9753 These options are defined for the MMIX:
9754
9755 @table @gcctabopt
9756 @item -mlibfuncs
9757 @itemx -mno-libfuncs
9758 @opindex mlibfuncs
9759 @opindex mno-libfuncs
9760 Specify that intrinsic library functions are being compiled, passing all
9761 values in registers, no matter the size.
9762
9763 @item -mepsilon
9764 @itemx -mno-epsilon
9765 @opindex mepsilon
9766 @opindex mno-epsilon
9767 Generate floating-point comparison instructions that compare with respect
9768 to the @code{rE} epsilon register.
9769
9770 @item -mabi=mmixware
9771 @itemx -mabi=gnu
9772 @opindex mabi-mmixware
9773 @opindex mabi=gnu
9774 Generate code that passes function parameters and return values that (in
9775 the called function) are seen as registers @code{$0} and up, as opposed to
9776 the GNU ABI which uses global registers @code{$231} and up.
9777
9778 @item -mzero-extend
9779 @itemx -mno-zero-extend
9780 @opindex mzero-extend
9781 @opindex mno-zero-extend
9782 When reading data from memory in sizes shorter than 64 bits, use (do not
9783 use) zero-extending load instructions by default, rather than
9784 sign-extending ones.
9785
9786 @item -mknuthdiv
9787 @itemx -mno-knuthdiv
9788 @opindex mknuthdiv
9789 @opindex mno-knuthdiv
9790 Make the result of a division yielding a remainder have the same sign as
9791 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
9792 remainder follows the sign of the dividend.  Both methods are
9793 arithmetically valid, the latter being almost exclusively used.
9794
9795 @item -mtoplevel-symbols
9796 @itemx -mno-toplevel-symbols
9797 @opindex mtoplevel-symbols
9798 @opindex mno-toplevel-symbols
9799 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
9800 code can be used with the @code{PREFIX} assembly directive.
9801
9802 @item -melf
9803 @opindex melf
9804 Generate an executable in the ELF format, rather than the default
9805 @samp{mmo} format used by the @command{mmix} simulator.
9806
9807 @item -mbranch-predict
9808 @itemx -mno-branch-predict
9809 @opindex mbranch-predict
9810 @opindex mno-branch-predict
9811 Use (do not use) the probable-branch instructions, when static branch
9812 prediction indicates a probable branch.
9813
9814 @item -mbase-addresses
9815 @itemx -mno-base-addresses
9816 @opindex mbase-addresses
9817 @opindex mno-base-addresses
9818 Generate (do not generate) code that uses @emph{base addresses}.  Using a
9819 base address automatically generates a request (handled by the assembler
9820 and the linker) for a constant to be set up in a global register.  The
9821 register is used for one or more base address requests within the range 0
9822 to 255 from the value held in the register.  The generally leads to short
9823 and fast code, but the number of different data items that can be
9824 addressed is limited.  This means that a program that uses lots of static
9825 data may require @option{-mno-base-addresses}.
9826
9827 @item -msingle-exit
9828 @itemx -mno-single-exit
9829 @opindex msingle-exit
9830 @opindex mno-single-exit
9831 Force (do not force) generated code to have a single exit point in each
9832 function.
9833 @end table
9834
9835 @node PDP-11 Options
9836 @subsection PDP-11 Options
9837 @cindex PDP-11 Options
9838
9839 These options are defined for the PDP-11:
9840
9841 @table @gcctabopt
9842 @item -mfpu
9843 @opindex mfpu
9844 Use hardware FPP floating point.  This is the default.  (FIS floating
9845 point on the PDP-11/40 is not supported.)
9846
9847 @item -msoft-float
9848 @opindex msoft-float
9849 Do not use hardware floating point.
9850
9851 @item -mac0
9852 @opindex mac0
9853 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
9854
9855 @item -mno-ac0
9856 @opindex mno-ac0
9857 Return floating-point results in memory.  This is the default.
9858
9859 @item -m40
9860 @opindex m40
9861 Generate code for a PDP-11/40.
9862
9863 @item -m45
9864 @opindex m45
9865 Generate code for a PDP-11/45.  This is the default.
9866
9867 @item -m10
9868 @opindex m10
9869 Generate code for a PDP-11/10.
9870
9871 @item -mbcopy-builtin
9872 @opindex bcopy-builtin
9873 Use inline @code{movstrhi} patterns for copying memory.  This is the
9874 default.
9875
9876 @item -mbcopy
9877 @opindex mbcopy
9878 Do not use inline @code{movstrhi} patterns for copying memory.
9879
9880 @item -mint16
9881 @itemx -mno-int32
9882 @opindex mint16
9883 @opindex mno-int32
9884 Use 16-bit @code{int}.  This is the default.
9885
9886 @item -mint32
9887 @itemx -mno-int16
9888 @opindex mint32
9889 @opindex mno-int16
9890 Use 32-bit @code{int}.
9891
9892 @item -mfloat64
9893 @itemx -mno-float32
9894 @opindex mfloat64
9895 @opindex mno-float32
9896 Use 64-bit @code{float}.  This is the default.
9897
9898 @item -mfloat32
9899 @item -mno-float64
9900 @opindex mfloat32
9901 @opindex mno-float64
9902 Use 32-bit @code{float}.
9903
9904 @item -mabshi
9905 @opindex mabshi
9906 Use @code{abshi2} pattern.  This is the default.
9907
9908 @item -mno-abshi
9909 @opindex mno-abshi
9910 Do not use @code{abshi2} pattern.
9911
9912 @item -mbranch-expensive
9913 @opindex mbranch-expensive
9914 Pretend that branches are expensive.  This is for experimenting with
9915 code generation only.
9916
9917 @item -mbranch-cheap
9918 @opindex mbranch-cheap
9919 Do not pretend that branches are expensive.  This is the default.
9920
9921 @item -msplit
9922 @opindex msplit
9923 Generate code for a system with split I&D.
9924
9925 @item -mno-split
9926 @opindex mno-split
9927 Generate code for a system without split I&D.  This is the default.
9928
9929 @item -munix-asm
9930 @opindex munix-asm
9931 Use Unix assembler syntax.  This is the default when configured for
9932 @samp{pdp11-*-bsd}.
9933
9934 @item -mdec-asm
9935 @opindex mdec-asm
9936 Use DEC assembler syntax.  This is the default when configured for any
9937 PDP-11 target other than @samp{pdp11-*-bsd}.
9938 @end table
9939
9940 @node Xstormy16 Options
9941 @subsection Xstormy16 Options
9942 @cindex Xstormy16 Options
9943
9944 These options are defined for Xstormy16:
9945
9946 @table @gcctabopt
9947 @item -msim
9948 @opindex msim
9949 Choose startup files and linker script suitable for the simulator.
9950 @end table
9951
9952 @node FRV Options
9953 @subsection FRV Options
9954 @cindex FRV Options
9955
9956 @table @gcctabopt
9957 @item -mgpr-32
9958 @opindex mgpr-32
9959
9960 Only use the first 32 general purpose registers.
9961
9962 @item -mgpr-64
9963 @opindex mgpr-64
9964
9965 Use all 64 general purpose registers.
9966
9967 @item -mfpr-32
9968 @opindex mfpr-32
9969
9970 Use only the first 32 floating point registers.
9971
9972 @item -mfpr-64
9973 @opindex mfpr-64
9974
9975 Use all 64 floating point registers
9976
9977 @item -mhard-float
9978 @opindex mhard-float
9979
9980 Use hardware instructions for floating point operations.
9981
9982 @item -msoft-float
9983 @opindex msoft-float
9984
9985 Use library routines for floating point operations.
9986
9987 @item -malloc-cc
9988 @opindex malloc-cc
9989
9990 Dynamically allocate condition code registers.
9991
9992 @item -mfixed-cc
9993 @opindex mfixed-cc
9994
9995 Do not try to dynamically allocate condition code registers, only
9996 use @code{icc0} and @code{fcc0}.
9997
9998 @item -mdword
9999 @opindex mdword
10000
10001 Change ABI to use double word insns.
10002
10003 @item -mno-dword
10004 @opindex mno-dword
10005
10006 Do not use double word instructions.
10007
10008 @item -mdouble
10009 @opindex mdouble
10010
10011 Use floating point double instructions.
10012
10013 @item -mno-double
10014 @opindex mno-double
10015
10016 Do not use floating point double instructions.
10017
10018 @item -mmedia
10019 @opindex mmedia
10020
10021 Use media instructions.
10022
10023 @item -mno-media
10024 @opindex mno-media
10025
10026 Do not use media instructions.
10027
10028 @item -mmuladd
10029 @opindex mmuladd
10030
10031 Use multiply and add/subtract instructions.
10032
10033 @item -mno-muladd
10034 @opindex mno-muladd
10035
10036 Do not use multiply and add/subtract instructions.
10037
10038 @item -mlibrary-pic
10039 @opindex mlibrary-pic
10040
10041 Enable PIC support for building libraries
10042
10043 @item -macc-4
10044 @opindex macc-4
10045
10046 Use only the first four media accumulator registers.
10047
10048 @item -macc-8
10049 @opindex macc-8
10050
10051 Use all eight media accumulator registers.
10052
10053 @item -mpack
10054 @opindex mpack
10055
10056 Pack VLIW instructions.
10057
10058 @item -mno-pack
10059 @opindex mno-pack
10060
10061 Do not pack VLIW instructions.
10062
10063 @item -mno-eflags
10064 @opindex mno-eflags
10065
10066 Do not mark ABI switches in e_flags.
10067
10068 @item -mcond-move
10069 @opindex mcond-move
10070
10071 Enable the use of conditional-move instructions (default).
10072
10073 This switch is mainly for debugging the compiler and will likely be removed
10074 in a future version.
10075
10076 @item -mno-cond-move
10077 @opindex mno-cond-move
10078
10079 Disable the use of conditional-move instructions.
10080
10081 This switch is mainly for debugging the compiler and will likely be removed
10082 in a future version.
10083
10084 @item -mscc
10085 @opindex mscc
10086
10087 Enable the use of conditional set instructions (default).
10088
10089 This switch is mainly for debugging the compiler and will likely be removed
10090 in a future version.
10091
10092 @item -mno-scc
10093 @opindex mno-scc
10094
10095 Disable the use of conditional set instructions.
10096
10097 This switch is mainly for debugging the compiler and will likely be removed
10098 in a future version.
10099
10100 @item -mcond-exec
10101 @opindex mcond-exec
10102
10103 Enable the use of conditional execution (default).
10104
10105 This switch is mainly for debugging the compiler and will likely be removed
10106 in a future version.
10107
10108 @item -mno-cond-exec
10109 @opindex mno-cond-exec
10110
10111 Disable the use of conditional execution.
10112
10113 This switch is mainly for debugging the compiler and will likely be removed
10114 in a future version.
10115
10116 @item -mvliw-branch
10117 @opindex mvliw-branch
10118
10119 Run a pass to pack branches into VLIW instructions (default).
10120
10121 This switch is mainly for debugging the compiler and will likely be removed
10122 in a future version.
10123
10124 @item -mno-vliw-branch
10125 @opindex mno-vliw-branch
10126
10127 Do not run a pass to pack branches into VLIW instructions.
10128
10129 This switch is mainly for debugging the compiler and will likely be removed
10130 in a future version.
10131
10132 @item -mmulti-cond-exec
10133 @opindex mmulti-cond-exec
10134
10135 Enable optimization of @code{&&} and @code{||} in conditional execution
10136 (default).
10137
10138 This switch is mainly for debugging the compiler and will likely be removed
10139 in a future version.
10140
10141 @item -mno-multi-cond-exec
10142 @opindex mno-multi-cond-exec
10143
10144 Disable optimization of @code{&&} and @code{||} in conditional execution.
10145
10146 This switch is mainly for debugging the compiler and will likely be removed
10147 in a future version.
10148
10149 @item -mnested-cond-exec
10150 @opindex mnested-cond-exec
10151
10152 Enable nested conditional execution optimizations (default).
10153
10154 This switch is mainly for debugging the compiler and will likely be removed
10155 in a future version.
10156
10157 @item -mno-nested-cond-exec
10158 @opindex mno-nested-cond-exec
10159
10160 Disable nested conditional execution optimizations.
10161
10162 This switch is mainly for debugging the compiler and will likely be removed
10163 in a future version.
10164
10165 @item -mtomcat-stats
10166 @opindex mtomcat-stats
10167
10168 Cause gas to print out tomcat statistics.
10169
10170 @item -mcpu=@var{cpu}
10171 @opindex mcpu
10172
10173 Select the processor type for which to generate code.  Possible values are
10174 @samp{simple}, @samp{tomcat}, @samp{fr500}, @samp{fr400}, @samp{fr300},
10175 @samp{frv}.
10176
10177 @end table
10178
10179 @node Xtensa Options
10180 @subsection Xtensa Options
10181 @cindex Xtensa Options
10182
10183 The Xtensa architecture is designed to support many different
10184 configurations.  The compiler's default options can be set to match a
10185 particular Xtensa configuration by copying a configuration file into the
10186 GCC sources when building GCC@.  The options below may be used to
10187 override the default options.
10188
10189 @table @gcctabopt
10190 @item -mbig-endian
10191 @itemx -mlittle-endian
10192 @opindex mbig-endian
10193 @opindex mlittle-endian
10194 Specify big-endian or little-endian byte ordering for the target Xtensa
10195 processor.
10196
10197 @item -mdensity
10198 @itemx -mno-density
10199 @opindex mdensity
10200 @opindex mno-density
10201 Enable or disable use of the optional Xtensa code density instructions.
10202
10203 @item -mmac16
10204 @itemx -mno-mac16
10205 @opindex mmac16
10206 @opindex mno-mac16
10207 Enable or disable use of the Xtensa MAC16 option.  When enabled, GCC
10208 will generate MAC16 instructions from standard C code, with the
10209 limitation that it will use neither the MR register file nor any
10210 instruction that operates on the MR registers.  When this option is
10211 disabled, GCC will translate 16-bit multiply/accumulate operations to a
10212 combination of core instructions and library calls, depending on whether
10213 any other multiplier options are enabled.
10214
10215 @item -mmul16
10216 @itemx -mno-mul16
10217 @opindex mmul16
10218 @opindex mno-mul16
10219 Enable or disable use of the 16-bit integer multiplier option.  When
10220 enabled, the compiler will generate 16-bit multiply instructions for
10221 multiplications of 16 bits or smaller in standard C code.  When this
10222 option is disabled, the compiler will either use 32-bit multiply or
10223 MAC16 instructions if they are available or generate library calls to
10224 perform the multiply operations using shifts and adds.
10225
10226 @item -mmul32
10227 @itemx -mno-mul32
10228 @opindex mmul32
10229 @opindex mno-mul32
10230 Enable or disable use of the 32-bit integer multiplier option.  When
10231 enabled, the compiler will generate 32-bit multiply instructions for
10232 multiplications of 32 bits or smaller in standard C code.  When this
10233 option is disabled, the compiler will generate library calls to perform
10234 the multiply operations using either shifts and adds or 16-bit multiply
10235 instructions if they are available.
10236
10237 @item -mnsa
10238 @itemx -mno-nsa
10239 @opindex mnsa
10240 @opindex mno-nsa
10241 Enable or disable use of the optional normalization shift amount
10242 (@code{NSA}) instructions to implement the built-in @code{ffs} function.
10243
10244 @item -mminmax
10245 @itemx -mno-minmax
10246 @opindex mminmax
10247 @opindex mno-minmax
10248 Enable or disable use of the optional minimum and maximum value
10249 instructions.
10250
10251 @item -msext
10252 @itemx -mno-sext
10253 @opindex msext
10254 @opindex mno-sext
10255 Enable or disable use of the optional sign extend (@code{SEXT})
10256 instruction.
10257
10258 @item -mbooleans
10259 @itemx -mno-booleans
10260 @opindex mbooleans
10261 @opindex mno-booleans
10262 Enable or disable support for the boolean register file used by Xtensa
10263 coprocessors.  This is not typically useful by itself but may be
10264 required for other options that make use of the boolean registers (e.g.,
10265 the floating-point option).
10266
10267 @item -mhard-float
10268 @itemx -msoft-float
10269 @opindex mhard-float
10270 @opindex msoft-float
10271 Enable or disable use of the floating-point option.  When enabled, GCC
10272 generates floating-point instructions for 32-bit @code{float}
10273 operations.  When this option is disabled, GCC generates library calls
10274 to emulate 32-bit floating-point operations using integer instructions.
10275 Regardless of this option, 64-bit @code{double} operations are always
10276 emulated with calls to library functions.
10277
10278 @item -mfused-madd
10279 @itemx -mno-fused-madd
10280 @opindex mfused-madd
10281 @opindex mno-fused-madd
10282 Enable or disable use of fused multiply/add and multiply/subtract
10283 instructions in the floating-point option.  This has no effect if the
10284 floating-point option is not also enabled.  Disabling fused multiply/add
10285 and multiply/subtract instructions forces the compiler to use separate
10286 instructions for the multiply and add/subtract operations.  This may be
10287 desirable in some cases where strict IEEE 754-compliant results are
10288 required: the fused multiply add/subtract instructions do not round the
10289 intermediate result, thereby producing results with @emph{more} bits of
10290 precision than specified by the IEEE standard.  Disabling fused multiply
10291 add/subtract instructions also ensures that the program output is not
10292 sensitive to the compiler's ability to combine multiply and add/subtract
10293 operations.
10294
10295 @item -mserialize-volatile
10296 @itemx -mno-serialize-volatile
10297 @opindex mserialize-volatile
10298 @opindex mno-serialize-volatile
10299 When this option is enabled, GCC inserts @code{MEMW} instructions before
10300 @code{volatile} memory references to guarantee sequential consistency.
10301 The default is @option{-mserialize-volatile}.  Use
10302 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
10303
10304 @item -mtext-section-literals
10305 @itemx -mno-text-section-literals
10306 @opindex mtext-section-literals
10307 @opindex mno-text-section-literals
10308 Control the treatment of literal pools.  The default is
10309 @option{-mno-text-section-literals}, which places literals in a separate
10310 section in the output file.  This allows the literal pool to be placed
10311 in a data RAM/ROM, and it also allows the linker to combine literal
10312 pools from separate object files to remove redundant literals and
10313 improve code size.  With @option{-mtext-section-literals}, the literals
10314 are interspersed in the text section in order to keep them as close as
10315 possible to their references.  This may be necessary for large assembly
10316 files.
10317
10318 @item -mtarget-align
10319 @itemx -mno-target-align
10320 @opindex mtarget-align
10321 @opindex mno-target-align
10322 When this option is enabled, GCC instructs the assembler to
10323 automatically align instructions to reduce branch penalties at the
10324 expense of some code density.  The assembler attempts to widen density
10325 instructions to align branch targets and the instructions following call
10326 instructions.  If there are not enough preceding safe density
10327 instructions to align a target, no widening will be performed.  The
10328 default is @option{-mtarget-align}.  These options do not affect the
10329 treatment of auto-aligned instructions like @code{LOOP}, which the
10330 assembler will always align, either by widening density instructions or
10331 by inserting no-op instructions.
10332
10333 @item -mlongcalls
10334 @itemx -mno-longcalls
10335 @opindex mlongcalls
10336 @opindex mno-longcalls
10337 When this option is enabled, GCC instructs the assembler to translate
10338 direct calls to indirect calls unless it can determine that the target
10339 of a direct call is in the range allowed by the call instruction.  This
10340 translation typically occurs for calls to functions in other source
10341 files.  Specifically, the assembler translates a direct @code{CALL}
10342 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
10343 The default is @option{-mno-longcalls}.  This option should be used in
10344 programs where the call target can potentially be out of range.  This
10345 option is implemented in the assembler, not the compiler, so the
10346 assembly code generated by GCC will still show direct call
10347 instructions---look at the disassembled object code to see the actual
10348 instructions.  Note that the assembler will use an indirect call for
10349 every cross-file call, not just those that really will be out of range.
10350 @end table
10351
10352 @node Code Gen Options
10353 @section Options for Code Generation Conventions
10354 @cindex code generation conventions
10355 @cindex options, code generation
10356 @cindex run-time options
10357
10358 These machine-independent options control the interface conventions
10359 used in code generation.
10360
10361 Most of them have both positive and negative forms; the negative form
10362 of @option{-ffoo} would be @option{-fno-foo}.  In the table below, only
10363 one of the forms is listed---the one which is not the default.  You
10364 can figure out the other form by either removing @samp{no-} or adding
10365 it.
10366
10367 @table @gcctabopt
10368 @item -fexceptions
10369 @opindex fexceptions
10370 Enable exception handling.  Generates extra code needed to propagate
10371 exceptions.  For some targets, this implies GCC will generate frame
10372 unwind information for all functions, which can produce significant data
10373 size overhead, although it does not affect execution.  If you do not
10374 specify this option, GCC will enable it by default for languages like
10375 C++ which normally require exception handling, and disable it for
10376 languages like C that do not normally require it.  However, you may need
10377 to enable this option when compiling C code that needs to interoperate
10378 properly with exception handlers written in C++.  You may also wish to
10379 disable this option if you are compiling older C++ programs that don't
10380 use exception handling.
10381
10382 @item -fnon-call-exceptions
10383 @opindex fnon-call-exceptions
10384 Generate code that allows trapping instructions to throw exceptions.
10385 Note that this requires platform-specific runtime support that does
10386 not exist everywhere.  Moreover, it only allows @emph{trapping}
10387 instructions to throw exceptions, i.e.@: memory references or floating
10388 point instructions.  It does not allow exceptions to be thrown from
10389 arbitrary signal handlers such as @code{SIGALRM}.
10390
10391 @item -funwind-tables
10392 @opindex funwind-tables
10393 Similar to @option{-fexceptions}, except that it will just generate any needed
10394 static data, but will not affect the generated code in any other way.
10395 You will normally not enable this option; instead, a language processor
10396 that needs this handling would enable it on your behalf.
10397
10398 @item -fasynchronous-unwind-tables
10399 @opindex funwind-tables
10400 Generate unwind table in dwarf2 format, if supported by target machine.  The
10401 table is exact at each instruction boundary, so it can be used for stack
10402 unwinding from asynchronous events (such as debugger or garbage collector).
10403
10404 @item -fpcc-struct-return
10405 @opindex fpcc-struct-return
10406 Return ``short'' @code{struct} and @code{union} values in memory like
10407 longer ones, rather than in registers.  This convention is less
10408 efficient, but it has the advantage of allowing intercallability between
10409 GCC-compiled files and files compiled with other compilers, particularly
10410 the Portable C Compiler (pcc).
10411
10412 The precise convention for returning structures in memory depends
10413 on the target configuration macros.
10414
10415 Short structures and unions are those whose size and alignment match
10416 that of some integer type.
10417
10418 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
10419 switch is not binary compatible with code compiled with the
10420 @option{-freg-struct-return} switch.
10421 Use it to conform to a non-default application binary interface.
10422
10423 @item -freg-struct-return
10424 @opindex freg-struct-return
10425 Return @code{struct} and @code{union} values in registers when possible.
10426 This is more efficient for small structures than
10427 @option{-fpcc-struct-return}.
10428
10429 If you specify neither @option{-fpcc-struct-return} nor
10430 @option{-freg-struct-return}, GCC defaults to whichever convention is
10431 standard for the target.  If there is no standard convention, GCC
10432 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
10433 the principal compiler.  In those cases, we can choose the standard, and
10434 we chose the more efficient register return alternative.
10435
10436 @strong{Warning:} code compiled with the @option{-freg-struct-return}
10437 switch is not binary compatible with code compiled with the
10438 @option{-fpcc-struct-return} switch.
10439 Use it to conform to a non-default application binary interface.
10440
10441 @item -fshort-enums
10442 @opindex fshort-enums
10443 Allocate to an @code{enum} type only as many bytes as it needs for the
10444 declared range of possible values.  Specifically, the @code{enum} type
10445 will be equivalent to the smallest integer type which has enough room.
10446
10447 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
10448 code that is not binary compatible with code generated without that switch.
10449 Use it to conform to a non-default application binary interface.
10450
10451 @item -fshort-double
10452 @opindex fshort-double
10453 Use the same size for @code{double} as for @code{float}.
10454
10455 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
10456 code that is not binary compatible with code generated without that switch.
10457 Use it to conform to a non-default application binary interface.
10458
10459 @item -fshort-wchar
10460 @opindex fshort-wchar
10461 Override the underlying type for @samp{wchar_t} to be @samp{short
10462 unsigned int} instead of the default for the target.  This option is
10463 useful for building programs to run under WINE@.
10464
10465 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
10466 code that is not binary compatible with code generated without that switch.
10467 Use it to conform to a non-default application binary interface.
10468
10469 @item -fshared-data
10470 @opindex fshared-data
10471 Requests that the data and non-@code{const} variables of this
10472 compilation be shared data rather than private data.  The distinction
10473 makes sense only on certain operating systems, where shared data is
10474 shared between processes running the same program, while private data
10475 exists in one copy per process.
10476
10477 @item -fno-common
10478 @opindex fno-common
10479 In C, allocate even uninitialized global variables in the data section of the
10480 object file, rather than generating them as common blocks.  This has the
10481 effect that if the same variable is declared (without @code{extern}) in
10482 two different compilations, you will get an error when you link them.
10483 The only reason this might be useful is if you wish to verify that the
10484 program will work on other systems which always work this way.
10485
10486 @item -fno-ident
10487 @opindex fno-ident
10488 Ignore the @samp{#ident} directive.
10489
10490 @item -fno-gnu-linker
10491 @opindex fno-gnu-linker
10492 Do not output global initializations (such as C++ constructors and
10493 destructors) in the form used by the GNU linker (on systems where the GNU
10494 linker is the standard method of handling them).  Use this option when
10495 you want to use a non-GNU linker, which also requires using the
10496 @command{collect2} program to make sure the system linker includes
10497 constructors and destructors.  (@command{collect2} is included in the GCC
10498 distribution.)  For systems which @emph{must} use @command{collect2}, the
10499 compiler driver @command{gcc} is configured to do this automatically.
10500
10501 @item -finhibit-size-directive
10502 @opindex finhibit-size-directive
10503 Don't output a @code{.size} assembler directive, or anything else that
10504 would cause trouble if the function is split in the middle, and the
10505 two halves are placed at locations far apart in memory.  This option is
10506 used when compiling @file{crtstuff.c}; you should not need to use it
10507 for anything else.
10508
10509 @item -fverbose-asm
10510 @opindex fverbose-asm
10511 Put extra commentary information in the generated assembly code to
10512 make it more readable.  This option is generally only of use to those
10513 who actually need to read the generated assembly code (perhaps while
10514 debugging the compiler itself).
10515
10516 @option{-fno-verbose-asm}, the default, causes the
10517 extra information to be omitted and is useful when comparing two assembler
10518 files.
10519
10520 @item -fvolatile
10521 @opindex fvolatile
10522 Consider all memory references through pointers to be volatile.
10523
10524 @item -fvolatile-global
10525 @opindex fvolatile-global
10526 Consider all memory references to extern and global data items to
10527 be volatile.  GCC does not consider static data items to be volatile
10528 because of this switch.
10529
10530 @item -fvolatile-static
10531 @opindex fvolatile-static
10532 Consider all memory references to static data to be volatile.
10533
10534 @item -fpic
10535 @opindex fpic
10536 @cindex global offset table
10537 @cindex PIC
10538 Generate position-independent code (PIC) suitable for use in a shared
10539 library, if supported for the target machine.  Such code accesses all
10540 constant addresses through a global offset table (GOT)@.  The dynamic
10541 loader resolves the GOT entries when the program starts (the dynamic
10542 loader is not part of GCC; it is part of the operating system).  If
10543 the GOT size for the linked executable exceeds a machine-specific
10544 maximum size, you get an error message from the linker indicating that
10545 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
10546 instead.  (These maximums are 16k on the m88k, 8k on the SPARC, and 32k
10547 on the m68k and RS/6000.  The 386 has no such limit.)
10548
10549 Position-independent code requires special support, and therefore works
10550 only on certain machines.  For the 386, GCC supports PIC for System V
10551 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
10552 position-independent.
10553
10554 @item -fPIC
10555 @opindex fPIC
10556 If supported for the target machine, emit position-independent code,
10557 suitable for dynamic linking and avoiding any limit on the size of the
10558 global offset table.  This option makes a difference on the m68k, m88k,
10559 and the SPARC.
10560
10561 Position-independent code requires special support, and therefore works
10562 only on certain machines.
10563
10564 @item -ffixed-@var{reg}
10565 @opindex ffixed
10566 Treat the register named @var{reg} as a fixed register; generated code
10567 should never refer to it (except perhaps as a stack pointer, frame
10568 pointer or in some other fixed role).
10569
10570 @var{reg} must be the name of a register.  The register names accepted
10571 are machine-specific and are defined in the @code{REGISTER_NAMES}
10572 macro in the machine description macro file.
10573
10574 This flag does not have a negative form, because it specifies a
10575 three-way choice.
10576
10577 @item -fcall-used-@var{reg}
10578 @opindex fcall-used
10579 Treat the register named @var{reg} as an allocable register that is
10580 clobbered by function calls.  It may be allocated for temporaries or
10581 variables that do not live across a call.  Functions compiled this way
10582 will not save and restore the register @var{reg}.
10583
10584 It is an error to used this flag with the frame pointer or stack pointer.
10585 Use of this flag for other registers that have fixed pervasive roles in
10586 the machine's execution model will produce disastrous results.
10587
10588 This flag does not have a negative form, because it specifies a
10589 three-way choice.
10590
10591 @item -fcall-saved-@var{reg}
10592 @opindex fcall-saved
10593 Treat the register named @var{reg} as an allocable register saved by
10594 functions.  It may be allocated even for temporaries or variables that
10595 live across a call.  Functions compiled this way will save and restore
10596 the register @var{reg} if they use it.
10597
10598 It is an error to used this flag with the frame pointer or stack pointer.
10599 Use of this flag for other registers that have fixed pervasive roles in
10600 the machine's execution model will produce disastrous results.
10601
10602 A different sort of disaster will result from the use of this flag for
10603 a register in which function values may be returned.
10604
10605 This flag does not have a negative form, because it specifies a
10606 three-way choice.
10607
10608 @item -fpack-struct
10609 @opindex fpack-struct
10610 Pack all structure members together without holes.
10611
10612 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
10613 code that is not binary compatible with code generated without that switch.
10614 Additionally, it makes the code suboptimal.
10615 Use it to conform to a non-default application binary interface.
10616
10617 @item -finstrument-functions
10618 @opindex finstrument-functions
10619 Generate instrumentation calls for entry and exit to functions.  Just
10620 after function entry and just before function exit, the following
10621 profiling functions will be called with the address of the current
10622 function and its call site.  (On some platforms,
10623 @code{__builtin_return_address} does not work beyond the current
10624 function, so the call site information may not be available to the
10625 profiling functions otherwise.)
10626
10627 @example
10628 void __cyg_profile_func_enter (void *this_fn,
10629                                void *call_site);
10630 void __cyg_profile_func_exit  (void *this_fn,
10631                                void *call_site);
10632 @end example
10633
10634 The first argument is the address of the start of the current function,
10635 which may be looked up exactly in the symbol table.
10636
10637 This instrumentation is also done for functions expanded inline in other
10638 functions.  The profiling calls will indicate where, conceptually, the
10639 inline function is entered and exited.  This means that addressable
10640 versions of such functions must be available.  If all your uses of a
10641 function are expanded inline, this may mean an additional expansion of
10642 code size.  If you use @samp{extern inline} in your C code, an
10643 addressable version of such functions must be provided.  (This is
10644 normally the case anyways, but if you get lucky and the optimizer always
10645 expands the functions inline, you might have gotten away without
10646 providing static copies.)
10647
10648 A function may be given the attribute @code{no_instrument_function}, in
10649 which case this instrumentation will not be done.  This can be used, for
10650 example, for the profiling functions listed above, high-priority
10651 interrupt routines, and any functions from which the profiling functions
10652 cannot safely be called (perhaps signal handlers, if the profiling
10653 routines generate output or allocate memory).
10654
10655 @item -fstack-check
10656 @opindex fstack-check
10657 Generate code to verify that you do not go beyond the boundary of the
10658 stack.  You should specify this flag if you are running in an
10659 environment with multiple threads, but only rarely need to specify it in
10660 a single-threaded environment since stack overflow is automatically
10661 detected on nearly all systems if there is only one stack.
10662
10663 Note that this switch does not actually cause checking to be done; the
10664 operating system must do that.  The switch causes generation of code
10665 to ensure that the operating system sees the stack being extended.
10666
10667 @item -fstack-limit-register=@var{reg}
10668 @itemx -fstack-limit-symbol=@var{sym}
10669 @itemx -fno-stack-limit
10670 @opindex fstack-limit-register
10671 @opindex fstack-limit-symbol
10672 @opindex fno-stack-limit
10673 Generate code to ensure that the stack does not grow beyond a certain value,
10674 either the value of a register or the address of a symbol.  If the stack
10675 would grow beyond the value, a signal is raised.  For most targets,
10676 the signal is raised before the stack overruns the boundary, so
10677 it is possible to catch the signal without taking special precautions.
10678
10679 For instance, if the stack starts at absolute address @samp{0x80000000}
10680 and grows downwards, you can use the flags
10681 @option{-fstack-limit-symbol=__stack_limit} and
10682 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
10683 of 128KB@.  Note that this may only work with the GNU linker.
10684
10685 @cindex aliasing of parameters
10686 @cindex parameters, aliased
10687 @item -fargument-alias
10688 @itemx -fargument-noalias
10689 @itemx -fargument-noalias-global
10690 @opindex fargument-alias
10691 @opindex fargument-noalias
10692 @opindex fargument-noalias-global
10693 Specify the possible relationships among parameters and between
10694 parameters and global data.
10695
10696 @option{-fargument-alias} specifies that arguments (parameters) may
10697 alias each other and may alias global storage.@*
10698 @option{-fargument-noalias} specifies that arguments do not alias
10699 each other, but may alias global storage.@*
10700 @option{-fargument-noalias-global} specifies that arguments do not
10701 alias each other and do not alias global storage.
10702
10703 Each language will automatically use whatever option is required by
10704 the language standard.  You should not need to use these options yourself.
10705
10706 @item -fleading-underscore
10707 @opindex fleading-underscore
10708 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
10709 change the way C symbols are represented in the object file.  One use
10710 is to help link with legacy assembly code.
10711
10712 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
10713 generate code that is not binary compatible with code generated without that
10714 switch.  Use it to conform to a non-default application binary interface.
10715 Not all targets provide complete support for this switch.
10716
10717 @item -ftls-model=@var{model}
10718 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
10719 The @var{model} argument should be one of @code{global-dynamic},
10720 @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
10721
10722 The default without @option{-fpic} is @code{initial-exec}; with
10723 @option{-fpic} the default is @code{global-dynamic}.
10724 @end table
10725
10726 @c man end
10727
10728 @node Environment Variables
10729 @section Environment Variables Affecting GCC
10730 @cindex environment variables
10731
10732 @c man begin ENVIRONMENT
10733
10734 This section describes several environment variables that affect how GCC
10735 operates.  Some of them work by specifying directories or prefixes to use
10736 when searching for various kinds of files.  Some are used to specify other
10737 aspects of the compilation environment.
10738
10739 Note that you can also specify places to search using options such as
10740 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
10741 take precedence over places specified using environment variables, which
10742 in turn take precedence over those specified by the configuration of GCC@.
10743 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
10744 GNU Compiler Collection (GCC) Internals}.
10745
10746 @table @env
10747 @item LANG
10748 @itemx LC_CTYPE
10749 @c @itemx LC_COLLATE
10750 @itemx LC_MESSAGES
10751 @c @itemx LC_MONETARY
10752 @c @itemx LC_NUMERIC
10753 @c @itemx LC_TIME
10754 @itemx LC_ALL
10755 @findex LANG
10756 @findex LC_CTYPE
10757 @c @findex LC_COLLATE
10758 @findex LC_MESSAGES
10759 @c @findex LC_MONETARY
10760 @c @findex LC_NUMERIC
10761 @c @findex LC_TIME
10762 @findex LC_ALL
10763 @cindex locale
10764 These environment variables control the way that GCC uses
10765 localization information that allow GCC to work with different
10766 national conventions.  GCC inspects the locale categories
10767 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
10768 so.  These locale categories can be set to any value supported by your
10769 installation.  A typical value is @samp{en_UK} for English in the United
10770 Kingdom.
10771
10772 The @env{LC_CTYPE} environment variable specifies character
10773 classification.  GCC uses it to determine the character boundaries in
10774 a string; this is needed for some multibyte encodings that contain quote
10775 and escape characters that would otherwise be interpreted as a string
10776 end or escape.
10777
10778 The @env{LC_MESSAGES} environment variable specifies the language to
10779 use in diagnostic messages.
10780
10781 If the @env{LC_ALL} environment variable is set, it overrides the value
10782 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
10783 and @env{LC_MESSAGES} default to the value of the @env{LANG}
10784 environment variable.  If none of these variables are set, GCC
10785 defaults to traditional C English behavior.
10786
10787 @item TMPDIR
10788 @findex TMPDIR
10789 If @env{TMPDIR} is set, it specifies the directory to use for temporary
10790 files.  GCC uses temporary files to hold the output of one stage of
10791 compilation which is to be used as input to the next stage: for example,
10792 the output of the preprocessor, which is the input to the compiler
10793 proper.
10794
10795 @item GCC_EXEC_PREFIX
10796 @findex GCC_EXEC_PREFIX
10797 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
10798 names of the subprograms executed by the compiler.  No slash is added
10799 when this prefix is combined with the name of a subprogram, but you can
10800 specify a prefix that ends with a slash if you wish.
10801
10802 If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
10803 an appropriate prefix to use based on the pathname it was invoked with.
10804
10805 If GCC cannot find the subprogram using the specified prefix, it
10806 tries looking in the usual places for the subprogram.
10807
10808 The default value of @env{GCC_EXEC_PREFIX} is
10809 @file{@var{prefix}/lib/gcc-lib/} where @var{prefix} is the value
10810 of @code{prefix} when you ran the @file{configure} script.
10811
10812 Other prefixes specified with @option{-B} take precedence over this prefix.
10813
10814 This prefix is also used for finding files such as @file{crt0.o} that are
10815 used for linking.
10816
10817 In addition, the prefix is used in an unusual way in finding the
10818 directories to search for header files.  For each of the standard
10819 directories whose name normally begins with @samp{/usr/local/lib/gcc-lib}
10820 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
10821 replacing that beginning with the specified prefix to produce an
10822 alternate directory name.  Thus, with @option{-Bfoo/}, GCC will search
10823 @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
10824 These alternate directories are searched first; the standard directories
10825 come next.
10826
10827 @item COMPILER_PATH
10828 @findex COMPILER_PATH
10829 The value of @env{COMPILER_PATH} is a colon-separated list of
10830 directories, much like @env{PATH}.  GCC tries the directories thus
10831 specified when searching for subprograms, if it can't find the
10832 subprograms using @env{GCC_EXEC_PREFIX}.
10833
10834 @item LIBRARY_PATH
10835 @findex LIBRARY_PATH
10836 The value of @env{LIBRARY_PATH} is a colon-separated list of
10837 directories, much like @env{PATH}.  When configured as a native compiler,
10838 GCC tries the directories thus specified when searching for special
10839 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}.  Linking
10840 using GCC also uses these directories when searching for ordinary
10841 libraries for the @option{-l} option (but directories specified with
10842 @option{-L} come first).
10843
10844 @item LANG
10845 @findex LANG
10846 @cindex locale definition
10847 This variable is used to pass locale information to the compiler.  One way in
10848 which this information is used is to determine the character set to be used
10849 when character literals, string literals and comments are parsed in C and C++.
10850 When the compiler is configured to allow multibyte characters,
10851 the following values for @env{LANG} are recognized:
10852
10853 @table @samp
10854 @item C-JIS
10855 Recognize JIS characters.
10856 @item C-SJIS
10857 Recognize SJIS characters.
10858 @item C-EUCJP
10859 Recognize EUCJP characters.
10860 @end table
10861
10862 If @env{LANG} is not defined, or if it has some other value, then the
10863 compiler will use mblen and mbtowc as defined by the default locale to
10864 recognize and translate multibyte characters.
10865 @end table
10866
10867 @noindent
10868 Some additional environments variables affect the behavior of the
10869 preprocessor.
10870
10871 @include cppenv.texi
10872
10873 @c man end
10874
10875 @node Running Protoize
10876 @section Running Protoize
10877
10878 The program @code{protoize} is an optional part of GCC@.  You can use
10879 it to add prototypes to a program, thus converting the program to ISO
10880 C in one respect.  The companion program @code{unprotoize} does the
10881 reverse: it removes argument types from any prototypes that are found.
10882
10883 When you run these programs, you must specify a set of source files as
10884 command line arguments.  The conversion programs start out by compiling
10885 these files to see what functions they define.  The information gathered
10886 about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
10887
10888 After scanning comes actual conversion.  The specified files are all
10889 eligible to be converted; any files they include (whether sources or
10890 just headers) are eligible as well.
10891
10892 But not all the eligible files are converted.  By default,
10893 @code{protoize} and @code{unprotoize} convert only source and header
10894 files in the current directory.  You can specify additional directories
10895 whose files should be converted with the @option{-d @var{directory}}
10896 option.  You can also specify particular files to exclude with the
10897 @option{-x @var{file}} option.  A file is converted if it is eligible, its
10898 directory name matches one of the specified directory names, and its
10899 name within the directory has not been excluded.
10900
10901 Basic conversion with @code{protoize} consists of rewriting most
10902 function definitions and function declarations to specify the types of
10903 the arguments.  The only ones not rewritten are those for varargs
10904 functions.
10905
10906 @code{protoize} optionally inserts prototype declarations at the
10907 beginning of the source file, to make them available for any calls that
10908 precede the function's definition.  Or it can insert prototype
10909 declarations with block scope in the blocks where undeclared functions
10910 are called.
10911
10912 Basic conversion with @code{unprotoize} consists of rewriting most
10913 function declarations to remove any argument types, and rewriting
10914 function definitions to the old-style pre-ISO form.
10915
10916 Both conversion programs print a warning for any function declaration or
10917 definition that they can't convert.  You can suppress these warnings
10918 with @option{-q}.
10919
10920 The output from @code{protoize} or @code{unprotoize} replaces the
10921 original source file.  The original file is renamed to a name ending
10922 with @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
10923 without the original @samp{.c} suffix).  If the @samp{.save} (@samp{.sav}
10924 for DOS) file already exists, then the source file is simply discarded.
10925
10926 @code{protoize} and @code{unprotoize} both depend on GCC itself to
10927 scan the program and collect information about the functions it uses.
10928 So neither of these programs will work until GCC is installed.
10929
10930 Here is a table of the options you can use with @code{protoize} and
10931 @code{unprotoize}.  Each option works with both programs unless
10932 otherwise stated.
10933
10934 @table @code
10935 @item -B @var{directory}
10936 Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
10937 usual directory (normally @file{/usr/local/lib}).  This file contains
10938 prototype information about standard system functions.  This option
10939 applies only to @code{protoize}.
10940
10941 @item -c @var{compilation-options}
10942 Use  @var{compilation-options} as the options when running @code{gcc} to
10943 produce the @samp{.X} files.  The special option @option{-aux-info} is
10944 always passed in addition, to tell @code{gcc} to write a @samp{.X} file.
10945
10946 Note that the compilation options must be given as a single argument to
10947 @code{protoize} or @code{unprotoize}.  If you want to specify several
10948 @code{gcc} options, you must quote the entire set of compilation options
10949 to make them a single word in the shell.
10950
10951 There are certain @code{gcc} arguments that you cannot use, because they
10952 would produce the wrong kind of output.  These include @option{-g},
10953 @option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
10954 the @var{compilation-options}, they are ignored.
10955
10956 @item -C
10957 Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file
10958 systems) instead of @samp{.c}.  This is convenient if you are converting
10959 a C program to C++.  This option applies only to @code{protoize}.
10960
10961 @item -g
10962 Add explicit global declarations.  This means inserting explicit
10963 declarations at the beginning of each source file for each function
10964 that is called in the file and was not declared.  These declarations
10965 precede the first function definition that contains a call to an
10966 undeclared function.  This option applies only to @code{protoize}.
10967
10968 @item -i @var{string}
10969 Indent old-style parameter declarations with the string @var{string}.
10970 This option applies only to @code{protoize}.
10971
10972 @code{unprotoize} converts prototyped function definitions to old-style
10973 function definitions, where the arguments are declared between the
10974 argument list and the initial @samp{@{}.  By default, @code{unprotoize}
10975 uses five spaces as the indentation.  If you want to indent with just
10976 one space instead, use @option{-i " "}.
10977
10978 @item -k
10979 Keep the @samp{.X} files.  Normally, they are deleted after conversion
10980 is finished.
10981
10982 @item -l
10983 Add explicit local declarations.  @code{protoize} with @option{-l} inserts
10984 a prototype declaration for each function in each block which calls the
10985 function without any declaration.  This option applies only to
10986 @code{protoize}.
10987
10988 @item -n
10989 Make no real changes.  This mode just prints information about the conversions
10990 that would have been done without @option{-n}.
10991
10992 @item -N
10993 Make no @samp{.save} files.  The original files are simply deleted.
10994 Use this option with caution.
10995
10996 @item -p @var{program}
10997 Use the program @var{program} as the compiler.  Normally, the name
10998 @file{gcc} is used.
10999
11000 @item -q
11001 Work quietly.  Most warnings are suppressed.
11002
11003 @item -v
11004 Print the version number, just like @option{-v} for @code{gcc}.
11005 @end table
11006
11007 If you need special compiler options to compile one of your program's
11008 source files, then you should generate that file's @samp{.X} file
11009 specially, by running @code{gcc} on that source file with the
11010 appropriate options and the option @option{-aux-info}.  Then run
11011 @code{protoize} on the entire set of files.  @code{protoize} will use
11012 the existing @samp{.X} file because it is newer than the source file.
11013 For example:
11014
11015 @example
11016 gcc -Dfoo=bar file1.c -aux-info file1.X
11017 protoize *.c
11018 @end example
11019
11020 @noindent
11021 You need to include the special files along with the rest in the
11022 @code{protoize} command, even though their @samp{.X} files already
11023 exist, because otherwise they won't get converted.
11024
11025 @xref{Protoize Caveats}, for more information on how to use
11026 @code{protoize} successfully.