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