* loop-invariant.c: New file.
[official-gcc.git] / gcc / doc / invoke.texi
blob2dd2b8239d754c0c075fe16a6a8c391a989eeedc
1 @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2 @c 2000, 2001, 2002, 2003, 2004 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, 2002, 2003, 2004 Free Software Foundation, Inc.
11 Permission is granted to copy, distribute and/or modify this document
12 under the terms of the GNU Free Documentation License, Version 1.2 or
13 any later version published by the Free Software Foundation; with the
14 Invariant Sections being ``GNU General Public License'' and ``Funding
15 Free Software'', the Front-Cover texts being (a) (see below), and with
16 the Back-Cover Texts being (b) (see below).  A copy of the license is
17 included in the gfdl(7) man page.
19 (a) The FSF's Front-Cover Text is:
21      A GNU Manual
23 (b) The FSF's Back-Cover Text is:
25      You have freedom to copy and modify this GNU Manual, like GNU
26      software.  Copies published by the Free Software Foundation raise
27      funds for GNU development.
28 @c man end
29 @c Set file name and title for the man page.
30 @setfilename gcc
31 @settitle GNU project C and C++ compiler
32 @c man begin SYNOPSIS
33 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
34     [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
35     [@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
36     [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
37     [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
38     [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
39     [@option{-o} @var{outfile}] @var{infile}@dots{}
41 Only the most useful options are listed here; see below for the
42 remainder.  @samp{g++} accepts mostly the same options as @samp{gcc}.
43 @c man end
44 @c man begin SEEALSO
45 gpl(7), gfdl(7), fsf-funding(7),
46 cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
47 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
48 @file{ld}, @file{binutils} and @file{gdb}.
49 @c man end
50 @c man begin BUGS
51 For instructions on reporting bugs, see
52 @w{@uref{http://gcc.gnu.org/bugs.html}}.  Use of the @command{gccbug}
53 script to report bugs is recommended.
54 @c man end
55 @c man begin AUTHOR
56 See the Info entry for @command{gcc}, or
57 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
58 for contributors to GCC@.
59 @c man end
60 @end ignore
62 @node Invoking GCC
63 @chapter GCC Command Options
64 @cindex GCC command options
65 @cindex command options
66 @cindex options, GCC command
68 @c man begin DESCRIPTION
69 When you invoke GCC, it normally does preprocessing, compilation,
70 assembly and linking.  The ``overall options'' allow you to stop this
71 process at an intermediate stage.  For example, the @option{-c} option
72 says not to run the linker.  Then the output consists of object files
73 output by the assembler.
75 Other options are passed on to one stage of processing.  Some options
76 control the preprocessor and others the compiler itself.  Yet other
77 options control the assembler and linker; most of these are not
78 documented here, since you rarely need to use any of them.
80 @cindex C compilation options
81 Most of the command line options that you can use with GCC are useful
82 for C programs; when an option is only useful with another language
83 (usually C++), the explanation says so explicitly.  If the description
84 for a particular option does not mention a source language, you can use
85 that option with all supported languages.
87 @cindex C++ compilation options
88 @xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
89 options for compiling C++ programs.
91 @cindex grouping options
92 @cindex options, grouping
93 The @command{gcc} program accepts options and file names as operands.  Many
94 options have multi-letter names; therefore multiple single-letter options
95 may @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d
96 -r}}.
98 @cindex order of options
99 @cindex options, order
100 You can mix options and other arguments.  For the most part, the order
101 you use doesn't matter.  Order does matter when you use several options
102 of the same kind; for example, if you specify @option{-L} more than once,
103 the directories are searched in the order specified.
105 Many options have long names starting with @samp{-f} or with
106 @samp{-W}---for example, @option{-fforce-mem},
107 @option{-fstrength-reduce}, @option{-Wformat} and so on.  Most of
108 these have both positive and negative forms; the negative form of
109 @option{-ffoo} would be @option{-fno-foo}.  This manual documents
110 only one of these two forms, whichever one is not the default.
112 @c man end
114 @xref{Option Index}, for an index to GCC's options.
116 @menu
117 * Option Summary::      Brief list of all options, without explanations.
118 * Overall Options::     Controlling the kind of output:
119                         an executable, object files, assembler files,
120                         or preprocessed source.
121 * Invoking G++::        Compiling C++ programs.
122 * C Dialect Options::   Controlling the variant of C language compiled.
123 * C++ Dialect Options:: Variations on C++.
124 * Objective-C Dialect Options:: Variations on Objective-C.
125 * Language Independent Options:: Controlling how diagnostics should be
126                         formatted.
127 * Warning Options::     How picky should the compiler be?
128 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
129 * Optimize Options::    How much optimization?
130 * Preprocessor Options:: Controlling header files and macro definitions.
131                          Also, getting dependency information for Make.
132 * Assembler Options::   Passing options to the assembler.
133 * Link Options::        Specifying libraries and so on.
134 * Directory Options::   Where to find header files and libraries.
135                         Where to find the compiler executable files.
136 * Spec Files::          How to pass switches to sub-processes.
137 * Target Options::      Running a cross-compiler, or an old version of GCC.
138 * Submodel Options::    Specifying minor hardware or convention variations,
139                         such as 68010 vs 68020.
140 * Code Gen Options::    Specifying conventions for function calls, data layout
141                         and register usage.
142 * Environment Variables:: Env vars that affect GCC.
143 * Precompiled Headers:: Compiling a header once, and using it many times.
144 * Running Protoize::    Automatically adding or removing function prototypes.
145 @end menu
147 @c man begin OPTIONS
149 @node Option Summary
150 @section Option Summary
152 Here is a summary of all the options, grouped by type.  Explanations are
153 in the following sections.
155 @table @emph
156 @item Overall Options
157 @xref{Overall Options,,Options Controlling the Kind of Output}.
158 @gccoptlist{-c  -S  -E  -o @var{file}  -combine -pipe  -pass-exit-codes  @gol
159 -x @var{language}  -v  -###  --help  --target-help  --version}
161 @item C Language Options
162 @xref{C Dialect Options,,Options Controlling C Dialect}.
163 @gccoptlist{-ansi  -std=@var{standard}  -aux-info @var{filename} @gol
164 -fno-asm  -fno-builtin  -fno-builtin-@var{function} @gol
165 -fhosted  -ffreestanding  -fms-extensions @gol
166 -trigraphs  -no-integrated-cpp  -traditional  -traditional-cpp @gol
167 -fallow-single-precision  -fcond-mismatch @gol
168 -fsigned-bitfields  -fsigned-char @gol
169 -funsigned-bitfields  -funsigned-char}
171 @item C++ Language Options
172 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
173 @gccoptlist{-fabi-version=@var{n}  -fno-access-control  -fcheck-new @gol
174 -fconserve-space  -fno-const-strings @gol
175 -fno-elide-constructors @gol
176 -fno-enforce-eh-specs @gol
177 -ffor-scope  -fno-for-scope  -fno-gnu-keywords @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  -fno-weak  -nostdinc++ @gol
185 -fno-default-inline  -Wabi  -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 @gol
197 -fno-nil-receivers @gol
198 -fobjc-exceptions @gol
199 -freplace-objc-classes @gol
200 -fzero-link @gol
201 -gen-decls @gol
202 -Wno-protocol  -Wselector -Wundeclared-selector}
204 @item Language Independent Options
205 @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
206 @gccoptlist{-fmessage-length=@var{n}  @gol
207 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}}
209 @item Warning Options
210 @xref{Warning Options,,Options to Request or Suppress Warnings}.
211 @gccoptlist{-fsyntax-only  -pedantic  -pedantic-errors @gol
212 -w  -Wextra  -Wall  -Waggregate-return @gol
213 -Wcast-align  -Wcast-qual  -Wchar-subscripts  -Wcomment @gol
214 -Wconversion  -Wno-deprecated-declarations @gol
215 -Wdisabled-optimization  -Wno-div-by-zero  -Wendif-labels @gol
216 -Werror  -Werror-implicit-function-declaration @gol
217 -Wfatal-errors  -Wfloat-equal  -Wformat  -Wformat=2 @gol
218 -Wno-format-extra-args -Wformat-nonliteral @gol
219 -Wformat-security  -Wformat-y2k @gol
220 -Wimplicit  -Wimplicit-function-declaration  -Wimplicit-int @gol
221 -Wimport  -Wno-import  -Winit-self  -Winline @gol
222 -Wno-invalid-offsetof  -Winvalid-pch @gol
223 -Wlarger-than-@var{len}  -Wlong-long @gol
224 -Wmain  -Wmissing-braces @gol
225 -Wmissing-format-attribute  -Wmissing-include-dirs @gol
226 -Wmissing-noreturn @gol
227 -Wno-multichar  -Wnonnull  -Wpacked  -Wpadded @gol
228 -Wparentheses  -Wpointer-arith  -Wredundant-decls @gol
229 -Wreturn-type  -Wsequence-point  -Wshadow @gol
230 -Wsign-compare  -Wstrict-aliasing -Wstrict-aliasing=2 @gol
231 -Wswitch  -Wswitch-default  -Wswitch-enum @gol
232 -Wsystem-headers  -Wtrigraphs  -Wundef  -Wuninitialized @gol
233 -Wunknown-pragmas  -Wunreachable-code @gol
234 -Wunused  -Wunused-function  -Wunused-label  -Wunused-parameter @gol
235 -Wunused-value  -Wunused-variable  -Wwrite-strings @gol
236 -Wvariadic-macros}
238 @item C-only Warning Options
239 @gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
240 -Wmissing-prototypes  -Wnested-externs  -Wold-style-definition @gol
241 -Wstrict-prototypes  -Wtraditional @gol
242 -Wdeclaration-after-statement}
244 @item Debugging Options
245 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
246 @gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
247 -fdump-unnumbered  -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
248 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
249 -fdump-tree-all @gol
250 -fdump-tree-original@r{[}-@var{n}@r{]}  @gol
251 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
252 -fdump-tree-inlined@r{[}-@var{n}@r{]} @gol
253 -fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol
254 -fdump-tree-ch @gol
255 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
256 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
257 -fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
258 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
259 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
260 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
261 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
262 -fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
263 -fdump-tree-nrv @gol
264 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
265 -feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
266 -feliminate-unused-debug-symbols -fmem-report -fprofile-arcs -ftree-based-profiling @gol
267 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
268 -ftest-coverage  -ftime-report -fvar-tracking @gol
269 -g  -g@var{level}  -gcoff -gdwarf-2 @gol
270 -ggdb  -gstabs  -gstabs+  -gvms  -gxcoff  -gxcoff+ @gol
271 -p  -pg  -print-file-name=@var{library}  -print-libgcc-file-name @gol
272 -print-multi-directory  -print-multi-lib @gol
273 -print-prog-name=@var{program}  -print-search-dirs  -Q @gol
274 -save-temps  -time}
276 @item Optimization Options
277 @xref{Optimize Options,,Options that Control Optimization}.
278 @gccoptlist{-falign-functions=@var{n}  -falign-jumps=@var{n} @gol
279 -falign-labels=@var{n}  -falign-loops=@var{n}  @gol
280 -fbounds-check -fmudflap -fmudflapth -fmudflapir @gol
281 -fbranch-probabilities -fprofile-values -fvpt -fbranch-target-load-optimize @gol
282 -fbranch-target-load-optimize2 -fbtr-bb-exclusive @gol
283 -fcaller-saves  -fcprop-registers @gol
284 -fcse-follow-jumps  -fcse-skip-blocks  -fdata-sections @gol
285 -fdelayed-branch  -fdelete-null-pointer-checks @gol
286 -fexpensive-optimizations  -ffast-math  -ffloat-store @gol
287 -fforce-addr  -fforce-mem  -ffunction-sections @gol
288 -fgcse  -fgcse-lm  -fgcse-sm  -fgcse-las  -fgcse-after-reload @gol
289 -floop-optimize -fcrossjumping  -fif-conversion  -fif-conversion2 @gol
290 -finline-functions  -finline-limit=@var{n}  -fkeep-inline-functions @gol
291 -fkeep-static-consts  -fmerge-constants  -fmerge-all-constants @gol
292 -fmodulo-sched -fmove-all-movables  -fnew-ra  -fno-branch-count-reg @gol
293 -fno-default-inline  -fno-defer-pop -floop-optimize2 -fmove-loop-invariants @gol
294 -fno-function-cse  -fno-guess-branch-probability @gol
295 -fno-inline  -fno-math-errno  -fno-peephole  -fno-peephole2 @gol
296 -funsafe-math-optimizations  -ffinite-math-only @gol
297 -fno-trapping-math  -fno-zero-initialized-in-bss @gol
298 -fomit-frame-pointer  -foptimize-register-move @gol
299 -foptimize-sibling-calls  -fprefetch-loop-arrays @gol
300 -fprofile-generate -fprofile-use @gol
301 -freduce-all-givs  -fregmove  -frename-registers @gol
302 -freorder-blocks  -freorder-blocks-and-partition -freorder-functions @gol
303 -frerun-cse-after-loop  -frerun-loop-opt @gol
304 -frounding-math -fschedule-insns  -fschedule-insns2 @gol
305 -fno-sched-interblock  -fno-sched-spec  -fsched-spec-load @gol
306 -fsched-spec-load-dangerous  @gol
307 -fsched-stalled-insns=@var{n} -sched-stalled-insns-dep=@var{n} @gol
308 -fsched2-use-superblocks @gol
309 -fsched2-use-traces  -fsignaling-nans @gol
310 -fsingle-precision-constant  @gol
311 -fstrength-reduce  -fstrict-aliasing  -ftracer  -fthread-jumps @gol
312 -funroll-all-loops  -funroll-loops  -fpeel-loops @gol
313 -funswitch-loops  -fold-unroll-loops  -fold-unroll-all-loops @gol
314 -ftree-pre  -ftree-ccp  -ftree-dce  @gol
315 -ftree-dominator-opts -ftree-dse -ftree-copyrename @gol
316 -ftree-ch -ftree-sra -ftree-ter -ftree-lrs @gol
317 --param @var{name}=@var{value}
318 -O  -O0  -O1  -O2  -O3  -Os}
320 @item Preprocessor Options
321 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
322 @gccoptlist{-A@var{question}=@var{answer} @gol
323 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
324 -C  -dD  -dI  -dM  -dN @gol
325 -D@var{macro}@r{[}=@var{defn}@r{]}  -E  -H @gol
326 -idirafter @var{dir} @gol
327 -include @var{file}  -imacros @var{file} @gol
328 -iprefix @var{file}  -iwithprefix @var{dir} @gol
329 -iwithprefixbefore @var{dir}  -isystem @var{dir} @gol
330 -M  -MM  -MF  -MG  -MP  -MQ  -MT  -nostdinc  @gol
331 -P  -fworking-directory  -remap @gol
332 -trigraphs  -undef  -U@var{macro}  -Wp,@var{option} @gol
333 -Xpreprocessor @var{option}}
335 @item Assembler Option
336 @xref{Assembler Options,,Passing Options to the Assembler}.
337 @gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
339 @item Linker Options
340 @xref{Link Options,,Options for Linking}.
341 @gccoptlist{@var{object-file-name}  -l@var{library} @gol
342 -nostartfiles  -nodefaultlibs  -nostdlib -pie @gol
343 -s  -static  -static-libgcc  -shared  -shared-libgcc  -symbolic @gol
344 -Wl,@var{option}  -Xlinker @var{option} @gol
345 -u @var{symbol}}
347 @item Directory Options
348 @xref{Directory Options,,Options for Directory Search}.
349 @gccoptlist{-B@var{prefix}  -I@var{dir}  -iquote@var{dir}  -L@var{dir}  -specs=@var{file}  -I-}
351 @item Target Options
352 @c I wrote this xref this way to avoid overfull hbox. -- rms
353 @xref{Target Options}.
354 @gccoptlist{-V @var{version}  -b @var{machine}}
356 @item Machine Dependent Options
357 @xref{Submodel Options,,Hardware Models and Configurations}.
359 @emph{M680x0 Options}
360 @gccoptlist{-m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
361 -m68060  -mcpu32  -m5200  -m68881  -mbitfield  -mc68000  -mc68020   @gol
362 -mnobitfield  -mrtd  -mshort  -msoft-float  -mpcrel @gol
363 -malign-int  -mstrict-align  -msep-data  -mno-sep-data @gol
364 -mshared-library-id=n  -mid-shared-library  -mno-id-shared-library}
366 @emph{M68hc1x Options}
367 @gccoptlist{-m6811  -m6812  -m68hc11  -m68hc12   -m68hcs12 @gol
368 -mauto-incdec  -minmax  -mlong-calls  -mshort @gol
369 -msoft-reg-count=@var{count}}
371 @emph{VAX Options}
372 @gccoptlist{-mg  -mgnu  -munix}
374 @emph{SPARC Options}
375 @gccoptlist{-mcpu=@var{cpu-type} @gol
376 -mtune=@var{cpu-type} @gol
377 -mcmodel=@var{code-model} @gol
378 -m32  -m64  -mapp-regs  -mno-app-regs @gol
379 -mfaster-structs  -mno-faster-structs @gol
380 -mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
381 -mhard-quad-float  -msoft-quad-float @gol
382 -mimpure-text  -mno-impure-text  -mlittle-endian @gol
383 -mstack-bias  -mno-stack-bias @gol
384 -munaligned-doubles  -mno-unaligned-doubles @gol
385 -mv8plus  -mno-v8plus  -mvis  -mno-vis}
387 @emph{ARM Options}
388 @gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
389 -mabi=@var{name} @gol
390 -mapcs-stack-check  -mno-apcs-stack-check @gol
391 -mapcs-float  -mno-apcs-float @gol
392 -mapcs-reentrant  -mno-apcs-reentrant @gol
393 -msched-prolog  -mno-sched-prolog @gol
394 -mlittle-endian  -mbig-endian  -mwords-little-endian @gol
395 -mfloat-abi=@var{name}  -msoft-float  -mhard-float  -mfpe @gol
396 -mthumb-interwork  -mno-thumb-interwork @gol
397 -mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
398 -mstructure-size-boundary=@var{n} @gol
399 -mabort-on-noreturn @gol
400 -mlong-calls  -mno-long-calls @gol
401 -msingle-pic-base  -mno-single-pic-base @gol
402 -mpic-register=@var{reg} @gol
403 -mnop-fun-dllimport @gol
404 -mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
405 -mpoke-function-name @gol
406 -mthumb  -marm @gol
407 -mtpcs-frame  -mtpcs-leaf-frame @gol
408 -mcaller-super-interworking  -mcallee-super-interworking}
410 @emph{MN10300 Options}
411 @gccoptlist{-mmult-bug  -mno-mult-bug @gol
412 -mam33  -mno-am33 @gol
413 -mam33-2  -mno-am33-2 @gol
414 -mno-crt0  -mrelax}
416 @emph{M32R/D Options}
417 @gccoptlist{-m32r2 -m32rx -m32r @gol
418 -mdebug @gol
419 -malign-loops -mno-align-loops @gol
420 -missue-rate=@var{number} @gol
421 -mbranch-cost=@var{number} @gol
422 -mmodel=@var{code-size-model-type} @gol
423 -msdata=@var{sdata-type} @gol
424 -mno-flush-func -mflush-func=@var{name} @gol
425 -mno-flush-trap -mflush-trap=@var{number} @gol
426 -G @var{num}}
428 @emph{RS/6000 and PowerPC Options}
429 @gccoptlist{-mcpu=@var{cpu-type} @gol
430 -mtune=@var{cpu-type} @gol
431 -mpower  -mno-power  -mpower2  -mno-power2 @gol
432 -mpowerpc  -mpowerpc64  -mno-powerpc @gol
433 -maltivec  -mno-altivec @gol
434 -mpowerpc-gpopt  -mno-powerpc-gpopt @gol
435 -mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
436 -mnew-mnemonics  -mold-mnemonics @gol
437 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
438 -m64  -m32  -mxl-call  -mno-xl-call  -mpe @gol
439 -malign-power  -malign-natural @gol
440 -msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
441 -mstring  -mno-string  -mupdate  -mno-update @gol
442 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
443 -mstrict-align  -mno-strict-align  -mrelocatable @gol
444 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
445 -mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
446 -mdynamic-no-pic @gol
447 -mprioritize-restricted-insns=@var{priority} @gol
448 -msched-costly-dep=@var{dependence_type} @gol
449 -minsert-sched-nops=@var{scheme} @gol
450 -mcall-sysv  -mcall-netbsd @gol
451 -maix-struct-return  -msvr4-struct-return @gol
452 -mabi=altivec  -mabi=no-altivec @gol
453 -mabi=spe  -mabi=no-spe @gol
454 -misel=yes  -misel=no @gol
455 -mspe=yes  -mspe=no @gol
456 -mfloat-gprs=yes  -mfloat-gprs=no @gol
457 -mprototype  -mno-prototype @gol
458 -msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
459 -msdata=@var{opt}  -mvxworks  -mwindiss  -G @var{num}  -pthread}
461 @emph{Darwin Options}
462 @gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal @gol
463 -arch_only  -bind_at_load  -bundle  -bundle_loader @gol
464 -client_name  -compatibility_version  -current_version @gol
465 -dependency-file  -dylib_file  -dylinker_install_name @gol
466 -dynamic  -dynamiclib  -exported_symbols_list @gol
467 -filelist  -flat_namespace  -force_cpusubtype_ALL @gol
468 -force_flat_namespace  -headerpad_max_install_names @gol
469 -image_base  -init  -install_name  -keep_private_externs @gol
470 -multi_module  -multiply_defined  -multiply_defined_unused @gol
471 -noall_load  -nofixprebinding -nomultidefs  -noprebind  -noseglinkedit @gol
472 -pagezero_size  -prebind  -prebind_all_twolevel_modules @gol
473 -private_bundle  -read_only_relocs  -sectalign @gol
474 -sectobjectsymbols  -whyload  -seg1addr @gol
475 -sectcreate  -sectobjectsymbols  -sectorder @gol
476 -seg_addr_table  -seg_addr_table_filename  -seglinkedit @gol
477 -segprot  -segs_read_only_addr  -segs_read_write_addr @gol
478 -single_module  -static  -sub_library  -sub_umbrella @gol
479 -twolevel_namespace  -umbrella  -undefined @gol
480 -unexported_symbols_list  -weak_reference_mismatches @gol
481 -whatsloaded -F}
483 @emph{MIPS Options}
484 @gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
485 -mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips64 @gol
486 -mips16  -mno-mips16  -mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
487 -mxgot  -mno-xgot  -mgp32  -mgp64  -mfp32  -mfp64 @gol
488 -mhard-float  -msoft-float  -msingle-float  -mdouble-float @gol
489 -mint64  -mlong64  -mlong32 @gol
490 -G@var{num}  -membedded-data  -mno-embedded-data @gol
491 -muninit-const-in-rodata  -mno-uninit-const-in-rodata @gol
492 -msplit-addresses  -mno-split-addresses  @gol
493 -mexplicit-relocs  -mno-explicit-relocs  @gol
494 -mrnames  -mno-rnames @gol
495 -mcheck-zero-division  -mno-check-zero-division @gol
496 -mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls @gol
497 -mmad  -mno-mad  -mfused-madd  -mno-fused-madd  -nocpp @gol
498 -mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400 @gol
499 -mfix-vr4120  -mno-fix-vr4120  -mfix-sb1  -mno-fix-sb1 @gol
500 -mflush-func=@var{func}  -mno-flush-func @gol
501 -mbranch-likely  -mno-branch-likely @gol
502 -mfp-exceptions -mno-fp-exceptions @gol
503 -mvr4130-align -mno-vr4130-align}
505 @emph{i386 and x86-64 Options}
506 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
507 -mfpmath=@var{unit} @gol
508 -masm=@var{dialect}  -mno-fancy-math-387 @gol
509 -mno-fp-ret-in-387  -msoft-float  -msvr3-shlib @gol
510 -mno-wide-multiply  -mrtd  -malign-double @gol
511 -mpreferred-stack-boundary=@var{num} @gol
512 -mmmx  -msse  -msse2 -msse3 -m3dnow @gol
513 -mthreads  -mno-align-stringops  -minline-all-stringops @gol
514 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
515 -m96bit-long-double  -mregparm=@var{num}  -momit-leaf-frame-pointer @gol
516 -mno-red-zone -mno-tls-direct-seg-refs @gol
517 -mcmodel=@var{code-model} @gol
518 -m32  -m64}
520 @emph{HPPA Options}
521 @gccoptlist{-march=@var{architecture-type} @gol
522 -mbig-switch  -mdisable-fpregs  -mdisable-indexing @gol
523 -mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
524 -mjump-in-delay -mlinker-opt -mlong-calls @gol
525 -mlong-load-store  -mno-big-switch  -mno-disable-fpregs @gol
526 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
527 -mno-jump-in-delay  -mno-long-load-store @gol
528 -mno-portable-runtime  -mno-soft-float @gol
529 -mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
530 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
531 -mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
532 -nolibdld  -static  -threads}
534 @emph{DEC Alpha Options}
535 @gccoptlist{-mno-fp-regs  -msoft-float  -malpha-as  -mgas @gol
536 -mieee  -mieee-with-inexact  -mieee-conformant @gol
537 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
538 -mtrap-precision=@var{mode}  -mbuild-constants @gol
539 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
540 -mbwx  -mmax  -mfix  -mcix @gol
541 -mfloat-vax  -mfloat-ieee @gol
542 -mexplicit-relocs  -msmall-data  -mlarge-data @gol
543 -msmall-text  -mlarge-text @gol
544 -mmemory-latency=@var{time}}
546 @emph{DEC Alpha/VMS Options}
547 @gccoptlist{-mvms-return-codes}
549 @emph{H8/300 Options}
550 @gccoptlist{-mrelax  -mh  -ms  -mn  -mint32  -malign-300}
552 @emph{SH Options}
553 @gccoptlist{-m1  -m2  -m2e  -m3  -m3e @gol
554 -m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
555 -m5-64media  -m5-64media-nofpu @gol
556 -m5-32media  -m5-32media-nofpu @gol
557 -m5-compact  -m5-compact-nofpu @gol
558 -mb  -ml  -mdalign  -mrelax @gol
559 -mbigtable  -mfmovd  -mhitachi  -mnomacsave @gol
560 -mieee  -misize  -mpadstruct  -mspace @gol
561 -mprefergot  -musermode}
563 @emph{System V Options}
564 @gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
566 @emph{ARC Options}
567 @gccoptlist{-EB  -EL @gol
568 -mmangle-cpu  -mcpu=@var{cpu}  -mtext=@var{text-section} @gol
569 -mdata=@var{data-section}  -mrodata=@var{readonly-data-section}}
571 @emph{TMS320C3x/C4x Options}
572 @gccoptlist{-mcpu=@var{cpu}  -mbig  -msmall  -mregparm  -mmemparm @gol
573 -mfast-fix  -mmpyi  -mbk  -mti  -mdp-isr-reload @gol
574 -mrpts=@var{count}  -mrptb  -mdb  -mloop-unsigned @gol
575 -mparallel-insns  -mparallel-mpy  -mpreserve-float}
577 @emph{V850 Options}
578 @gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
579 -mprolog-function  -mno-prolog-function  -mspace @gol
580 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
581 -mapp-regs  -mno-app-regs @gol
582 -mdisable-callt  -mno-disable-callt @gol
583 -mv850e1 @gol
584 -mv850e @gol
585 -mv850  -mbig-switch}
587 @emph{NS32K Options}
588 @gccoptlist{-m32032  -m32332  -m32532  -m32081  -m32381 @gol
589 -mmult-add  -mnomult-add  -msoft-float  -mrtd  -mnortd @gol
590 -mregparam  -mnoregparam  -msb  -mnosb @gol
591 -mbitfield  -mnobitfield  -mhimem  -mnohimem}
593 @emph{AVR Options}
594 @gccoptlist{-mmcu=@var{mcu}  -msize  -minit-stack=@var{n}  -mno-interrupts @gol
595 -mcall-prologues  -mno-tablejump  -mtiny-stack  -mint8}
597 @emph{MCore Options}
598 @gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
599 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
600 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
601 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
602 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
604 @emph{MMIX Options}
605 @gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
606 -mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
607 -melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
608 -mno-base-addresses  -msingle-exit  -mno-single-exit}
610 @emph{IA-64 Options}
611 @gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
612 -mvolatile-asm-stop  -mb-step  -mregister-names  -mno-sdata @gol
613 -mconstant-gp  -mauto-pic  -minline-float-divide-min-latency @gol
614 -minline-float-divide-max-throughput @gol
615 -minline-int-divide-min-latency @gol
616 -minline-int-divide-max-throughput  -mno-dwarf2-asm @gol
617 -mfixed-range=@var{register-range}}
619 @emph{S/390 and zSeries Options}
620 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
621 -mhard-float  -msoft-float  -mbackchain  -mno-backchain @gol
622 -msmall-exec  -mno-small-exec  -mmvcle -mno-mvcle @gol
623 -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch @gol
624 -mtpf-trace -mno-tpf-trace  -mfused-madd  -mno-fused-madd}
626 @emph{CRIS Options}
627 @gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}  -mtune=@var{cpu} @gol
628 -mmax-stack-frame=@var{n}  -melinux-stacksize=@var{n} @gol
629 -metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
630 -mstack-align  -mdata-align  -mconst-align @gol
631 -m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue  -mno-gotplt @gol
632 -melf  -maout  -melinux  -mlinux  -sim  -sim2 @gol
633 -mmul-bug-workaround  -mno-mul-bug-workaround}
635 @emph{PDP-11 Options}
636 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
637 -mbcopy  -mbcopy-builtin  -mint32  -mno-int16 @gol
638 -mint16  -mno-int32  -mfloat32  -mno-float64 @gol
639 -mfloat64  -mno-float32  -mabshi  -mno-abshi @gol
640 -mbranch-expensive  -mbranch-cheap @gol
641 -msplit  -mno-split  -munix-asm  -mdec-asm}
643 @emph{Xstormy16 Options}
644 @gccoptlist{-msim}
646 @emph{Xtensa Options}
647 @gccoptlist{-mconst16 -mno-const16 @gol
648 -mfused-madd  -mno-fused-madd @gol
649 -mtext-section-literals  -mno-text-section-literals @gol
650 -mtarget-align  -mno-target-align @gol
651 -mlongcalls  -mno-longcalls}
653 @emph{FRV Options}
654 @gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
655 -mhard-float  -msoft-float @gol
656 -malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
657 -mdouble  -mno-double @gol
658 -mmedia  -mno-media  -mmuladd  -mno-muladd @gol
659 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic -mlinked-fp @gol
660 -mlibrary-pic  -macc-4 -macc-8 @gol
661 -mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
662 -mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
663 -mvliw-branch  -mno-vliw-branch @gol
664 -mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
665 -mno-nested-cond-exec  -mtomcat-stats @gol
666 -mcpu=@var{cpu}}
668 @item Code Generation Options
669 @xref{Code Gen Options,,Options for Code Generation Conventions}.
670 @gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
671 -ffixed-@var{reg}  -fexceptions @gol
672 -fnon-call-exceptions  -funwind-tables @gol
673 -fasynchronous-unwind-tables @gol
674 -finhibit-size-directive  -finstrument-functions @gol
675 -fno-common  -fno-ident @gol
676 -fpcc-struct-return  -fpic  -fPIC -fpie -fPIE @gol
677 -freg-struct-return  -fshared-data  -fshort-enums @gol
678 -fshort-double  -fshort-wchar @gol
679 -fverbose-asm  -fpack-struct  -fstack-check @gol
680 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
681 -fargument-alias  -fargument-noalias @gol
682 -fargument-noalias-global  -fleading-underscore @gol
683 -ftls-model=@var{model} @gol
684 -ftrapv  -fwrapv  -fbounds-check}
685 @end table
687 @menu
688 * Overall Options::     Controlling the kind of output:
689                         an executable, object files, assembler files,
690                         or preprocessed source.
691 * C Dialect Options::   Controlling the variant of C language compiled.
692 * C++ Dialect Options:: Variations on C++.
693 * Objective-C Dialect Options:: Variations on Objective-C.
694 * Language Independent Options:: Controlling how diagnostics should be
695                         formatted.
696 * Warning Options::     How picky should the compiler be?
697 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
698 * Optimize Options::    How much optimization?
699 * Preprocessor Options:: Controlling header files and macro definitions.
700                          Also, getting dependency information for Make.
701 * Assembler Options::   Passing options to the assembler.
702 * Link Options::        Specifying libraries and so on.
703 * Directory Options::   Where to find header files and libraries.
704                         Where to find the compiler executable files.
705 * Spec Files::          How to pass switches to sub-processes.
706 * Target Options::      Running a cross-compiler, or an old version of GCC.
707 @end menu
709 @node Overall Options
710 @section Options Controlling the Kind of Output
712 Compilation can involve up to four stages: preprocessing, compilation
713 proper, assembly and linking, always in that order.  GCC is capable of
714 preprocessing and compiling several files either into several
715 assembler input files, or into one assembler input file; then each
716 assembler input file produces an object file, and linking combines all
717 the object files (those newly compiled, and those specified as input)
718 into an executable file.
720 @cindex file name suffix
721 For any given input file, the file name suffix determines what kind of
722 compilation is done:
724 @table @gcctabopt
725 @item @var{file}.c
726 C source code which must be preprocessed.
728 @item @var{file}.i
729 C source code which should not be preprocessed.
731 @item @var{file}.ii
732 C++ source code which should not be preprocessed.
734 @item @var{file}.m
735 Objective-C source code.  Note that you must link with the library
736 @file{libobjc.a} to make an Objective-C program work.
738 @item @var{file}.mi
739 Objective-C source code which should not be preprocessed.
741 @item @var{file}.h
742 C or C++ header file to be turned into a precompiled header.
744 @item @var{file}.cc
745 @itemx @var{file}.cp
746 @itemx @var{file}.cxx
747 @itemx @var{file}.cpp
748 @itemx @var{file}.CPP
749 @itemx @var{file}.c++
750 @itemx @var{file}.C
751 C++ source code which must be preprocessed.  Note that in @samp{.cxx},
752 the last two letters must both be literally @samp{x}.  Likewise,
753 @samp{.C} refers to a literal capital C@.
755 @item @var{file}.hh
756 @itemx @var{file}.H
757 C++ header file to be turned into a precompiled header.
759 @item @var{file}.f
760 @itemx @var{file}.for
761 @itemx @var{file}.FOR
762 Fortran source code which should not be preprocessed.
764 @item @var{file}.F
765 @itemx @var{file}.fpp
766 @itemx @var{file}.FPP
767 Fortran source code which must be preprocessed (with the traditional
768 preprocessor).
770 @item @var{file}.r
771 Fortran source code which must be preprocessed with a RATFOR
772 preprocessor (not included with GCC)@.
774 @item @var{file}.f90
775 @itemx @var{file}.f95
776 Fortran 90/95 source code which should not be preprocessed.
778 @c FIXME: Descriptions of Java file types.
779 @c @var{file}.java
780 @c @var{file}.class
781 @c @var{file}.zip
782 @c @var{file}.jar
784 @item @var{file}.ads
785 Ada source code file which contains a library unit declaration (a
786 declaration of a package, subprogram, or generic, or a generic
787 instantiation), or a library unit renaming declaration (a package,
788 generic, or subprogram renaming declaration).  Such files are also
789 called @dfn{specs}.
791 @itemx @var{file}.adb
792 Ada source code file containing a library unit body (a subprogram or
793 package body).  Such files are also called @dfn{bodies}.
795 @c GCC also knows about some suffixes for languages not yet included:
796 @c Pascal:
797 @c @var{file}.p
798 @c @var{file}.pas
800 @item @var{file}.s
801 Assembler code.
803 @item @var{file}.S
804 Assembler code which must be preprocessed.
806 @item @var{other}
807 An object file to be fed straight into linking.
808 Any file name with no recognized suffix is treated this way.
809 @end table
811 @opindex x
812 You can specify the input language explicitly with the @option{-x} option:
814 @table @gcctabopt
815 @item -x @var{language}
816 Specify explicitly the @var{language} for the following input files
817 (rather than letting the compiler choose a default based on the file
818 name suffix).  This option applies to all following input files until
819 the next @option{-x} option.  Possible values for @var{language} are:
820 @smallexample
821 c  c-header  cpp-output
822 c++  c++-header  c++-cpp-output
823 objective-c  objective-c-header  objc-cpp-output
824 assembler  assembler-with-cpp
826 f77  f77-cpp-input  ratfor
828 java
829 treelang
830 @end smallexample
832 @item -x none
833 Turn off any specification of a language, so that subsequent files are
834 handled according to their file name suffixes (as they are if @option{-x}
835 has not been used at all).
837 @item -pass-exit-codes
838 @opindex pass-exit-codes
839 Normally the @command{gcc} program will exit with the code of 1 if any
840 phase of the compiler returns a non-success return code.  If you specify
841 @option{-pass-exit-codes}, the @command{gcc} program will instead return with
842 numerically highest error produced by any phase that returned an error
843 indication.
844 @end table
846 If you only want some of the stages of compilation, you can use
847 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
848 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
849 @command{gcc} is to stop.  Note that some combinations (for example,
850 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
852 @table @gcctabopt
853 @item -c
854 @opindex c
855 Compile or assemble the source files, but do not link.  The linking
856 stage simply is not done.  The ultimate output is in the form of an
857 object file for each source file.
859 By default, the object file name for a source file is made by replacing
860 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
862 Unrecognized input files, not requiring compilation or assembly, are
863 ignored.
865 @item -S
866 @opindex S
867 Stop after the stage of compilation proper; do not assemble.  The output
868 is in the form of an assembler code file for each non-assembler input
869 file specified.
871 By default, the assembler file name for a source file is made by
872 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
874 Input files that don't require compilation are ignored.
876 @item -E
877 @opindex E
878 Stop after the preprocessing stage; do not run the compiler proper.  The
879 output is in the form of preprocessed source code, which is sent to the
880 standard output.
882 Input files which don't require preprocessing are ignored.
884 @cindex output file option
885 @item -o @var{file}
886 @opindex o
887 Place output in file @var{file}.  This applies regardless to whatever
888 sort of output is being produced, whether it be an executable file,
889 an object file, an assembler file or preprocessed C code.
891 If @option{-o} is not specified, the default is to put an executable
892 file in @file{a.out}, the object file for
893 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
894 assembler file in @file{@var{source}.s}, a precompiled header file in
895 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
896 standard output.
898 @item -v
899 @opindex v
900 Print (on standard error output) the commands executed to run the stages
901 of compilation.  Also print the version number of the compiler driver
902 program and of the preprocessor and the compiler proper.
904 @item -###
905 @opindex ###
906 Like @option{-v} except the commands are not executed and all command
907 arguments are quoted.  This is useful for shell scripts to capture the
908 driver-generated command lines.
910 @item -pipe
911 @opindex pipe
912 Use pipes rather than temporary files for communication between the
913 various stages of compilation.  This fails to work on some systems where
914 the assembler is unable to read from a pipe; but the GNU assembler has
915 no trouble.
917 @item -combine
918 @opindex combine
919 If you are compiling multiple source files, this option tells the driver
920 to pass all the source files to the compiler at once (for those
921 languages for which the compiler can handle this).  This will allow
922 intermodule analysis (IMA) to be performed by the compiler.  Currently the only
923 language for which this is supported is C.  If you pass source files for
924 multiple languages to the driver, using this option, the driver will invoke
925 the compiler(s) that support IMA once each, passing each compiler all the
926 source files appropriate for it.  For those languages that do not support
927 IMA this option will be ignored, and the compiler will be invoked once for
928 each source file in that language.  If you use this option in conjunction
929 with -save-temps, the compiler will generate multiple pre-processed files
930 (one for each source file), but only one (combined) .o or .s file.
932 @item --help
933 @opindex help
934 Print (on the standard output) a description of the command line options
935 understood by @command{gcc}.  If the @option{-v} option is also specified
936 then @option{--help} will also be passed on to the various processes
937 invoked by @command{gcc}, so that they can display the command line options
938 they accept.  If the @option{-Wextra} option is also specified then command
939 line options which have no documentation associated with them will also
940 be displayed.
942 @item --target-help
943 @opindex target-help
944 Print (on the standard output) a description of target specific command
945 line options for each tool.
947 @item --version
948 @opindex version
949 Display the version number and copyrights of the invoked GCC.
950 @end table
952 @node Invoking G++
953 @section Compiling C++ Programs
955 @cindex suffixes for C++ source
956 @cindex C++ source file suffixes
957 C++ source files conventionally use one of the suffixes @samp{.C},
958 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
959 @samp{.cxx}; C++ header files often use @samp{.hh} or @samp{.H}; and
960 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
961 files with these names and compiles them as C++ programs even if you
962 call the compiler the same way as for compiling C programs (usually
963 with the name @command{gcc}).
965 @findex g++
966 @findex c++
967 However, C++ programs often require class libraries as well as a
968 compiler that understands the C++ language---and under some
969 circumstances, you might want to compile programs or header files from
970 standard input, or otherwise without a suffix that flags them as C++
971 programs.  You might also like to precompile a C header file with a
972 @samp{.h} extension to be used in C++ compilations.  @command{g++} is a
973 program that calls GCC with the default language set to C++, and
974 automatically specifies linking against the C++ library.  On many
975 systems, @command{g++} is also installed with the name @command{c++}.
977 @cindex invoking @command{g++}
978 When you compile C++ programs, you may specify many of the same
979 command-line options that you use for compiling programs in any
980 language; or command-line options meaningful for C and related
981 languages; or options that are meaningful only for C++ programs.
982 @xref{C Dialect Options,,Options Controlling C Dialect}, for
983 explanations of options for languages related to C@.
984 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
985 explanations of options that are meaningful only for C++ programs.
987 @node C Dialect Options
988 @section Options Controlling C Dialect
989 @cindex dialect options
990 @cindex language dialect options
991 @cindex options, dialect
993 The following options control the dialect of C (or languages derived
994 from C, such as C++ and Objective-C) that the compiler accepts:
996 @table @gcctabopt
997 @cindex ANSI support
998 @cindex ISO support
999 @item -ansi
1000 @opindex ansi
1001 In C mode, support all ISO C90 programs.  In C++ mode,
1002 remove GNU extensions that conflict with ISO C++.
1004 This turns off certain features of GCC that are incompatible with ISO
1005 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1006 such as the @code{asm} and @code{typeof} keywords, and
1007 predefined macros such as @code{unix} and @code{vax} that identify the
1008 type of system you are using.  It also enables the undesirable and
1009 rarely used ISO trigraph feature.  For the C compiler,
1010 it disables recognition of C++ style @samp{//} comments as well as
1011 the @code{inline} keyword.
1013 The alternate keywords @code{__asm__}, @code{__extension__},
1014 @code{__inline__} and @code{__typeof__} continue to work despite
1015 @option{-ansi}.  You would not want to use them in an ISO C program, of
1016 course, but it is useful to put them in header files that might be included
1017 in compilations done with @option{-ansi}.  Alternate predefined macros
1018 such as @code{__unix__} and @code{__vax__} are also available, with or
1019 without @option{-ansi}.
1021 The @option{-ansi} option does not cause non-ISO programs to be
1022 rejected gratuitously.  For that, @option{-pedantic} is required in
1023 addition to @option{-ansi}.  @xref{Warning Options}.
1025 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1026 option is used.  Some header files may notice this macro and refrain
1027 from declaring certain functions or defining certain macros that the
1028 ISO standard doesn't call for; this is to avoid interfering with any
1029 programs that might use these names for other things.
1031 Functions which would normally be built in but do not have semantics
1032 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1033 functions with @option{-ansi} is used.  @xref{Other Builtins,,Other
1034 built-in functions provided by GCC}, for details of the functions
1035 affected.
1037 @item -std=
1038 @opindex std
1039 Determine the language standard.  This option is currently only
1040 supported when compiling C or C++.  A value for this option must be
1041 provided; possible values are
1043 @table @samp
1044 @item c89
1045 @itemx iso9899:1990
1046 ISO C90 (same as @option{-ansi}).
1048 @item iso9899:199409
1049 ISO C90 as modified in amendment 1.
1051 @item c99
1052 @itemx c9x
1053 @itemx iso9899:1999
1054 @itemx iso9899:199x
1055 ISO C99.  Note that this standard is not yet fully supported; see
1056 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information.  The
1057 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1059 @item gnu89
1060 Default, ISO C90 plus GNU extensions (including some C99 features).
1062 @item gnu99
1063 @itemx gnu9x
1064 ISO C99 plus GNU extensions.  When ISO C99 is fully implemented in GCC,
1065 this will become the default.  The name @samp{gnu9x} is deprecated.
1067 @item c++98
1068 The 1998 ISO C++ standard plus amendments.
1070 @item gnu++98
1071 The same as @option{-std=c++98} plus GNU extensions.  This is the
1072 default for C++ code.
1073 @end table
1075 Even when this option is not specified, you can still use some of the
1076 features of newer standards in so far as they do not conflict with
1077 previous C standards.  For example, you may use @code{__restrict__} even
1078 when @option{-std=c99} is not specified.
1080 The @option{-std} options specifying some version of ISO C have the same
1081 effects as @option{-ansi}, except that features that were not in ISO C90
1082 but are in the specified version (for example, @samp{//} comments and
1083 the @code{inline} keyword in ISO C99) are not disabled.
1085 @xref{Standards,,Language Standards Supported by GCC}, for details of
1086 these standard versions.
1088 @item -aux-info @var{filename}
1089 @opindex aux-info
1090 Output to the given filename prototyped declarations for all functions
1091 declared and/or defined in a translation unit, including those in header
1092 files.  This option is silently ignored in any language other than C@.
1094 Besides declarations, the file indicates, in comments, the origin of
1095 each declaration (source file and line), whether the declaration was
1096 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1097 @samp{O} for old, respectively, in the first character after the line
1098 number and the colon), and whether it came from a declaration or a
1099 definition (@samp{C} or @samp{F}, respectively, in the following
1100 character).  In the case of function definitions, a K&R-style list of
1101 arguments followed by their declarations is also provided, inside
1102 comments, after the declaration.
1104 @item -fno-asm
1105 @opindex fno-asm
1106 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1107 keyword, so that code can use these words as identifiers.  You can use
1108 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1109 instead.  @option{-ansi} implies @option{-fno-asm}.
1111 In C++, this switch only affects the @code{typeof} keyword, since
1112 @code{asm} and @code{inline} are standard keywords.  You may want to
1113 use the @option{-fno-gnu-keywords} flag instead, which has the same
1114 effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1115 switch only affects the @code{asm} and @code{typeof} keywords, since
1116 @code{inline} is a standard keyword in ISO C99.
1118 @item -fno-builtin
1119 @itemx -fno-builtin-@var{function}
1120 @opindex fno-builtin
1121 @cindex built-in functions
1122 Don't recognize built-in functions that do not begin with
1123 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
1124 functions provided by GCC}, for details of the functions affected,
1125 including those which are not built-in functions when @option{-ansi} or
1126 @option{-std} options for strict ISO C conformance are used because they
1127 do not have an ISO standard meaning.
1129 GCC normally generates special code to handle certain built-in functions
1130 more efficiently; for instance, calls to @code{alloca} may become single
1131 instructions that adjust the stack directly, and calls to @code{memcpy}
1132 may become inline copy loops.  The resulting code is often both smaller
1133 and faster, but since the function calls no longer appear as such, you
1134 cannot set a breakpoint on those calls, nor can you change the behavior
1135 of the functions by linking with a different library.
1137 With the @option{-fno-builtin-@var{function}} option
1138 only the built-in function @var{function} is
1139 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
1140 function is named this is not built-in in this version of GCC, this
1141 option is ignored.  There is no corresponding
1142 @option{-fbuiltin-@var{function}} option; if you wish to enable
1143 built-in functions selectively when using @option{-fno-builtin} or
1144 @option{-ffreestanding}, you may define macros such as:
1146 @smallexample
1147 #define abs(n)          __builtin_abs ((n))
1148 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
1149 @end smallexample
1151 @item -fhosted
1152 @opindex fhosted
1153 @cindex hosted environment
1155 Assert that compilation takes place in a hosted environment.  This implies
1156 @option{-fbuiltin}.  A hosted environment is one in which the
1157 entire standard library is available, and in which @code{main} has a return
1158 type of @code{int}.  Examples are nearly everything except a kernel.
1159 This is equivalent to @option{-fno-freestanding}.
1161 @item -ffreestanding
1162 @opindex ffreestanding
1163 @cindex hosted environment
1165 Assert that compilation takes place in a freestanding environment.  This
1166 implies @option{-fno-builtin}.  A freestanding environment
1167 is one in which the standard library may not exist, and program startup may
1168 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
1169 This is equivalent to @option{-fno-hosted}.
1171 @xref{Standards,,Language Standards Supported by GCC}, for details of
1172 freestanding and hosted environments.
1174 @item -fms-extensions
1175 @opindex fms-extensions
1176 Accept some non-standard constructs used in Microsoft header files.
1178 @item -trigraphs
1179 @opindex trigraphs
1180 Support ISO C trigraphs.  The @option{-ansi} option (and @option{-std}
1181 options for strict ISO C conformance) implies @option{-trigraphs}.
1183 @item -no-integrated-cpp
1184 @opindex no-integrated-cpp
1185 Performs a compilation in two passes: preprocessing and compiling.  This
1186 option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1187 @option{-B} option. The user supplied compilation step can then add in
1188 an additional preprocessing step after normal preprocessing but before
1189 compiling. The default is to use the integrated cpp (internal cpp)
1191 The semantics of this option will change if "cc1", "cc1plus", and
1192 "cc1obj" are merged.
1194 @cindex traditional C language
1195 @cindex C language, traditional
1196 @item -traditional
1197 @itemx -traditional-cpp
1198 @opindex traditional-cpp
1199 @opindex traditional
1200 Formerly, these options caused GCC to attempt to emulate a pre-standard
1201 C compiler.  They are now only supported with the @option{-E} switch.
1202 The preprocessor continues to support a pre-standard mode.  See the GNU
1203 CPP manual for details.
1205 @item -fcond-mismatch
1206 @opindex fcond-mismatch
1207 Allow conditional expressions with mismatched types in the second and
1208 third arguments.  The value of such an expression is void.  This option
1209 is not supported for C++.
1211 @item -funsigned-char
1212 @opindex funsigned-char
1213 Let the type @code{char} be unsigned, like @code{unsigned char}.
1215 Each kind of machine has a default for what @code{char} should
1216 be.  It is either like @code{unsigned char} by default or like
1217 @code{signed char} by default.
1219 Ideally, a portable program should always use @code{signed char} or
1220 @code{unsigned char} when it depends on the signedness of an object.
1221 But many programs have been written to use plain @code{char} and
1222 expect it to be signed, or expect it to be unsigned, depending on the
1223 machines they were written for.  This option, and its inverse, let you
1224 make such a program work with the opposite default.
1226 The type @code{char} is always a distinct type from each of
1227 @code{signed char} or @code{unsigned char}, even though its behavior
1228 is always just like one of those two.
1230 @item -fsigned-char
1231 @opindex fsigned-char
1232 Let the type @code{char} be signed, like @code{signed char}.
1234 Note that this is equivalent to @option{-fno-unsigned-char}, which is
1235 the negative form of @option{-funsigned-char}.  Likewise, the option
1236 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1238 @item -fsigned-bitfields
1239 @itemx -funsigned-bitfields
1240 @itemx -fno-signed-bitfields
1241 @itemx -fno-unsigned-bitfields
1242 @opindex fsigned-bitfields
1243 @opindex funsigned-bitfields
1244 @opindex fno-signed-bitfields
1245 @opindex fno-unsigned-bitfields
1246 These options control whether a bit-field is signed or unsigned, when the
1247 declaration does not use either @code{signed} or @code{unsigned}.  By
1248 default, such a bit-field is signed, because this is consistent: the
1249 basic integer types such as @code{int} are signed types.
1250 @end table
1252 @node C++ Dialect Options
1253 @section Options Controlling C++ Dialect
1255 @cindex compiler options, C++
1256 @cindex C++ options, command line
1257 @cindex options, C++
1258 This section describes the command-line options that are only meaningful
1259 for C++ programs; but you can also use most of the GNU compiler options
1260 regardless of what language your program is in.  For example, you
1261 might compile a file @code{firstClass.C} like this:
1263 @smallexample
1264 g++ -g -frepo -O -c firstClass.C
1265 @end smallexample
1267 @noindent
1268 In this example, only @option{-frepo} is an option meant
1269 only for C++ programs; you can use the other options with any
1270 language supported by GCC@.
1272 Here is a list of options that are @emph{only} for compiling C++ programs:
1274 @table @gcctabopt
1276 @item -fabi-version=@var{n}
1277 @opindex fabi-version
1278 Use version @var{n} of the C++ ABI.  Version 2 is the version of the
1279 C++ ABI that first appeared in G++ 3.4.  Version 1 is the version of
1280 the C++ ABI that first appeared in G++ 3.2.  Version 0 will always be
1281 the version that conforms most closely to the C++ ABI specification.
1282 Therefore, the ABI obtained using version 0 will change as ABI bugs
1283 are fixed.
1285 The default is version 2.
1287 @item -fno-access-control
1288 @opindex fno-access-control
1289 Turn off all access checking.  This switch is mainly useful for working
1290 around bugs in the access control code.
1292 @item -fcheck-new
1293 @opindex fcheck-new
1294 Check that the pointer returned by @code{operator new} is non-null
1295 before attempting to modify the storage allocated.  This check is
1296 normally unnecessary because the C++ standard specifies that
1297 @code{operator new} will only return @code{0} if it is declared
1298 @samp{throw()}, in which case the compiler will always check the
1299 return value even without this option.  In all other cases, when
1300 @code{operator new} has a non-empty exception specification, memory
1301 exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
1302 @samp{new (nothrow)}.
1304 @item -fconserve-space
1305 @opindex fconserve-space
1306 Put uninitialized or runtime-initialized global variables into the
1307 common segment, as C does.  This saves space in the executable at the
1308 cost of not diagnosing duplicate definitions.  If you compile with this
1309 flag and your program mysteriously crashes after @code{main()} has
1310 completed, you may have an object that is being destroyed twice because
1311 two definitions were merged.
1313 This option is no longer useful on most targets, now that support has
1314 been added for putting variables into BSS without making them common.
1316 @item -fno-const-strings
1317 @opindex fno-const-strings
1318 Give string constants type @code{char *} instead of type @code{const
1319 char *}.  By default, G++ uses type @code{const char *} as required by
1320 the standard.  Even if you use @option{-fno-const-strings}, you cannot
1321 actually modify the value of a string constant.
1323 This option might be removed in a future release of G++.  For maximum
1324 portability, you should structure your code so that it works with
1325 string constants that have type @code{const char *}.
1327 @item -fno-elide-constructors
1328 @opindex fno-elide-constructors
1329 The C++ standard allows an implementation to omit creating a temporary
1330 which is only used to initialize another object of the same type.
1331 Specifying this option disables that optimization, and forces G++ to
1332 call the copy constructor in all cases.
1334 @item -fno-enforce-eh-specs
1335 @opindex fno-enforce-eh-specs
1336 Don't check for violation of exception specifications at runtime.  This
1337 option violates the C++ standard, but may be useful for reducing code
1338 size in production builds, much like defining @samp{NDEBUG}.  The compiler
1339 will still optimize based on the exception specifications.
1341 @item -ffor-scope
1342 @itemx -fno-for-scope
1343 @opindex ffor-scope
1344 @opindex fno-for-scope
1345 If @option{-ffor-scope} is specified, the scope of variables declared in
1346 a @i{for-init-statement} is limited to the @samp{for} loop itself,
1347 as specified by the C++ standard.
1348 If @option{-fno-for-scope} is specified, the scope of variables declared in
1349 a @i{for-init-statement} extends to the end of the enclosing scope,
1350 as was the case in old versions of G++, and other (traditional)
1351 implementations of C++.
1353 The default if neither flag is given to follow the standard,
1354 but to allow and give a warning for old-style code that would
1355 otherwise be invalid, or have different behavior.
1357 @item -fno-gnu-keywords
1358 @opindex fno-gnu-keywords
1359 Do not recognize @code{typeof} as a keyword, so that code can use this
1360 word as an identifier.  You can use the keyword @code{__typeof__} instead.
1361 @option{-ansi} implies @option{-fno-gnu-keywords}.
1363 @item -fno-implicit-templates
1364 @opindex fno-implicit-templates
1365 Never emit code for non-inline templates which are instantiated
1366 implicitly (i.e.@: by use); only emit code for explicit instantiations.
1367 @xref{Template Instantiation}, for more information.
1369 @item -fno-implicit-inline-templates
1370 @opindex fno-implicit-inline-templates
1371 Don't emit code for implicit instantiations of inline templates, either.
1372 The default is to handle inlines differently so that compiles with and
1373 without optimization will need the same set of explicit instantiations.
1375 @item -fno-implement-inlines
1376 @opindex fno-implement-inlines
1377 To save space, do not emit out-of-line copies of inline functions
1378 controlled by @samp{#pragma implementation}.  This will cause linker
1379 errors if these functions are not inlined everywhere they are called.
1381 @item -fms-extensions
1382 @opindex fms-extensions
1383 Disable pedantic warnings about constructs used in MFC, such as implicit
1384 int and getting a pointer to member function via non-standard syntax.
1386 @item -fno-nonansi-builtins
1387 @opindex fno-nonansi-builtins
1388 Disable built-in declarations of functions that are not mandated by
1389 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
1390 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
1392 @item -fno-operator-names
1393 @opindex fno-operator-names
1394 Do not treat the operator name keywords @code{and}, @code{bitand},
1395 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1396 synonyms as keywords.
1398 @item -fno-optional-diags
1399 @opindex fno-optional-diags
1400 Disable diagnostics that the standard says a compiler does not need to
1401 issue.  Currently, the only such diagnostic issued by G++ is the one for
1402 a name having multiple meanings within a class.
1404 @item -fpermissive
1405 @opindex fpermissive
1406 Downgrade some diagnostics about nonconformant code from errors to
1407 warnings.  Thus, using @option{-fpermissive} will allow some
1408 nonconforming code to compile.
1410 @item -frepo
1411 @opindex frepo
1412 Enable automatic template instantiation at link time.  This option also
1413 implies @option{-fno-implicit-templates}.  @xref{Template
1414 Instantiation}, for more information.
1416 @item -fno-rtti
1417 @opindex fno-rtti
1418 Disable generation of information about every class with virtual
1419 functions for use by the C++ runtime type identification features
1420 (@samp{dynamic_cast} and @samp{typeid}).  If you don't use those parts
1421 of the language, you can save some space by using this flag.  Note that
1422 exception handling uses the same information, but it will generate it as
1423 needed.
1425 @item -fstats
1426 @opindex fstats
1427 Emit statistics about front-end processing at the end of the compilation.
1428 This information is generally only useful to the G++ development team.
1430 @item -ftemplate-depth-@var{n}
1431 @opindex ftemplate-depth
1432 Set the maximum instantiation depth for template classes to @var{n}.
1433 A limit on the template instantiation depth is needed to detect
1434 endless recursions during template class instantiation.  ANSI/ISO C++
1435 conforming programs must not rely on a maximum depth greater than 17.
1437 @item -fuse-cxa-atexit
1438 @opindex fuse-cxa-atexit
1439 Register destructors for objects with static storage duration with the
1440 @code{__cxa_atexit} function rather than the @code{atexit} function.
1441 This option is required for fully standards-compliant handling of static
1442 destructors, but will only work if your C library supports
1443 @code{__cxa_atexit}.
1445 @item -fno-weak
1446 @opindex fno-weak
1447 Do not use weak symbol support, even if it is provided by the linker.
1448 By default, G++ will use weak symbols if they are available.  This
1449 option exists only for testing, and should not be used by end-users;
1450 it will result in inferior code and has no benefits.  This option may
1451 be removed in a future release of G++.
1453 @item -nostdinc++
1454 @opindex nostdinc++
1455 Do not search for header files in the standard directories specific to
1456 C++, but do still search the other standard directories.  (This option
1457 is used when building the C++ library.)
1458 @end table
1460 In addition, these optimization, warning, and code generation options
1461 have meanings only for C++ programs:
1463 @table @gcctabopt
1464 @item -fno-default-inline
1465 @opindex fno-default-inline
1466 Do not assume @samp{inline} for functions defined inside a class scope.
1467 @xref{Optimize Options,,Options That Control Optimization}.  Note that these
1468 functions will have linkage like inline functions; they just won't be
1469 inlined by default.
1471 @item -Wabi @r{(C++ only)}
1472 @opindex Wabi
1473 Warn when G++ generates code that is probably not compatible with the
1474 vendor-neutral C++ ABI.  Although an effort has been made to warn about
1475 all such cases, there are probably some cases that are not warned about,
1476 even though G++ is generating incompatible code.  There may also be
1477 cases where warnings are emitted even though the code that is generated
1478 will be compatible.
1480 You should rewrite your code to avoid these warnings if you are
1481 concerned about the fact that code generated by G++ may not be binary
1482 compatible with code generated by other compilers.
1484 The known incompatibilities at this point include:
1486 @itemize @bullet
1488 @item
1489 Incorrect handling of tail-padding for bit-fields.  G++ may attempt to
1490 pack data into the same byte as a base class.  For example:
1492 @smallexample
1493 struct A @{ virtual void f(); int f1 : 1; @};
1494 struct B : public A @{ int f2 : 1; @};
1495 @end smallexample
1497 @noindent
1498 In this case, G++ will place @code{B::f2} into the same byte
1499 as@code{A::f1}; other compilers will not.  You can avoid this problem
1500 by explicitly padding @code{A} so that its size is a multiple of the
1501 byte size on your platform; that will cause G++ and other compilers to
1502 layout @code{B} identically.
1504 @item
1505 Incorrect handling of tail-padding for virtual bases.  G++ does not use
1506 tail padding when laying out virtual bases.  For example:
1508 @smallexample
1509 struct A @{ virtual void f(); char c1; @};
1510 struct B @{ B(); char c2; @};
1511 struct C : public A, public virtual B @{@};
1512 @end smallexample
1514 @noindent
1515 In this case, G++ will not place @code{B} into the tail-padding for
1516 @code{A}; other compilers will.  You can avoid this problem by
1517 explicitly padding @code{A} so that its size is a multiple of its
1518 alignment (ignoring virtual base classes); that will cause G++ and other
1519 compilers to layout @code{C} identically.
1521 @item
1522 Incorrect handling of bit-fields with declared widths greater than that
1523 of their underlying types, when the bit-fields appear in a union.  For
1524 example:
1526 @smallexample
1527 union U @{ int i : 4096; @};
1528 @end smallexample
1530 @noindent
1531 Assuming that an @code{int} does not have 4096 bits, G++ will make the
1532 union too small by the number of bits in an @code{int}.
1534 @item
1535 Empty classes can be placed at incorrect offsets.  For example:
1537 @smallexample
1538 struct A @{@};
1540 struct B @{
1541   A a;
1542   virtual void f ();
1545 struct C : public B, public A @{@};
1546 @end smallexample
1548 @noindent
1549 G++ will place the @code{A} base class of @code{C} at a nonzero offset;
1550 it should be placed at offset zero.  G++ mistakenly believes that the
1551 @code{A} data member of @code{B} is already at offset zero.
1553 @item
1554 Names of template functions whose types involve @code{typename} or
1555 template template parameters can be mangled incorrectly.
1557 @smallexample
1558 template <typename Q>
1559 void f(typename Q::X) @{@}
1561 template <template <typename> class Q>
1562 void f(typename Q<int>::X) @{@}
1563 @end smallexample
1565 @noindent
1566 Instantiations of these templates may be mangled incorrectly.
1568 @end itemize
1570 @item -Wctor-dtor-privacy @r{(C++ only)}
1571 @opindex Wctor-dtor-privacy
1572 Warn when a class seems unusable because all the constructors or
1573 destructors in that class are private, and it has neither friends nor
1574 public static member functions.
1576 @item -Wnon-virtual-dtor @r{(C++ only)}
1577 @opindex Wnon-virtual-dtor
1578 Warn when a class appears to be polymorphic, thereby requiring a virtual
1579 destructor, yet it declares a non-virtual one.
1580 This warning is enabled by @option{-Wall}.
1582 @item -Wreorder @r{(C++ only)}
1583 @opindex Wreorder
1584 @cindex reordering, warning
1585 @cindex warning for reordering of member initializers
1586 Warn when the order of member initializers given in the code does not
1587 match the order in which they must be executed.  For instance:
1589 @smallexample
1590 struct A @{
1591   int i;
1592   int j;
1593   A(): j (0), i (1) @{ @}
1595 @end smallexample
1597 The compiler will rearrange the member initializers for @samp{i}
1598 and @samp{j} to match the declaration order of the members, emitting
1599 a warning to that effect.  This warning is enabled by @option{-Wall}.
1600 @end table
1602 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
1604 @table @gcctabopt
1605 @item -Weffc++ @r{(C++ only)}
1606 @opindex Weffc++
1607 Warn about violations of the following style guidelines from Scott Meyers'
1608 @cite{Effective C++} book:
1610 @itemize @bullet
1611 @item
1612 Item 11:  Define a copy constructor and an assignment operator for classes
1613 with dynamically allocated memory.
1615 @item
1616 Item 12:  Prefer initialization to assignment in constructors.
1618 @item
1619 Item 14:  Make destructors virtual in base classes.
1621 @item
1622 Item 15:  Have @code{operator=} return a reference to @code{*this}.
1624 @item
1625 Item 23:  Don't try to return a reference when you must return an object.
1627 @end itemize
1629 Also warn about violations of the following style guidelines from
1630 Scott Meyers' @cite{More Effective C++} book:
1632 @itemize @bullet
1633 @item
1634 Item 6:  Distinguish between prefix and postfix forms of increment and
1635 decrement operators.
1637 @item
1638 Item 7:  Never overload @code{&&}, @code{||}, or @code{,}.
1640 @end itemize
1642 When selecting this option, be aware that the standard library
1643 headers do not obey all of these guidelines; use @samp{grep -v}
1644 to filter out those warnings.
1646 @item -Wno-deprecated @r{(C++ only)}
1647 @opindex Wno-deprecated
1648 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
1650 @item -Wno-non-template-friend @r{(C++ only)}
1651 @opindex Wno-non-template-friend
1652 Disable warnings when non-templatized friend functions are declared
1653 within a template.  Since the advent of explicit template specification
1654 support in G++, if the name of the friend is an unqualified-id (i.e.,
1655 @samp{friend foo(int)}), the C++ language specification demands that the
1656 friend declare or define an ordinary, nontemplate function.  (Section
1657 14.5.3).  Before G++ implemented explicit specification, unqualified-ids
1658 could be interpreted as a particular specialization of a templatized
1659 function.  Because this non-conforming behavior is no longer the default
1660 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
1661 check existing code for potential trouble spots and is on by default.
1662 This new compiler behavior can be turned off with
1663 @option{-Wno-non-template-friend} which keeps the conformant compiler code
1664 but disables the helpful warning.
1666 @item -Wold-style-cast @r{(C++ only)}
1667 @opindex Wold-style-cast
1668 Warn if an old-style (C-style) cast to a non-void type is used within
1669 a C++ program.  The new-style casts (@samp{static_cast},
1670 @samp{reinterpret_cast}, and @samp{const_cast}) are less vulnerable to
1671 unintended effects and much easier to search for.
1673 @item -Woverloaded-virtual @r{(C++ only)}
1674 @opindex Woverloaded-virtual
1675 @cindex overloaded virtual fn, warning
1676 @cindex warning for overloaded virtual fn
1677 Warn when a function declaration hides virtual functions from a
1678 base class.  For example, in:
1680 @smallexample
1681 struct A @{
1682   virtual void f();
1685 struct B: public A @{
1686   void f(int);
1688 @end smallexample
1690 the @code{A} class version of @code{f} is hidden in @code{B}, and code
1691 like:
1693 @smallexample
1694 B* b;
1695 b->f();
1696 @end smallexample
1698 will fail to compile.
1700 @item -Wno-pmf-conversions @r{(C++ only)}
1701 @opindex Wno-pmf-conversions
1702 Disable the diagnostic for converting a bound pointer to member function
1703 to a plain pointer.
1705 @item -Wsign-promo @r{(C++ only)}
1706 @opindex Wsign-promo
1707 Warn when overload resolution chooses a promotion from unsigned or
1708 enumeral type to a signed type, over a conversion to an unsigned type of
1709 the same size.  Previous versions of G++ would try to preserve
1710 unsignedness, but the standard mandates the current behavior.
1712 @item -Wsynth @r{(C++ only)}
1713 @opindex Wsynth
1714 @cindex warning for synthesized methods
1715 @cindex synthesized methods, warning
1716 Warn when G++'s synthesis behavior does not match that of cfront.  For
1717 instance:
1719 @smallexample
1720 struct A @{
1721   operator int ();
1722   A& operator = (int);
1725 main ()
1727   A a,b;
1728   a = b;
1730 @end smallexample
1732 In this example, G++ will synthesize a default @samp{A& operator =
1733 (const A&);}, while cfront will use the user-defined @samp{operator =}.
1734 @end table
1736 @node Objective-C Dialect Options
1737 @section Options Controlling Objective-C Dialect
1739 @cindex compiler options, Objective-C
1740 @cindex Objective-C options, command line
1741 @cindex options, Objective-C
1742 (NOTE: This manual does not describe the Objective-C language itself.  See
1743 @w{@uref{http://gcc.gnu.org/readings.html}} for references.)
1745 This section describes the command-line options that are only meaningful
1746 for Objective-C programs, but you can also use most of the GNU compiler
1747 options regardless of what language your program is in.  For example,
1748 you might compile a file @code{some_class.m} like this:
1750 @smallexample
1751 gcc -g -fgnu-runtime -O -c some_class.m
1752 @end smallexample
1754 @noindent
1755 In this example, @option{-fgnu-runtime} is an option meant only for
1756 Objective-C programs; you can use the other options with any language
1757 supported by GCC@.
1759 Here is a list of options that are @emph{only} for compiling Objective-C
1760 programs:
1762 @table @gcctabopt
1763 @item -fconstant-string-class=@var{class-name}
1764 @opindex fconstant-string-class
1765 Use @var{class-name} as the name of the class to instantiate for each
1766 literal string specified with the syntax @code{@@"@dots{}"}.  The default
1767 class name is @code{NXConstantString} if the GNU runtime is being used, and
1768 @code{NSConstantString} if the NeXT runtime is being used (see below).  The
1769 @option{-fconstant-cfstrings} option, if also present, will override the
1770 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
1771 to be laid out as constant CoreFoundation strings.
1773 @item -fgnu-runtime
1774 @opindex fgnu-runtime
1775 Generate object code compatible with the standard GNU Objective-C
1776 runtime.  This is the default for most types of systems.
1778 @item -fnext-runtime
1779 @opindex fnext-runtime
1780 Generate output compatible with the NeXT runtime.  This is the default
1781 for NeXT-based systems, including Darwin and Mac OS X@.  The macro
1782 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
1783 used.
1785 @item -fno-nil-receivers
1786 @opindex fno-nil-receivers
1787 Assume that all Objective-C message dispatches (e.g.,
1788 @code{[receiver message:arg]}) in this translation unit ensure that the receiver
1789 is not @code{nil}.  This allows for more efficient entry points in the runtime to be
1790 used.  Currently, this option is only available in conjunction with
1791 the NeXT runtime on Mac OS X 10.3 and later.
1793 @item -fobjc-exceptions
1794 @opindex fobjc-exceptions
1795 Enable syntactic support for structured exception handling in Objective-C,
1796 similar to what is offered by C++ and Java.  Currently, this option is only
1797 available in conjunction with the NeXT runtime on Mac OS X 10.3 and later.
1799 @smallexample
1800   @@try @{
1801     @dots{}
1802        @@throw expr;
1803     @dots{}
1804   @}
1805   @@catch (AnObjCClass *exc) @{
1806     @dots{}
1807       @@throw expr;
1808     @dots{}
1809       @@throw;
1810     @dots{}
1811   @}
1812   @@catch (AnotherClass *exc) @{
1813     @dots{}
1814   @}
1815   @@catch (id allOthers) @{
1816     @dots{}
1817   @}
1818   @@finally @{
1819     @dots{}
1820       @@throw expr;
1821     @dots{}
1822   @}
1823 @end smallexample
1825 The @code{@@throw} statement may appear anywhere in an Objective-C or
1826 Objective-C++ program; when used inside of a @code{@@catch} block, the
1827 @code{@@throw} may appear without an argument (as shown above), in which case
1828 the object caught by the @code{@@catch} will be rethrown.
1830 Note that only (pointers to) Objective-C objects may be thrown and
1831 caught using this scheme.  When an object is thrown, it will be caught
1832 by the nearest @code{@@catch} clause capable of handling objects of that type,
1833 analogously to how @code{catch} blocks work in C++ and Java.  A
1834 @code{@@catch(id @dots{})} clause (as shown above) may also be provided to catch
1835 any and all Objective-C exceptions not caught by previous @code{@@catch}
1836 clauses (if any).
1838 The @code{@@finally} clause, if present, will be executed upon exit from the
1839 immediately preceding @code{@@try @dots{} @@catch} section.  This will happen
1840 regardless of whether any exceptions are thrown, caught or rethrown
1841 inside the @code{@@try @dots{} @@catch} section, analogously to the behavior
1842 of the @code{finally} clause in Java.
1844 There are several caveats to using the new exception mechanism:
1846 @itemize @bullet
1847 @item
1848 Although currently designed to be binary compatible with @code{NS_HANDLER}-style
1849 idioms provided by the @code{NSException} class, the new
1850 exceptions can only be used on Mac OS X 10.3 (Panther) and later
1851 systems, due to additional functionality needed in the (NeXT) Objective-C
1852 runtime.
1854 @item
1855 As mentioned above, the new exceptions do not support handling
1856 types other than Objective-C objects.   Furthermore, when used from
1857 Objective-C++, the Objective-C exception model does not interoperate with C++
1858 exceptions at this time.  This means you cannot @code{@@throw} an exception
1859 from Objective-C and @code{catch} it in C++, or vice versa
1860 (i.e., @code{throw @dots{} @@catch}).
1861 @end itemize
1863 The @option{-fobjc-exceptions} switch also enables the use of synchronization
1864 blocks for thread-safe execution:
1866 @smallexample
1867   @@synchronized (ObjCClass *guard) @{
1868     @dots{}
1869   @}
1870 @end smallexample
1872 Upon entering the @code{@@synchronized} block, a thread of execution shall
1873 first check whether a lock has been placed on the corresponding @code{guard}
1874 object by another thread.  If it has, the current thread shall wait until
1875 the other thread relinquishes its lock.  Once @code{guard} becomes available,
1876 the current thread will place its own lock on it, execute the code contained in
1877 the @code{@@synchronized} block, and finally relinquish the lock (thereby
1878 making @code{guard} available to other threads).
1880 Unlike Java, Objective-C does not allow for entire methods to be marked
1881 @code{@@synchronized}.  Note that throwing exceptions out of
1882 @code{@@synchronized} blocks is allowed, and will cause the guarding object
1883 to be unlocked properly.
1885 @item -freplace-objc-classes
1886 @opindex freplace-objc-classes
1887 Emit a special marker instructing @command{ld(1)} not to statically link in
1888 the resulting object file, and allow @command{dyld(1)} to load it in at
1889 run time instead.  This is used in conjunction with the Fix-and-Continue
1890 debugging mode, where the object file in question may be recompiled and
1891 dynamically reloaded in the course of program execution, without the need
1892 to restart the program itself.  Currently, Fix-and-Continue functionality
1893 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
1894 and later.
1896 @item -fzero-link
1897 @opindex fzero-link
1898 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
1899 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
1900 compile time) with static class references that get initialized at load time,
1901 which improves run-time performance.  Specifying the @option{-fzero-link} flag
1902 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
1903 to be retained.  This is useful in Zero-Link debugging mode, since it allows
1904 for individual class implementations to be modified during program execution.
1906 @item -gen-decls
1907 @opindex gen-decls
1908 Dump interface declarations for all classes seen in the source file to a
1909 file named @file{@var{sourcename}.decl}.
1911 @item -Wno-protocol
1912 @opindex Wno-protocol
1913 If a class is declared to implement a protocol, a warning is issued for
1914 every method in the protocol that is not implemented by the class.  The
1915 default behavior is to issue a warning for every method not explicitly
1916 implemented in the class, even if a method implementation is inherited
1917 from the superclass.  If you use the @code{-Wno-protocol} option, then
1918 methods inherited from the superclass are considered to be implemented,
1919 and no warning is issued for them.
1921 @item -Wselector
1922 @opindex Wselector
1923 Warn if multiple methods of different types for the same selector are
1924 found during compilation.  The check is performed on the list of methods
1925 in the final stage of compilation.  Additionally, a check is performed
1926 for each selector appearing in a @code{@@selector(@dots{})}
1927 expression, and a corresponding method for that selector has been found
1928 during compilation.  Because these checks scan the method table only at
1929 the end of compilation, these warnings are not produced if the final
1930 stage of compilation is not reached, for example because an error is
1931 found during compilation, or because the @code{-fsyntax-only} option is
1932 being used.
1934 @item -Wundeclared-selector
1935 @opindex Wundeclared-selector
1936 Warn if a @code{@@selector(@dots{})} expression referring to an
1937 undeclared selector is found.  A selector is considered undeclared if no
1938 method with that name has been declared before the
1939 @code{@@selector(@dots{})} expression, either explicitly in an
1940 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
1941 an @code{@@implementation} section.  This option always performs its
1942 checks as soon as a @code{@@selector(@dots{})} expression is found,
1943 while @code{-Wselector} only performs its checks in the final stage of
1944 compilation.  This also enforces the coding style convention
1945 that methods and selectors must be declared before being used.
1947 @item -print-objc-runtime-info
1948 @opindex print-objc-runtime-info
1949 Generate C header describing the largest structure that is passed by
1950 value, if any.
1952 @end table
1954 @node Language Independent Options
1955 @section Options to Control Diagnostic Messages Formatting
1956 @cindex options to control diagnostics formatting
1957 @cindex diagnostic messages
1958 @cindex message formatting
1960 Traditionally, diagnostic messages have been formatted irrespective of
1961 the output device's aspect (e.g.@: its width, @dots{}).  The options described
1962 below can be used to control the diagnostic messages formatting
1963 algorithm, e.g.@: how many characters per line, how often source location
1964 information should be reported.  Right now, only the C++ front end can
1965 honor these options.  However it is expected, in the near future, that
1966 the remaining front ends would be able to digest them correctly.
1968 @table @gcctabopt
1969 @item -fmessage-length=@var{n}
1970 @opindex fmessage-length
1971 Try to format error messages so that they fit on lines of about @var{n}
1972 characters.  The default is 72 characters for @command{g++} and 0 for the rest of
1973 the front ends supported by GCC@.  If @var{n} is zero, then no
1974 line-wrapping will be done; each error message will appear on a single
1975 line.
1977 @opindex fdiagnostics-show-location
1978 @item -fdiagnostics-show-location=once
1979 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
1980 reporter to emit @emph{once} source location information; that is, in
1981 case the message is too long to fit on a single physical line and has to
1982 be wrapped, the source location won't be emitted (as prefix) again,
1983 over and over, in subsequent continuation lines.  This is the default
1984 behavior.
1986 @item -fdiagnostics-show-location=every-line
1987 Only meaningful in line-wrapping mode.  Instructs the diagnostic
1988 messages reporter to emit the same source location information (as
1989 prefix) for physical lines that result from the process of breaking
1990 a message which is too long to fit on a single line.
1992 @end table
1994 @node Warning Options
1995 @section Options to Request or Suppress Warnings
1996 @cindex options to control warnings
1997 @cindex warning messages
1998 @cindex messages, warning
1999 @cindex suppressing warnings
2001 Warnings are diagnostic messages that report constructions which
2002 are not inherently erroneous but which are risky or suggest there
2003 may have been an error.
2005 You can request many specific warnings with options beginning @samp{-W},
2006 for example @option{-Wimplicit} to request warnings on implicit
2007 declarations.  Each of these specific warning options also has a
2008 negative form beginning @samp{-Wno-} to turn off warnings;
2009 for example, @option{-Wno-implicit}.  This manual lists only one of the
2010 two forms, whichever is not the default.
2012 The following options control the amount and kinds of warnings produced
2013 by GCC; for further, language-specific options also refer to
2014 @ref{C++ Dialect Options} and @ref{Objective-C Dialect Options}.
2016 @table @gcctabopt
2017 @cindex syntax checking
2018 @item -fsyntax-only
2019 @opindex fsyntax-only
2020 Check the code for syntax errors, but don't do anything beyond that.
2022 @item -pedantic
2023 @opindex pedantic
2024 Issue all the warnings demanded by strict ISO C and ISO C++;
2025 reject all programs that use forbidden extensions, and some other
2026 programs that do not follow ISO C and ISO C++.  For ISO C, follows the
2027 version of the ISO C standard specified by any @option{-std} option used.
2029 Valid ISO C and ISO C++ programs should compile properly with or without
2030 this option (though a rare few will require @option{-ansi} or a
2031 @option{-std} option specifying the required version of ISO C)@.  However,
2032 without this option, certain GNU extensions and traditional C and C++
2033 features are supported as well.  With this option, they are rejected.
2035 @option{-pedantic} does not cause warning messages for use of the
2036 alternate keywords whose names begin and end with @samp{__}.  Pedantic
2037 warnings are also disabled in the expression that follows
2038 @code{__extension__}.  However, only system header files should use
2039 these escape routes; application programs should avoid them.
2040 @xref{Alternate Keywords}.
2042 Some users try to use @option{-pedantic} to check programs for strict ISO
2043 C conformance.  They soon find that it does not do quite what they want:
2044 it finds some non-ISO practices, but not all---only those for which
2045 ISO C @emph{requires} a diagnostic, and some others for which
2046 diagnostics have been added.
2048 A feature to report any failure to conform to ISO C might be useful in
2049 some instances, but would require considerable additional work and would
2050 be quite different from @option{-pedantic}.  We don't have plans to
2051 support such a feature in the near future.
2053 Where the standard specified with @option{-std} represents a GNU
2054 extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
2055 corresponding @dfn{base standard}, the version of ISO C on which the GNU
2056 extended dialect is based.  Warnings from @option{-pedantic} are given
2057 where they are required by the base standard.  (It would not make sense
2058 for such warnings to be given only for features not in the specified GNU
2059 C dialect, since by definition the GNU dialects of C include all
2060 features the compiler supports with the given option, and there would be
2061 nothing to warn about.)
2063 @item -pedantic-errors
2064 @opindex pedantic-errors
2065 Like @option{-pedantic}, except that errors are produced rather than
2066 warnings.
2068 @item -w
2069 @opindex w
2070 Inhibit all warning messages.
2072 @item -Wno-import
2073 @opindex Wno-import
2074 Inhibit warning messages about the use of @samp{#import}.
2076 @item -Wchar-subscripts
2077 @opindex Wchar-subscripts
2078 Warn if an array subscript has type @code{char}.  This is a common cause
2079 of error, as programmers often forget that this type is signed on some
2080 machines.
2082 @item -Wcomment
2083 @opindex Wcomment
2084 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
2085 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
2087 @item -Wfatal-errors
2088 @opindex Wfatal-errors
2089 This option causes the compiler to abort compilation on the first error
2090 occurred rather than trying to keep going and printing further error
2091 messages.
2093 @item -Wformat
2094 @opindex Wformat
2095 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
2096 the arguments supplied have types appropriate to the format string
2097 specified, and that the conversions specified in the format string make
2098 sense.  This includes standard functions, and others specified by format
2099 attributes (@pxref{Function Attributes}), in the @code{printf},
2100 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
2101 not in the C standard) families.
2103 The formats are checked against the format features supported by GNU
2104 libc version 2.2.  These include all ISO C90 and C99 features, as well
2105 as features from the Single Unix Specification and some BSD and GNU
2106 extensions.  Other library implementations may not support all these
2107 features; GCC does not support warning about features that go beyond a
2108 particular library's limitations.  However, if @option{-pedantic} is used
2109 with @option{-Wformat}, warnings will be given about format features not
2110 in the selected standard version (but not for @code{strfmon} formats,
2111 since those are not in any version of the C standard).  @xref{C Dialect
2112 Options,,Options Controlling C Dialect}.
2114 Since @option{-Wformat} also checks for null format arguments for
2115 several functions, @option{-Wformat} also implies @option{-Wnonnull}.
2117 @option{-Wformat} is included in @option{-Wall}.  For more control over some
2118 aspects of format checking, the options @option{-Wformat-y2k},
2119 @option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
2120 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
2121 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
2123 @item -Wformat-y2k
2124 @opindex Wformat-y2k
2125 If @option{-Wformat} is specified, also warn about @code{strftime}
2126 formats which may yield only a two-digit year.
2128 @item -Wno-format-extra-args
2129 @opindex Wno-format-extra-args
2130 If @option{-Wformat} is specified, do not warn about excess arguments to a
2131 @code{printf} or @code{scanf} format function.  The C standard specifies
2132 that such arguments are ignored.
2134 Where the unused arguments lie between used arguments that are
2135 specified with @samp{$} operand number specifications, normally
2136 warnings are still given, since the implementation could not know what
2137 type to pass to @code{va_arg} to skip the unused arguments.  However,
2138 in the case of @code{scanf} formats, this option will suppress the
2139 warning if the unused arguments are all pointers, since the Single
2140 Unix Specification says that such unused arguments are allowed.
2142 @item -Wno-format-zero-length
2143 @opindex Wno-format-zero-length
2144 If @option{-Wformat} is specified, do not warn about zero-length formats.
2145 The C standard specifies that zero-length formats are allowed.
2147 @item -Wformat-nonliteral
2148 @opindex Wformat-nonliteral
2149 If @option{-Wformat} is specified, also warn if the format string is not a
2150 string literal and so cannot be checked, unless the format function
2151 takes its format arguments as a @code{va_list}.
2153 @item -Wformat-security
2154 @opindex Wformat-security
2155 If @option{-Wformat} is specified, also warn about uses of format
2156 functions that represent possible security problems.  At present, this
2157 warns about calls to @code{printf} and @code{scanf} functions where the
2158 format string is not a string literal and there are no format arguments,
2159 as in @code{printf (foo);}.  This may be a security hole if the format
2160 string came from untrusted input and contains @samp{%n}.  (This is
2161 currently a subset of what @option{-Wformat-nonliteral} warns about, but
2162 in future warnings may be added to @option{-Wformat-security} that are not
2163 included in @option{-Wformat-nonliteral}.)
2165 @item -Wformat=2
2166 @opindex Wformat=2
2167 Enable @option{-Wformat} plus format checks not included in
2168 @option{-Wformat}.  Currently equivalent to @samp{-Wformat
2169 -Wformat-nonliteral -Wformat-security -Wformat-y2k}.
2171 @item -Wnonnull
2172 @opindex Wnonnull
2173 Warn about passing a null pointer for arguments marked as
2174 requiring a non-null value by the @code{nonnull} function attribute.
2176 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
2177 can be disabled with the @option{-Wno-nonnull} option.
2179 @item -Winit-self @r{(C, C++, and Objective-C only)}
2180 @opindex Winit-self
2181 Warn about uninitialized variables which are initialized with themselves.
2182 Note this option can only be used with the @option{-Wuninitialized} option,
2183 which in turn only works with @option{-O1} and above.
2185 For example, GCC will warn about @code{i} being uninitialized in the
2186 following snippet only when @option{-Winit-self} has been specified:
2187 @smallexample
2188 @group
2189 int f()
2191   int i = i;
2192   return i;
2194 @end group
2195 @end smallexample
2197 @item -Wimplicit-int
2198 @opindex Wimplicit-int
2199 Warn when a declaration does not specify a type.
2201 @item -Wimplicit-function-declaration
2202 @itemx -Werror-implicit-function-declaration
2203 @opindex Wimplicit-function-declaration
2204 @opindex Werror-implicit-function-declaration
2205 Give a warning (or error) whenever a function is used before being
2206 declared.
2208 @item -Wimplicit
2209 @opindex Wimplicit
2210 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
2212 @item -Wmain
2213 @opindex Wmain
2214 Warn if the type of @samp{main} is suspicious.  @samp{main} should be a
2215 function with external linkage, returning int, taking either zero
2216 arguments, two, or three arguments of appropriate types.
2218 @item -Wmissing-braces
2219 @opindex Wmissing-braces
2220 Warn if an aggregate or union initializer is not fully bracketed.  In
2221 the following example, the initializer for @samp{a} is not fully
2222 bracketed, but that for @samp{b} is fully bracketed.
2224 @smallexample
2225 int a[2][2] = @{ 0, 1, 2, 3 @};
2226 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
2227 @end smallexample
2229 @item -Wmissing-include-dirs @r{(C, C++, and Objective-C only)}
2230 @opindex Wmissing-include-dirs
2231 Warn if a user-supplied include directory does not exist.
2233 @item -Wparentheses
2234 @opindex Wparentheses
2235 Warn if parentheses are omitted in certain contexts, such
2236 as when there is an assignment in a context where a truth value
2237 is expected, or when operators are nested whose precedence people
2238 often get confused about.
2240 Also warn about constructions where there may be confusion to which
2241 @code{if} statement an @code{else} branch belongs.  Here is an example of
2242 such a case:
2244 @smallexample
2245 @group
2247   if (a)
2248     if (b)
2249       foo ();
2250   else
2251     bar ();
2253 @end group
2254 @end smallexample
2256 In C, every @code{else} branch belongs to the innermost possible @code{if}
2257 statement, which in this example is @code{if (b)}.  This is often not
2258 what the programmer expected, as illustrated in the above example by
2259 indentation the programmer chose.  When there is the potential for this
2260 confusion, GCC will issue a warning when this flag is specified.
2261 To eliminate the warning, add explicit braces around the innermost
2262 @code{if} statement so there is no way the @code{else} could belong to
2263 the enclosing @code{if}.  The resulting code would look like this:
2265 @smallexample
2266 @group
2268   if (a)
2269     @{
2270       if (b)
2271         foo ();
2272       else
2273         bar ();
2274     @}
2276 @end group
2277 @end smallexample
2279 @item -Wsequence-point
2280 @opindex Wsequence-point
2281 Warn about code that may have undefined semantics because of violations
2282 of sequence point rules in the C standard.
2284 The C standard defines the order in which expressions in a C program are
2285 evaluated in terms of @dfn{sequence points}, which represent a partial
2286 ordering between the execution of parts of the program: those executed
2287 before the sequence point, and those executed after it.  These occur
2288 after the evaluation of a full expression (one which is not part of a
2289 larger expression), after the evaluation of the first operand of a
2290 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
2291 function is called (but after the evaluation of its arguments and the
2292 expression denoting the called function), and in certain other places.
2293 Other than as expressed by the sequence point rules, the order of
2294 evaluation of subexpressions of an expression is not specified.  All
2295 these rules describe only a partial order rather than a total order,
2296 since, for example, if two functions are called within one expression
2297 with no sequence point between them, the order in which the functions
2298 are called is not specified.  However, the standards committee have
2299 ruled that function calls do not overlap.
2301 It is not specified when between sequence points modifications to the
2302 values of objects take effect.  Programs whose behavior depends on this
2303 have undefined behavior; the C standard specifies that ``Between the
2304 previous and next sequence point an object shall have its stored value
2305 modified at most once by the evaluation of an expression.  Furthermore,
2306 the prior value shall be read only to determine the value to be
2307 stored.''.  If a program breaks these rules, the results on any
2308 particular implementation are entirely unpredictable.
2310 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
2311 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
2312 diagnosed by this option, and it may give an occasional false positive
2313 result, but in general it has been found fairly effective at detecting
2314 this sort of problem in programs.
2316 The present implementation of this option only works for C programs.  A
2317 future implementation may also work for C++ programs.
2319 The C standard is worded confusingly, therefore there is some debate
2320 over the precise meaning of the sequence point rules in subtle cases.
2321 Links to discussions of the problem, including proposed formal
2322 definitions, may be found on our readings page, at
2323 @w{@uref{http://gcc.gnu.org/readings.html}}.
2325 @item -Wreturn-type
2326 @opindex Wreturn-type
2327 Warn whenever a function is defined with a return-type that defaults to
2328 @code{int}.  Also warn about any @code{return} statement with no
2329 return-value in a function whose return-type is not @code{void}.
2331 For C++, a function without return type always produces a diagnostic
2332 message, even when @option{-Wno-return-type} is specified.  The only
2333 exceptions are @samp{main} and functions defined in system headers.
2335 @item -Wswitch
2336 @opindex Wswitch
2337 Warn whenever a @code{switch} statement has an index of enumeral type
2338 and lacks a @code{case} for one or more of the named codes of that
2339 enumeration.  (The presence of a @code{default} label prevents this
2340 warning.)  @code{case} labels outside the enumeration range also
2341 provoke warnings when this option is used.
2343 @item -Wswitch-default
2344 @opindex Wswitch-switch
2345 Warn whenever a @code{switch} statement does not have a @code{default}
2346 case.
2348 @item -Wswitch-enum
2349 @opindex Wswitch-enum
2350 Warn whenever a @code{switch} statement has an index of enumeral type
2351 and lacks a @code{case} for one or more of the named codes of that
2352 enumeration.  @code{case} labels outside the enumeration range also
2353 provoke warnings when this option is used.
2355 @item -Wtrigraphs
2356 @opindex Wtrigraphs
2357 Warn if any trigraphs are encountered that might change the meaning of
2358 the program (trigraphs within comments are not warned about).
2360 @item -Wunused-function
2361 @opindex Wunused-function
2362 Warn whenever a static function is declared but not defined or a
2363 non\-inline static function is unused.
2365 @item -Wunused-label
2366 @opindex Wunused-label
2367 Warn whenever a label is declared but not used.
2369 To suppress this warning use the @samp{unused} attribute
2370 (@pxref{Variable Attributes}).
2372 @item -Wunused-parameter
2373 @opindex Wunused-parameter
2374 Warn whenever a function parameter is unused aside from its declaration.
2376 To suppress this warning use the @samp{unused} attribute
2377 (@pxref{Variable Attributes}).
2379 @item -Wunused-variable
2380 @opindex Wunused-variable
2381 Warn whenever a local variable or non-constant static variable is unused
2382 aside from its declaration
2384 To suppress this warning use the @samp{unused} attribute
2385 (@pxref{Variable Attributes}).
2387 @item -Wunused-value
2388 @opindex Wunused-value
2389 Warn whenever a statement computes a result that is explicitly not used.
2391 To suppress this warning cast the expression to @samp{void}.
2393 @item -Wunused
2394 @opindex Wunused
2395 All the above @option{-Wunused} options combined.
2397 In order to get a warning about an unused function parameter, you must
2398 either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
2399 @samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
2401 @item -Wuninitialized
2402 @opindex Wuninitialized
2403 Warn if an automatic variable is used without first being initialized or
2404 if a variable may be clobbered by a @code{setjmp} call.
2406 These warnings are possible only in optimizing compilation,
2407 because they require data flow information that is computed only
2408 when optimizing.  If you don't specify @option{-O}, you simply won't
2409 get these warnings.
2411 If you want to warn about code which uses the uninitialized value of the
2412 variable in its own initializer, use the @option{-Winit-self} option.
2414 These warnings occur only for variables that are candidates for
2415 register allocation.  Therefore, they do not occur for a variable that
2416 is declared @code{volatile}, or whose address is taken, or whose size
2417 is other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
2418 structures, unions or arrays, even when they are in registers.
2420 Note that there may be no warning about a variable that is used only
2421 to compute a value that itself is never used, because such
2422 computations may be deleted by data flow analysis before the warnings
2423 are printed.
2425 These warnings are made optional because GCC is not smart
2426 enough to see all the reasons why the code might be correct
2427 despite appearing to have an error.  Here is one example of how
2428 this can happen:
2430 @smallexample
2431 @group
2433   int x;
2434   switch (y)
2435     @{
2436     case 1: x = 1;
2437       break;
2438     case 2: x = 4;
2439       break;
2440     case 3: x = 5;
2441     @}
2442   foo (x);
2444 @end group
2445 @end smallexample
2447 @noindent
2448 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
2449 always initialized, but GCC doesn't know this.  Here is
2450 another common case:
2452 @smallexample
2454   int save_y;
2455   if (change_y) save_y = y, y = new_y;
2456   @dots{}
2457   if (change_y) y = save_y;
2459 @end smallexample
2461 @noindent
2462 This has no bug because @code{save_y} is used only if it is set.
2464 @cindex @code{longjmp} warnings
2465 This option also warns when a non-volatile automatic variable might be
2466 changed by a call to @code{longjmp}.  These warnings as well are possible
2467 only in optimizing compilation.
2469 The compiler sees only the calls to @code{setjmp}.  It cannot know
2470 where @code{longjmp} will be called; in fact, a signal handler could
2471 call it at any point in the code.  As a result, you may get a warning
2472 even when there is in fact no problem because @code{longjmp} cannot
2473 in fact be called at the place which would cause a problem.
2475 Some spurious warnings can be avoided if you declare all the functions
2476 you use that never return as @code{noreturn}.  @xref{Function
2477 Attributes}.
2479 @item -Wunknown-pragmas
2480 @opindex Wunknown-pragmas
2481 @cindex warning for unknown pragmas
2482 @cindex unknown pragmas, warning
2483 @cindex pragmas, warning of unknown
2484 Warn when a #pragma directive is encountered which is not understood by
2485 GCC@.  If this command line option is used, warnings will even be issued
2486 for unknown pragmas in system header files.  This is not the case if
2487 the warnings were only enabled by the @option{-Wall} command line option.
2489 @item -Wstrict-aliasing
2490 @opindex Wstrict-aliasing
2491 This option is only active when @option{-fstrict-aliasing} is active.
2492 It warns about code which might break the strict aliasing rules that the
2493 compiler is using for optimization. The warning does not catch all
2494 cases, but does attempt to catch the more common pitfalls. It is
2495 included in @option{-Wall}.
2497 @item -Wstrict-aliasing=2
2498 @opindex Wstrict-aliasing=2
2499 This option is only active when @option{-fstrict-aliasing} is active.
2500 It warns about all code which might break the strict aliasing rules that the
2501 compiler is using for optimization.  This warning catches all cases, but
2502 it will also give a warning for some ambiguous cases that are safe.
2504 @item -Wall
2505 @opindex Wall
2506 All of the above @samp{-W} options combined.  This enables all the
2507 warnings about constructions that some users consider questionable, and
2508 that are easy to avoid (or modify to prevent the warning), even in
2509 conjunction with macros.  This also enables some language-specific
2510 warnings described in @ref{C++ Dialect Options} and
2511 @ref{Objective-C Dialect Options}.
2512 @end table
2514 The following @option{-W@dots{}} options are not implied by @option{-Wall}.
2515 Some of them warn about constructions that users generally do not
2516 consider questionable, but which occasionally you might wish to check
2517 for; others warn about constructions that are necessary or hard to avoid
2518 in some cases, and there is no simple way to modify the code to suppress
2519 the warning.
2521 @table @gcctabopt
2522 @item -Wextra
2523 @opindex W
2524 @opindex Wextra
2525 (This option used to be called @option{-W}.  The older name is still
2526 supported, but the newer name is more descriptive.)  Print extra warning
2527 messages for these events:
2529 @itemize @bullet
2530 @item
2531 A function can return either with or without a value.  (Falling
2532 off the end of the function body is considered returning without
2533 a value.)  For example, this function would evoke such a
2534 warning:
2536 @smallexample
2537 @group
2538 foo (a)
2540   if (a > 0)
2541     return a;
2543 @end group
2544 @end smallexample
2546 @item
2547 An expression-statement or the left-hand side of a comma expression
2548 contains no side effects.
2549 To suppress the warning, cast the unused expression to void.
2550 For example, an expression such as @samp{x[i,j]} will cause a warning,
2551 but @samp{x[(void)i,j]} will not.
2553 @item
2554 An unsigned value is compared against zero with @samp{<} or @samp{>=}.
2556 @item
2557 A comparison like @samp{x<=y<=z} appears; this is equivalent to
2558 @samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from
2559 that of ordinary mathematical notation.
2561 @item
2562 Storage-class specifiers like @code{static} are not the first things in
2563 a declaration.  According to the C Standard, this usage is obsolescent.
2565 @item
2566 The return type of a function has a type qualifier such as @code{const}.
2567 Such a type qualifier has no effect, since the value returned by a
2568 function is not an lvalue.  (But don't warn about the GNU extension of
2569 @code{volatile void} return types.  That extension will be warned about
2570 if @option{-pedantic} is specified.)
2572 @item
2573 If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
2574 arguments.
2576 @item
2577 A comparison between signed and unsigned values could produce an
2578 incorrect result when the signed value is converted to unsigned.
2579 (But don't warn if @option{-Wno-sign-compare} is also specified.)
2581 @item
2582 An aggregate has an initializer which does not initialize all members.
2583 For example, the following code would cause such a warning, because
2584 @code{x.h} would be implicitly initialized to zero:
2586 @smallexample
2587 struct s @{ int f, g, h; @};
2588 struct s x = @{ 3, 4 @};
2589 @end smallexample
2591 @item
2592 A function parameter is declared without a type specifier in K&R-style
2593 functions:
2595 @smallexample
2596 void foo(bar) @{ @}
2597 @end smallexample
2599 @item
2600 An empty body occurs in an @samp{if} or @samp{else} statement.
2602 @item
2603 A pointer is compared against integer zero with @samp{<}, @samp{<=},
2604 @samp{>}, or @samp{>=}.
2606 @item
2607 A variable might be changed by @samp{longjmp} or @samp{vfork}.
2609 @item
2610 Any of several floating-point events that often indicate errors, such as
2611 overflow, underflow, loss of precision, etc.
2613 @item @r{(C++ only)}
2614 An enumerator and a non-enumerator both appear in a conditional expression.
2616 @item @r{(C++ only)}
2617 A non-static reference or non-static @samp{const} member appears in a
2618 class without constructors.
2620 @item @r{(C++ only)}
2621 Ambiguous virtual bases.
2623 @item @r{(C++ only)}
2624 Subscripting an array which has been declared @samp{register}.
2626 @item @r{(C++ only)}
2627 Taking the address of a variable which has been declared @samp{register}.
2629 @item @r{(C++ only)}
2630 A base class is not initialized in a derived class' copy constructor.
2631 @end itemize
2633 @item -Wno-div-by-zero
2634 @opindex Wno-div-by-zero
2635 @opindex Wdiv-by-zero
2636 Do not warn about compile-time integer division by zero.  Floating point
2637 division by zero is not warned about, as it can be a legitimate way of
2638 obtaining infinities and NaNs.
2640 @item -Wsystem-headers
2641 @opindex Wsystem-headers
2642 @cindex warnings from system headers
2643 @cindex system headers, warnings from
2644 Print warning messages for constructs found in system header files.
2645 Warnings from system headers are normally suppressed, on the assumption
2646 that they usually do not indicate real problems and would only make the
2647 compiler output harder to read.  Using this command line option tells
2648 GCC to emit warnings from system headers as if they occurred in user
2649 code.  However, note that using @option{-Wall} in conjunction with this
2650 option will @emph{not} warn about unknown pragmas in system
2651 headers---for that, @option{-Wunknown-pragmas} must also be used.
2653 @item -Wfloat-equal
2654 @opindex Wfloat-equal
2655 Warn if floating point values are used in equality comparisons.
2657 The idea behind this is that sometimes it is convenient (for the
2658 programmer) to consider floating-point values as approximations to
2659 infinitely precise real numbers.  If you are doing this, then you need
2660 to compute (by analyzing the code, or in some other way) the maximum or
2661 likely maximum error that the computation introduces, and allow for it
2662 when performing comparisons (and when producing output, but that's a
2663 different problem).  In particular, instead of testing for equality, you
2664 would check to see whether the two values have ranges that overlap; and
2665 this is done with the relational operators, so equality comparisons are
2666 probably mistaken.
2668 @item -Wtraditional @r{(C only)}
2669 @opindex Wtraditional
2670 Warn about certain constructs that behave differently in traditional and
2671 ISO C@.  Also warn about ISO C constructs that have no traditional C
2672 equivalent, and/or problematic constructs which should be avoided.
2674 @itemize @bullet
2675 @item
2676 Macro parameters that appear within string literals in the macro body.
2677 In traditional C macro replacement takes place within string literals,
2678 but does not in ISO C@.
2680 @item
2681 In traditional C, some preprocessor directives did not exist.
2682 Traditional preprocessors would only consider a line to be a directive
2683 if the @samp{#} appeared in column 1 on the line.  Therefore
2684 @option{-Wtraditional} warns about directives that traditional C
2685 understands but would ignore because the @samp{#} does not appear as the
2686 first character on the line.  It also suggests you hide directives like
2687 @samp{#pragma} not understood by traditional C by indenting them.  Some
2688 traditional implementations would not recognize @samp{#elif}, so it
2689 suggests avoiding it altogether.
2691 @item
2692 A function-like macro that appears without arguments.
2694 @item
2695 The unary plus operator.
2697 @item
2698 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
2699 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
2700 constants.)  Note, these suffixes appear in macros defined in the system
2701 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
2702 Use of these macros in user code might normally lead to spurious
2703 warnings, however GCC's integrated preprocessor has enough context to
2704 avoid warning in these cases.
2706 @item
2707 A function declared external in one block and then used after the end of
2708 the block.
2710 @item
2711 A @code{switch} statement has an operand of type @code{long}.
2713 @item
2714 A non-@code{static} function declaration follows a @code{static} one.
2715 This construct is not accepted by some traditional C compilers.
2717 @item
2718 The ISO type of an integer constant has a different width or
2719 signedness from its traditional type.  This warning is only issued if
2720 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
2721 typically represent bit patterns, are not warned about.
2723 @item
2724 Usage of ISO string concatenation is detected.
2726 @item
2727 Initialization of automatic aggregates.
2729 @item
2730 Identifier conflicts with labels.  Traditional C lacks a separate
2731 namespace for labels.
2733 @item
2734 Initialization of unions.  If the initializer is zero, the warning is
2735 omitted.  This is done under the assumption that the zero initializer in
2736 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
2737 initializer warnings and relies on default initialization to zero in the
2738 traditional C case.
2740 @item
2741 Conversions by prototypes between fixed/floating point values and vice
2742 versa.  The absence of these prototypes when compiling with traditional
2743 C would cause serious problems.  This is a subset of the possible
2744 conversion warnings, for the full set use @option{-Wconversion}.
2746 @item
2747 Use of ISO C style function definitions.  This warning intentionally is
2748 @emph{not} issued for prototype declarations or variadic functions
2749 because these ISO C features will appear in your code when using
2750 libiberty's traditional C compatibility macros, @code{PARAMS} and
2751 @code{VPARAMS}.  This warning is also bypassed for nested functions
2752 because that feature is already a GCC extension and thus not relevant to
2753 traditional C compatibility.
2754 @end itemize
2756 @item -Wdeclaration-after-statement @r{(C only)}
2757 @opindex Wdeclaration-after-statement
2758 Warn when a declaration is found after a statement in a block.  This
2759 construct, known from C++, was introduced with ISO C99 and is by default
2760 allowed in GCC@.  It is not supported by ISO C90 and was not supported by
2761 GCC versions before GCC 3.0.  @xref{Mixed Declarations}.
2763 @item -Wundef
2764 @opindex Wundef
2765 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
2767 @item -Wendif-labels
2768 @opindex Wendif-labels
2769 Warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
2771 @item -Wshadow
2772 @opindex Wshadow
2773 Warn whenever a local variable shadows another local variable, parameter or
2774 global variable or whenever a built-in function is shadowed.
2776 @item -Wlarger-than-@var{len}
2777 @opindex Wlarger-than
2778 Warn whenever an object of larger than @var{len} bytes is defined.
2780 @item -Wpointer-arith
2781 @opindex Wpointer-arith
2782 Warn about anything that depends on the ``size of'' a function type or
2783 of @code{void}.  GNU C assigns these types a size of 1, for
2784 convenience in calculations with @code{void *} pointers and pointers
2785 to functions.
2787 @item -Wbad-function-cast @r{(C only)}
2788 @opindex Wbad-function-cast
2789 Warn whenever a function call is cast to a non-matching type.
2790 For example, warn if @code{int malloc()} is cast to @code{anything *}.
2792 @item -Wcast-qual
2793 @opindex Wcast-qual
2794 Warn whenever a pointer is cast so as to remove a type qualifier from
2795 the target type.  For example, warn if a @code{const char *} is cast
2796 to an ordinary @code{char *}.
2798 @item -Wcast-align
2799 @opindex Wcast-align
2800 Warn whenever a pointer is cast such that the required alignment of the
2801 target is increased.  For example, warn if a @code{char *} is cast to
2802 an @code{int *} on machines where integers can only be accessed at
2803 two- or four-byte boundaries.
2805 @item -Wwrite-strings
2806 @opindex Wwrite-strings
2807 When compiling C, give string constants the type @code{const
2808 char[@var{length}]} so that
2809 copying the address of one into a non-@code{const} @code{char *}
2810 pointer will get a warning; when compiling C++, warn about the
2811 deprecated conversion from string constants to @code{char *}.
2812 These warnings will help you find at
2813 compile time code that can try to write into a string constant, but
2814 only if you have been very careful about using @code{const} in
2815 declarations and prototypes.  Otherwise, it will just be a nuisance;
2816 this is why we did not make @option{-Wall} request these warnings.
2818 @item -Wconversion
2819 @opindex Wconversion
2820 Warn if a prototype causes a type conversion that is different from what
2821 would happen to the same argument in the absence of a prototype.  This
2822 includes conversions of fixed point to floating and vice versa, and
2823 conversions changing the width or signedness of a fixed point argument
2824 except when the same as the default promotion.
2826 Also, warn if a negative integer constant expression is implicitly
2827 converted to an unsigned type.  For example, warn about the assignment
2828 @code{x = -1} if @code{x} is unsigned.  But do not warn about explicit
2829 casts like @code{(unsigned) -1}.
2831 @item -Wsign-compare
2832 @opindex Wsign-compare
2833 @cindex warning for comparison of signed and unsigned values
2834 @cindex comparison of signed and unsigned values, warning
2835 @cindex signed and unsigned values, comparison warning
2836 Warn when a comparison between signed and unsigned values could produce
2837 an incorrect result when the signed value is converted to unsigned.
2838 This warning is also enabled by @option{-Wextra}; to get the other warnings
2839 of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
2841 @item -Waggregate-return
2842 @opindex Waggregate-return
2843 Warn if any functions that return structures or unions are defined or
2844 called.  (In languages where you can return an array, this also elicits
2845 a warning.)
2847 @item -Wstrict-prototypes @r{(C only)}
2848 @opindex Wstrict-prototypes
2849 Warn if a function is declared or defined without specifying the
2850 argument types.  (An old-style function definition is permitted without
2851 a warning if preceded by a declaration which specifies the argument
2852 types.)
2854 @item -Wold-style-definition @r{(C only)}
2855 @opindex Wold-style-definition
2856 Warn if an old-style function definition is used.  A warning is given
2857 even if there is a previous prototype.
2859 @item -Wmissing-prototypes @r{(C only)}
2860 @opindex Wmissing-prototypes
2861 Warn if a global function is defined without a previous prototype
2862 declaration.  This warning is issued even if the definition itself
2863 provides a prototype.  The aim is to detect global functions that fail
2864 to be declared in header files.
2866 @item -Wmissing-declarations @r{(C only)}
2867 @opindex Wmissing-declarations
2868 Warn if a global function is defined without a previous declaration.
2869 Do so even if the definition itself provides a prototype.
2870 Use this option to detect global functions that are not declared in
2871 header files.
2873 @item -Wmissing-noreturn
2874 @opindex Wmissing-noreturn
2875 Warn about functions which might be candidates for attribute @code{noreturn}.
2876 Note these are only possible candidates, not absolute ones.  Care should
2877 be taken to manually verify functions actually do not ever return before
2878 adding the @code{noreturn} attribute, otherwise subtle code generation
2879 bugs could be introduced.  You will not get a warning for @code{main} in
2880 hosted C environments.
2882 @item -Wmissing-format-attribute
2883 @opindex Wmissing-format-attribute
2884 @opindex Wformat
2885 If @option{-Wformat} is enabled, also warn about functions which might be
2886 candidates for @code{format} attributes.  Note these are only possible
2887 candidates, not absolute ones.  GCC will guess that @code{format}
2888 attributes might be appropriate for any function that calls a function
2889 like @code{vprintf} or @code{vscanf}, but this might not always be the
2890 case, and some functions for which @code{format} attributes are
2891 appropriate may not be detected.  This option has no effect unless
2892 @option{-Wformat} is enabled (possibly by @option{-Wall}).
2894 @item -Wno-multichar
2895 @opindex Wno-multichar
2896 @opindex Wmultichar
2897 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
2898 Usually they indicate a typo in the user's code, as they have
2899 implementation-defined values, and should not be used in portable code.
2901 @item -Wno-deprecated-declarations
2902 @opindex Wno-deprecated-declarations
2903 Do not warn about uses of functions, variables, and types marked as
2904 deprecated by using the @code{deprecated} attribute.
2905 (@pxref{Function Attributes}, @pxref{Variable Attributes},
2906 @pxref{Type Attributes}.)
2908 @item -Wpacked
2909 @opindex Wpacked
2910 Warn if a structure is given the packed attribute, but the packed
2911 attribute has no effect on the layout or size of the structure.
2912 Such structures may be mis-aligned for little benefit.  For
2913 instance, in this code, the variable @code{f.x} in @code{struct bar}
2914 will be misaligned even though @code{struct bar} does not itself
2915 have the packed attribute:
2917 @smallexample
2918 @group
2919 struct foo @{
2920   int x;
2921   char a, b, c, d;
2922 @} __attribute__((packed));
2923 struct bar @{
2924   char z;
2925   struct foo f;
2927 @end group
2928 @end smallexample
2930 @item -Wpadded
2931 @opindex Wpadded
2932 Warn if padding is included in a structure, either to align an element
2933 of the structure or to align the whole structure.  Sometimes when this
2934 happens it is possible to rearrange the fields of the structure to
2935 reduce the padding and so make the structure smaller.
2937 @item -Wredundant-decls
2938 @opindex Wredundant-decls
2939 Warn if anything is declared more than once in the same scope, even in
2940 cases where multiple declaration is valid and changes nothing.
2942 @item -Wnested-externs @r{(C only)}
2943 @opindex Wnested-externs
2944 Warn if an @code{extern} declaration is encountered within a function.
2946 @item -Wunreachable-code
2947 @opindex Wunreachable-code
2948 Warn if the compiler detects that code will never be executed.
2950 This option is intended to warn when the compiler detects that at
2951 least a whole line of source code will never be executed, because
2952 some condition is never satisfied or because it is after a
2953 procedure that never returns.
2955 It is possible for this option to produce a warning even though there
2956 are circumstances under which part of the affected line can be executed,
2957 so care should be taken when removing apparently-unreachable code.
2959 For instance, when a function is inlined, a warning may mean that the
2960 line is unreachable in only one inlined copy of the function.
2962 This option is not made part of @option{-Wall} because in a debugging
2963 version of a program there is often substantial code which checks
2964 correct functioning of the program and is, hopefully, unreachable
2965 because the program does work.  Another common use of unreachable
2966 code is to provide behavior which is selectable at compile-time.
2968 @item -Winline
2969 @opindex Winline
2970 Warn if a function can not be inlined and it was declared as inline.
2971 Even with this option, the compiler will not warn about failures to
2972 inline functions declared in system headers.
2974 The compiler uses a variety of heuristics to determine whether or not
2975 to inline a function.  For example, the compiler takes into account
2976 the size of the function being inlined and the the amount of inlining
2977 that has already been done in the current function.  Therefore,
2978 seemingly insignificant changes in the source program can cause the
2979 warnings produced by @option{-Winline} to appear or disappear.
2981 @item -Wno-invalid-offsetof @r{(C++ only)}
2982 @opindex Wno-invalid-offsetof
2983 Suppress warnings from applying the @samp{offsetof} macro to a non-POD
2984 type.  According to the 1998 ISO C++ standard, applying @samp{offsetof}
2985 to a non-POD type is undefined.  In existing C++ implementations,
2986 however, @samp{offsetof} typically gives meaningful results even when
2987 applied to certain kinds of non-POD types. (Such as a simple
2988 @samp{struct} that fails to be a POD type only by virtue of having a
2989 constructor.)  This flag is for users who are aware that they are
2990 writing nonportable code and who have deliberately chosen to ignore the
2991 warning about it.
2993 The restrictions on @samp{offsetof} may be relaxed in a future version
2994 of the C++ standard.
2996 @item -Winvalid-pch
2997 @opindex Winvalid-pch
2998 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
2999 the search path but can't be used.
3001 @item -Wlong-long
3002 @opindex Wlong-long
3003 @opindex Wno-long-long
3004 Warn if @samp{long long} type is used.  This is default.  To inhibit
3005 the warning messages, use @option{-Wno-long-long}.  Flags
3006 @option{-Wlong-long} and @option{-Wno-long-long} are taken into account
3007 only when @option{-pedantic} flag is used.
3009 @item -Wvariadic-macros
3010 @opindex Wvariadic-macros
3011 @opindex Wno-variadic-macros
3012 Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
3013 alternate syntax when in pedantic ISO C99 mode.  This is default.
3014 To inhibit the warning messages, use @option{-Wno-variadic-macros}.
3016 @item -Wdisabled-optimization
3017 @opindex Wdisabled-optimization
3018 Warn if a requested optimization pass is disabled.  This warning does
3019 not generally indicate that there is anything wrong with your code; it
3020 merely indicates that GCC's optimizers were unable to handle the code
3021 effectively.  Often, the problem is that your code is too big or too
3022 complex; GCC will refuse to optimize programs when the optimization
3023 itself is likely to take inordinate amounts of time.
3025 @item -Werror
3026 @opindex Werror
3027 Make all warnings into errors.
3028 @end table
3030 @node Debugging Options
3031 @section Options for Debugging Your Program or GCC
3032 @cindex options, debugging
3033 @cindex debugging information options
3035 GCC has various special options that are used for debugging
3036 either your program or GCC:
3038 @table @gcctabopt
3039 @item -g
3040 @opindex g
3041 Produce debugging information in the operating system's native format
3042 (stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
3043 information.
3045 On most systems that use stabs format, @option{-g} enables use of extra
3046 debugging information that only GDB can use; this extra information
3047 makes debugging work better in GDB but will probably make other debuggers
3048 crash or
3049 refuse to read the program.  If you want to control for certain whether
3050 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
3051 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
3053 Unlike most other C compilers, GCC allows you to use @option{-g} with
3054 @option{-O}.  The shortcuts taken by optimized code may occasionally
3055 produce surprising results: some variables you declared may not exist
3056 at all; flow of control may briefly move where you did not expect it;
3057 some statements may not be executed because they compute constant
3058 results or their values were already at hand; some statements may
3059 execute in different places because they were moved out of loops.
3061 Nevertheless it proves possible to debug optimized output.  This makes
3062 it reasonable to use the optimizer for programs that might have bugs.
3064 The following options are useful when GCC is generated with the
3065 capability for more than one debugging format.
3067 @item -ggdb
3068 @opindex ggdb
3069 Produce debugging information for use by GDB@.  This means to use the
3070 most expressive format available (DWARF 2, stabs, or the native format
3071 if neither of those are supported), including GDB extensions if at all
3072 possible.
3074 @item -gstabs
3075 @opindex gstabs
3076 Produce debugging information in stabs format (if that is supported),
3077 without GDB extensions.  This is the format used by DBX on most BSD
3078 systems.  On MIPS, Alpha and System V Release 4 systems this option
3079 produces stabs debugging output which is not understood by DBX or SDB@.
3080 On System V Release 4 systems this option requires the GNU assembler.
3082 @item -feliminate-unused-debug-symbols
3083 @opindex feliminate-unused-debug-symbols
3084 Produce debugging information in stabs format (if that is supported),
3085 for only symbols that are actually used.
3087 @item -gstabs+
3088 @opindex gstabs+
3089 Produce debugging information in stabs format (if that is supported),
3090 using GNU extensions understood only by the GNU debugger (GDB)@.  The
3091 use of these extensions is likely to make other debuggers crash or
3092 refuse to read the program.
3094 @item -gcoff
3095 @opindex gcoff
3096 Produce debugging information in COFF format (if that is supported).
3097 This is the format used by SDB on most System V systems prior to
3098 System V Release 4.
3100 @item -gxcoff
3101 @opindex gxcoff
3102 Produce debugging information in XCOFF format (if that is supported).
3103 This is the format used by the DBX debugger on IBM RS/6000 systems.
3105 @item -gxcoff+
3106 @opindex gxcoff+
3107 Produce debugging information in XCOFF format (if that is supported),
3108 using GNU extensions understood only by the GNU debugger (GDB)@.  The
3109 use of these extensions is likely to make other debuggers crash or
3110 refuse to read the program, and may cause assemblers other than the GNU
3111 assembler (GAS) to fail with an error.
3113 @item -gdwarf-2
3114 @opindex gdwarf-2
3115 Produce debugging information in DWARF version 2 format (if that is
3116 supported).  This is the format used by DBX on IRIX 6.
3118 @item -gvms
3119 @opindex gvms
3120 Produce debugging information in VMS debug format (if that is
3121 supported).  This is the format used by DEBUG on VMS systems.
3123 @item -g@var{level}
3124 @itemx -ggdb@var{level}
3125 @itemx -gstabs@var{level}
3126 @itemx -gcoff@var{level}
3127 @itemx -gxcoff@var{level}
3128 @itemx -gvms@var{level}
3129 Request debugging information and also use @var{level} to specify how
3130 much information.  The default level is 2.
3132 Level 1 produces minimal information, enough for making backtraces in
3133 parts of the program that you don't plan to debug.  This includes
3134 descriptions of functions and external variables, but no information
3135 about local variables and no line numbers.
3137 Level 3 includes extra information, such as all the macro definitions
3138 present in the program.  Some debuggers support macro expansion when
3139 you use @option{-g3}.
3141 Note that in order to avoid confusion between DWARF1 debug level 2,
3142 and DWARF2 @option{-gdwarf-2} does not accept a concatenated debug
3143 level.  Instead use an additional @option{-g@var{level}} option to
3144 change the debug level for DWARF2.
3146 @item -feliminate-dwarf2-dups
3147 @opindex feliminate-dwarf2-dups
3148 Compress DWARF2 debugging information by eliminating duplicated
3149 information about each symbol.  This option only makes sense when
3150 generating DWARF2 debugging information with @option{-gdwarf-2}.
3152 @cindex @command{prof}
3153 @item -p
3154 @opindex p
3155 Generate extra code to write profile information suitable for the
3156 analysis program @command{prof}.  You must use this option when compiling
3157 the source files you want data about, and you must also use it when
3158 linking.
3160 @cindex @command{gprof}
3161 @item -pg
3162 @opindex pg
3163 Generate extra code to write profile information suitable for the
3164 analysis program @command{gprof}.  You must use this option when compiling
3165 the source files you want data about, and you must also use it when
3166 linking.
3168 @item -Q
3169 @opindex Q
3170 Makes the compiler print out each function name as it is compiled, and
3171 print some statistics about each pass when it finishes.
3173 @item -ftime-report
3174 @opindex ftime-report
3175 Makes the compiler print some statistics about the time consumed by each
3176 pass when it finishes.
3178 @item -fmem-report
3179 @opindex fmem-report
3180 Makes the compiler print some statistics about permanent memory
3181 allocation when it finishes.
3183 @item -fprofile-arcs
3184 @opindex fprofile-arcs
3185 Add code so that program flow @dfn{arcs} are instrumented.  During
3186 execution the program records how many times each branch and call is
3187 executed and how many times it is taken or returns.  When the compiled
3188 program exits it saves this data to a file called
3189 @file{@var{auxname}.gcda} for each source file. The data may be used for
3190 profile-directed optimizations (@option{-fbranch-probabilities}), or for
3191 test coverage analysis (@option{-ftest-coverage}). Each object file's
3192 @var{auxname} is generated from the name of the output file, if
3193 explicitly specified and it is not the final executable, otherwise it is
3194 the basename of the source file. In both cases any suffix is removed
3195 (e.g.  @file{foo.gcda} for input file @file{dir/foo.c}, or
3196 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
3198 @itemize
3200 @item
3201 Compile the source files with @option{-fprofile-arcs} plus optimization
3202 and code generation options. For test coverage analysis, use the
3203 additional @option{-ftest-coverage} option. You do not need to profile
3204 every source file in a program.
3206 @item
3207 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
3208 (the latter implies the former).
3210 @item
3211 Run the program on a representative workload to generate the arc profile
3212 information. This may be repeated any number of times. You can run
3213 concurrent instances of your program, and provided that the file system
3214 supports locking, the data files will be correctly updated. Also
3215 @code{fork} calls are detected and correctly handled (double counting
3216 will not happen).
3218 @item
3219 For profile-directed optimizations, compile the source files again with
3220 the same optimization and code generation options plus
3221 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
3222 Control Optimization}).
3224 @item
3225 For test coverage analysis, use @command{gcov} to produce human readable
3226 information from the @file{.gcno} and @file{.gcda} files. Refer to the
3227 @command{gcov} documentation for further information.
3229 @end itemize
3231 With @option{-fprofile-arcs}, for each function of your program GCC
3232 creates a program flow graph, then finds a spanning tree for the graph.
3233 Only arcs that are not on the spanning tree have to be instrumented: the
3234 compiler adds code to count the number of times that these arcs are
3235 executed.  When an arc is the only exit or only entrance to a block, the
3236 instrumentation code can be added to the block; otherwise, a new basic
3237 block must be created to hold the instrumentation code.
3239 @item -ftree-based-profiling
3240 @opindex ftree-based-profiling
3241 This option is used in addition to @option{-fprofile-arcs} or
3242 @option{-fbranch-probabilities} to control whether those optimizations
3243 are performed on a tree-based or rtl-based internal representation.
3244 If you use this option when compiling with @option{-fprofile-arcs},
3245 you must also use it when compiling later with @option{-fbranch-probabilities}.
3246 Currently the tree-based optimization is in an early stage of
3247 development, and this option is recommended only for those people
3248 working on improving it.
3250 @need 2000
3251 @item -ftest-coverage
3252 @opindex ftest-coverage
3253 Produce a notes file that the @command{gcov} code-coverage utility
3254 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
3255 show program coverage. Each source file's note file is called
3256 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
3257 above for a description of @var{auxname} and instructions on how to
3258 generate test coverage data. Coverage data will match the source files
3259 more closely, if you do not optimize.
3261 @item -d@var{letters}
3262 @opindex d
3263 Says to make debugging dumps during compilation at times specified by
3264 @var{letters}.  This is used for debugging the compiler.  The file names
3265 for most of the dumps are made by appending a pass number and a word to
3266 the @var{dumpname}. @var{dumpname} is generated from the name of the
3267 output file, if explicitly specified and it is not an executable,
3268 otherwise it is the basename of the source file. In both cases any
3269 suffix is removed (e.g.  @file{foo.01.rtl} or @file{foo.02.sibling}).
3270 Here are the possible letters for use in @var{letters}, and their
3271 meanings:
3273 @table @samp
3274 @item A
3275 @opindex dA
3276 Annotate the assembler output with miscellaneous debugging information.
3277 @item b
3278 @opindex db
3279 Dump after computing branch probabilities, to @file{@var{file}.12.bp}.
3280 @item B
3281 @opindex dB
3282 Dump after block reordering, to @file{@var{file}.32.bbro}.
3283 @item c
3284 @opindex dc
3285 Dump after instruction combination, to the file @file{@var{file}.20.combine}.
3286 @item C
3287 @opindex dC
3288 Dump after the first if conversion, to the file @file{@var{file}.14.ce1}.
3289 Also dump after the second if conversion, to the file @file{@var{file}.21.ce2}.
3290 @item d
3291 @opindex dd
3292 Dump after branch target load optimization, to to @file{@var{file}.33.btl}.
3293 Also dump after delayed branch scheduling, to @file{@var{file}.37.dbr}.
3294 @item D
3295 @opindex dD
3296 Dump all macro definitions, at the end of preprocessing, in addition to
3297 normal output.
3298 @item E
3299 @opindex dE
3300 Dump after the third if conversion, to @file{@var{file}.31.ce3}.
3301 @item f
3302 @opindex df
3303 Dump after control and data flow analysis, to @file{@var{file}.11.cfg}.
3304 Also dump after life analysis, to @file{@var{file}.19.life}.
3305 @item F
3306 @opindex dF
3307 Dump after purging @code{ADDRESSOF} codes, to @file{@var{file}.07.addressof}.
3308 @item g
3309 @opindex dg
3310 Dump after global register allocation, to @file{@var{file}.26.greg}.
3311 @item G
3312 @opindex dG
3313 Dump after GCSE, to @file{@var{file}.08.gcse}.
3314 Also dump after jump bypassing and control flow optimizations, to
3315 @file{@var{file}.10.bypass}.
3316 @item h
3317 @opindex dh
3318 Dump after finalization of EH handling code, to @file{@var{file}.03.eh}.
3319 @item i
3320 @opindex di
3321 Dump after sibling call optimizations, to @file{@var{file}.02.sibling}.
3322 @item j
3323 @opindex dj
3324 Dump after the first jump optimization, to @file{@var{file}.04.jump}.
3325 @item k
3326 @opindex dk
3327 Dump after conversion from registers to stack, to @file{@var{file}.35.stack}.
3328 @item l
3329 @opindex dl
3330 Dump after local register allocation, to @file{@var{file}.25.lreg}.
3331 @item L
3332 @opindex dL
3333 Dump after loop optimization passes, to @file{@var{file}.09.loop} and
3334 @file{@var{file}.16.loop2}.
3335 @item m
3336 @opindex dm
3337 Dump after modulo scheduling, to @file{@var{file}.23.sms}.
3338 @item M
3339 @opindex dM
3340 Dump after performing the machine dependent reorganization pass, to
3341 @file{@var{file}.36.mach}.
3342 @item n
3343 @opindex dn
3344 Dump after register renumbering, to @file{@var{file}.30.rnreg}.
3345 @item N
3346 @opindex dN
3347 Dump after the register move pass, to @file{@var{file}.22.regmove}.
3348 @item o
3349 @opindex do
3350 Dump after post-reload optimizations, to @file{@var{file}.27.postreload}.
3351 @item r
3352 @opindex dr
3353 Dump after RTL generation, to @file{@var{file}.01.rtl}.
3354 @item R
3355 @opindex dR
3356 Dump after the second scheduling pass, to @file{@var{file}.34.sched2}.
3357 @item s
3358 @opindex ds
3359 Dump after CSE (including the jump optimization that sometimes follows
3360 CSE), to @file{@var{file}.06.cse}.
3361 @item S
3362 @opindex dS
3363 Dump after the first scheduling pass, to @file{@var{file}.24.sched}.
3364 @item t
3365 @opindex dt
3366 Dump after the second CSE pass (including the jump optimization that
3367 sometimes follows CSE), to @file{@var{file}.18.cse2}.
3368 @item T
3369 @opindex dT
3370 Dump after running tracer, to @file{@var{file}.15.tracer}.
3371 @item u
3372 @opindex du
3373 Dump after null pointer elimination pass to @file{@var{file}.05.null}.
3374 @item U
3375 @opindex dU
3376 Dump callgraph and unit-at-a-time optimization @file{@var{file}.00.unit}.
3377 @item V
3378 @opindex dV
3379 Dump after the value profile transformations, to @file{@var{file}.13.vpt}.
3380 Also dump after variable tracking, to @file{@var{file}.35.vartrack}.
3381 @item w
3382 @opindex dw
3383 Dump after the second flow pass, to @file{@var{file}.28.flow2}.
3384 @item z
3385 @opindex dz
3386 Dump after the peephole pass, to @file{@var{file}.29.peephole2}.
3387 @item Z
3388 @opindex dZ
3389 Dump after constructing the web, to @file{@var{file}.17.web}.
3390 @item a
3391 @opindex da
3392 Produce all the dumps listed above.
3393 @item H
3394 @opindex dH
3395 Produce a core dump whenever an error occurs.
3396 @item m
3397 @opindex dm
3398 Print statistics on memory usage, at the end of the run, to
3399 standard error.
3400 @item p
3401 @opindex dp
3402 Annotate the assembler output with a comment indicating which
3403 pattern and alternative was used.  The length of each instruction is
3404 also printed.
3405 @item P
3406 @opindex dP
3407 Dump the RTL in the assembler output as a comment before each instruction.
3408 Also turns on @option{-dp} annotation.
3409 @item v
3410 @opindex dv
3411 For each of the other indicated dump files (except for
3412 @file{@var{file}.01.rtl}), dump a representation of the control flow graph
3413 suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
3414 @item x
3415 @opindex dx
3416 Just generate RTL for a function instead of compiling it.  Usually used
3417 with @samp{r}.
3418 @item y
3419 @opindex dy
3420 Dump debugging information during parsing, to standard error.
3421 @end table
3423 @item -fdump-unnumbered
3424 @opindex fdump-unnumbered
3425 When doing debugging dumps (see @option{-d} option above), suppress instruction
3426 numbers and line number note output.  This makes it more feasible to
3427 use diff on debugging dumps for compiler invocations with different
3428 options, in particular with and without @option{-g}.
3430 @item -fdump-translation-unit @r{(C and C++ only)}
3431 @itemx -fdump-translation-unit-@var{options} @r{(C and C++ only)}
3432 @opindex fdump-translation-unit
3433 Dump a representation of the tree structure for the entire translation
3434 unit to a file.  The file name is made by appending @file{.tu} to the
3435 source file name.  If the @samp{-@var{options}} form is used, @var{options}
3436 controls the details of the dump as described for the
3437 @option{-fdump-tree} options.
3439 @item -fdump-class-hierarchy @r{(C++ only)}
3440 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
3441 @opindex fdump-class-hierarchy
3442 Dump a representation of each class's hierarchy and virtual function
3443 table layout to a file.  The file name is made by appending @file{.class}
3444 to the source file name.  If the @samp{-@var{options}} form is used,
3445 @var{options} controls the details of the dump as described for the
3446 @option{-fdump-tree} options.
3448 @item -fdump-tree-@var{switch} @r{(C and C++ only)}
3449 @itemx -fdump-tree-@var{switch}-@var{options} @r{(C and C++ only)}
3450 @opindex fdump-tree
3451 Control the dumping at various stages of processing the intermediate
3452 language tree to a file.  The file name is generated by appending a switch
3453 specific suffix to the source file name.  If the @samp{-@var{options}}
3454 form is used, @var{options} is a list of @samp{-} separated options that
3455 control the details of the dump. Not all options are applicable to all
3456 dumps, those which are not meaningful will be ignored. The following
3457 options are available
3459 @table @samp
3460 @item address
3461 Print the address of each node.  Usually this is not meaningful as it
3462 changes according to the environment and source file. Its primary use
3463 is for tying up a dump file with a debug environment.
3464 @item slim
3465 Inhibit dumping of members of a scope or body of a function merely
3466 because that scope has been reached.  Only dump such items when they
3467 are directly reachable by some other path.  When dumping pretty-printed
3468 trees, this option inhibits dumping the bodies of control structures.
3469 @item raw
3470 Print a raw representation of the tree.  By default, trees are
3471 pretty-printed into a C-like representation.
3472 @item details
3473 Enable more detailed dumps (not honored by every dump option).
3474 @item stats
3475 Enable dumping various statistics about the pass (not honored by every dump
3476 option).
3477 @item blocks
3478 Enable showing basic block boundaries (disabled in raw dumps).
3479 @item vops
3480 Enable showing virtual operands for every statement.
3481 @item lineno
3482 Enable showing line numbers for statements.
3483 @item uid
3484 Enable showing the unique ID (@code{DECL_UID}) for each variable.
3485 @item all
3486 Turn on all options, except @option{raw}, @option{slim} and @option{lineno}.
3487 @end table
3489 The following tree dumps are possible:
3490 @table @samp
3492 @item original
3493 Dump before any tree based optimization, to @file{@var{file}.original}.
3495 @item optimized
3496 Dump after all tree based optimization, to @file{@var{file}.optimized}.
3498 @item inlined
3499 Dump after function inlining, to @file{@var{file}.inlined}.
3501 @item gimple
3502 @opindex fdump-tree-gimple
3503 Dump each function before and after the gimplification pass to a file.  The
3504 file name is made by appending @file{.gimple} to the source file name.
3506 @item cfg
3507 @opindex fdump-tree-cfg
3508 Dump the control flow graph of each function to a file.  The file name is
3509 made by appending @file{.cfg} to the source file name.
3511 @item vcg
3512 @opindex fdump-tree-vcg
3513 Dump the control flow graph of each function to a file in VCG format.  The
3514 file name is made by appending @file{.vcg} to the source file name.  Note
3515 that if the file contains more than one function, the generated file cannot
3516 be used directly by VCG.  You will need to cut and paste each function's
3517 graph into its own separate file first.
3519 @item ch
3520 @opindex fdump-tree-ch
3521 Dump each function after copying loop headers.  The file name is made by
3522 appending @file{.ch} to the source file name.
3524 @item ssa
3525 @opindex fdump-tree-ssa
3526 Dump SSA related information to a file.  The file name is made by appending
3527 @file{.ssa} to the source file name.
3529 @item alias
3530 @opindex fdump-tree-alias
3531 Dump aliasing information for each function.  The file name is made by
3532 appending @file{.alias} to the source file name.
3534 @item ccp
3535 @opindex fdump-tree-ccp
3536 Dump each function after CCP.  The file name is made by appending
3537 @file{.ccp} to the source file name.
3539 @item pre
3540 @opindex fdump-tree-pre
3541 Dump trees after partial redundancy elimination.  The file name is made
3542 by appending @file{.pre} to the source file name.
3544 @item dce
3545 @opindex fdump-tree-dce
3546 Dump each function after dead code elimination.  The file name is made by
3547 appending @file{.dce} to the source file name.
3549 @item mudflap
3550 @opindex fdump-tree-mudflap
3551 Dump each function after adding mudflap instrumentation.  The file name is
3552 made by appending @file{.mudflap} to the source file name.
3554 @item sra
3555 @opindex fdump-tree-sra
3556 Dump each function after performing scalar replacement of aggregates.  The
3557 file name is made by appending @file{.sra} to the source file name.
3559 @item dom
3560 @opindex fdump-tree-dom
3561 Dump each function after applying dominator tree optimizations.  The file
3562 name is made by appending @file{.dom} to the source file name.
3564 @item dse
3565 @opindex fdump-tree-dse
3566 Dump each function after applying dead store elimination.  The file
3567 name is made by appending @file{.dse} to the source file name.
3569 @item phiopt
3570 @opindex fdump-tree-phiopt
3571 Dump each function after optimizing PHI nodes into straightline code.  The file
3572 name is made by appending @file{.phiopt} to the source file name.
3574 @item forwprop
3575 @opindex fdump-tree-forwprop
3576 Dump each function after forward propagating single use variables.  The file
3577 name is made by appending @file{.forwprop} to the source file name.
3579 @item copyrename
3580 @opindex fdump-tree-copyrename
3581 Dump each function after applying the copy rename optimization.  The file
3582 name is made by appending @file{.copyrename} to the source file name.
3584 @item nrv
3585 @opindex fdump-tree-nrv
3586 Dump each function after applying the named return value optimization on
3587 generic trees.  The file name is made by appending @file{.nrv} to the source
3588 file name.
3590 @item all
3591 @opindex fdump-tree-all
3592 Enable all the available tree dumps with the flags provided in this option.
3593 @end table
3595 @item -frandom-seed=@var{string}
3596 @opindex frandom-string
3597 This option provides a seed that GCC uses when it would otherwise use
3598 random numbers.  It is used to generate certain symbol names
3599 that have to be different in every compiled file. It is also used to
3600 place unique stamps in coverage data files and the object files that
3601 produce them. You can use the @option{-frandom-seed} option to produce
3602 reproducibly identical object files.
3604 The @var{string} should be different for every file you compile.
3606 @item -fsched-verbose=@var{n}
3607 @opindex fsched-verbose
3608 On targets that use instruction scheduling, this option controls the
3609 amount of debugging output the scheduler prints.  This information is
3610 written to standard error, unless @option{-dS} or @option{-dR} is
3611 specified, in which case it is output to the usual dump
3612 listing file, @file{.sched} or @file{.sched2} respectively.  However
3613 for @var{n} greater than nine, the output is always printed to standard
3614 error.
3616 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
3617 same information as @option{-dRS}.  For @var{n} greater than one, it
3618 also output basic block probabilities, detailed ready list information
3619 and unit/insn info.  For @var{n} greater than two, it includes RTL
3620 at abort point, control-flow and regions info.  And for @var{n} over
3621 four, @option{-fsched-verbose} also includes dependence info.
3623 @item -save-temps
3624 @opindex save-temps
3625 Store the usual ``temporary'' intermediate files permanently; place them
3626 in the current directory and name them based on the source file.  Thus,
3627 compiling @file{foo.c} with @samp{-c -save-temps} would produce files
3628 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
3629 preprocessed @file{foo.i} output file even though the compiler now
3630 normally uses an integrated preprocessor.
3632 @item -time
3633 @opindex time
3634 Report the CPU time taken by each subprocess in the compilation
3635 sequence.  For C source files, this is the compiler proper and assembler
3636 (plus the linker if linking is done).  The output looks like this:
3638 @smallexample
3639 # cc1 0.12 0.01
3640 # as 0.00 0.01
3641 @end smallexample
3643 The first number on each line is the ``user time,'' that is time spent
3644 executing the program itself.  The second number is ``system time,''
3645 time spent executing operating system routines on behalf of the program.
3646 Both numbers are in seconds.
3648 @item -fvar-tracking
3649 @opindex fvar-tracking
3650 Run variable tracking pass. It computes where variables are stored at each
3651 position in code. Better debugging information is then generated
3652 (if the debugging information format supports this information).
3654 It is enabled by default when compiling with optimization (@option{-Os},
3655 @option{-O}, @option{-O2}, ...), debugging information (@option{-g}) and
3656 the debug info format supports it.
3658 @item -print-file-name=@var{library}
3659 @opindex print-file-name
3660 Print the full absolute name of the library file @var{library} that
3661 would be used when linking---and don't do anything else.  With this
3662 option, GCC does not compile or link anything; it just prints the
3663 file name.
3665 @item -print-multi-directory
3666 @opindex print-multi-directory
3667 Print the directory name corresponding to the multilib selected by any
3668 other switches present in the command line.  This directory is supposed
3669 to exist in @env{GCC_EXEC_PREFIX}.
3671 @item -print-multi-lib
3672 @opindex print-multi-lib
3673 Print the mapping from multilib directory names to compiler switches
3674 that enable them.  The directory name is separated from the switches by
3675 @samp{;}, and each switch starts with an @samp{@@} instead of the
3676 @samp{-}, without spaces between multiple switches.  This is supposed to
3677 ease shell-processing.
3679 @item -print-prog-name=@var{program}
3680 @opindex print-prog-name
3681 Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
3683 @item -print-libgcc-file-name
3684 @opindex print-libgcc-file-name
3685 Same as @option{-print-file-name=libgcc.a}.
3687 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
3688 but you do want to link with @file{libgcc.a}.  You can do
3690 @smallexample
3691 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
3692 @end smallexample
3694 @item -print-search-dirs
3695 @opindex print-search-dirs
3696 Print the name of the configured installation directory and a list of
3697 program and library directories @command{gcc} will search---and don't do anything else.
3699 This is useful when @command{gcc} prints the error message
3700 @samp{installation problem, cannot exec cpp0: No such file or directory}.
3701 To resolve this you either need to put @file{cpp0} and the other compiler
3702 components where @command{gcc} expects to find them, or you can set the environment
3703 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
3704 Don't forget the trailing '/'.
3705 @xref{Environment Variables}.
3707 @item -dumpmachine
3708 @opindex dumpmachine
3709 Print the compiler's target machine (for example,
3710 @samp{i686-pc-linux-gnu})---and don't do anything else.
3712 @item -dumpversion
3713 @opindex dumpversion
3714 Print the compiler version (for example, @samp{3.0})---and don't do
3715 anything else.
3717 @item -dumpspecs
3718 @opindex dumpspecs
3719 Print the compiler's built-in specs---and don't do anything else.  (This
3720 is used when GCC itself is being built.)  @xref{Spec Files}.
3722 @item -feliminate-unused-debug-types
3723 @opindex feliminate-unused-debug-types
3724 Normally, when producing DWARF2 output, GCC will emit debugging
3725 information for all types declared in a compilation
3726 unit, regardless of whether or not they are actually used
3727 in that compilation unit.  Sometimes this is useful, such as
3728 if, in the debugger, you want to cast a value to a type that is
3729 not actually used in your program (but is declared).  More often,
3730 however, this results in a significant amount of wasted space.
3731 With this option, GCC will avoid producing debug symbol output
3732 for types that are nowhere used in the source file being compiled.
3733 @end table
3735 @node Optimize Options
3736 @section Options That Control Optimization
3737 @cindex optimize options
3738 @cindex options, optimization
3740 These options control various sorts of optimizations.
3742 Without any optimization option, the compiler's goal is to reduce the
3743 cost of compilation and to make debugging produce the expected
3744 results.  Statements are independent: if you stop the program with a
3745 breakpoint between statements, you can then assign a new value to any
3746 variable or change the program counter to any other statement in the
3747 function and get exactly the results you would expect from the source
3748 code.
3750 Turning on optimization flags makes the compiler attempt to improve
3751 the performance and/or code size at the expense of compilation time
3752 and possibly the ability to debug the program.
3754 The compiler performs optimization based on the knowledge it has of
3755 the program.  Optimization levels @option{-O2} and above, in
3756 particular, enable @emph{unit-at-a-time} mode, which allows the
3757 compiler to consider information gained from later functions in
3758 the file when compiling a function.  Compiling multiple files at
3759 once to a single output file in @emph{unit-at-a-time} mode allows
3760 the compiler to use information gained from all of the files when
3761 compiling each of them.
3763 Not all optimizations are controlled directly by a flag.  Only
3764 optimizations that have a flag are listed.
3766 @table @gcctabopt
3767 @item -O
3768 @itemx -O1
3769 @opindex O
3770 @opindex O1
3771 Optimize.  Optimizing compilation takes somewhat more time, and a lot
3772 more memory for a large function.
3774 With @option{-O}, the compiler tries to reduce code size and execution
3775 time, without performing any optimizations that take a great deal of
3776 compilation time.
3778 @option{-O} turns on the following optimization flags:
3779 @gccoptlist{-fdefer-pop @gol
3780 -fmerge-constants @gol
3781 -fthread-jumps @gol
3782 -floop-optimize @gol
3783 -fif-conversion @gol
3784 -fif-conversion2 @gol
3785 -fdelayed-branch @gol
3786 -fguess-branch-probability @gol
3787 -fcprop-registers}
3789 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
3790 where doing so does not interfere with debugging.
3792 @item -O2
3793 @opindex O2
3794 Optimize even more.  GCC performs nearly all supported optimizations
3795 that do not involve a space-speed tradeoff.  The compiler does not
3796 perform loop unrolling or function inlining when you specify @option{-O2}.
3797 As compared to @option{-O}, this option increases both compilation time
3798 and the performance of the generated code.
3800 @option{-O2} turns on all optimization flags specified by @option{-O}.  It
3801 also turns on the following optimization flags:
3802 @gccoptlist{-fforce-mem @gol
3803 -foptimize-sibling-calls @gol
3804 -fstrength-reduce @gol
3805 -fcse-follow-jumps  -fcse-skip-blocks @gol
3806 -frerun-cse-after-loop  -frerun-loop-opt @gol
3807 -fgcse  -fgcse-lm  -fgcse-sm  -fgcse-las @gol
3808 -fdelete-null-pointer-checks @gol
3809 -fexpensive-optimizations @gol
3810 -fregmove @gol
3811 -fschedule-insns  -fschedule-insns2 @gol
3812 -fsched-interblock  -fsched-spec @gol
3813 -fcaller-saves @gol
3814 -fpeephole2 @gol
3815 -freorder-blocks  -freorder-functions @gol
3816 -fstrict-aliasing @gol
3817 -funit-at-a-time @gol
3818 -falign-functions  -falign-jumps @gol
3819 -falign-loops  -falign-labels @gol
3820 -fcrossjumping}
3822 Please note the warning under @option{-fgcse} about
3823 invoking @option{-O2} on programs that use computed gotos.
3825 @item -O3
3826 @opindex O3
3827 Optimize yet more.  @option{-O3} turns on all optimizations specified by
3828 @option{-O2} and also turns on the @option{-finline-functions},
3829 @option{-fweb}, @option{-frename-registers}
3830 and @option{-fgcse-after-reload} options.
3832 @item -O0
3833 @opindex O0
3834 Do not optimize.  This is the default.
3836 @item -Os
3837 @opindex Os
3838 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations that
3839 do not typically increase code size.  It also performs further
3840 optimizations designed to reduce code size.
3842 @option{-Os} disables the following optimization flags:
3843 @gccoptlist{-falign-functions  -falign-jumps  -falign-loops @gol
3844 -falign-labels  -freorder-blocks  -freorder-blocks-and-partition -fprefetch-loop-arrays}
3846 If you use multiple @option{-O} options, with or without level numbers,
3847 the last such option is the one that is effective.
3848 @end table
3850 Options of the form @option{-f@var{flag}} specify machine-independent
3851 flags.  Most flags have both positive and negative forms; the negative
3852 form of @option{-ffoo} would be @option{-fno-foo}.  In the table
3853 below, only one of the forms is listed---the one you typically will
3854 use.  You can figure out the other form by either removing @samp{no-}
3855 or adding it.
3857 The following options control specific optimizations.  They are either
3858 activated by @option{-O} options or are related to ones that are.  You
3859 can use the following flags in the rare cases when ``fine-tuning'' of
3860 optimizations to be performed is desired.
3862 @table @gcctabopt
3863 @item -fno-default-inline
3864 @opindex fno-default-inline
3865 Do not make member functions inline by default merely because they are
3866 defined inside the class scope (C++ only).  Otherwise, when you specify
3867 @w{@option{-O}}, member functions defined inside class scope are compiled
3868 inline by default; i.e., you don't need to add @samp{inline} in front of
3869 the member function name.
3871 @item -fno-defer-pop
3872 @opindex fno-defer-pop
3873 Always pop the arguments to each function call as soon as that function
3874 returns.  For machines which must pop arguments after a function call,
3875 the compiler normally lets arguments accumulate on the stack for several
3876 function calls and pops them all at once.
3878 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3880 @item -fforce-mem
3881 @opindex fforce-mem
3882 Force memory operands to be copied into registers before doing
3883 arithmetic on them.  This produces better code by making all memory
3884 references potential common subexpressions.  When they are not common
3885 subexpressions, instruction combination should eliminate the separate
3886 register-load.
3888 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3890 @item -fforce-addr
3891 @opindex fforce-addr
3892 Force memory address constants to be copied into registers before
3893 doing arithmetic on them.  This may produce better code just as
3894 @option{-fforce-mem} may.
3896 @item -fomit-frame-pointer
3897 @opindex fomit-frame-pointer
3898 Don't keep the frame pointer in a register for functions that
3899 don't need one.  This avoids the instructions to save, set up and
3900 restore frame pointers; it also makes an extra register available
3901 in many functions.  @strong{It also makes debugging impossible on
3902 some machines.}
3904 On some machines, such as the VAX, this flag has no effect, because
3905 the standard calling sequence automatically handles the frame pointer
3906 and nothing is saved by pretending it doesn't exist.  The
3907 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
3908 whether a target machine supports this flag.  @xref{Registers,,Register
3909 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
3911 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3913 @item -foptimize-sibling-calls
3914 @opindex foptimize-sibling-calls
3915 Optimize sibling and tail recursive calls.
3917 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3919 @item -fno-inline
3920 @opindex fno-inline
3921 Don't pay attention to the @code{inline} keyword.  Normally this option
3922 is used to keep the compiler from expanding any functions inline.
3923 Note that if you are not optimizing, no functions can be expanded inline.
3925 @item -finline-functions
3926 @opindex finline-functions
3927 Integrate all simple functions into their callers.  The compiler
3928 heuristically decides which functions are simple enough to be worth
3929 integrating in this way.
3931 If all calls to a given function are integrated, and the function is
3932 declared @code{static}, then the function is normally not output as
3933 assembler code in its own right.
3935 Enabled at level @option{-O3}.
3937 @item -finline-limit=@var{n}
3938 @opindex finline-limit
3939 By default, GCC limits the size of functions that can be inlined.  This flag
3940 allows the control of this limit for functions that are explicitly marked as
3941 inline (i.e., marked with the inline keyword or defined within the class
3942 definition in c++).  @var{n} is the size of functions that can be inlined in
3943 number of pseudo instructions (not counting parameter handling).  The default
3944 value of @var{n} is 600.
3945 Increasing this value can result in more inlined code at
3946 the cost of compilation time and memory consumption.  Decreasing usually makes
3947 the compilation faster and less code will be inlined (which presumably
3948 means slower programs).  This option is particularly useful for programs that
3949 use inlining heavily such as those based on recursive templates with C++.
3951 Inlining is actually controlled by a number of parameters, which may be
3952 specified individually by using @option{--param @var{name}=@var{value}}.
3953 The @option{-finline-limit=@var{n}} option sets some of these parameters
3954 as follows:
3956 @table @gcctabopt
3957  @item max-inline-insns-single
3958   is set to @var{n}/2.
3959  @item max-inline-insns-auto
3960   is set to @var{n}/2.
3961  @item min-inline-insns
3962   is set to 130 or @var{n}/4, whichever is smaller.
3963  @item max-inline-insns-rtl
3964   is set to @var{n}.
3965 @end table
3967 See below for a documentation of the individual
3968 parameters controlling inlining.
3970 @emph{Note:} pseudo instruction represents, in this particular context, an
3971 abstract measurement of function's size.  In no way, it represents a count
3972 of assembly instructions and as such its exact meaning might change from one
3973 release to an another.
3975 @item -fkeep-inline-functions
3976 @opindex fkeep-inline-functions
3977 Even if all calls to a given function are integrated, and the function
3978 is declared @code{static}, nevertheless output a separate run-time
3979 callable version of the function.  This switch does not affect
3980 @code{extern inline} functions.
3982 @item -fkeep-static-consts
3983 @opindex fkeep-static-consts
3984 Emit variables declared @code{static const} when optimization isn't turned
3985 on, even if the variables aren't referenced.
3987 GCC enables this option by default.  If you want to force the compiler to
3988 check if the variable was referenced, regardless of whether or not
3989 optimization is turned on, use the @option{-fno-keep-static-consts} option.
3991 @item -fmerge-constants
3992 Attempt to merge identical constants (string constants and floating point
3993 constants) across compilation units.
3995 This option is the default for optimized compilation if the assembler and
3996 linker support it.  Use @option{-fno-merge-constants} to inhibit this
3997 behavior.
3999 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4001 @item -fmerge-all-constants
4002 Attempt to merge identical constants and identical variables.
4004 This option implies @option{-fmerge-constants}.  In addition to
4005 @option{-fmerge-constants} this considers e.g. even constant initialized
4006 arrays or initialized constant variables with integral or floating point
4007 types.  Languages like C or C++ require each non-automatic variable to
4008 have distinct location, so using this option will result in non-conforming
4009 behavior.
4011 @item -fmodulo-sched
4012 @opindex fmodulo-sched
4013 Perform swing modulo scheduling immediately before the first scheduling
4014 pass.  This pass looks at innermost loops and reorders their
4015 instructions by overlapping different iterations.
4017 @item -fnew-ra
4018 @opindex fnew-ra
4019 Use a graph coloring register allocator.  Currently this option is meant
4020 only for testing.  Users should not specify this option, since it is not
4021 yet ready for production use.
4023 @item -fno-branch-count-reg
4024 @opindex fno-branch-count-reg
4025 Do not use ``decrement and branch'' instructions on a count register,
4026 but instead generate a sequence of instructions that decrement a
4027 register, compare it against zero, then branch based upon the result.
4028 This option is only meaningful on architectures that support such
4029 instructions, which include x86, PowerPC, IA-64 and S/390.
4031 The default is @option{-fbranch-count-reg}, enabled when
4032 @option{-fstrength-reduce} is enabled.
4034 @item -fno-function-cse
4035 @opindex fno-function-cse
4036 Do not put function addresses in registers; make each instruction that
4037 calls a constant function contain the function's address explicitly.
4039 This option results in less efficient code, but some strange hacks
4040 that alter the assembler output may be confused by the optimizations
4041 performed when this option is not used.
4043 The default is @option{-ffunction-cse}
4045 @item -fno-zero-initialized-in-bss
4046 @opindex fno-zero-initialized-in-bss
4047 If the target supports a BSS section, GCC by default puts variables that
4048 are initialized to zero into BSS@.  This can save space in the resulting
4049 code.
4051 This option turns off this behavior because some programs explicitly
4052 rely on variables going to the data section.  E.g., so that the
4053 resulting executable can find the beginning of that section and/or make
4054 assumptions based on that.
4056 The default is @option{-fzero-initialized-in-bss}.
4058 @item -fbounds-check
4059 @opindex fbounds-check
4060 For front-ends that support it, generate additional code to check that
4061 indices used to access arrays are within the declared range.  This is
4062 currently only supported by the Java and Fortran front-ends, where
4063 this option defaults to true and false respectively.
4065 @item -fmudflap -fmudflapth -fmudflapir
4066 @opindex fmudflap
4067 @opindex fmudflapth
4068 @opindex fmudflapir
4069 @cindex bounds checking
4070 @cindex mudflap
4071 For front-ends that support it (C and C++), instrument all risky
4072 pointer/array dereferencing operations, some standard library
4073 string/heap functions, and some other associated constructs with
4074 range/validity tests.  Modules so instrumented should be immune to
4075 buffer overflows, invalid heap use, and some other classes of C/C++
4076 programming errors.  The instrumentation relies on a separate runtime
4077 library (@file{libmudflap}), which will be linked into a program if
4078 @option{-fmudflap} is given at link time.  Run-time behavior of the
4079 instrumented program is controlled by the @env{MUDFLAP_OPTIONS}
4080 environment variable.  See @code{env MUDFLAP_OPTIONS=-help a.out}
4081 for its options.
4083 Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to
4084 link if your program is multi-threaded.  Use @option{-fmudflapir}, in
4085 addition to @option{-fmudflap} or @option{-fmudflapth}, if
4086 instrumentation should ignore pointer reads.  This produces less
4087 instrumentation (and therefore faster execution) and still provides
4088 some protection against outright memory corrupting writes, but allows
4089 erroneously read data to propagate within a program.
4091 @item -fstrength-reduce
4092 @opindex fstrength-reduce
4093 Perform the optimizations of loop strength reduction and
4094 elimination of iteration variables.
4096 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4098 @item -fthread-jumps
4099 @opindex fthread-jumps
4100 Perform optimizations where we check to see if a jump branches to a
4101 location where another comparison subsumed by the first is found.  If
4102 so, the first branch is redirected to either the destination of the
4103 second branch or a point immediately following it, depending on whether
4104 the condition is known to be true or false.
4106 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4108 @item -fcse-follow-jumps
4109 @opindex fcse-follow-jumps
4110 In common subexpression elimination, scan through jump instructions
4111 when the target of the jump is not reached by any other path.  For
4112 example, when CSE encounters an @code{if} statement with an
4113 @code{else} clause, CSE will follow the jump when the condition
4114 tested is false.
4116 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4118 @item -fcse-skip-blocks
4119 @opindex fcse-skip-blocks
4120 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
4121 follow jumps which conditionally skip over blocks.  When CSE
4122 encounters a simple @code{if} statement with no else clause,
4123 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
4124 body of the @code{if}.
4126 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4128 @item -frerun-cse-after-loop
4129 @opindex frerun-cse-after-loop
4130 Re-run common subexpression elimination after loop optimizations has been
4131 performed.
4133 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4135 @item -frerun-loop-opt
4136 @opindex frerun-loop-opt
4137 Run the loop optimizer twice.
4139 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4141 @item -fgcse
4142 @opindex fgcse
4143 Perform a global common subexpression elimination pass.
4144 This pass also performs global constant and copy propagation.
4146 @emph{Note:} When compiling a program using computed gotos, a GCC
4147 extension, you may get better runtime performance if you disable
4148 the global common subexpression elimination pass by adding
4149 @option{-fno-gcse} to the command line.
4151 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4153 @item -fgcse-lm
4154 @opindex fgcse-lm
4155 When @option{-fgcse-lm} is enabled, global common subexpression elimination will
4156 attempt to move loads which are only killed by stores into themselves.  This
4157 allows a loop containing a load/store sequence to be changed to a load outside
4158 the loop, and a copy/store within the loop.
4160 Enabled by default when gcse is enabled.
4162 @item -fgcse-sm
4163 @opindex fgcse-sm
4164 When @option{-fgcse-sm} is enabled, a store motion pass is run after
4165 global common subexpression elimination.  This pass will attempt to move
4166 stores out of loops.  When used in conjunction with @option{-fgcse-lm},
4167 loops containing a load/store sequence can be changed to a load before
4168 the loop and a store after the loop.
4170 Enabled by default when gcse is enabled.
4172 @item -fgcse-las
4173 @opindex fgcse-las
4174 When @option{-fgcse-las} is enabled, the global common subexpression
4175 elimination pass eliminates redundant loads that come after stores to the
4176 same memory location (both partial and full redundancies).
4178 Enabled by default when gcse is enabled.
4180 @item -fgcse-after-reload
4181 @opindex fgcse-after-reload
4182 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
4183 pass is performed after reload. The purpose of this pass is to cleanup
4184 redundant spilling.
4186 @item -floop-optimize
4187 @opindex floop-optimize
4188 Perform loop optimizations: move constant expressions out of loops, simplify
4189 exit test conditions and optionally do strength-reduction and loop unrolling as
4190 well.
4192 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4194 @item -floop-optimize2
4195 @opindex floop-optimize2
4196 Perform loop optimizations using the new loop optimizer.  The optimizations
4197 (loop unrolling, peeling and unswitching, loop invariant motion) are enabled
4198 by separate flags.
4200 @item -fcrossjumping
4201 @opindex crossjumping
4202 Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The
4203 resulting code may or may not perform better than without cross-jumping.
4205 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4207 @item -fif-conversion
4208 @opindex if-conversion
4209 Attempt to transform conditional jumps into branch-less equivalents.  This
4210 include use of conditional moves, min, max, set flags and abs instructions, and
4211 some tricks doable by standard arithmetics.  The use of conditional execution
4212 on chips where it is available is controlled by @code{if-conversion2}.
4214 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4216 @item -fif-conversion2
4217 @opindex if-conversion2
4218 Use conditional execution (where available) to transform conditional jumps into
4219 branch-less equivalents.
4221 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4223 @item -fdelete-null-pointer-checks
4224 @opindex fdelete-null-pointer-checks
4225 Use global dataflow analysis to identify and eliminate useless checks
4226 for null pointers.  The compiler assumes that dereferencing a null
4227 pointer would have halted the program.  If a pointer is checked after
4228 it has already been dereferenced, it cannot be null.
4230 In some environments, this assumption is not true, and programs can
4231 safely dereference null pointers.  Use
4232 @option{-fno-delete-null-pointer-checks} to disable this optimization
4233 for programs which depend on that behavior.
4235 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4237 @item -fexpensive-optimizations
4238 @opindex fexpensive-optimizations
4239 Perform a number of minor optimizations that are relatively expensive.
4241 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4243 @item -foptimize-register-move
4244 @itemx -fregmove
4245 @opindex foptimize-register-move
4246 @opindex fregmove
4247 Attempt to reassign register numbers in move instructions and as
4248 operands of other simple instructions in order to maximize the amount of
4249 register tying.  This is especially helpful on machines with two-operand
4250 instructions.
4252 Note @option{-fregmove} and @option{-foptimize-register-move} are the same
4253 optimization.
4255 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4257 @item -fdelayed-branch
4258 @opindex fdelayed-branch
4259 If supported for the target machine, attempt to reorder instructions
4260 to exploit instruction slots available after delayed branch
4261 instructions.
4263 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4265 @item -fschedule-insns
4266 @opindex fschedule-insns
4267 If supported for the target machine, attempt to reorder instructions to
4268 eliminate execution stalls due to required data being unavailable.  This
4269 helps machines that have slow floating point or memory load instructions
4270 by allowing other instructions to be issued until the result of the load
4271 or floating point instruction is required.
4273 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4275 @item -fschedule-insns2
4276 @opindex fschedule-insns2
4277 Similar to @option{-fschedule-insns}, but requests an additional pass of
4278 instruction scheduling after register allocation has been done.  This is
4279 especially useful on machines with a relatively small number of
4280 registers and where memory load instructions take more than one cycle.
4282 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4284 @item -fno-sched-interblock
4285 @opindex fno-sched-interblock
4286 Don't schedule instructions across basic blocks.  This is normally
4287 enabled by default when scheduling before register allocation, i.e.@:
4288 with @option{-fschedule-insns} or at @option{-O2} or higher.
4290 @item -fno-sched-spec
4291 @opindex fno-sched-spec
4292 Don't allow speculative motion of non-load instructions.  This is normally
4293 enabled by default when scheduling before register allocation, i.e.@:
4294 with @option{-fschedule-insns} or at @option{-O2} or higher.
4296 @item -fsched-spec-load
4297 @opindex fsched-spec-load
4298 Allow speculative motion of some load instructions.  This only makes
4299 sense when scheduling before register allocation, i.e.@: with
4300 @option{-fschedule-insns} or at @option{-O2} or higher.
4302 @item -fsched-spec-load-dangerous
4303 @opindex fsched-spec-load-dangerous
4304 Allow speculative motion of more load instructions.  This only makes
4305 sense when scheduling before register allocation, i.e.@: with
4306 @option{-fschedule-insns} or at @option{-O2} or higher.
4308 @item -fsched-stalled-insns=@var{n}
4309 @opindex fsched-stalled-insns
4310 Define how many insns (if any) can be moved prematurely from the queue
4311 of stalled insns into the ready list, during the second scheduling pass.
4313 @item -fsched-stalled-insns-dep=@var{n}
4314 @opindex fsched-stalled-insns-dep
4315 Define how many insn groups (cycles) will be examined for a dependency
4316 on a stalled insn that is candidate for premature removal from the queue
4317 of stalled insns.  Has an effect only during the second scheduling pass,
4318 and only if @option{-fsched-stalled-insns} is used and its value is not zero.
4320 @item -fsched2-use-superblocks
4321 @opindex fsched2-use-superblocks
4322 When scheduling after register allocation, do use superblock scheduling
4323 algorithm.  Superblock scheduling allows motion across basic block boundaries
4324 resulting on faster schedules.  This option is experimental, as not all machine
4325 descriptions used by GCC model the CPU closely enough to avoid unreliable
4326 results from the algorithm.
4328 This only makes sense when scheduling after register allocation, i.e.@: with
4329 @option{-fschedule-insns2} or at @option{-O2} or higher.
4331 @item -fsched2-use-traces
4332 @opindex fsched2-use-traces
4333 Use @option{-fsched2-use-superblocks} algorithm when scheduling after register
4334 allocation and additionally perform code duplication in order to increase the
4335 size of superblocks using tracer pass.  See @option{-ftracer} for details on
4336 trace formation.
4338 This mode should produce faster but significantly longer programs.  Also
4339 without @code{-fbranch-probabilities} the traces constructed may not match the
4340 reality and hurt the performance.  This only makes
4341 sense when scheduling after register allocation, i.e.@: with
4342 @option{-fschedule-insns2} or at @option{-O2} or higher.
4344 @item -fcaller-saves
4345 @opindex fcaller-saves
4346 Enable values to be allocated in registers that will be clobbered by
4347 function calls, by emitting extra instructions to save and restore the
4348 registers around such calls.  Such allocation is done only when it
4349 seems to result in better code than would otherwise be produced.
4351 This option is always enabled by default on certain machines, usually
4352 those which have no call-preserved registers to use instead.
4354 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4356 @item -ftree-pre
4357 Perform Partial Redundancy Elimination (PRE) on trees.  This flag is
4358 enabled by default at -O and higher.
4360 @item -ftree-ccp
4361 Perform sparse conditional constant propagation (CCP) on trees.  This flag
4362 is enabled by default at -O and higher.
4364 @item -ftree-dce
4365 Perform dead code elimination (DCE) on trees.  This flag is enabled by
4366 default at -O and higher.
4368 @item -ftree-dominator-opts
4369 Perform dead code elimination (DCE) on trees.  This flag is enabled by
4370 default at -O and higher.
4372 @item -ftree-ch
4373 Perform loop header copying on trees.  This is beneficial since it increases
4374 effectivity of code motion optimizations.  It also saves one jump.  This flag
4375 is enabled by default at -O and higher.  It is not enabled for -Os, since it
4376 usually increases code size.
4378 @item -ftree-sra
4379 Perform scalar replacement of aggregates.  This pass replaces structure
4380 references with scalars to prevent committing structures to memory too
4381 early.  This flag is enabled by default at -O and higher.
4383 @item -ftree-copyrename
4384 Perform copy renaming on trees.  This pass attempts to rename compiler
4385 temporaries to other variables at copy locations, usually resulting in
4386 variable names which more closely resemble the original variables.  This flag
4387 is enabled by default at -O and higher.
4389 @item -ftree-ter
4390 Perform temporary expression replacement during the SSA->normal phase.  Single
4391 use/single def temporaries are replaced at their use location with their
4392 defining expression.  This results in non-GIMPLE code, but gives the expanders
4393 much more complex trees to work on resulting in better RTL generation.  This is
4394 enabled by default at -O and higher.
4396 @item -ftree-lrs
4397 Perform live range splitting during the SSA->normal phase.  Distinct live
4398 ranges of a variable are split into unique variables, allowing for better
4399 optimization later.  This is enabled by default at -O and higher.
4401 @item -ftracer
4402 @opindex ftracer
4403 Perform tail duplication to enlarge superblock size. This transformation
4404 simplifies the control flow of the function allowing other optimizations to do
4405 better job.
4407 @item -funroll-loops
4408 @opindex funroll-loops
4409 Unroll loops whose number of iterations can be determined at compile
4410 time or upon entry to the loop.  @option{-funroll-loops} implies both
4411 @option{-fstrength-reduce} and @option{-frerun-cse-after-loop}.  This
4412 option makes code larger, and may or may not make it run faster.
4414 @item -funroll-all-loops
4415 @opindex funroll-all-loops
4416 Unroll all loops, even if their number of iterations is uncertain when
4417 the loop is entered.  This usually makes programs run more slowly.
4418 @option{-funroll-all-loops} implies the same options as
4419 @option{-funroll-loops},
4421 @item -fprefetch-loop-arrays
4422 @opindex fprefetch-loop-arrays
4423 If supported by the target machine, generate instructions to prefetch
4424 memory to improve the performance of loops that access large arrays.
4426 @item -fmove-all-movables
4427 @opindex fmove-all-movables
4428 Forces all invariant computations in loops to be moved
4429 outside the loop.
4431 @item -freduce-all-givs
4432 @opindex freduce-all-givs
4433 Forces all general-induction variables in loops to be
4434 strength-reduced.
4436 @emph{Note:} When compiling programs written in Fortran,
4437 @option{-fmove-all-movables} and @option{-freduce-all-givs} are enabled
4438 by default when you use the optimizer.
4440 These options may generate better or worse code; results are highly
4441 dependent on the structure of loops within the source code.
4443 These two options are intended to be removed someday, once
4444 they have helped determine the efficacy of various
4445 approaches to improving loop optimizations.
4447 Please let us (@w{@email{gcc@@gcc.gnu.org}} and @w{@email{fortran@@gnu.org}})
4448 know how use of these options affects
4449 the performance of your production code.
4450 We're very interested in code that runs @emph{slower}
4451 when these options are @emph{enabled}.
4453 @item -fno-peephole
4454 @itemx -fno-peephole2
4455 @opindex fno-peephole
4456 @opindex fno-peephole2
4457 Disable any machine-specific peephole optimizations.  The difference
4458 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
4459 are implemented in the compiler; some targets use one, some use the
4460 other, a few use both.
4462 @option{-fpeephole} is enabled by default.
4463 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4465 @item -fno-guess-branch-probability
4466 @opindex fno-guess-branch-probability
4467 Do not guess branch probabilities using a randomized model.
4469 Sometimes GCC will opt to use a randomized model to guess branch
4470 probabilities, when none are available from either profiling feedback
4471 (@option{-fprofile-arcs}) or @samp{__builtin_expect}.  This means that
4472 different runs of the compiler on the same program may produce different
4473 object code.
4475 In a hard real-time system, people don't want different runs of the
4476 compiler to produce code that has different behavior; minimizing
4477 non-determinism is of paramount import.  This switch allows users to
4478 reduce non-determinism, possibly at the expense of inferior
4479 optimization.
4481 The default is @option{-fguess-branch-probability} at levels
4482 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4484 @item -freorder-blocks
4485 @opindex freorder-blocks
4486 Reorder basic blocks in the compiled function in order to reduce number of
4487 taken branches and improve code locality.
4489 Enabled at levels @option{-O2}, @option{-O3}.
4491 @item -freorder-blocks-and-partition
4492 @opindex freorder-blocks-and-partition
4493 In addition to reordering basic blocks in the compiled function, in order
4494 to reduce number of taken branches, partitions hot and cold basic blocks
4495 into separate sections of the assembly and .o files, to improve
4496 paging and cache locality performance.
4498 @item -freorder-functions
4499 @opindex freorder-functions
4500 Reorder basic blocks in the compiled function in order to reduce number of
4501 taken branches and improve code locality. This is implemented by using special
4502 subsections @code{.text.hot} for most frequently executed functions and
4503 @code{.text.unlikely} for unlikely executed functions.  Reordering is done by
4504 the linker so object file format must support named sections and linker must
4505 place them in a reasonable way.
4507 Also profile feedback must be available in to make this option effective.  See
4508 @option{-fprofile-arcs} for details.
4510 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4512 @item -fstrict-aliasing
4513 @opindex fstrict-aliasing
4514 Allows the compiler to assume the strictest aliasing rules applicable to
4515 the language being compiled.  For C (and C++), this activates
4516 optimizations based on the type of expressions.  In particular, an
4517 object of one type is assumed never to reside at the same address as an
4518 object of a different type, unless the types are almost the same.  For
4519 example, an @code{unsigned int} can alias an @code{int}, but not a
4520 @code{void*} or a @code{double}.  A character type may alias any other
4521 type.
4523 Pay special attention to code like this:
4524 @smallexample
4525 union a_union @{
4526   int i;
4527   double d;
4530 int f() @{
4531   a_union t;
4532   t.d = 3.0;
4533   return t.i;
4535 @end smallexample
4536 The practice of reading from a different union member than the one most
4537 recently written to (called ``type-punning'') is common.  Even with
4538 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
4539 is accessed through the union type.  So, the code above will work as
4540 expected.  However, this code might not:
4541 @smallexample
4542 int f() @{
4543   a_union t;
4544   int* ip;
4545   t.d = 3.0;
4546   ip = &t.i;
4547   return *ip;
4549 @end smallexample
4551 Every language that wishes to perform language-specific alias analysis
4552 should define a function that computes, given an @code{tree}
4553 node, an alias set for the node.  Nodes in different alias sets are not
4554 allowed to alias.  For an example, see the C front-end function
4555 @code{c_get_alias_set}.
4557 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4559 @item -falign-functions
4560 @itemx -falign-functions=@var{n}
4561 @opindex falign-functions
4562 Align the start of functions to the next power-of-two greater than
4563 @var{n}, skipping up to @var{n} bytes.  For instance,
4564 @option{-falign-functions=32} aligns functions to the next 32-byte
4565 boundary, but @option{-falign-functions=24} would align to the next
4566 32-byte boundary only if this can be done by skipping 23 bytes or less.
4568 @option{-fno-align-functions} and @option{-falign-functions=1} are
4569 equivalent and mean that functions will not be aligned.
4571 Some assemblers only support this flag when @var{n} is a power of two;
4572 in that case, it is rounded up.
4574 If @var{n} is not specified or is zero, use a machine-dependent default.
4576 Enabled at levels @option{-O2}, @option{-O3}.
4578 @item -falign-labels
4579 @itemx -falign-labels=@var{n}
4580 @opindex falign-labels
4581 Align all branch targets to a power-of-two boundary, skipping up to
4582 @var{n} bytes like @option{-falign-functions}.  This option can easily
4583 make code slower, because it must insert dummy operations for when the
4584 branch target is reached in the usual flow of the code.
4586 @option{-fno-align-labels} and @option{-falign-labels=1} are
4587 equivalent and mean that labels will not be aligned.
4589 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
4590 are greater than this value, then their values are used instead.
4592 If @var{n} is not specified or is zero, use a machine-dependent default
4593 which is very likely to be @samp{1}, meaning no alignment.
4595 Enabled at levels @option{-O2}, @option{-O3}.
4597 @item -falign-loops
4598 @itemx -falign-loops=@var{n}
4599 @opindex falign-loops
4600 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
4601 like @option{-falign-functions}.  The hope is that the loop will be
4602 executed many times, which will make up for any execution of the dummy
4603 operations.
4605 @option{-fno-align-loops} and @option{-falign-loops=1} are
4606 equivalent and mean that loops will not be aligned.
4608 If @var{n} is not specified or is zero, use a machine-dependent default.
4610 Enabled at levels @option{-O2}, @option{-O3}.
4612 @item -falign-jumps
4613 @itemx -falign-jumps=@var{n}
4614 @opindex falign-jumps
4615 Align branch targets to a power-of-two boundary, for branch targets
4616 where the targets can only be reached by jumping, skipping up to @var{n}
4617 bytes like @option{-falign-functions}.  In this case, no dummy operations
4618 need be executed.
4620 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
4621 equivalent and mean that loops will not be aligned.
4623 If @var{n} is not specified or is zero, use a machine-dependent default.
4625 Enabled at levels @option{-O2}, @option{-O3}.
4627 @item -funit-at-a-time
4628 @opindex funit-at-a-time
4629 Parse the whole compilation unit before starting to produce code.
4630 This allows some extra optimizations to take place but consumes
4631 more memory (in general).  There are some compatibility issues
4632 with @emph{unit-at-at-time} mode:
4633 @itemize @bullet
4634 @item
4635 enabling @emph{unit-at-a-time} mode may change the order
4636 in which functions, variables, and top-level @code{asm} statements
4637 are emitted, and will likely break code relying on some particular
4638 ordering.  The majority of such top-level @code{asm} statements,
4639 though, can be replaced by @code{section} attributes.
4641 @item
4642 @emph{unit-at-a-time} mode removes unreferenced static variables
4643 and functions are removed.  This may result in undefined references
4644 when an @code{asm} statement refers directly to variables or functions
4645 that are otherwise unused.  In that case either the variable/function
4646 shall be listed as an operand of the @code{asm} statement operand or,
4647 in the case of top-level @code{asm} statements the attribute @code{used}
4648 shall be used on the declaration.
4650 @item
4651 Static functions now can use non-standard passing conventions that
4652 may break @code{asm} statements calling functions directly. Again,
4653 attribute @code{used} will prevent this behavior.
4654 @end itemize
4656 As a temporary workaround, @option{-fno-unit-at-a-time} can be used,
4657 but this scheme may not be supported by future releases of GCC.
4659 Enabled at levels @option{-O2}, @option{-O3}.
4661 @item -fweb
4662 @opindex fweb
4663 Constructs webs as commonly used for register allocation purposes and assign
4664 each web individual pseudo register.  This allows our register allocation pass
4665 to operate on pseudos directly, but also strengthens several other optimization
4666 passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
4667 however, make debugging impossible, since variables will no longer stay in a
4668 ``home register''.
4670 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os},
4671 on targets where the default format for debugging information supports
4672 variable tracking.
4674 @item -fno-cprop-registers
4675 @opindex fno-cprop-registers
4676 After register allocation and post-register allocation instruction splitting,
4677 we perform a copy-propagation pass to try to reduce scheduling dependencies
4678 and occasionally eliminate the copy.
4680 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4682 @item -fprofile-generate
4683 @opindex fprofile-generate
4685 Enable options usually used for instrumenting application to produce
4686 profile useful for later recompilation with profile feedback based
4687 optimization.  You must use @code{-fprofile-generate} both when
4688 compiling and when linking your program.
4690 The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
4692 @item -fprofile-use
4693 @opindex fprofile-use
4694 Enable profile feedback directed optimizations, and optimizations
4695 generally profitable only with profile feedback available.
4697 The following options are enabled: @code{-fbranch-probabilities},
4698 @code{-fvpt}, @code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}.
4700 @end table
4702 The following options control compiler behavior regarding floating
4703 point arithmetic.  These options trade off between speed and
4704 correctness.  All must be specifically enabled.
4706 @table @gcctabopt
4707 @item -ffloat-store
4708 @opindex ffloat-store
4709 Do not store floating point variables in registers, and inhibit other
4710 options that might change whether a floating point value is taken from a
4711 register or memory.
4713 @cindex floating point precision
4714 This option prevents undesirable excess precision on machines such as
4715 the 68000 where the floating registers (of the 68881) keep more
4716 precision than a @code{double} is supposed to have.  Similarly for the
4717 x86 architecture.  For most programs, the excess precision does only
4718 good, but a few programs rely on the precise definition of IEEE floating
4719 point.  Use @option{-ffloat-store} for such programs, after modifying
4720 them to store all pertinent intermediate computations into variables.
4722 @item -ffast-math
4723 @opindex ffast-math
4724 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @*
4725 @option{-fno-trapping-math}, @option{-ffinite-math-only},
4726 @option{-fno-rounding-math} and @option{-fno-signaling-nans}.
4728 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
4730 This option should never be turned on by any @option{-O} option since
4731 it can result in incorrect output for programs which depend on
4732 an exact implementation of IEEE or ISO rules/specifications for
4733 math functions.
4735 @item -fno-math-errno
4736 @opindex fno-math-errno
4737 Do not set ERRNO after calling math functions that are executed
4738 with a single instruction, e.g., sqrt.  A program that relies on
4739 IEEE exceptions for math error handling may want to use this flag
4740 for speed while maintaining IEEE arithmetic compatibility.
4742 This option should never be turned on by any @option{-O} option since
4743 it can result in incorrect output for programs which depend on
4744 an exact implementation of IEEE or ISO rules/specifications for
4745 math functions.
4747 The default is @option{-fmath-errno}.
4749 @item -funsafe-math-optimizations
4750 @opindex funsafe-math-optimizations
4751 Allow optimizations for floating-point arithmetic that (a) assume
4752 that arguments and results are valid and (b) may violate IEEE or
4753 ANSI standards.  When used at link-time, it may include libraries
4754 or startup files that change the default FPU control word or other
4755 similar optimizations.
4757 This option should never be turned on by any @option{-O} option since
4758 it can result in incorrect output for programs which depend on
4759 an exact implementation of IEEE or ISO rules/specifications for
4760 math functions.
4762 The default is @option{-fno-unsafe-math-optimizations}.
4764 @item -ffinite-math-only
4765 @opindex ffinite-math-only
4766 Allow optimizations for floating-point arithmetic that assume
4767 that arguments and results are not NaNs or +-Infs.
4769 This option should never be turned on by any @option{-O} option since
4770 it can result in incorrect output for programs which depend on
4771 an exact implementation of IEEE or ISO rules/specifications.
4773 The default is @option{-fno-finite-math-only}.
4775 @item -fno-trapping-math
4776 @opindex fno-trapping-math
4777 Compile code assuming that floating-point operations cannot generate
4778 user-visible traps.  These traps include division by zero, overflow,
4779 underflow, inexact result and invalid operation.  This option implies
4780 @option{-fno-signaling-nans}.  Setting this option may allow faster
4781 code if one relies on ``non-stop'' IEEE arithmetic, for example.
4783 This option should never be turned on by any @option{-O} option since
4784 it can result in incorrect output for programs which depend on
4785 an exact implementation of IEEE or ISO rules/specifications for
4786 math functions.
4788 The default is @option{-ftrapping-math}.
4790 @item -frounding-math
4791 @opindex frounding-math
4792 Disable transformations and optimizations that assume default floating
4793 point rounding behavior.  This is round-to-zero for all floating point
4794 to integer conversions, and round-to-nearest for all other arithmetic
4795 truncations.  This option should be specified for programs that change
4796 the FP rounding mode dynamically, or that may be executed with a
4797 non-default rounding mode.  This option disables constant folding of
4798 floating point expressions at compile-time (which may be affected by
4799 rounding mode) and arithmetic transformations that are unsafe in the
4800 presence of sign-dependent rounding modes.
4802 The default is @option{-fno-rounding-math}.
4804 This option is experimental and does not currently guarantee to
4805 disable all GCC optimizations that are affected by rounding mode.
4806 Future versions of GCC may provide finer control of this setting
4807 using C99's @code{FENV_ACCESS} pragma.  This command line option
4808 will be used to specify the default state for @code{FENV_ACCESS}.
4810 @item -fsignaling-nans
4811 @opindex fsignaling-nans
4812 Compile code assuming that IEEE signaling NaNs may generate user-visible
4813 traps during floating-point operations.  Setting this option disables
4814 optimizations that may change the number of exceptions visible with
4815 signaling NaNs.  This option implies @option{-ftrapping-math}.
4817 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
4818 be defined.
4820 The default is @option{-fno-signaling-nans}.
4822 This option is experimental and does not currently guarantee to
4823 disable all GCC optimizations that affect signaling NaN behavior.
4825 @item -fsingle-precision-constant
4826 @opindex fsingle-precision-constant
4827 Treat floating point constant as single precision constant instead of
4828 implicitly converting it to double precision constant.
4831 @end table
4833 The following options control optimizations that may improve
4834 performance, but are not enabled by any @option{-O} options.  This
4835 section includes experimental options that may produce broken code.
4837 @table @gcctabopt
4838 @item -fbranch-probabilities
4839 @opindex fbranch-probabilities
4840 After running a program compiled with @option{-fprofile-arcs}
4841 (@pxref{Debugging Options,, Options for Debugging Your Program or
4842 @command{gcc}}), you can compile it a second time using
4843 @option{-fbranch-probabilities}, to improve optimizations based on
4844 the number of times each branch was taken.  When the program
4845 compiled with @option{-fprofile-arcs} exits it saves arc execution
4846 counts to a file called @file{@var{sourcename}.gcda} for each source
4847 file  The information in this data file is very dependent on the
4848 structure of the generated code, so you must use the same source code
4849 and the same optimization options for both compilations.
4851 With @option{-fbranch-probabilities}, GCC puts a
4852 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
4853 These can be used to improve optimization.  Currently, they are only
4854 used in one place: in @file{reorg.c}, instead of guessing which path a
4855 branch is mostly to take, the @samp{REG_BR_PROB} values are used to
4856 exactly determine which path is taken more often.
4858 @item -fprofile-values
4859 @opindex fprofile-values
4860 If combined with @option{-fprofile-arcs}, it adds code so that some
4861 data about values of expressions in the program is gathered.
4863 With @option{-fbranch-probabilities}, it reads back the data gathered
4864 from profiling values of expressions and adds @samp{REG_VALUE_PROFILE}
4865 notes to instructions for their later usage in optimizations.
4867 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
4869 @item -fvpt
4870 @opindex fvpt
4871 If combined with @option{-fprofile-arcs}, it instructs the compiler to add
4872 a code to gather information about values of expressions.
4874 With @option{-fbranch-probabilities}, it reads back the data gathered
4875 and actually performs the optimizations based on them.
4876 Currently the optimizations include specialization of division operation
4877 using the knowledge about the value of the denominator.
4879 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
4881 @item -frename-registers
4882 @opindex frename-registers
4883 Attempt to avoid false dependencies in scheduled code by making use
4884 of registers left over after register allocation.  This optimization
4885 will most benefit processors with lots of registers.  Depending on the
4886 debug information format adopted by the target, however, it can
4887 make debugging impossible, since variables will no longer stay in
4888 a ``home register''.
4890 Not enabled by default at any level because it has known bugs.
4892 @item -fnew-ra
4893 @opindex fnew-ra
4894 Use a graph coloring register allocator.  Currently this option is meant
4895 for testing, so we are interested to hear about miscompilations with
4896 @option{-fnew-ra}.
4898 @item -ftracer
4899 @opindex ftracer
4900 Perform tail duplication to enlarge superblock size. This transformation
4901 simplifies the control flow of the function allowing other optimizations to do
4902 better job.
4904 Enabled with @option{-fprofile-use}.
4906 @item -funroll-loops
4907 @opindex funroll-loops
4908 Unroll loops whose number of iterations can be determined at compile time or
4909 upon entry to the loop.  @option{-funroll-loops} implies
4910 @option{-frerun-cse-after-loop}.  It also turns on complete loop peeling
4911 (i.e. complete removal of loops with small constant number of iterations).
4912 This option makes code larger, and may or may not make it run faster.
4914 Enabled with @option{-fprofile-use}.
4916 @item -funroll-all-loops
4917 @opindex funroll-all-loops
4918 Unroll all loops, even if their number of iterations is uncertain when
4919 the loop is entered.  This usually makes programs run more slowly.
4920 @option{-funroll-all-loops} implies the same options as
4921 @option{-funroll-loops}.
4923 @item -fpeel-loops
4924 @opindex fpeel-loops
4925 Peels the loops for that there is enough information that they do not
4926 roll much (from profile feedback).  It also turns on complete loop peeling
4927 (i.e. complete removal of loops with small constant number of iterations).
4929 Enabled with @option{-fprofile-use}.
4931 @item -fmove-loop-invariants
4932 @opindex fmove-loop-invariants
4933 Enables the loop invariant motion pass in the new loop optimizer.  Enabled
4934 at level @option{-O1}
4936 @item -funswitch-loops
4937 @opindex funswitch-loops
4938 Move branches with loop invariant conditions out of the loop, with duplicates
4939 of the loop on both branches (modified according to result of the condition).
4941 @item -fold-unroll-loops
4942 @opindex fold-unroll-loops
4943 Unroll loops whose number of iterations can be determined at compile
4944 time or upon entry to the loop, using the old loop unroller whose loop
4945 recognition is based on notes from frontend.  @option{-fold-unroll-loops} implies
4946 both @option{-fstrength-reduce} and @option{-frerun-cse-after-loop}.  This
4947 option makes code larger, and may or may not make it run faster.
4949 @item -fold-unroll-all-loops
4950 @opindex fold-unroll-all-loops
4951 Unroll all loops, even if their number of iterations is uncertain when
4952 the loop is entered. This is done using the old loop unroller whose loop
4953 recognition is based on notes from frontend.  This usually makes programs run more slowly.
4954 @option{-fold-unroll-all-loops} implies the same options as
4955 @option{-fold-unroll-loops}.
4957 @item -fprefetch-loop-arrays
4958 @opindex fprefetch-loop-arrays
4959 If supported by the target machine, generate instructions to prefetch
4960 memory to improve the performance of loops that access large arrays.
4962 Disabled at level @option{-Os}.
4964 @item -ffunction-sections
4965 @itemx -fdata-sections
4966 @opindex ffunction-sections
4967 @opindex fdata-sections
4968 Place each function or data item into its own section in the output
4969 file if the target supports arbitrary sections.  The name of the
4970 function or the name of the data item determines the section's name
4971 in the output file.
4973 Use these options on systems where the linker can perform optimizations
4974 to improve locality of reference in the instruction space.  Most systems
4975 using the ELF object format and SPARC processors running Solaris 2 have
4976 linkers with such optimizations.  AIX may have these optimizations in
4977 the future.
4979 Only use these options when there are significant benefits from doing
4980 so.  When you specify these options, the assembler and linker will
4981 create larger object and executable files and will also be slower.
4982 You will not be able to use @code{gprof} on all systems if you
4983 specify this option and you may have problems with debugging if
4984 you specify both this option and @option{-g}.
4986 @item -fbranch-target-load-optimize
4987 @opindex fbranch-target-load-optimize
4988 Perform branch target register load optimization before prologue / epilogue
4989 threading.
4990 The use of target registers can typically be exposed only during reload,
4991 thus hoisting loads out of loops and doing inter-block scheduling needs
4992 a separate optimization pass.
4994 @item -fbranch-target-load-optimize2
4995 @opindex fbranch-target-load-optimize2
4996 Perform branch target register load optimization after prologue / epilogue
4997 threading.
4999 @item -fbtr-bb-exclusive
5000 @opindex fbtr-bb-exclusive
5001 When performing branch target register load optimization, don't reuse
5002 branch target registers in within any basic block.
5004 @item --param @var{name}=@var{value}
5005 @opindex param
5006 In some places, GCC uses various constants to control the amount of
5007 optimization that is done.  For example, GCC will not inline functions
5008 that contain more that a certain number of instructions.  You can
5009 control some of these constants on the command-line using the
5010 @option{--param} option.
5012 The names of specific parameters, and the meaning of the values, are
5013 tied to the internals of the compiler, and are subject to change
5014 without notice in future releases.
5016 In each case, the @var{value} is an integer.  The allowable choices for
5017 @var{name} are given in the following table:
5019 @table @gcctabopt
5020 @item max-crossjump-edges
5021 The maximum number of incoming edges to consider for crossjumping.
5022 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
5023 the number of edges incoming to each block.  Increasing values mean
5024 more aggressive optimization, making the compile time increase with
5025 probably small improvement in executable size.
5027 @item max-delay-slot-insn-search
5028 The maximum number of instructions to consider when looking for an
5029 instruction to fill a delay slot.  If more than this arbitrary number of
5030 instructions is searched, the time savings from filling the delay slot
5031 will be minimal so stop searching.  Increasing values mean more
5032 aggressive optimization, making the compile time increase with probably
5033 small improvement in executable run time.
5035 @item max-delay-slot-live-search
5036 When trying to fill delay slots, the maximum number of instructions to
5037 consider when searching for a block with valid live register
5038 information.  Increasing this arbitrarily chosen value means more
5039 aggressive optimization, increasing the compile time.  This parameter
5040 should be removed when the delay slot code is rewritten to maintain the
5041 control-flow graph.
5043 @item max-gcse-memory
5044 The approximate maximum amount of memory that will be allocated in
5045 order to perform the global common subexpression elimination
5046 optimization.  If more memory than specified is required, the
5047 optimization will not be done.
5049 @item max-gcse-passes
5050 The maximum number of passes of GCSE to run.  The default is 1.
5052 @item max-pending-list-length
5053 The maximum number of pending dependencies scheduling will allow
5054 before flushing the current state and starting over.  Large functions
5055 with few branches or calls can create excessively large lists which
5056 needlessly consume memory and resources.
5058 @item max-inline-insns-single
5059 Several parameters control the tree inliner used in gcc.
5060 This number sets the maximum number of instructions (counted in GCC's
5061 internal representation) in a single function that the tree inliner
5062 will consider for inlining.  This only affects functions declared
5063 inline and methods implemented in a class declaration (C++).
5064 The default value is 500.
5066 @item max-inline-insns-auto
5067 When you use @option{-finline-functions} (included in @option{-O3}),
5068 a lot of functions that would otherwise not be considered for inlining
5069 by the compiler will be investigated.  To those functions, a different
5070 (more restrictive) limit compared to functions declared inline can
5071 be applied.
5072 The default value is 120.
5074 @item large-function-insns
5075 The limit specifying really large functions.  For functions greater than this
5076 limit inlining is constrained by @option{--param large-function-growth}.
5077 This parameter is useful primarily to avoid extreme compilation time caused by non-linear
5078 algorithms used by the backend.
5079 This parameter is ignored when @option{-funit-at-a-time} is not used.
5080 The default value is 3000.
5082 @item large-function-growth
5083 Specifies maximal growth of large function caused by inlining in percents.
5084 This parameter is ignored when @option{-funit-at-a-time} is not used.
5085 The default value is 200.
5087 @item inline-unit-growth
5088 Specifies maximal overall growth of the compilation unit caused by inlining.
5089 This parameter is ignored when @option{-funit-at-a-time} is not used.
5090 The default value is 150.
5092 @item max-inline-insns-recursive
5093 @itemx max-inline-insns-recursive-auto
5094 Specifies maximum number of instructions out-of-line copy of self recursive inline
5095 function can grow into by performing recursive inlining.
5097 For functions declared inline @option{--param max-inline-insns-recursive} is
5098 taken into acount.  For function not declared inline, recursive inlining
5099 happens only when @option{-finline-functions} (included in @option{-O3}) is
5100 enabled and @option{--param max-inline-insns-recursive-auto} is used.  The
5101 default value is 500.
5103 @item max-inline-recursive-depth
5104 @itemx max-inline-recursive-depth-auto
5105 Specifies maximum recursion depth used by the recursive inlining.
5107 For functions declared inline @option{--param max-inline-recursive-depth} is
5108 taken into acount.  For function not declared inline, recursive inlining
5109 happens only when @option{-finline-functions} (included in @option{-O3}) is
5110 enabled and @option{--param max-inline-recursive-depth-auto} is used.  The
5111 default value is 500.
5113 @item max-inline-insns-rtl
5114 For languages that use the RTL inliner (this happens at a later stage
5115 than tree inlining), you can set the maximum allowable size (counted
5116 in RTL instructions) for the RTL inliner with this parameter.
5117 The default value is 600.
5119 @item max-unrolled-insns
5120 The maximum number of instructions that a loop should have if that loop
5121 is unrolled, and if the loop is unrolled, it determines how many times
5122 the loop code is unrolled.
5124 @item max-average-unrolled-insns
5125 The maximum number of instructions biased by probabilities of their execution
5126 that a loop should have if that loop is unrolled, and if the loop is unrolled,
5127 it determines how many times the loop code is unrolled.
5129 @item max-unroll-times
5130 The maximum number of unrollings of a single loop.
5132 @item max-peeled-insns
5133 The maximum number of instructions that a loop should have if that loop
5134 is peeled, and if the loop is peeled, it determines how many times
5135 the loop code is peeled.
5137 @item max-peel-times
5138 The maximum number of peelings of a single loop.
5140 @item max-completely-peeled-insns
5141 The maximum number of insns of a completely peeled loop.
5143 @item max-completely-peel-times
5144 The maximum number of iterations of a loop to be suitable for complete peeling.
5146 @item max-unswitch-insns
5147 The maximum number of insns of an unswitched loop.
5149 @item max-unswitch-level
5150 The maximum number of branches unswitched in a single loop.
5152 @item hot-bb-count-fraction
5153 Select fraction of the maximal count of repetitions of basic block in program
5154 given basic block needs to have to be considered hot.
5156 @item hot-bb-frequency-fraction
5157 Select fraction of the maximal frequency of executions of basic block in
5158 function given basic block needs to have to be considered hot
5160 @item tracer-dynamic-coverage
5161 @itemx tracer-dynamic-coverage-feedback
5163 This value is used to limit superblock formation once the given percentage of
5164 executed instructions is covered.  This limits unnecessary code size
5165 expansion.
5167 The @option{tracer-dynamic-coverage-feedback} is used only when profile
5168 feedback is available.  The real profiles (as opposed to statically estimated
5169 ones) are much less balanced allowing the threshold to be larger value.
5171 @item tracer-max-code-growth
5172 Stop tail duplication once code growth has reached given percentage.  This is
5173 rather hokey argument, as most of the duplicates will be eliminated later in
5174 cross jumping, so it may be set to much higher values than is the desired code
5175 growth.
5177 @item tracer-min-branch-ratio
5179 Stop reverse growth when the reverse probability of best edge is less than this
5180 threshold (in percent).
5182 @item tracer-min-branch-ratio
5183 @itemx tracer-min-branch-ratio-feedback
5185 Stop forward growth if the best edge do have probability lower than this
5186 threshold.
5188 Similarly to @option{tracer-dynamic-coverage} two values are present, one for
5189 compilation for profile feedback and one for compilation without.  The value
5190 for compilation with profile feedback needs to be more conservative (higher) in
5191 order to make tracer effective.
5193 @item max-cse-path-length
5195 Maximum number of basic blocks on path that cse considers.  The default is 10.
5197 @item global-var-threshold
5199 Counts the number of function calls (N) and the number of
5200 call-clobbered variables (V).  If NxV is larger than this limit, a
5201 single artificial variable will be created to represent all the
5202 call-clobbered variables at function call sites.  This artificial
5203 variable will then be made to alias every call-clobbered variable.
5204 (done as int * size_t on the host machine; beware overflow).
5206 @item max-aliased-vops
5208 Maxiumum number of virtual operands allowed to represent aliases
5209 before triggering the alias grouping heuristic.  Alias grouping
5210 reduces compile times and memory consumption needed for aliasing at
5211 the expense of precision loss in alias information.
5213 @item ggc-min-expand
5215 GCC uses a garbage collector to manage its own memory allocation.  This
5216 parameter specifies the minimum percentage by which the garbage
5217 collector's heap should be allowed to expand between collections.
5218 Tuning this may improve compilation speed; it has no effect on code
5219 generation.
5221 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
5222 RAM >= 1GB.  If @code{getrlimit} is available, the notion of "RAM" is
5223 the smallest of actual RAM, RLIMIT_RSS, RLIMIT_DATA and RLIMIT_AS.  If
5224 GCC is not able to calculate RAM on a particular platform, the lower
5225 bound of 30% is used.  Setting this parameter and
5226 @option{ggc-min-heapsize} to zero causes a full collection to occur at
5227 every opportunity.  This is extremely slow, but can be useful for
5228 debugging.
5230 @item ggc-min-heapsize
5232 Minimum size of the garbage collector's heap before it begins bothering
5233 to collect garbage.  The first collection occurs after the heap expands
5234 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
5235 tuning this may improve compilation speed, and has no effect on code
5236 generation.
5238 The default is RAM/8, with a lower bound of 4096 (four megabytes) and an
5239 upper bound of 131072 (128 megabytes).  If @code{getrlimit} is
5240 available, the notion of "RAM" is the smallest of actual RAM,
5241 RLIMIT_RSS, RLIMIT_DATA and RLIMIT_AS.  If GCC is not able to calculate
5242 RAM on a particular platform, the lower bound is used.  Setting this
5243 parameter very large effectively disables garbage collection.  Setting
5244 this parameter and @option{ggc-min-expand} to zero causes a full
5245 collection to occur at every opportunity.
5247 @item max-reload-search-insns
5248 The maximum number of instruction reload should look backward for equivalent
5249 register.  Increasing values mean more aggressive optimization, making the
5250 compile time increase with probably slightly better performance.  The default
5251 value is 100.
5253 @item max-cselib-memory-location
5254 The maximum number of memory locations cselib should take into acount.
5255 Increasing values mean more aggressive optimization, making the compile time
5256 increase with probably slightly better performance.  The default value is 500.
5258 @item reorder-blocks-duplicate
5259 @itemx reorder-blocks-duplicate-feedback
5261 Used by basic block reordering pass to decide whether to use unconditional
5262 branch or duplicate the code on its destination.  Code is duplicated when its
5263 estimated size is smaller than this value multiplied by the estimated size of
5264 unconditional jump in the hot spots of the program.
5266 The @option{reorder-block-duplicate-feedback} is used only when profile
5267 feedback is available and may be set to higher values than
5268 @option{reorder-block-duplicate} since information about the hot spots is more
5269 accurate.
5271 @item max-sched-region-blocks
5272 The maximum number of blocks in a region to be considered for
5273 interblock scheduling.  The default value is 10.
5275 @item max-sched-region-insns
5276 The maximum number of insns in a region to be considered for
5277 interblock scheduling.  The default value is 100.
5278 @end table
5279 @end table
5281 @node Preprocessor Options
5282 @section Options Controlling the Preprocessor
5283 @cindex preprocessor options
5284 @cindex options, preprocessor
5286 These options control the C preprocessor, which is run on each C source
5287 file before actual compilation.
5289 If you use the @option{-E} option, nothing is done except preprocessing.
5290 Some of these options make sense only together with @option{-E} because
5291 they cause the preprocessor output to be unsuitable for actual
5292 compilation.
5294 @table @gcctabopt
5295 @opindex Wp
5296 You can use @option{-Wp,@var{option}} to bypass the compiler driver
5297 and pass @var{option} directly through to the preprocessor.  If
5298 @var{option} contains commas, it is split into multiple options at the
5299 commas.  However, many options are modified, translated or interpreted
5300 by the compiler driver before being passed to the preprocessor, and
5301 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
5302 interface is undocumented and subject to change, so whenever possible
5303 you should avoid using @option{-Wp} and let the driver handle the
5304 options instead.
5306 @item -Xpreprocessor @var{option}
5307 @opindex preprocessor
5308 Pass @var{option} as an option to the preprocessor.  You can use this to
5309 supply system-specific preprocessor options which GCC does not know how to
5310 recognize.
5312 If you want to pass an option that takes an argument, you must use
5313 @option{-Xpreprocessor} twice, once for the option and once for the argument.
5314 @end table
5316 @include cppopts.texi
5318 @node Assembler Options
5319 @section Passing Options to the Assembler
5321 @c prevent bad page break with this line
5322 You can pass options to the assembler.
5324 @table @gcctabopt
5325 @item -Wa,@var{option}
5326 @opindex Wa
5327 Pass @var{option} as an option to the assembler.  If @var{option}
5328 contains commas, it is split into multiple options at the commas.
5330 @item -Xassembler @var{option}
5331 @opindex Xassembler
5332 Pass @var{option} as an option to the assembler.  You can use this to
5333 supply system-specific assembler options which GCC does not know how to
5334 recognize.
5336 If you want to pass an option that takes an argument, you must use
5337 @option{-Xassembler} twice, once for the option and once for the argument.
5339 @end table
5341 @node Link Options
5342 @section Options for Linking
5343 @cindex link options
5344 @cindex options, linking
5346 These options come into play when the compiler links object files into
5347 an executable output file.  They are meaningless if the compiler is
5348 not doing a link step.
5350 @table @gcctabopt
5351 @cindex file names
5352 @item @var{object-file-name}
5353 A file name that does not end in a special recognized suffix is
5354 considered to name an object file or library.  (Object files are
5355 distinguished from libraries by the linker according to the file
5356 contents.)  If linking is done, these object files are used as input
5357 to the linker.
5359 @item -c
5360 @itemx -S
5361 @itemx -E
5362 @opindex c
5363 @opindex S
5364 @opindex E
5365 If any of these options is used, then the linker is not run, and
5366 object file names should not be used as arguments.  @xref{Overall
5367 Options}.
5369 @cindex Libraries
5370 @item -l@var{library}
5371 @itemx -l @var{library}
5372 @opindex l
5373 Search the library named @var{library} when linking.  (The second
5374 alternative with the library as a separate argument is only for
5375 POSIX compliance and is not recommended.)
5377 It makes a difference where in the command you write this option; the
5378 linker searches and processes libraries and object files in the order they
5379 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
5380 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
5381 to functions in @samp{z}, those functions may not be loaded.
5383 The linker searches a standard list of directories for the library,
5384 which is actually a file named @file{lib@var{library}.a}.  The linker
5385 then uses this file as if it had been specified precisely by name.
5387 The directories searched include several standard system directories
5388 plus any that you specify with @option{-L}.
5390 Normally the files found this way are library files---archive files
5391 whose members are object files.  The linker handles an archive file by
5392 scanning through it for members which define symbols that have so far
5393 been referenced but not defined.  But if the file that is found is an
5394 ordinary object file, it is linked in the usual fashion.  The only
5395 difference between using an @option{-l} option and specifying a file name
5396 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
5397 and searches several directories.
5399 @item -lobjc
5400 @opindex lobjc
5401 You need this special case of the @option{-l} option in order to
5402 link an Objective-C program.
5404 @item -nostartfiles
5405 @opindex nostartfiles
5406 Do not use the standard system startup files when linking.
5407 The standard system libraries are used normally, unless @option{-nostdlib}
5408 or @option{-nodefaultlibs} is used.
5410 @item -nodefaultlibs
5411 @opindex nodefaultlibs
5412 Do not use the standard system libraries when linking.
5413 Only the libraries you specify will be passed to the linker.
5414 The standard startup files are used normally, unless @option{-nostartfiles}
5415 is used.  The compiler may generate calls to memcmp, memset, and memcpy
5416 for System V (and ISO C) environments or to bcopy and bzero for
5417 BSD environments.  These entries are usually resolved by entries in
5418 libc.  These entry points should be supplied through some other
5419 mechanism when this option is specified.
5421 @item -nostdlib
5422 @opindex nostdlib
5423 Do not use the standard system startup files or libraries when linking.
5424 No startup files and only the libraries you specify will be passed to
5425 the linker.  The compiler may generate calls to memcmp, memset, and memcpy
5426 for System V (and ISO C) environments or to bcopy and bzero for
5427 BSD environments.  These entries are usually resolved by entries in
5428 libc.  These entry points should be supplied through some other
5429 mechanism when this option is specified.
5431 @cindex @option{-lgcc}, use with @option{-nostdlib}
5432 @cindex @option{-nostdlib} and unresolved references
5433 @cindex unresolved references and @option{-nostdlib}
5434 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
5435 @cindex @option{-nodefaultlibs} and unresolved references
5436 @cindex unresolved references and @option{-nodefaultlibs}
5437 One of the standard libraries bypassed by @option{-nostdlib} and
5438 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
5439 that GCC uses to overcome shortcomings of particular machines, or special
5440 needs for some languages.
5441 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
5442 Collection (GCC) Internals},
5443 for more discussion of @file{libgcc.a}.)
5444 In most cases, you need @file{libgcc.a} even when you want to avoid
5445 other standard libraries.  In other words, when you specify @option{-nostdlib}
5446 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
5447 This ensures that you have no unresolved references to internal GCC
5448 library subroutines.  (For example, @samp{__main}, used to ensure C++
5449 constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
5450 GNU Compiler Collection (GCC) Internals}.)
5452 @item -pie
5453 @opindex pie
5454 Produce a position independent executable on targets which support it.
5455 For predictable results, you must also specify the same set of options
5456 that were used to generate code (@option{-fpie}, @option{-fPIE},
5457 or model suboptions) when you specify this option.
5459 @item -s
5460 @opindex s
5461 Remove all symbol table and relocation information from the executable.
5463 @item -static
5464 @opindex static
5465 On systems that support dynamic linking, this prevents linking with the shared
5466 libraries.  On other systems, this option has no effect.
5468 @item -shared
5469 @opindex shared
5470 Produce a shared object which can then be linked with other objects to
5471 form an executable.  Not all systems support this option.  For predictable
5472 results, you must also specify the same set of options that were used to
5473 generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
5474 when you specify this option.@footnote{On some systems, @samp{gcc -shared}
5475 needs to build supplementary stub code for constructors to work.  On
5476 multi-libbed systems, @samp{gcc -shared} must select the correct support
5477 libraries to link against.  Failing to supply the correct flags may lead
5478 to subtle defects.  Supplying them in cases where they are not necessary
5479 is innocuous.}
5481 @item -shared-libgcc
5482 @itemx -static-libgcc
5483 @opindex shared-libgcc
5484 @opindex static-libgcc
5485 On systems that provide @file{libgcc} as a shared library, these options
5486 force the use of either the shared or static version respectively.
5487 If no shared version of @file{libgcc} was built when the compiler was
5488 configured, these options have no effect.
5490 There are several situations in which an application should use the
5491 shared @file{libgcc} instead of the static version.  The most common
5492 of these is when the application wishes to throw and catch exceptions
5493 across different shared libraries.  In that case, each of the libraries
5494 as well as the application itself should use the shared @file{libgcc}.
5496 Therefore, the G++ and GCJ drivers automatically add
5497 @option{-shared-libgcc} whenever you build a shared library or a main
5498 executable, because C++ and Java programs typically use exceptions, so
5499 this is the right thing to do.
5501 If, instead, you use the GCC driver to create shared libraries, you may
5502 find that they will not always be linked with the shared @file{libgcc}.
5503 If GCC finds, at its configuration time, that you have a non-GNU linker
5504 or a GNU linker that does not support option @option{--eh-frame-hdr},
5505 it will link the shared version of @file{libgcc} into shared libraries
5506 by default.  Otherwise, it will take advantage of the linker and optimize
5507 away the linking with the shared version of @file{libgcc}, linking with
5508 the static version of libgcc by default.  This allows exceptions to
5509 propagate through such shared libraries, without incurring relocation
5510 costs at library load time.
5512 However, if a library or main executable is supposed to throw or catch
5513 exceptions, you must link it using the G++ or GCJ driver, as appropriate
5514 for the languages used in the program, or using the option
5515 @option{-shared-libgcc}, such that it is linked with the shared
5516 @file{libgcc}.
5518 @item -symbolic
5519 @opindex symbolic
5520 Bind references to global symbols when building a shared object.  Warn
5521 about any unresolved references (unless overridden by the link editor
5522 option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
5523 this option.
5525 @item -Xlinker @var{option}
5526 @opindex Xlinker
5527 Pass @var{option} as an option to the linker.  You can use this to
5528 supply system-specific linker options which GCC does not know how to
5529 recognize.
5531 If you want to pass an option that takes an argument, you must use
5532 @option{-Xlinker} twice, once for the option and once for the argument.
5533 For example, to pass @option{-assert definitions}, you must write
5534 @samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
5535 @option{-Xlinker "-assert definitions"}, because this passes the entire
5536 string as a single argument, which is not what the linker expects.
5538 @item -Wl,@var{option}
5539 @opindex Wl
5540 Pass @var{option} as an option to the linker.  If @var{option} contains
5541 commas, it is split into multiple options at the commas.
5543 @item -u @var{symbol}
5544 @opindex u
5545 Pretend the symbol @var{symbol} is undefined, to force linking of
5546 library modules to define it.  You can use @option{-u} multiple times with
5547 different symbols to force loading of additional library modules.
5548 @end table
5550 @node Directory Options
5551 @section Options for Directory Search
5552 @cindex directory options
5553 @cindex options, directory search
5554 @cindex search path
5556 These options specify directories to search for header files, for
5557 libraries and for parts of the compiler:
5559 @table @gcctabopt
5560 @item -I@var{dir}
5561 @opindex I
5562 Add the directory @var{dir} to the head of the list of directories to be
5563 searched for header files.  This can be used to override a system header
5564 file, substituting your own version, since these directories are
5565 searched before the system header file directories.  However, you should
5566 not use this option to add directories that contain vendor-supplied
5567 system header files (use @option{-isystem} for that).  If you use more than
5568 one @option{-I} option, the directories are scanned in left-to-right
5569 order; the standard system directories come after.
5571 If a standard system include directory, or a directory specified with
5572 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
5573 option will be ignored.  The directory will still be searched but as a
5574 system directory at its normal position in the system include chain.
5575 This is to ensure that GCC's procedure to fix buggy system headers and
5576 the ordering for the include_next directive are not inadvertently changed.
5577 If you really need to change the search order for system directories,
5578 use the @option{-nostdinc} and/or @option{-isystem} options.
5580 @item -iquote@var{dir}
5581 @opindex iquote
5582 Add the directory @var{dir} to the head of the list of directories to
5583 be searched for header files only for the case of @samp{#include
5584 "@var{file}"}; they are not searched for @samp{#include <@var{file}>},
5585 otherwise just like @option{-I}.
5587 @item -L@var{dir}
5588 @opindex L
5589 Add directory @var{dir} to the list of directories to be searched
5590 for @option{-l}.
5592 @item -B@var{prefix}
5593 @opindex B
5594 This option specifies where to find the executables, libraries,
5595 include files, and data files of the compiler itself.
5597 The compiler driver program runs one or more of the subprograms
5598 @file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
5599 @var{prefix} as a prefix for each program it tries to run, both with and
5600 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
5602 For each subprogram to be run, the compiler driver first tries the
5603 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
5604 was not specified, the driver tries two standard prefixes, which are
5605 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
5606 those results in a file name that is found, the unmodified program
5607 name is searched for using the directories specified in your
5608 @env{PATH} environment variable.
5610 The compiler will check to see if the path provided by the @option{-B}
5611 refers to a directory, and if necessary it will add a directory
5612 separator character at the end of the path.
5614 @option{-B} prefixes that effectively specify directory names also apply
5615 to libraries in the linker, because the compiler translates these
5616 options into @option{-L} options for the linker.  They also apply to
5617 includes files in the preprocessor, because the compiler translates these
5618 options into @option{-isystem} options for the preprocessor.  In this case,
5619 the compiler appends @samp{include} to the prefix.
5621 The run-time support file @file{libgcc.a} can also be searched for using
5622 the @option{-B} prefix, if needed.  If it is not found there, the two
5623 standard prefixes above are tried, and that is all.  The file is left
5624 out of the link if it is not found by those means.
5626 Another way to specify a prefix much like the @option{-B} prefix is to use
5627 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
5628 Variables}.
5630 As a special kludge, if the path provided by @option{-B} is
5631 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
5632 9, then it will be replaced by @file{[dir/]include}.  This is to help
5633 with boot-strapping the compiler.
5635 @item -specs=@var{file}
5636 @opindex specs
5637 Process @var{file} after the compiler reads in the standard @file{specs}
5638 file, in order to override the defaults that the @file{gcc} driver
5639 program uses when determining what switches to pass to @file{cc1},
5640 @file{cc1plus}, @file{as}, @file{ld}, etc.  More than one
5641 @option{-specs=@var{file}} can be specified on the command line, and they
5642 are processed in order, from left to right.
5644 @item -I-
5645 @opindex I-
5646 This option has been deprecated.  Please use @option{-iquote} instead for
5647 @option{-I} directories before the @option{-I-} and remove the @option{-I-}.
5648 Any directories you specify with @option{-I} options before the @option{-I-}
5649 option are searched only for the case of @samp{#include "@var{file}"};
5650 they are not searched for @samp{#include <@var{file}>}.
5652 If additional directories are specified with @option{-I} options after
5653 the @option{-I-}, these directories are searched for all @samp{#include}
5654 directives.  (Ordinarily @emph{all} @option{-I} directories are used
5655 this way.)
5657 In addition, the @option{-I-} option inhibits the use of the current
5658 directory (where the current input file came from) as the first search
5659 directory for @samp{#include "@var{file}"}.  There is no way to
5660 override this effect of @option{-I-}.  With @option{-I.} you can specify
5661 searching the directory which was current when the compiler was
5662 invoked.  That is not exactly the same as what the preprocessor does
5663 by default, but it is often satisfactory.
5665 @option{-I-} does not inhibit the use of the standard system directories
5666 for header files.  Thus, @option{-I-} and @option{-nostdinc} are
5667 independent.
5668 @end table
5670 @c man end
5672 @node Spec Files
5673 @section Specifying subprocesses and the switches to pass to them
5674 @cindex Spec Files
5676 @command{gcc} is a driver program.  It performs its job by invoking a
5677 sequence of other programs to do the work of compiling, assembling and
5678 linking.  GCC interprets its command-line parameters and uses these to
5679 deduce which programs it should invoke, and which command-line options
5680 it ought to place on their command lines.  This behavior is controlled
5681 by @dfn{spec strings}.  In most cases there is one spec string for each
5682 program that GCC can invoke, but a few programs have multiple spec
5683 strings to control their behavior.  The spec strings built into GCC can
5684 be overridden by using the @option{-specs=} command-line switch to specify
5685 a spec file.
5687 @dfn{Spec files} are plaintext files that are used to construct spec
5688 strings.  They consist of a sequence of directives separated by blank
5689 lines.  The type of directive is determined by the first non-whitespace
5690 character on the line and it can be one of the following:
5692 @table @code
5693 @item %@var{command}
5694 Issues a @var{command} to the spec file processor.  The commands that can
5695 appear here are:
5697 @table @code
5698 @item %include <@var{file}>
5699 @cindex %include
5700 Search for @var{file} and insert its text at the current point in the
5701 specs file.
5703 @item %include_noerr <@var{file}>
5704 @cindex %include_noerr
5705 Just like @samp{%include}, but do not generate an error message if the include
5706 file cannot be found.
5708 @item %rename @var{old_name} @var{new_name}
5709 @cindex %rename
5710 Rename the spec string @var{old_name} to @var{new_name}.
5712 @end table
5714 @item *[@var{spec_name}]:
5715 This tells the compiler to create, override or delete the named spec
5716 string.  All lines after this directive up to the next directive or
5717 blank line are considered to be the text for the spec string.  If this
5718 results in an empty string then the spec will be deleted.  (Or, if the
5719 spec did not exist, then nothing will happened.)  Otherwise, if the spec
5720 does not currently exist a new spec will be created.  If the spec does
5721 exist then its contents will be overridden by the text of this
5722 directive, unless the first character of that text is the @samp{+}
5723 character, in which case the text will be appended to the spec.
5725 @item [@var{suffix}]:
5726 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
5727 and up to the next directive or blank line are considered to make up the
5728 spec string for the indicated suffix.  When the compiler encounters an
5729 input file with the named suffix, it will processes the spec string in
5730 order to work out how to compile that file.  For example:
5732 @smallexample
5733 .ZZ:
5734 z-compile -input %i
5735 @end smallexample
5737 This says that any input file whose name ends in @samp{.ZZ} should be
5738 passed to the program @samp{z-compile}, which should be invoked with the
5739 command-line switch @option{-input} and with the result of performing the
5740 @samp{%i} substitution.  (See below.)
5742 As an alternative to providing a spec string, the text that follows a
5743 suffix directive can be one of the following:
5745 @table @code
5746 @item @@@var{language}
5747 This says that the suffix is an alias for a known @var{language}.  This is
5748 similar to using the @option{-x} command-line switch to GCC to specify a
5749 language explicitly.  For example:
5751 @smallexample
5752 .ZZ:
5753 @@c++
5754 @end smallexample
5756 Says that .ZZ files are, in fact, C++ source files.
5758 @item #@var{name}
5759 This causes an error messages saying:
5761 @smallexample
5762 @var{name} compiler not installed on this system.
5763 @end smallexample
5764 @end table
5766 GCC already has an extensive list of suffixes built into it.
5767 This directive will add an entry to the end of the list of suffixes, but
5768 since the list is searched from the end backwards, it is effectively
5769 possible to override earlier entries using this technique.
5771 @end table
5773 GCC has the following spec strings built into it.  Spec files can
5774 override these strings or create their own.  Note that individual
5775 targets can also add their own spec strings to this list.
5777 @smallexample
5778 asm          Options to pass to the assembler
5779 asm_final    Options to pass to the assembler post-processor
5780 cpp          Options to pass to the C preprocessor
5781 cc1          Options to pass to the C compiler
5782 cc1plus      Options to pass to the C++ compiler
5783 endfile      Object files to include at the end of the link
5784 link         Options to pass to the linker
5785 lib          Libraries to include on the command line to the linker
5786 libgcc       Decides which GCC support library to pass to the linker
5787 linker       Sets the name of the linker
5788 predefines   Defines to be passed to the C preprocessor
5789 signed_char  Defines to pass to CPP to say whether @code{char} is signed
5790              by default
5791 startfile    Object files to include at the start of the link
5792 @end smallexample
5794 Here is a small example of a spec file:
5796 @smallexample
5797 %rename lib                 old_lib
5799 *lib:
5800 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
5801 @end smallexample
5803 This example renames the spec called @samp{lib} to @samp{old_lib} and
5804 then overrides the previous definition of @samp{lib} with a new one.
5805 The new definition adds in some extra command-line options before
5806 including the text of the old definition.
5808 @dfn{Spec strings} are a list of command-line options to be passed to their
5809 corresponding program.  In addition, the spec strings can contain
5810 @samp{%}-prefixed sequences to substitute variable text or to
5811 conditionally insert text into the command line.  Using these constructs
5812 it is possible to generate quite complex command lines.
5814 Here is a table of all defined @samp{%}-sequences for spec
5815 strings.  Note that spaces are not generated automatically around the
5816 results of expanding these sequences.  Therefore you can concatenate them
5817 together or combine them with constant text in a single argument.
5819 @table @code
5820 @item %%
5821 Substitute one @samp{%} into the program name or argument.
5823 @item %i
5824 Substitute the name of the input file being processed.
5826 @item %b
5827 Substitute the basename of the input file being processed.
5828 This is the substring up to (and not including) the last period
5829 and not including the directory.
5831 @item %B
5832 This is the same as @samp{%b}, but include the file suffix (text after
5833 the last period).
5835 @item %d
5836 Marks the argument containing or following the @samp{%d} as a
5837 temporary file name, so that that file will be deleted if GCC exits
5838 successfully.  Unlike @samp{%g}, this contributes no text to the
5839 argument.
5841 @item %g@var{suffix}
5842 Substitute a file name that has suffix @var{suffix} and is chosen
5843 once per compilation, and mark the argument in the same way as
5844 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
5845 name is now chosen in a way that is hard to predict even when previously
5846 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
5847 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
5848 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
5849 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
5850 was simply substituted with a file name chosen once per compilation,
5851 without regard to any appended suffix (which was therefore treated
5852 just like ordinary text), making such attacks more likely to succeed.
5854 @item %u@var{suffix}
5855 Like @samp{%g}, but generates a new temporary file name even if
5856 @samp{%u@var{suffix}} was already seen.
5858 @item %U@var{suffix}
5859 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
5860 new one if there is no such last file name.  In the absence of any
5861 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
5862 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
5863 would involve the generation of two distinct file names, one
5864 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
5865 simply substituted with a file name chosen for the previous @samp{%u},
5866 without regard to any appended suffix.
5868 @item %j@var{suffix}
5869 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
5870 writable, and if save-temps is off; otherwise, substitute the name
5871 of a temporary file, just like @samp{%u}.  This temporary file is not
5872 meant for communication between processes, but rather as a junk
5873 disposal mechanism.
5875 @item %|@var{suffix}
5876 @itemx %m@var{suffix}
5877 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
5878 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
5879 all.  These are the two most common ways to instruct a program that it
5880 should read from standard input or write to standard output.  If you
5881 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
5882 construct: see for example @file{f/lang-specs.h}.
5884 @item %.@var{SUFFIX}
5885 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
5886 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
5887 terminated by the next space or %.
5889 @item %w
5890 Marks the argument containing or following the @samp{%w} as the
5891 designated output file of this compilation.  This puts the argument
5892 into the sequence of arguments that @samp{%o} will substitute later.
5894 @item %o
5895 Substitutes the names of all the output files, with spaces
5896 automatically placed around them.  You should write spaces
5897 around the @samp{%o} as well or the results are undefined.
5898 @samp{%o} is for use in the specs for running the linker.
5899 Input files whose names have no recognized suffix are not compiled
5900 at all, but they are included among the output files, so they will
5901 be linked.
5903 @item %O
5904 Substitutes the suffix for object files.  Note that this is
5905 handled specially when it immediately follows @samp{%g, %u, or %U},
5906 because of the need for those to form complete file names.  The
5907 handling is such that @samp{%O} is treated exactly as if it had already
5908 been substituted, except that @samp{%g, %u, and %U} do not currently
5909 support additional @var{suffix} characters following @samp{%O} as they would
5910 following, for example, @samp{.o}.
5912 @item %p
5913 Substitutes the standard macro predefinitions for the
5914 current target machine.  Use this when running @code{cpp}.
5916 @item %P
5917 Like @samp{%p}, but puts @samp{__} before and after the name of each
5918 predefined macro, except for macros that start with @samp{__} or with
5919 @samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
5922 @item %I
5923 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
5924 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), and
5925 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
5926 as necessary.
5928 @item %s
5929 Current argument is the name of a library or startup file of some sort.
5930 Search for that file in a standard list of directories and substitute
5931 the full name found.
5933 @item %e@var{str}
5934 Print @var{str} as an error message.  @var{str} is terminated by a newline.
5935 Use this when inconsistent options are detected.
5937 @item %(@var{name})
5938 Substitute the contents of spec string @var{name} at this point.
5940 @item %[@var{name}]
5941 Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
5943 @item %x@{@var{option}@}
5944 Accumulate an option for @samp{%X}.
5946 @item %X
5947 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
5948 spec string.
5950 @item %Y
5951 Output the accumulated assembler options specified by @option{-Wa}.
5953 @item %Z
5954 Output the accumulated preprocessor options specified by @option{-Wp}.
5956 @item %a
5957 Process the @code{asm} spec.  This is used to compute the
5958 switches to be passed to the assembler.
5960 @item %A
5961 Process the @code{asm_final} spec.  This is a spec string for
5962 passing switches to an assembler post-processor, if such a program is
5963 needed.
5965 @item %l
5966 Process the @code{link} spec.  This is the spec for computing the
5967 command line passed to the linker.  Typically it will make use of the
5968 @samp{%L %G %S %D and %E} sequences.
5970 @item %D
5971 Dump out a @option{-L} option for each directory that GCC believes might
5972 contain startup files.  If the target supports multilibs then the
5973 current multilib directory will be prepended to each of these paths.
5975 @item %M
5976 Output the multilib directory with directory separators replaced with
5977 @samp{_}.  If multilib directories are not set, or the multilib directory is
5978 @file{.} then this option emits nothing.
5980 @item %L
5981 Process the @code{lib} spec.  This is a spec string for deciding which
5982 libraries should be included on the command line to the linker.
5984 @item %G
5985 Process the @code{libgcc} spec.  This is a spec string for deciding
5986 which GCC support library should be included on the command line to the linker.
5988 @item %S
5989 Process the @code{startfile} spec.  This is a spec for deciding which
5990 object files should be the first ones passed to the linker.  Typically
5991 this might be a file named @file{crt0.o}.
5993 @item %E
5994 Process the @code{endfile} spec.  This is a spec string that specifies
5995 the last object files that will be passed to the linker.
5997 @item %C
5998 Process the @code{cpp} spec.  This is used to construct the arguments
5999 to be passed to the C preprocessor.
6001 @item %1
6002 Process the @code{cc1} spec.  This is used to construct the options to be
6003 passed to the actual C compiler (@samp{cc1}).
6005 @item %2
6006 Process the @code{cc1plus} spec.  This is used to construct the options to be
6007 passed to the actual C++ compiler (@samp{cc1plus}).
6009 @item %*
6010 Substitute the variable part of a matched option.  See below.
6011 Note that each comma in the substituted string is replaced by
6012 a single space.
6014 @item %<@code{S}
6015 Remove all occurrences of @code{-S} from the command line.  Note---this
6016 command is position dependent.  @samp{%} commands in the spec string
6017 before this one will see @code{-S}, @samp{%} commands in the spec string
6018 after this one will not.
6020 @item %:@var{function}(@var{args})
6021 Call the named function @var{function}, passing it @var{args}.
6022 @var{args} is first processed as a nested spec string, then split
6023 into an argument vector in the usual fashion.  The function returns
6024 a string which is processed as if it had appeared literally as part
6025 of the current spec.
6027 The following built-in spec functions are provided:
6029 @table @code
6030 @item @code{if-exists}
6031 The @code{if-exists} spec function takes one argument, an absolute
6032 pathname to a file.  If the file exists, @code{if-exists} returns the
6033 pathname.  Here is a small example of its usage:
6035 @smallexample
6036 *startfile:
6037 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
6038 @end smallexample
6040 @item @code{if-exists-else}
6041 The @code{if-exists-else} spec function is similar to the @code{if-exists}
6042 spec function, except that it takes two arguments.  The first argument is
6043 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
6044 returns the pathname.  If it does not exist, it returns the second argument.
6045 This way, @code{if-exists-else} can be used to select one file or another,
6046 based on the existence of the first.  Here is a small example of its usage:
6048 @smallexample
6049 *startfile:
6050 crt0%O%s %:if-exists(crti%O%s) \
6051 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
6052 @end smallexample
6053 @end table
6055 @item %@{@code{S}@}
6056 Substitutes the @code{-S} switch, if that switch was given to GCC@.
6057 If that switch was not specified, this substitutes nothing.  Note that
6058 the leading dash is omitted when specifying this option, and it is
6059 automatically inserted if the substitution is performed.  Thus the spec
6060 string @samp{%@{foo@}} would match the command-line option @option{-foo}
6061 and would output the command line option @option{-foo}.
6063 @item %W@{@code{S}@}
6064 Like %@{@code{S}@} but mark last argument supplied within as a file to be
6065 deleted on failure.
6067 @item %@{@code{S}*@}
6068 Substitutes all the switches specified to GCC whose names start
6069 with @code{-S}, but which also take an argument.  This is used for
6070 switches like @option{-o}, @option{-D}, @option{-I}, etc.
6071 GCC considers @option{-o foo} as being
6072 one switch whose names starts with @samp{o}.  %@{o*@} would substitute this
6073 text, including the space.  Thus two arguments would be generated.
6075 @item %@{@code{S}*&@code{T}*@}
6076 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
6077 (the order of @code{S} and @code{T} in the spec is not significant).
6078 There can be any number of ampersand-separated variables; for each the
6079 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
6081 @item %@{@code{S}:@code{X}@}
6082 Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
6084 @item %@{!@code{S}:@code{X}@}
6085 Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
6087 @item %@{@code{S}*:@code{X}@}
6088 Substitutes @code{X} if one or more switches whose names start with
6089 @code{-S} are specified to GCC@.  Normally @code{X} is substituted only
6090 once, no matter how many such switches appeared.  However, if @code{%*}
6091 appears somewhere in @code{X}, then @code{X} will be substituted once
6092 for each matching switch, with the @code{%*} replaced by the part of
6093 that switch that matched the @code{*}.
6095 @item %@{.@code{S}:@code{X}@}
6096 Substitutes @code{X}, if processing a file with suffix @code{S}.
6098 @item %@{!.@code{S}:@code{X}@}
6099 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
6101 @item %@{@code{S}|@code{P}:@code{X}@}
6102 Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@.
6103 This may be combined with @samp{!}, @samp{.}, and @code{*} sequences as well,
6104 although they have a stronger binding than the @samp{|}.  If @code{%*}
6105 appears in @code{X}, all of the alternatives must be starred, and only
6106 the first matching alternative is substituted.
6108 For example, a spec string like this:
6110 @smallexample
6111 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
6112 @end smallexample
6114 will output the following command-line options from the following input
6115 command-line options:
6117 @smallexample
6118 fred.c        -foo -baz
6119 jim.d         -bar -boggle
6120 -d fred.c     -foo -baz -boggle
6121 -d jim.d      -bar -baz -boggle
6122 @end smallexample
6124 @item %@{S:X; T:Y; :D@}
6126 If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
6127 given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
6128 be as many clauses as you need.  This may be combined with @code{.},
6129 @code{!}, @code{|}, and @code{*} as needed.
6132 @end table
6134 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
6135 construct may contain other nested @samp{%} constructs or spaces, or
6136 even newlines.  They are processed as usual, as described above.
6137 Trailing white space in @code{X} is ignored.  White space may also
6138 appear anywhere on the left side of the colon in these constructs,
6139 except between @code{.} or @code{*} and the corresponding word.
6141 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
6142 handled specifically in these constructs.  If another value of
6143 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
6144 @option{-W} switch is found later in the command line, the earlier
6145 switch value is ignored, except with @{@code{S}*@} where @code{S} is
6146 just one letter, which passes all matching options.
6148 The character @samp{|} at the beginning of the predicate text is used to
6149 indicate that a command should be piped to the following command, but
6150 only if @option{-pipe} is specified.
6152 It is built into GCC which switches take arguments and which do not.
6153 (You might think it would be useful to generalize this to allow each
6154 compiler's spec to say which switches take arguments.  But this cannot
6155 be done in a consistent fashion.  GCC cannot even decide which input
6156 files have been specified without knowing which switches take arguments,
6157 and it must know which input files to compile in order to tell which
6158 compilers to run).
6160 GCC also knows implicitly that arguments starting in @option{-l} are to be
6161 treated as compiler output files, and passed to the linker in their
6162 proper position among the other output files.
6164 @c man begin OPTIONS
6166 @node Target Options
6167 @section Specifying Target Machine and Compiler Version
6168 @cindex target options
6169 @cindex cross compiling
6170 @cindex specifying machine version
6171 @cindex specifying compiler version and target machine
6172 @cindex compiler version, specifying
6173 @cindex target machine, specifying
6175 The usual way to run GCC is to run the executable called @file{gcc}, or
6176 @file{<machine>-gcc} when cross-compiling, or
6177 @file{<machine>-gcc-<version>} to run a version other than the one that
6178 was installed last.  Sometimes this is inconvenient, so GCC provides
6179 options that will switch to another cross-compiler or version.
6181 @table @gcctabopt
6182 @item -b @var{machine}
6183 @opindex b
6184 The argument @var{machine} specifies the target machine for compilation.
6186 The value to use for @var{machine} is the same as was specified as the
6187 machine type when configuring GCC as a cross-compiler.  For
6188 example, if a cross-compiler was configured with @samp{configure
6189 i386v}, meaning to compile for an 80386 running System V, then you
6190 would specify @option{-b i386v} to run that cross compiler.
6192 @item -V @var{version}
6193 @opindex V
6194 The argument @var{version} specifies which version of GCC to run.
6195 This is useful when multiple versions are installed.  For example,
6196 @var{version} might be @samp{2.0}, meaning to run GCC version 2.0.
6197 @end table
6199 The @option{-V} and @option{-b} options work by running the
6200 @file{<machine>-gcc-<version>} executable, so there's no real reason to
6201 use them if you can just run that directly.
6203 @node Submodel Options
6204 @section Hardware Models and Configurations
6205 @cindex submodel options
6206 @cindex specifying hardware config
6207 @cindex hardware models and configurations, specifying
6208 @cindex machine dependent options
6210 Earlier we discussed the standard option @option{-b} which chooses among
6211 different installed compilers for completely different target
6212 machines, such as VAX vs.@: 68000 vs.@: 80386.
6214 In addition, each of these target machine types can have its own
6215 special options, starting with @samp{-m}, to choose among various
6216 hardware models or configurations---for example, 68010 vs 68020,
6217 floating coprocessor or none.  A single installed version of the
6218 compiler can compile for any model or configuration, according to the
6219 options specified.
6221 Some configurations of the compiler also support additional special
6222 options, usually for compatibility with other compilers on the same
6223 platform.
6225 These options are defined by the macro @code{TARGET_SWITCHES} in the
6226 machine description.  The default for the options is also defined by
6227 that macro, which enables you to change the defaults.
6229 @menu
6230 * M680x0 Options::
6231 * M68hc1x Options::
6232 * VAX Options::
6233 * SPARC Options::
6234 * ARM Options::
6235 * MN10300 Options::
6236 * M32R/D Options::
6237 * RS/6000 and PowerPC Options::
6238 * Darwin Options::
6239 * MIPS Options::
6240 * i386 and x86-64 Options::
6241 * HPPA Options::
6242 * DEC Alpha Options::
6243 * DEC Alpha/VMS Options::
6244 * H8/300 Options::
6245 * SH Options::
6246 * System V Options::
6247 * TMS320C3x/C4x Options::
6248 * V850 Options::
6249 * ARC Options::
6250 * NS32K Options::
6251 * AVR Options::
6252 * MCore Options::
6253 * IA-64 Options::
6254 * S/390 and zSeries Options::
6255 * CRIS Options::
6256 * MMIX Options::
6257 * PDP-11 Options::
6258 * Xstormy16 Options::
6259 * Xtensa Options::
6260 * FRV Options::
6261 @end menu
6263 @node M680x0 Options
6264 @subsection M680x0 Options
6265 @cindex M680x0 options
6267 These are the @samp{-m} options defined for the 68000 series.  The default
6268 values for these options depends on which style of 68000 was selected when
6269 the compiler was configured; the defaults for the most common choices are
6270 given below.
6272 @table @gcctabopt
6273 @item -m68000
6274 @itemx -mc68000
6275 @opindex m68000
6276 @opindex mc68000
6277 Generate output for a 68000.  This is the default
6278 when the compiler is configured for 68000-based systems.
6280 Use this option for microcontrollers with a 68000 or EC000 core,
6281 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
6283 @item -m68020
6284 @itemx -mc68020
6285 @opindex m68020
6286 @opindex mc68020
6287 Generate output for a 68020.  This is the default
6288 when the compiler is configured for 68020-based systems.
6290 @item -m68881
6291 @opindex m68881
6292 Generate output containing 68881 instructions for floating point.
6293 This is the default for most 68020 systems unless @option{--nfp} was
6294 specified when the compiler was configured.
6296 @item -m68030
6297 @opindex m68030
6298 Generate output for a 68030.  This is the default when the compiler is
6299 configured for 68030-based systems.
6301 @item -m68040
6302 @opindex m68040
6303 Generate output for a 68040.  This is the default when the compiler is
6304 configured for 68040-based systems.
6306 This option inhibits the use of 68881/68882 instructions that have to be
6307 emulated by software on the 68040.  Use this option if your 68040 does not
6308 have code to emulate those instructions.
6310 @item -m68060
6311 @opindex m68060
6312 Generate output for a 68060.  This is the default when the compiler is
6313 configured for 68060-based systems.
6315 This option inhibits the use of 68020 and 68881/68882 instructions that
6316 have to be emulated by software on the 68060.  Use this option if your 68060
6317 does not have code to emulate those instructions.
6319 @item -mcpu32
6320 @opindex mcpu32
6321 Generate output for a CPU32.  This is the default
6322 when the compiler is configured for CPU32-based systems.
6324 Use this option for microcontrollers with a
6325 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
6326 68336, 68340, 68341, 68349 and 68360.
6328 @item -m5200
6329 @opindex m5200
6330 Generate output for a 520X ``coldfire'' family cpu.  This is the default
6331 when the compiler is configured for 520X-based systems.
6333 Use this option for microcontroller with a 5200 core, including
6334 the MCF5202, MCF5203, MCF5204 and MCF5202.
6337 @item -m68020-40
6338 @opindex m68020-40
6339 Generate output for a 68040, without using any of the new instructions.
6340 This results in code which can run relatively efficiently on either a
6341 68020/68881 or a 68030 or a 68040.  The generated code does use the
6342 68881 instructions that are emulated on the 68040.
6344 @item -m68020-60
6345 @opindex m68020-60
6346 Generate output for a 68060, without using any of the new instructions.
6347 This results in code which can run relatively efficiently on either a
6348 68020/68881 or a 68030 or a 68040.  The generated code does use the
6349 68881 instructions that are emulated on the 68060.
6351 @item -msoft-float
6352 @opindex msoft-float
6353 Generate output containing library calls for floating point.
6354 @strong{Warning:} the requisite libraries are not available for all m68k
6355 targets.  Normally the facilities of the machine's usual C compiler are
6356 used, but this can't be done directly in cross-compilation.  You must
6357 make your own arrangements to provide suitable library functions for
6358 cross-compilation.  The embedded targets @samp{m68k-*-aout} and
6359 @samp{m68k-*-coff} do provide software floating point support.
6361 @item -mshort
6362 @opindex mshort
6363 Consider type @code{int} to be 16 bits wide, like @code{short int}.
6364 Additionally, parameters passed on the stack are also aligned to a
6365 16-bit boundary even on targets whose API mandates promotion to 32-bit.
6367 @item -mnobitfield
6368 @opindex mnobitfield
6369 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
6370 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
6372 @item -mbitfield
6373 @opindex mbitfield
6374 Do use the bit-field instructions.  The @option{-m68020} option implies
6375 @option{-mbitfield}.  This is the default if you use a configuration
6376 designed for a 68020.
6378 @item -mrtd
6379 @opindex mrtd
6380 Use a different function-calling convention, in which functions
6381 that take a fixed number of arguments return with the @code{rtd}
6382 instruction, which pops their arguments while returning.  This
6383 saves one instruction in the caller since there is no need to pop
6384 the arguments there.
6386 This calling convention is incompatible with the one normally
6387 used on Unix, so you cannot use it if you need to call libraries
6388 compiled with the Unix compiler.
6390 Also, you must provide function prototypes for all functions that
6391 take variable numbers of arguments (including @code{printf});
6392 otherwise incorrect code will be generated for calls to those
6393 functions.
6395 In addition, seriously incorrect code will result if you call a
6396 function with too many arguments.  (Normally, extra arguments are
6397 harmlessly ignored.)
6399 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
6400 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
6402 @item -malign-int
6403 @itemx -mno-align-int
6404 @opindex malign-int
6405 @opindex mno-align-int
6406 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
6407 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
6408 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
6409 Aligning variables on 32-bit boundaries produces code that runs somewhat
6410 faster on processors with 32-bit busses at the expense of more memory.
6412 @strong{Warning:} if you use the @option{-malign-int} switch, GCC will
6413 align structures containing the above types  differently than
6414 most published application binary interface specifications for the m68k.
6416 @item -mpcrel
6417 @opindex mpcrel
6418 Use the pc-relative addressing mode of the 68000 directly, instead of
6419 using a global offset table.  At present, this option implies @option{-fpic},
6420 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
6421 not presently supported with @option{-mpcrel}, though this could be supported for
6422 68020 and higher processors.
6424 @item -mno-strict-align
6425 @itemx -mstrict-align
6426 @opindex mno-strict-align
6427 @opindex mstrict-align
6428 Do not (do) assume that unaligned memory references will be handled by
6429 the system.
6431 @item -msep-data
6432 Generate code that allows the data segment to be located in a different
6433 area of memory from the text segment.  This allows for execute in place in
6434 an environment without virtual memory management.  This option implies -fPIC.
6436 @item -mno-sep-data
6437 Generate code that assumes that the data segment follows the text segment.
6438 This is the default.
6440 @item -mid-shared-library
6441 Generate code that supports shared libraries via the library ID method.
6442 This allows for execute in place and shared libraries in an environment
6443 without virtual memory management.  This option implies -fPIC.
6445 @item -mno-id-shared-library
6446 Generate code that doesn't assume ID based shared libraries are being used.
6447 This is the default.
6449 @item -mshared-library-id=n
6450 Specified the identification number of the ID based shared library being
6451 compiled.  Specifying a value of 0 will generate more compact code, specifying
6452 other values will force the allocation of that number to the current
6453 library but is no more space or time efficient than omitting this option.
6455 @end table
6457 @node M68hc1x Options
6458 @subsection M68hc1x Options
6459 @cindex M68hc1x options
6461 These are the @samp{-m} options defined for the 68hc11 and 68hc12
6462 microcontrollers.  The default values for these options depends on
6463 which style of microcontroller was selected when the compiler was configured;
6464 the defaults for the most common choices are given below.
6466 @table @gcctabopt
6467 @item -m6811
6468 @itemx -m68hc11
6469 @opindex m6811
6470 @opindex m68hc11
6471 Generate output for a 68HC11.  This is the default
6472 when the compiler is configured for 68HC11-based systems.
6474 @item -m6812
6475 @itemx -m68hc12
6476 @opindex m6812
6477 @opindex m68hc12
6478 Generate output for a 68HC12.  This is the default
6479 when the compiler is configured for 68HC12-based systems.
6481 @item -m68S12
6482 @itemx -m68hcs12
6483 @opindex m68S12
6484 @opindex m68hcs12
6485 Generate output for a 68HCS12.
6487 @item -mauto-incdec
6488 @opindex mauto-incdec
6489 Enable the use of 68HC12 pre and post auto-increment and auto-decrement
6490 addressing modes.
6492 @item -minmax
6493 @itemx -nominmax
6494 @opindex minmax
6495 @opindex mnominmax
6496 Enable the use of 68HC12 min and max instructions.
6498 @item -mlong-calls
6499 @itemx -mno-long-calls
6500 @opindex mlong-calls
6501 @opindex mno-long-calls
6502 Treat all calls as being far away (near).  If calls are assumed to be
6503 far away, the compiler will use the @code{call} instruction to
6504 call a function and the @code{rtc} instruction for returning.
6506 @item -mshort
6507 @opindex mshort
6508 Consider type @code{int} to be 16 bits wide, like @code{short int}.
6510 @item -msoft-reg-count=@var{count}
6511 @opindex msoft-reg-count
6512 Specify the number of pseudo-soft registers which are used for the
6513 code generation.  The maximum number is 32.  Using more pseudo-soft
6514 register may or may not result in better code depending on the program.
6515 The default is 4 for 68HC11 and 2 for 68HC12.
6517 @end table
6519 @node VAX Options
6520 @subsection VAX Options
6521 @cindex VAX options
6523 These @samp{-m} options are defined for the VAX:
6525 @table @gcctabopt
6526 @item -munix
6527 @opindex munix
6528 Do not output certain jump instructions (@code{aobleq} and so on)
6529 that the Unix assembler for the VAX cannot handle across long
6530 ranges.
6532 @item -mgnu
6533 @opindex mgnu
6534 Do output those jump instructions, on the assumption that you
6535 will assemble with the GNU assembler.
6537 @item -mg
6538 @opindex mg
6539 Output code for g-format floating point numbers instead of d-format.
6540 @end table
6542 @node SPARC Options
6543 @subsection SPARC Options
6544 @cindex SPARC options
6546 These @samp{-m} options are supported on the SPARC:
6548 @table @gcctabopt
6549 @item -mno-app-regs
6550 @itemx -mapp-regs
6551 @opindex mno-app-regs
6552 @opindex mapp-regs
6553 Specify @option{-mapp-regs} to generate output using the global registers
6554 2 through 4, which the SPARC SVR4 ABI reserves for applications.  This
6555 is the default.
6557 To be fully SVR4 ABI compliant at the cost of some performance loss,
6558 specify @option{-mno-app-regs}.  You should compile libraries and system
6559 software with this option.
6561 @item -mfpu
6562 @itemx -mhard-float
6563 @opindex mfpu
6564 @opindex mhard-float
6565 Generate output containing floating point instructions.  This is the
6566 default.
6568 @item -mno-fpu
6569 @itemx -msoft-float
6570 @opindex mno-fpu
6571 @opindex msoft-float
6572 Generate output containing library calls for floating point.
6573 @strong{Warning:} the requisite libraries are not available for all SPARC
6574 targets.  Normally the facilities of the machine's usual C compiler are
6575 used, but this cannot be done directly in cross-compilation.  You must make
6576 your own arrangements to provide suitable library functions for
6577 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
6578 @samp{sparclite-*-*} do provide software floating point support.
6580 @option{-msoft-float} changes the calling convention in the output file;
6581 therefore, it is only useful if you compile @emph{all} of a program with
6582 this option.  In particular, you need to compile @file{libgcc.a}, the
6583 library that comes with GCC, with @option{-msoft-float} in order for
6584 this to work.
6586 @item -mhard-quad-float
6587 @opindex mhard-quad-float
6588 Generate output containing quad-word (long double) floating point
6589 instructions.
6591 @item -msoft-quad-float
6592 @opindex msoft-quad-float
6593 Generate output containing library calls for quad-word (long double)
6594 floating point instructions.  The functions called are those specified
6595 in the SPARC ABI@.  This is the default.
6597 As of this writing, there are no SPARC implementations that have hardware
6598 support for the quad-word floating point instructions.  They all invoke
6599 a trap handler for one of these instructions, and then the trap handler
6600 emulates the effect of the instruction.  Because of the trap handler overhead,
6601 this is much slower than calling the ABI library routines.  Thus the
6602 @option{-msoft-quad-float} option is the default.
6604 @item -mno-unaligned-doubles
6605 @itemx -munaligned-doubles
6606 @opindex mno-unaligned-doubles
6607 @opindex munaligned-doubles
6608 Assume that doubles have 8 byte alignment.  This is the default.
6610 With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
6611 alignment only if they are contained in another type, or if they have an
6612 absolute address.  Otherwise, it assumes they have 4 byte alignment.
6613 Specifying this option avoids some rare compatibility problems with code
6614 generated by other compilers.  It is not the default because it results
6615 in a performance loss, especially for floating point code.
6617 @item -mno-faster-structs
6618 @itemx -mfaster-structs
6619 @opindex mno-faster-structs
6620 @opindex mfaster-structs
6621 With @option{-mfaster-structs}, the compiler assumes that structures
6622 should have 8 byte alignment.  This enables the use of pairs of
6623 @code{ldd} and @code{std} instructions for copies in structure
6624 assignment, in place of twice as many @code{ld} and @code{st} pairs.
6625 However, the use of this changed alignment directly violates the SPARC
6626 ABI@.  Thus, it's intended only for use on targets where the developer
6627 acknowledges that their resulting code will not be directly in line with
6628 the rules of the ABI@.
6630 @item -mimpure-text
6631 @opindex mimpure-text
6632 @option{-mimpure-text}, used in addition to @option{-shared}, tells
6633 the compiler to not pass @option{-z text} to the linker when linking a
6634 shared object.  Using this option, you can link position-dependent
6635 code into a shared object.
6637 @option{-mimpure-text} suppresses the ``relocations remain against
6638 allocatable but non-writable sections'' linker error message.
6639 However, the necessary relocations will trigger copy-on-write, and the
6640 shared object is not actually shared across processes.  Instead of
6641 using @option{-mimpure-text}, you should compile all source code with
6642 @option{-fpic} or @option{-fPIC}.
6644 This option is only available on SunOS and Solaris.
6646 @item -mcpu=@var{cpu_type}
6647 @opindex mcpu
6648 Set the instruction set, register set, and instruction scheduling parameters
6649 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
6650 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
6651 @samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x},
6652 @samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc}, and
6653 @samp{ultrasparc3}.
6655 Default instruction scheduling parameters are used for values that select
6656 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
6657 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
6659 Here is a list of each supported architecture and their supported
6660 implementations.
6662 @smallexample
6663     v7:             cypress
6664     v8:             supersparc, hypersparc
6665     sparclite:      f930, f934, sparclite86x
6666     sparclet:       tsc701
6667     v9:             ultrasparc, ultrasparc3
6668 @end smallexample
6670 By default (unless configured otherwise), GCC generates code for the V7
6671 variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
6672 additionally optimizes it for the Cypress CY7C602 chip, as used in the
6673 SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
6674 SPARCStation 1, 2, IPX etc.
6676 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
6677 architecture.  The only difference from V7 code is that the compiler emits
6678 the integer multiply and integer divide instructions which exist in SPARC-V8
6679 but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
6680 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
6681 2000 series.
6683 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
6684 the SPARC architecture.  This adds the integer multiply, integer divide step
6685 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
6686 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
6687 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU.  With
6688 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
6689 MB86934 chip, which is the more recent SPARClite with FPU.
6691 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
6692 the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
6693 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
6694 but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
6695 optimizes it for the TEMIC SPARClet chip.
6697 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
6698 architecture.  This adds 64-bit integer and floating-point move instructions,
6699 3 additional floating-point condition code registers and conditional move
6700 instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
6701 optimizes it for the Sun UltraSPARC I/II chips.  With
6702 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
6703 Sun UltraSPARC III chip.
6705 @item -mtune=@var{cpu_type}
6706 @opindex mtune
6707 Set the instruction scheduling parameters for machine type
6708 @var{cpu_type}, but do not set the instruction set or register set that the
6709 option @option{-mcpu=@var{cpu_type}} would.
6711 The same values for @option{-mcpu=@var{cpu_type}} can be used for
6712 @option{-mtune=@var{cpu_type}}, but the only useful values are those
6713 that select a particular cpu implementation.  Those are @samp{cypress},
6714 @samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
6715 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, and
6716 @samp{ultrasparc3}.
6718 @item -mv8plus
6719 @itemx -mno-v8plus
6720 @opindex mv8plus
6721 @opindex mno-v8plus
6722 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI.  The
6723 difference from the V8 ABI is that the global and out registers are
6724 considered 64-bit wide.  This is enabled by default on Solaris in 32-bit
6725 mode for all SPARC-V9 processors.
6727 @item -mvis
6728 @itemx -mno-vis
6729 @opindex mvis
6730 @opindex mno-vis
6731 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
6732 Visual Instruction Set extensions.  The default is @option{-mno-vis}.
6733 @end table
6735 These @samp{-m} options are supported in addition to the above
6736 on SPARC-V9 processors in 64-bit environments:
6738 @table @gcctabopt
6739 @item -mlittle-endian
6740 @opindex mlittle-endian
6741 Generate code for a processor running in little-endian mode. It is only
6742 available for a few configurations and most notably not on Solaris.
6744 @item -m32
6745 @itemx -m64
6746 @opindex m32
6747 @opindex m64
6748 Generate code for a 32-bit or 64-bit environment.
6749 The 32-bit environment sets int, long and pointer to 32 bits.
6750 The 64-bit environment sets int to 32 bits and long and pointer
6751 to 64 bits.
6753 @item -mcmodel=medlow
6754 @opindex mcmodel=medlow
6755 Generate code for the Medium/Low code model: 64-bit addresses, programs
6756 must be linked in the low 32 bits of memory.  Programs can be statically
6757 or dynamically linked.
6759 @item -mcmodel=medmid
6760 @opindex mcmodel=medmid
6761 Generate code for the Medium/Middle code model: 64-bit addresses, programs
6762 must be linked in the low 44 bits of memory, the text and data segments must
6763 be less than 2GB in size and the data segment must be located within 2GB of
6764 the text segment.
6766 @item -mcmodel=medany
6767 @opindex mcmodel=medany
6768 Generate code for the Medium/Anywhere code model: 64-bit addresses, programs
6769 may be linked anywhere in memory, the text and data segments must be less
6770 than 2GB in size and the data segment must be located within 2GB of the
6771 text segment.
6773 @item -mcmodel=embmedany
6774 @opindex mcmodel=embmedany
6775 Generate code for the Medium/Anywhere code model for embedded systems:
6776 64-bit addresses, the text and data segments must be less than 2GB in
6777 size, both starting anywhere in memory (determined at link time).  The
6778 global register %g4 points to the base of the data segment.  Programs
6779 are statically linked and PIC is not supported.
6781 @item -mstack-bias
6782 @itemx -mno-stack-bias
6783 @opindex mstack-bias
6784 @opindex mno-stack-bias
6785 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
6786 frame pointer if present, are offset by @minus{}2047 which must be added back
6787 when making stack frame references.  This is the default in 64-bit mode.
6788 Otherwise, assume no such offset is present.
6789 @end table
6791 @node ARM Options
6792 @subsection ARM Options
6793 @cindex ARM options
6795 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
6796 architectures:
6798 @table @gcctabopt
6799 @item -mabi=@var{name}
6800 @opindex mabi
6801 Generate code for the specified ABI.  Permissible values are: @samp{apcs-gnu},
6802 @samp{atpcs}, @samp{aapcs} and @samp{iwmmxt}.
6804 @item -mapcs-frame
6805 @opindex mapcs-frame
6806 Generate a stack frame that is compliant with the ARM Procedure Call
6807 Standard for all functions, even if this is not strictly necessary for
6808 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
6809 with this option will cause the stack frames not to be generated for
6810 leaf functions.  The default is @option{-mno-apcs-frame}.
6812 @item -mapcs
6813 @opindex mapcs
6814 This is a synonym for @option{-mapcs-frame}.
6816 @ignore
6817 @c not currently implemented
6818 @item -mapcs-stack-check
6819 @opindex mapcs-stack-check
6820 Generate code to check the amount of stack space available upon entry to
6821 every function (that actually uses some stack space).  If there is
6822 insufficient space available then either the function
6823 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
6824 called, depending upon the amount of stack space required.  The run time
6825 system is required to provide these functions.  The default is
6826 @option{-mno-apcs-stack-check}, since this produces smaller code.
6828 @c not currently implemented
6829 @item -mapcs-float
6830 @opindex mapcs-float
6831 Pass floating point arguments using the float point registers.  This is
6832 one of the variants of the APCS@.  This option is recommended if the
6833 target hardware has a floating point unit or if a lot of floating point
6834 arithmetic is going to be performed by the code.  The default is
6835 @option{-mno-apcs-float}, since integer only code is slightly increased in
6836 size if @option{-mapcs-float} is used.
6838 @c not currently implemented
6839 @item -mapcs-reentrant
6840 @opindex mapcs-reentrant
6841 Generate reentrant, position independent code.  The default is
6842 @option{-mno-apcs-reentrant}.
6843 @end ignore
6845 @item -mthumb-interwork
6846 @opindex mthumb-interwork
6847 Generate code which supports calling between the ARM and Thumb
6848 instruction sets.  Without this option the two instruction sets cannot
6849 be reliably used inside one program.  The default is
6850 @option{-mno-thumb-interwork}, since slightly larger code is generated
6851 when @option{-mthumb-interwork} is specified.
6853 @item -mno-sched-prolog
6854 @opindex mno-sched-prolog
6855 Prevent the reordering of instructions in the function prolog, or the
6856 merging of those instruction with the instructions in the function's
6857 body.  This means that all functions will start with a recognizable set
6858 of instructions (or in fact one of a choice from a small set of
6859 different function prologues), and this information can be used to
6860 locate the start if functions inside an executable piece of code.  The
6861 default is @option{-msched-prolog}.
6863 @item -mhard-float
6864 @opindex mhard-float
6865 Generate output containing floating point instructions.  This is the
6866 default.
6868 @item -msoft-float
6869 @opindex msoft-float
6870 Generate output containing library calls for floating point.
6871 @strong{Warning:} the requisite libraries are not available for all ARM
6872 targets.  Normally the facilities of the machine's usual C compiler are
6873 used, but this cannot be done directly in cross-compilation.  You must make
6874 your own arrangements to provide suitable library functions for
6875 cross-compilation.
6877 @option{-msoft-float} changes the calling convention in the output file;
6878 therefore, it is only useful if you compile @emph{all} of a program with
6879 this option.  In particular, you need to compile @file{libgcc.a}, the
6880 library that comes with GCC, with @option{-msoft-float} in order for
6881 this to work.
6883 @item -mfloat-abi=@var{name}
6884 @opindex mfloat-abi
6885 Specifies which ABI to use for floating point values.  Permissible values
6886 are: @samp{soft}, @samp{softfp} and @samp{hard}.
6888 @samp{soft} and @samp{hard} are equivalent to @option{-msoft-float}
6889 and @option{-mhard-float} respectively.  @samp{softfp} allows the generation
6890 of floating point instructions, but still uses the soft-float calling
6891 conventions.
6893 @item -mlittle-endian
6894 @opindex mlittle-endian
6895 Generate code for a processor running in little-endian mode.  This is
6896 the default for all standard configurations.
6898 @item -mbig-endian
6899 @opindex mbig-endian
6900 Generate code for a processor running in big-endian mode; the default is
6901 to compile code for a little-endian processor.
6903 @item -mwords-little-endian
6904 @opindex mwords-little-endian
6905 This option only applies when generating code for big-endian processors.
6906 Generate code for a little-endian word order but a big-endian byte
6907 order.  That is, a byte order of the form @samp{32107654}.  Note: this
6908 option should only be used if you require compatibility with code for
6909 big-endian ARM processors generated by versions of the compiler prior to
6910 2.8.
6912 @item -mcpu=@var{name}
6913 @opindex mcpu
6914 This specifies the name of the target ARM processor.  GCC uses this name
6915 to determine what kind of instructions it can emit when generating
6916 assembly code.  Permissible names are: @samp{arm2}, @samp{arm250},
6917 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
6918 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
6919 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
6920 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
6921 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm8},
6922 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
6923 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
6924 @samp{arm920t}, @samp{arm926ejs}, @samp{arm940t}, @samp{arm9tdmi},
6925 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ejs},
6926 @samp{arm1136js}, @samp{arm1136jfs} ,@samp{xscale}, @samp{iwmmxt},
6927 @samp{ep9312}.
6929 @itemx -mtune=@var{name}
6930 @opindex mtune
6931 This option is very similar to the @option{-mcpu=} option, except that
6932 instead of specifying the actual target processor type, and hence
6933 restricting which instructions can be used, it specifies that GCC should
6934 tune the performance of the code as if the target were of the type
6935 specified in this option, but still choosing the instructions that it
6936 will generate based on the cpu specified by a @option{-mcpu=} option.
6937 For some ARM implementations better performance can be obtained by using
6938 this option.
6940 @item -march=@var{name}
6941 @opindex march
6942 This specifies the name of the target ARM architecture.  GCC uses this
6943 name to determine what kind of instructions it can emit when generating
6944 assembly code.  This option can be used in conjunction with or instead
6945 of the @option{-mcpu=} option.  Permissible names are: @samp{armv2},
6946 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
6947 @samp{armv5}, @samp{armv5t}, @samp{armv5te}, @samp{armv6}, @samp{armv6j},
6948 @samp{iwmmxt}, @samp{ep9312}.
6950 @item -mfpu=@var{name}
6951 @itemx -mfpe=@var{number}
6952 @itemx -mfp=@var{number}
6953 @opindex mfpu
6954 @opindex mfpe
6955 @opindex mfp
6956 This specifies what floating point hardware (or hardware emulation) is
6957 available on the target.  Permissible names are: @samp{fpa}, @samp{fpe2},
6958 @samp{fpe3}, @samp{maverick}, @samp{vfp}.  @option{-mfp} and @option{-mfpe}
6959 are synonyms for @option{-mfpu}=@samp{fpe}@var{number}, for compatibility
6960 with older versions of GCC@.
6962 If @option{-msoft-float} is specified this specifies the format of
6963 floating point values.
6965 @item -mstructure-size-boundary=@var{n}
6966 @opindex mstructure-size-boundary
6967 The size of all structures and unions will be rounded up to a multiple
6968 of the number of bits set by this option.  Permissible values are 8, 32
6969 and 64.  The default value varies for different toolchains.  For the COFF
6970 targeted toolchain the default value is 8.  A value of 64 is only allowed
6971 if the underlying ABI supports it.
6973 Specifying the larger number can produce faster, more efficient code, but
6974 can also increase the size of the program.  Different values are potentially
6975 incompatible.  Code compiled with one value cannot necessarily expect to
6976 work with code or libraries compiled with another value, if they exchange
6977 information using structures or unions.
6979 @item -mabort-on-noreturn
6980 @opindex mabort-on-noreturn
6981 Generate a call to the function @code{abort} at the end of a
6982 @code{noreturn} function.  It will be executed if the function tries to
6983 return.
6985 @item -mlong-calls
6986 @itemx -mno-long-calls
6987 @opindex mlong-calls
6988 @opindex mno-long-calls
6989 Tells the compiler to perform function calls by first loading the
6990 address of the function into a register and then performing a subroutine
6991 call on this register.  This switch is needed if the target function
6992 will lie outside of the 64 megabyte addressing range of the offset based
6993 version of subroutine call instruction.
6995 Even if this switch is enabled, not all function calls will be turned
6996 into long calls.  The heuristic is that static functions, functions
6997 which have the @samp{short-call} attribute, functions that are inside
6998 the scope of a @samp{#pragma no_long_calls} directive and functions whose
6999 definitions have already been compiled within the current compilation
7000 unit, will not be turned into long calls.  The exception to this rule is
7001 that weak function definitions, functions with the @samp{long-call}
7002 attribute or the @samp{section} attribute, and functions that are within
7003 the scope of a @samp{#pragma long_calls} directive, will always be
7004 turned into long calls.
7006 This feature is not enabled by default.  Specifying
7007 @option{-mno-long-calls} will restore the default behavior, as will
7008 placing the function calls within the scope of a @samp{#pragma
7009 long_calls_off} directive.  Note these switches have no effect on how
7010 the compiler generates code to handle function calls via function
7011 pointers.
7013 @item -mnop-fun-dllimport
7014 @opindex mnop-fun-dllimport
7015 Disable support for the @code{dllimport} attribute.
7017 @item -msingle-pic-base
7018 @opindex msingle-pic-base
7019 Treat the register used for PIC addressing as read-only, rather than
7020 loading it in the prologue for each function.  The run-time system is
7021 responsible for initializing this register with an appropriate value
7022 before execution begins.
7024 @item -mpic-register=@var{reg}
7025 @opindex mpic-register
7026 Specify the register to be used for PIC addressing.  The default is R10
7027 unless stack-checking is enabled, when R9 is used.
7029 @item -mcirrus-fix-invalid-insns
7030 @opindex mcirrus-fix-invalid-insns
7031 @opindex mno-cirrus-fix-invalid-insns
7032 Insert NOPs into the instruction stream to in order to work around
7033 problems with invalid Maverick instruction combinations.  This option
7034 is only valid if the @option{-mcpu=ep9312} option has been used to
7035 enable generation of instructions for the Cirrus Maverick floating
7036 point co-processor.  This option is not enabled by default, since the
7037 problem is only present in older Maverick implementations.  The default
7038 can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
7039 switch.
7041 @item -mpoke-function-name
7042 @opindex mpoke-function-name
7043 Write the name of each function into the text section, directly
7044 preceding the function prologue.  The generated code is similar to this:
7046 @smallexample
7047      t0
7048          .ascii "arm_poke_function_name", 0
7049          .align
7050      t1
7051          .word 0xff000000 + (t1 - t0)
7052      arm_poke_function_name
7053          mov     ip, sp
7054          stmfd   sp!, @{fp, ip, lr, pc@}
7055          sub     fp, ip, #4
7056 @end smallexample
7058 When performing a stack backtrace, code can inspect the value of
7059 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
7060 location @code{pc - 12} and the top 8 bits are set, then we know that
7061 there is a function name embedded immediately preceding this location
7062 and has length @code{((pc[-3]) & 0xff000000)}.
7064 @item -mthumb
7065 @opindex mthumb
7066 Generate code for the 16-bit Thumb instruction set.  The default is to
7067 use the 32-bit ARM instruction set.
7069 @item -mtpcs-frame
7070 @opindex mtpcs-frame
7071 Generate a stack frame that is compliant with the Thumb Procedure Call
7072 Standard for all non-leaf functions.  (A leaf function is one that does
7073 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
7075 @item -mtpcs-leaf-frame
7076 @opindex mtpcs-leaf-frame
7077 Generate a stack frame that is compliant with the Thumb Procedure Call
7078 Standard for all leaf functions.  (A leaf function is one that does
7079 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
7081 @item -mcallee-super-interworking
7082 @opindex mcallee-super-interworking
7083 Gives all externally visible functions in the file being compiled an ARM
7084 instruction set header which switches to Thumb mode before executing the
7085 rest of the function.  This allows these functions to be called from
7086 non-interworking code.
7088 @item -mcaller-super-interworking
7089 @opindex mcaller-super-interworking
7090 Allows calls via function pointers (including virtual functions) to
7091 execute correctly regardless of whether the target code has been
7092 compiled for interworking or not.  There is a small overhead in the cost
7093 of executing a function pointer if this option is enabled.
7095 @end table
7097 @node MN10300 Options
7098 @subsection MN10300 Options
7099 @cindex MN10300 options
7101 These @option{-m} options are defined for Matsushita MN10300 architectures:
7103 @table @gcctabopt
7104 @item -mmult-bug
7105 @opindex mmult-bug
7106 Generate code to avoid bugs in the multiply instructions for the MN10300
7107 processors.  This is the default.
7109 @item -mno-mult-bug
7110 @opindex mno-mult-bug
7111 Do not generate code to avoid bugs in the multiply instructions for the
7112 MN10300 processors.
7114 @item -mam33
7115 @opindex mam33
7116 Generate code which uses features specific to the AM33 processor.
7118 @item -mno-am33
7119 @opindex mno-am33
7120 Do not generate code which uses features specific to the AM33 processor.  This
7121 is the default.
7123 @item -mno-crt0
7124 @opindex mno-crt0
7125 Do not link in the C run-time initialization object file.
7127 @item -mrelax
7128 @opindex mrelax
7129 Indicate to the linker that it should perform a relaxation optimization pass
7130 to shorten branches, calls and absolute memory addresses.  This option only
7131 has an effect when used on the command line for the final link step.
7133 This option makes symbolic debugging impossible.
7134 @end table
7137 @node M32R/D Options
7138 @subsection M32R/D Options
7139 @cindex M32R/D options
7141 These @option{-m} options are defined for Renesas M32R/D architectures:
7143 @table @gcctabopt
7144 @item -m32r2
7145 @opindex m32r2
7146 Generate code for the M32R/2@.
7148 @item -m32rx
7149 @opindex m32rx
7150 Generate code for the M32R/X@.
7152 @item -m32r
7153 @opindex m32r
7154 Generate code for the M32R@.  This is the default.
7156 @item -mmodel=small
7157 @opindex mmodel=small
7158 Assume all objects live in the lower 16MB of memory (so that their addresses
7159 can be loaded with the @code{ld24} instruction), and assume all subroutines
7160 are reachable with the @code{bl} instruction.
7161 This is the default.
7163 The addressability of a particular object can be set with the
7164 @code{model} attribute.
7166 @item -mmodel=medium
7167 @opindex mmodel=medium
7168 Assume objects may be anywhere in the 32-bit address space (the compiler
7169 will generate @code{seth/add3} instructions to load their addresses), and
7170 assume all subroutines are reachable with the @code{bl} instruction.
7172 @item -mmodel=large
7173 @opindex mmodel=large
7174 Assume objects may be anywhere in the 32-bit address space (the compiler
7175 will generate @code{seth/add3} instructions to load their addresses), and
7176 assume subroutines may not be reachable with the @code{bl} instruction
7177 (the compiler will generate the much slower @code{seth/add3/jl}
7178 instruction sequence).
7180 @item -msdata=none
7181 @opindex msdata=none
7182 Disable use of the small data area.  Variables will be put into
7183 one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
7184 @code{section} attribute has been specified).
7185 This is the default.
7187 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
7188 Objects may be explicitly put in the small data area with the
7189 @code{section} attribute using one of these sections.
7191 @item -msdata=sdata
7192 @opindex msdata=sdata
7193 Put small global and static data in the small data area, but do not
7194 generate special code to reference them.
7196 @item -msdata=use
7197 @opindex msdata=use
7198 Put small global and static data in the small data area, and generate
7199 special instructions to reference them.
7201 @item -G @var{num}
7202 @opindex G
7203 @cindex smaller data references
7204 Put global and static objects less than or equal to @var{num} bytes
7205 into the small data or bss sections instead of the normal data or bss
7206 sections.  The default value of @var{num} is 8.
7207 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
7208 for this option to have any effect.
7210 All modules should be compiled with the same @option{-G @var{num}} value.
7211 Compiling with different values of @var{num} may or may not work; if it
7212 doesn't the linker will give an error message---incorrect code will not be
7213 generated.
7215 @item -mdebug
7216 @opindex mdebug
7217 Makes the M32R specific code in the compiler display some statistics
7218 that might help in debugging programs.
7220 @item -malign-loops
7221 @opindex malign-loops
7222 Align all loops to a 32-byte boundary.
7224 @item -mno-align-loops
7225 @opindex mno-align-loops
7226 Do not enforce a 32-byte alignment for loops.  This is the default.
7228 @item -missue-rate=@var{number}
7229 @opindex missue-rate=@var{number}
7230 Issue @var{number} instructions per cycle.  @var{number} can only be 1
7231 or 2.
7233 @item -mbranch-cost=@var{number}
7234 @opindex mbranch-cost=@var{number}
7235 @var{number} can only be 1 or 2.  If it is 1 then branches will be
7236 preferred over conditional code, if it is 2, then the opposite will
7237 apply.
7239 @item -mflush-trap=@var{number}
7240 @opindex mflush-trap=@var{number}
7241 Specifies the trap number to use to flush the cache.  The default is
7242 12.  Valid numbers are between 0 and 15 inclusive.
7244 @item -mno-flush-trap
7245 @opindex mno-flush-trap
7246 Specifies that the cache cannot be flushed by using a trap.
7248 @item -mflush-func=@var{name}
7249 @opindex mflush-func=@var{name}
7250 Specifies the name of the operating system function to call to flush
7251 the cache.  The default is @emph{_flush_cache}, but a function call
7252 will only be used if a trap is not available.
7254 @item -mno-flush-func
7255 @opindex mno-flush-func
7256 Indicates that there is no OS function for flushing the cache.
7258 @end table
7260 @node RS/6000 and PowerPC Options
7261 @subsection IBM RS/6000 and PowerPC Options
7262 @cindex RS/6000 and PowerPC Options
7263 @cindex IBM RS/6000 and PowerPC Options
7265 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
7266 @table @gcctabopt
7267 @item -mpower
7268 @itemx -mno-power
7269 @itemx -mpower2
7270 @itemx -mno-power2
7271 @itemx -mpowerpc
7272 @itemx -mno-powerpc
7273 @itemx -mpowerpc-gpopt
7274 @itemx -mno-powerpc-gpopt
7275 @itemx -mpowerpc-gfxopt
7276 @itemx -mno-powerpc-gfxopt
7277 @itemx -mpowerpc64
7278 @itemx -mno-powerpc64
7279 @opindex mpower
7280 @opindex mno-power
7281 @opindex mpower2
7282 @opindex mno-power2
7283 @opindex mpowerpc
7284 @opindex mno-powerpc
7285 @opindex mpowerpc-gpopt
7286 @opindex mno-powerpc-gpopt
7287 @opindex mpowerpc-gfxopt
7288 @opindex mno-powerpc-gfxopt
7289 @opindex mpowerpc64
7290 @opindex mno-powerpc64
7291 GCC supports two related instruction set architectures for the
7292 RS/6000 and PowerPC@.  The @dfn{POWER} instruction set are those
7293 instructions supported by the @samp{rios} chip set used in the original
7294 RS/6000 systems and the @dfn{PowerPC} instruction set is the
7295 architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and
7296 the IBM 4xx microprocessors.
7298 Neither architecture is a subset of the other.  However there is a
7299 large common subset of instructions supported by both.  An MQ
7300 register is included in processors supporting the POWER architecture.
7302 You use these options to specify which instructions are available on the
7303 processor you are using.  The default value of these options is
7304 determined when configuring GCC@.  Specifying the
7305 @option{-mcpu=@var{cpu_type}} overrides the specification of these
7306 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
7307 rather than the options listed above.
7309 The @option{-mpower} option allows GCC to generate instructions that
7310 are found only in the POWER architecture and to use the MQ register.
7311 Specifying @option{-mpower2} implies @option{-power} and also allows GCC
7312 to generate instructions that are present in the POWER2 architecture but
7313 not the original POWER architecture.
7315 The @option{-mpowerpc} option allows GCC to generate instructions that
7316 are found only in the 32-bit subset of the PowerPC architecture.
7317 Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
7318 GCC to use the optional PowerPC architecture instructions in the
7319 General Purpose group, including floating-point square root.  Specifying
7320 @option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
7321 use the optional PowerPC architecture instructions in the Graphics
7322 group, including floating-point select.
7324 The @option{-mpowerpc64} option allows GCC to generate the additional
7325 64-bit instructions that are found in the full PowerPC64 architecture
7326 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
7327 @option{-mno-powerpc64}.
7329 If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
7330 will use only the instructions in the common subset of both
7331 architectures plus some special AIX common-mode calls, and will not use
7332 the MQ register.  Specifying both @option{-mpower} and @option{-mpowerpc}
7333 permits GCC to use any instruction from either architecture and to
7334 allow use of the MQ register; specify this for the Motorola MPC601.
7336 @item -mnew-mnemonics
7337 @itemx -mold-mnemonics
7338 @opindex mnew-mnemonics
7339 @opindex mold-mnemonics
7340 Select which mnemonics to use in the generated assembler code.  With
7341 @option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
7342 the PowerPC architecture.  With @option{-mold-mnemonics} it uses the
7343 assembler mnemonics defined for the POWER architecture.  Instructions
7344 defined in only one architecture have only one mnemonic; GCC uses that
7345 mnemonic irrespective of which of these options is specified.
7347 GCC defaults to the mnemonics appropriate for the architecture in
7348 use.  Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
7349 value of these option.  Unless you are building a cross-compiler, you
7350 should normally not specify either @option{-mnew-mnemonics} or
7351 @option{-mold-mnemonics}, but should instead accept the default.
7353 @item -mcpu=@var{cpu_type}
7354 @opindex mcpu
7355 Set architecture type, register usage, choice of mnemonics, and
7356 instruction scheduling parameters for machine type @var{cpu_type}.
7357 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
7358 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{505},
7359 @samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604},
7360 @samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400},
7361 @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
7362 @samp{860}, @samp{970}, @samp{common}, @samp{ec603e}, @samp{G3},
7363 @samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3},
7364 @samp{power4}, @samp{power5}, @samp{powerpc}, @samp{powerpc64},
7365 @samp{rios}, @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64a}.
7367 @option{-mcpu=common} selects a completely generic processor.  Code
7368 generated under this option will run on any POWER or PowerPC processor.
7369 GCC will use only the instructions in the common subset of both
7370 architectures, and will not use the MQ register.  GCC assumes a generic
7371 processor model for scheduling purposes.
7373 @option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
7374 @option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
7375 PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
7376 types, with an appropriate, generic processor model assumed for
7377 scheduling purposes.
7379 The other options specify a specific processor.  Code generated under
7380 those options will run best on that processor, and may not run at all on
7381 others.
7383 The @option{-mcpu} options automatically enable or disable the
7384 following options: @option{-maltivec}, @option{-mhard-float},
7385 @option{-mmfcrf}, @option{-mmultiple}, @option{-mnew-mnemonics},
7386 @option{-mpower}, @option{-mpower2}, @option{-mpowerpc64},
7387 @option{-mpowerpc-gpopt}, @option{-mpowerpc-gfxopt},
7388 @option{-mstring}.  The particular options set for any particular CPU
7389 will vary between compiler versions, depending on what setting seems
7390 to produce optimal code for that CPU; it doesn't necessarily reflect
7391 the actual hardware's capabilities.  If you wish to set an individual
7392 option to a particular value, you may specify it after the
7393 @option{-mcpu} option, like @samp{-mcpu=970 -mno-altivec}.
7395 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
7396 not enabled or disabled by the @option{-mcpu} option at present, since
7397 AIX does not have full support for these options.  You may still
7398 enable or disable them individually if you're sure it'll work in your
7399 environment.
7401 @item -mtune=@var{cpu_type}
7402 @opindex mtune
7403 Set the instruction scheduling parameters for machine type
7404 @var{cpu_type}, but do not set the architecture type, register usage, or
7405 choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would.  The same
7406 values for @var{cpu_type} are used for @option{-mtune} as for
7407 @option{-mcpu}.  If both are specified, the code generated will use the
7408 architecture, registers, and mnemonics set by @option{-mcpu}, but the
7409 scheduling parameters set by @option{-mtune}.
7411 @item -maltivec
7412 @itemx -mno-altivec
7413 @opindex maltivec
7414 @opindex mno-altivec
7415 These switches enable or disable the use of built-in functions that
7416 allow access to the AltiVec instruction set.  You may also need to set
7417 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
7418 enhancements.
7420 @item -mabi=spe
7421 @opindex mabi=spe
7422 Extend the current ABI with SPE ABI extensions.  This does not change
7423 the default ABI, instead it adds the SPE ABI extensions to the current
7424 ABI@.
7426 @item -mabi=no-spe
7427 @opindex mabi=no-spe
7428 Disable Booke SPE ABI extensions for the current ABI.
7430 @item -misel=@var{yes/no}
7431 @itemx -misel
7432 @opindex misel
7433 This switch enables or disables the generation of ISEL instructions.
7435 @item -mspe=@var{yes/no}
7436 @itemx -mspe
7437 @opindex mspe
7438 This switch enables or disables the generation of SPE simd
7439 instructions.
7441 @item -mfloat-gprs=@var{yes/no}
7442 @itemx -mfloat-gprs
7443 @opindex mfloat-gprs
7444 This switch enables or disables the generation of floating point
7445 operations on the general purpose registers for architectures that
7446 support it.  This option is currently only available on the MPC8540.
7448 @item -mfull-toc
7449 @itemx -mno-fp-in-toc
7450 @itemx -mno-sum-in-toc
7451 @itemx -mminimal-toc
7452 @opindex mfull-toc
7453 @opindex mno-fp-in-toc
7454 @opindex mno-sum-in-toc
7455 @opindex mminimal-toc
7456 Modify generation of the TOC (Table Of Contents), which is created for
7457 every executable file.  The @option{-mfull-toc} option is selected by
7458 default.  In that case, GCC will allocate at least one TOC entry for
7459 each unique non-automatic variable reference in your program.  GCC
7460 will also place floating-point constants in the TOC@.  However, only
7461 16,384 entries are available in the TOC@.
7463 If you receive a linker error message that saying you have overflowed
7464 the available TOC space, you can reduce the amount of TOC space used
7465 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
7466 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
7467 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
7468 generate code to calculate the sum of an address and a constant at
7469 run-time instead of putting that sum into the TOC@.  You may specify one
7470 or both of these options.  Each causes GCC to produce very slightly
7471 slower and larger code at the expense of conserving TOC space.
7473 If you still run out of space in the TOC even when you specify both of
7474 these options, specify @option{-mminimal-toc} instead.  This option causes
7475 GCC to make only one TOC entry for every file.  When you specify this
7476 option, GCC will produce code that is slower and larger but which
7477 uses extremely little TOC space.  You may wish to use this option
7478 only on files that contain less frequently executed code.
7480 @item -maix64
7481 @itemx -maix32
7482 @opindex maix64
7483 @opindex maix32
7484 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
7485 @code{long} type, and the infrastructure needed to support them.
7486 Specifying @option{-maix64} implies @option{-mpowerpc64} and
7487 @option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
7488 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
7490 @item -mxl-call
7491 @itemx -mno-xl-call
7492 @opindex mxl-call
7493 @opindex mno-xl-call
7494 On AIX, pass floating-point arguments to prototyped functions beyond the
7495 register save area (RSA) on the stack in addition to argument FPRs.  The
7496 AIX calling convention was extended but not initially documented to
7497 handle an obscure K&R C case of calling a function that takes the
7498 address of its arguments with fewer arguments than declared.  AIX XL
7499 compilers access floating point arguments which do not fit in the
7500 RSA from the stack when a subroutine is compiled without
7501 optimization.  Because always storing floating-point arguments on the
7502 stack is inefficient and rarely needed, this option is not enabled by
7503 default and only is necessary when calling subroutines compiled by AIX
7504 XL compilers without optimization.
7506 @item -mpe
7507 @opindex mpe
7508 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
7509 application written to use message passing with special startup code to
7510 enable the application to run.  The system must have PE installed in the
7511 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
7512 must be overridden with the @option{-specs=} option to specify the
7513 appropriate directory location.  The Parallel Environment does not
7514 support threads, so the @option{-mpe} option and the @option{-pthread}
7515 option are incompatible.
7517 @item -malign-natural
7518 @itemx -malign-power
7519 @opindex malign-natural
7520 @opindex malign-power
7521 On AIX, Darwin, and 64-bit PowerPC GNU/Linux, the option
7522 @option{-malign-natural} overrides the ABI-defined alignment of larger
7523 types, such as floating-point doubles, on their natural size-based boundary.
7524 The option @option{-malign-power} instructs GCC to follow the ABI-specified
7525 alignment rules.  GCC defaults to the standard alignment defined in the ABI.
7527 @item -msoft-float
7528 @itemx -mhard-float
7529 @opindex msoft-float
7530 @opindex mhard-float
7531 Generate code that does not use (uses) the floating-point register set.
7532 Software floating point emulation is provided if you use the
7533 @option{-msoft-float} option, and pass the option to GCC when linking.
7535 @item -mmultiple
7536 @itemx -mno-multiple
7537 @opindex mmultiple
7538 @opindex mno-multiple
7539 Generate code that uses (does not use) the load multiple word
7540 instructions and the store multiple word instructions.  These
7541 instructions are generated by default on POWER systems, and not
7542 generated on PowerPC systems.  Do not use @option{-mmultiple} on little
7543 endian PowerPC systems, since those instructions do not work when the
7544 processor is in little endian mode.  The exceptions are PPC740 and
7545 PPC750 which permit the instructions usage in little endian mode.
7547 @item -mstring
7548 @itemx -mno-string
7549 @opindex mstring
7550 @opindex mno-string
7551 Generate code that uses (does not use) the load string instructions
7552 and the store string word instructions to save multiple registers and
7553 do small block moves.  These instructions are generated by default on
7554 POWER systems, and not generated on PowerPC systems.  Do not use
7555 @option{-mstring} on little endian PowerPC systems, since those
7556 instructions do not work when the processor is in little endian mode.
7557 The exceptions are PPC740 and PPC750 which permit the instructions
7558 usage in little endian mode.
7560 @item -mupdate
7561 @itemx -mno-update
7562 @opindex mupdate
7563 @opindex mno-update
7564 Generate code that uses (does not use) the load or store instructions
7565 that update the base register to the address of the calculated memory
7566 location.  These instructions are generated by default.  If you use
7567 @option{-mno-update}, there is a small window between the time that the
7568 stack pointer is updated and the address of the previous frame is
7569 stored, which means code that walks the stack frame across interrupts or
7570 signals may get corrupted data.
7572 @item -mfused-madd
7573 @itemx -mno-fused-madd
7574 @opindex mfused-madd
7575 @opindex mno-fused-madd
7576 Generate code that uses (does not use) the floating point multiply and
7577 accumulate instructions.  These instructions are generated by default if
7578 hardware floating is used.
7580 @item -mno-bit-align
7581 @itemx -mbit-align
7582 @opindex mno-bit-align
7583 @opindex mbit-align
7584 On System V.4 and embedded PowerPC systems do not (do) force structures
7585 and unions that contain bit-fields to be aligned to the base type of the
7586 bit-field.
7588 For example, by default a structure containing nothing but 8
7589 @code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
7590 boundary and have a size of 4 bytes.  By using @option{-mno-bit-align},
7591 the structure would be aligned to a 1 byte boundary and be one byte in
7592 size.
7594 @item -mno-strict-align
7595 @itemx -mstrict-align
7596 @opindex mno-strict-align
7597 @opindex mstrict-align
7598 On System V.4 and embedded PowerPC systems do not (do) assume that
7599 unaligned memory references will be handled by the system.
7601 @item -mrelocatable
7602 @itemx -mno-relocatable
7603 @opindex mrelocatable
7604 @opindex mno-relocatable
7605 On embedded PowerPC systems generate code that allows (does not allow)
7606 the program to be relocated to a different address at runtime.  If you
7607 use @option{-mrelocatable} on any module, all objects linked together must
7608 be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
7610 @item -mrelocatable-lib
7611 @itemx -mno-relocatable-lib
7612 @opindex mrelocatable-lib
7613 @opindex mno-relocatable-lib
7614 On embedded PowerPC systems generate code that allows (does not allow)
7615 the program to be relocated to a different address at runtime.  Modules
7616 compiled with @option{-mrelocatable-lib} can be linked with either modules
7617 compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
7618 with modules compiled with the @option{-mrelocatable} options.
7620 @item -mno-toc
7621 @itemx -mtoc
7622 @opindex mno-toc
7623 @opindex mtoc
7624 On System V.4 and embedded PowerPC systems do not (do) assume that
7625 register 2 contains a pointer to a global area pointing to the addresses
7626 used in the program.
7628 @item -mlittle
7629 @itemx -mlittle-endian
7630 @opindex mlittle
7631 @opindex mlittle-endian
7632 On System V.4 and embedded PowerPC systems compile code for the
7633 processor in little endian mode.  The @option{-mlittle-endian} option is
7634 the same as @option{-mlittle}.
7636 @item -mbig
7637 @itemx -mbig-endian
7638 @opindex mbig
7639 @opindex mbig-endian
7640 On System V.4 and embedded PowerPC systems compile code for the
7641 processor in big endian mode.  The @option{-mbig-endian} option is
7642 the same as @option{-mbig}.
7644 @item -mdynamic-no-pic
7645 @opindex mdynamic-no-pic
7646 On Darwin and Mac OS X systems, compile code so that it is not
7647 relocatable, but that its external references are relocatable.  The
7648 resulting code is suitable for applications, but not shared
7649 libraries.
7651 @item -mprioritize-restricted-insns=@var{priority}
7652 @opindex mprioritize-restricted-insns
7653 This option controls the priority that is assigned to
7654 dispatch-slot restricted instructions during the second scheduling
7655 pass.  The argument @var{priority} takes the value @var{0/1/2} to assign
7656 @var{no/highest/second-highest} priority to dispatch slot restricted
7657 instructions.
7659 @item -msched-costly-dep=@var{dependence_type}
7660 @opindex msched-costly-dep
7661 This option controls which dependences are considered costly
7662 by the target during instruction scheduling.  The argument
7663 @var{dependence_type} takes one of the following values:
7664 @var{no}: no dependence is costly,
7665 @var{all}: all dependences are costly,
7666 @var{true_store_to_load}: a true dependence from store to load is costly,
7667 @var{store_to_load}: any dependence from store to load is costly,
7668 @var{number}: any dependence which latency >= @var{number} is costly.
7670 @item -minsert-sched-nops=@var{scheme}
7671 @opindex minsert-sched-nops
7672 This option controls which nop insertion scheme will be used during
7673 the second scheduling pass. The argument @var{scheme} takes one of the
7674 following values:
7675 @var{no}: Don't insert nops.
7676 @var{pad}: Pad with nops any dispatch group which has vacant issue slots,
7677 according to the scheduler's grouping.
7678 @var{regroup_exact}: Insert nops to force costly dependent insns into
7679 separate groups.  Insert exactly as many nops as needed to force an insn
7680 to a new group, according to the estimated processor grouping.
7681 @var{number}: Insert nops to force costly dependent insns into
7682 separate groups.  Insert @var{number} nops to force an insn to a new group.
7684 @item -mcall-sysv
7685 @opindex mcall-sysv
7686 On System V.4 and embedded PowerPC systems compile code using calling
7687 conventions that adheres to the March 1995 draft of the System V
7688 Application Binary Interface, PowerPC processor supplement.  This is the
7689 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
7691 @item -mcall-sysv-eabi
7692 @opindex mcall-sysv-eabi
7693 Specify both @option{-mcall-sysv} and @option{-meabi} options.
7695 @item -mcall-sysv-noeabi
7696 @opindex mcall-sysv-noeabi
7697 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
7699 @item -mcall-solaris
7700 @opindex mcall-solaris
7701 On System V.4 and embedded PowerPC systems compile code for the Solaris
7702 operating system.
7704 @item -mcall-linux
7705 @opindex mcall-linux
7706 On System V.4 and embedded PowerPC systems compile code for the
7707 Linux-based GNU system.
7709 @item -mcall-gnu
7710 @opindex mcall-gnu
7711 On System V.4 and embedded PowerPC systems compile code for the
7712 Hurd-based GNU system.
7714 @item -mcall-netbsd
7715 @opindex mcall-netbsd
7716 On System V.4 and embedded PowerPC systems compile code for the
7717 NetBSD operating system.
7719 @item -maix-struct-return
7720 @opindex maix-struct-return
7721 Return all structures in memory (as specified by the AIX ABI)@.
7723 @item -msvr4-struct-return
7724 @opindex msvr4-struct-return
7725 Return structures smaller than 8 bytes in registers (as specified by the
7726 SVR4 ABI)@.
7728 @item -mabi=altivec
7729 @opindex mabi=altivec
7730 Extend the current ABI with AltiVec ABI extensions.  This does not
7731 change the default ABI, instead it adds the AltiVec ABI extensions to
7732 the current ABI@.
7734 @item -mabi=no-altivec
7735 @opindex mabi=no-altivec
7736 Disable AltiVec ABI extensions for the current ABI.
7738 @item -mprototype
7739 @itemx -mno-prototype
7740 @opindex mprototype
7741 @opindex mno-prototype
7742 On System V.4 and embedded PowerPC systems assume that all calls to
7743 variable argument functions are properly prototyped.  Otherwise, the
7744 compiler must insert an instruction before every non prototyped call to
7745 set or clear bit 6 of the condition code register (@var{CR}) to
7746 indicate whether floating point values were passed in the floating point
7747 registers in case the function takes a variable arguments.  With
7748 @option{-mprototype}, only calls to prototyped variable argument functions
7749 will set or clear the bit.
7751 @item -msim
7752 @opindex msim
7753 On embedded PowerPC systems, assume that the startup module is called
7754 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
7755 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}.
7756 configurations.
7758 @item -mmvme
7759 @opindex mmvme
7760 On embedded PowerPC systems, assume that the startup module is called
7761 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
7762 @file{libc.a}.
7764 @item -mads
7765 @opindex mads
7766 On embedded PowerPC systems, assume that the startup module is called
7767 @file{crt0.o} and the standard C libraries are @file{libads.a} and
7768 @file{libc.a}.
7770 @item -myellowknife
7771 @opindex myellowknife
7772 On embedded PowerPC systems, assume that the startup module is called
7773 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
7774 @file{libc.a}.
7776 @item -mvxworks
7777 @opindex mvxworks
7778 On System V.4 and embedded PowerPC systems, specify that you are
7779 compiling for a VxWorks system.
7781 @item -mwindiss
7782 @opindex mwindiss
7783 Specify that you are compiling for the WindISS simulation environment.
7785 @item -memb
7786 @opindex memb
7787 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
7788 header to indicate that @samp{eabi} extended relocations are used.
7790 @item -meabi
7791 @itemx -mno-eabi
7792 @opindex meabi
7793 @opindex mno-eabi
7794 On System V.4 and embedded PowerPC systems do (do not) adhere to the
7795 Embedded Applications Binary Interface (eabi) which is a set of
7796 modifications to the System V.4 specifications.  Selecting @option{-meabi}
7797 means that the stack is aligned to an 8 byte boundary, a function
7798 @code{__eabi} is called to from @code{main} to set up the eabi
7799 environment, and the @option{-msdata} option can use both @code{r2} and
7800 @code{r13} to point to two separate small data areas.  Selecting
7801 @option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
7802 do not call an initialization function from @code{main}, and the
7803 @option{-msdata} option will only use @code{r13} to point to a single
7804 small data area.  The @option{-meabi} option is on by default if you
7805 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
7807 @item -msdata=eabi
7808 @opindex msdata=eabi
7809 On System V.4 and embedded PowerPC systems, put small initialized
7810 @code{const} global and static data in the @samp{.sdata2} section, which
7811 is pointed to by register @code{r2}.  Put small initialized
7812 non-@code{const} global and static data in the @samp{.sdata} section,
7813 which is pointed to by register @code{r13}.  Put small uninitialized
7814 global and static data in the @samp{.sbss} section, which is adjacent to
7815 the @samp{.sdata} section.  The @option{-msdata=eabi} option is
7816 incompatible with the @option{-mrelocatable} option.  The
7817 @option{-msdata=eabi} option also sets the @option{-memb} option.
7819 @item -msdata=sysv
7820 @opindex msdata=sysv
7821 On System V.4 and embedded PowerPC systems, put small global and static
7822 data in the @samp{.sdata} section, which is pointed to by register
7823 @code{r13}.  Put small uninitialized global and static data in the
7824 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
7825 The @option{-msdata=sysv} option is incompatible with the
7826 @option{-mrelocatable} option.
7828 @item -msdata=default
7829 @itemx -msdata
7830 @opindex msdata=default
7831 @opindex msdata
7832 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
7833 compile code the same as @option{-msdata=eabi}, otherwise compile code the
7834 same as @option{-msdata=sysv}.
7836 @item -msdata-data
7837 @opindex msdata-data
7838 On System V.4 and embedded PowerPC systems, put small global and static
7839 data in the @samp{.sdata} section.  Put small uninitialized global and
7840 static data in the @samp{.sbss} section.  Do not use register @code{r13}
7841 to address small data however.  This is the default behavior unless
7842 other @option{-msdata} options are used.
7844 @item -msdata=none
7845 @itemx -mno-sdata
7846 @opindex msdata=none
7847 @opindex mno-sdata
7848 On embedded PowerPC systems, put all initialized global and static data
7849 in the @samp{.data} section, and all uninitialized data in the
7850 @samp{.bss} section.
7852 @item -G @var{num}
7853 @opindex G
7854 @cindex smaller data references (PowerPC)
7855 @cindex .sdata/.sdata2 references (PowerPC)
7856 On embedded PowerPC systems, put global and static items less than or
7857 equal to @var{num} bytes into the small data or bss sections instead of
7858 the normal data or bss section.  By default, @var{num} is 8.  The
7859 @option{-G @var{num}} switch is also passed to the linker.
7860 All modules should be compiled with the same @option{-G @var{num}} value.
7862 @item -mregnames
7863 @itemx -mno-regnames
7864 @opindex mregnames
7865 @opindex mno-regnames
7866 On System V.4 and embedded PowerPC systems do (do not) emit register
7867 names in the assembly language output using symbolic forms.
7869 @item -mlongcall
7870 @itemx -mno-longcall
7871 @opindex mlongcall
7872 @opindex mno-longcall
7873 Default to making all function calls indirectly, using a register, so
7874 that functions which reside further than 32 megabytes (33,554,432
7875 bytes) from the current location can be called.  This setting can be
7876 overridden by the @code{shortcall} function attribute, or by
7877 @code{#pragma longcall(0)}.
7879 Some linkers are capable of detecting out-of-range calls and generating
7880 glue code on the fly.  On these systems, long calls are unnecessary and
7881 generate slower code.  As of this writing, the AIX linker can do this,
7882 as can the GNU linker for PowerPC/64.  It is planned to add this feature
7883 to the GNU linker for 32-bit PowerPC systems as well.
7885 On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr
7886 callee, L42'', plus a ``branch island'' (glue code).  The two target
7887 addresses represent the callee and the ``branch island.'' The
7888 Darwin/PPC linker will prefer the first address and generate a ``bl
7889 callee'' if the PPC ``bl'' instruction will reach the callee directly;
7890 otherwise, the linker will generate ``bl L42'' to call the ``branch
7891 island.''  The ``branch island'' is appended to the body of the
7892 calling function; it computes the full 32-bit address of the callee
7893 and jumps to it.
7895 On Mach-O (Darwin) systems, this option directs the compiler emit to
7896 the glue for every direct call, and the Darwin linker decides whether
7897 to use or discard it.
7899 In the future, we may cause GCC to ignore all longcall specifications
7900 when the linker is known to generate glue.
7902 @item -pthread
7903 @opindex pthread
7904 Adds support for multithreading with the @dfn{pthreads} library.
7905 This option sets flags for both the preprocessor and linker.
7907 @end table
7909 @node Darwin Options
7910 @subsection Darwin Options
7911 @cindex Darwin options
7913 These options are defined for all architectures running the Darwin operating
7914 system.  They are useful for compatibility with other Mac OS compilers.
7916 @table @gcctabopt
7917 @item -F@var{dir}
7918 @opindex F
7919 Add the framework directory @var{dir} to the head of the list of
7920 directories to be searched for header files.  These directories are
7921 interleaved with those specified by @option{-I} options and are
7922 scanned in a left-to-right order.
7924 A framework directory is a directory with frameworks in it.  A
7925 framework is a directory with a @samp{"Headers"} and/or
7926 @samp{"PrivateHeaders"} directory contained directly in it that ends
7927 in @samp{".framework"}.  The name of a framework is the name of this
7928 directory excluding the @samp{".framework"}.  Headers associated with
7929 the framework are found in one of those two directories, with
7930 @samp{"Headers"} being searched first.  A subframework is a framework
7931 directory that is in a framework's @samp{"Frameworks"} directory.
7932 Includes of subframework headers can only appear in a header of a
7933 framework that contains the subframework, or in a sibling subframework
7934 header.  Two subframeworks are siblings if they occur in the same
7935 framework.  A subframework should not have the same name as a
7936 framework, a warning will be issued if this is violated.  Currently a
7937 subframework cannot have subframeworks, in the future, the mechanism
7938 may be extended to support this.  The standard frameworks can be found
7939 in @samp{"/System/Library/Frameworks"}, @samp{"/Library/Frameworks"}
7940 and @samp{"/Local/Library/Frameworks"}.  An example include looks like
7941 @code{#include <Framework/header.h>}, where @samp{Framework} denotes
7942 the name of the framework and header.h is found in the
7943 @samp{"PrivateHeaders"} or @samp{"Headers"} directory.
7945 @item -all_load
7946 @opindex all_load
7947 Loads all members of static archive libraries.
7948 See man ld(1) for more information.
7950 @item -arch_errors_fatal
7951 @opindex arch_errors_fatal
7952 Cause the errors having to do with files that have the wrong architecture
7953 to be fatal.
7955 @item -bind_at_load
7956 @opindex bind_at_load
7957 Causes the output file to be marked such that the dynamic linker will
7958 bind all undefined references when the file is loaded or launched.
7960 @item -bundle
7961 @opindex bundle
7962 Produce a Mach-o bundle format file.
7963 See man ld(1) for more information.
7965 @item -bundle_loader @var{executable}
7966 @opindex bundle_loader
7967 This specifies the @var{executable} that will be loading the build
7968 output file being linked. See man ld(1) for more information.
7970 @item -allowable_client  @var{client_name}
7971 @itemx -arch_only
7973 @itemx -client_name
7974 @itemx -compatibility_version
7975 @itemx -current_version
7976 @itemx -dependency-file
7977 @itemx -dylib_file
7978 @itemx -dylinker_install_name
7979 @itemx -dynamic
7980 @itemx -dynamiclib
7981 @itemx -exported_symbols_list
7982 @itemx -filelist
7983 @itemx -flat_namespace
7984 @itemx -force_cpusubtype_ALL
7985 @itemx -force_flat_namespace
7986 @itemx -headerpad_max_install_names
7987 @itemx -image_base
7988 @itemx -init
7989 @itemx -install_name
7990 @itemx -keep_private_externs
7991 @itemx -multi_module
7992 @itemx -multiply_defined
7993 @itemx -multiply_defined_unused
7994 @itemx -noall_load
7995 @itemx -nofixprebinding
7996 @itemx -nomultidefs
7997 @itemx -noprebind
7998 @itemx -noseglinkedit
7999 @itemx -pagezero_size
8000 @itemx -prebind
8001 @itemx -prebind_all_twolevel_modules
8002 @itemx -private_bundle
8003 @itemx -read_only_relocs
8004 @itemx -sectalign
8005 @itemx -sectobjectsymbols
8006 @itemx -whyload
8007 @itemx -seg1addr
8008 @itemx -sectcreate
8009 @itemx -sectobjectsymbols
8010 @itemx -sectorder
8011 @itemx -seg_addr_table
8012 @itemx -seg_addr_table_filename
8013 @itemx -seglinkedit
8014 @itemx -segprot
8015 @itemx -segs_read_only_addr
8016 @itemx -segs_read_write_addr
8017 @itemx -single_module
8018 @itemx -static
8019 @itemx -sub_library
8020 @itemx -sub_umbrella
8021 @itemx -twolevel_namespace
8022 @itemx -umbrella
8023 @itemx -undefined
8024 @itemx -unexported_symbols_list
8025 @itemx -weak_reference_mismatches
8026 @itemx -whatsloaded
8028 @opindex allowable_client
8029 @opindex arch_only
8030 @opindex client_name
8031 @opindex compatibility_version
8032 @opindex current_version
8033 @opindex dependency-file
8034 @opindex dylib_file
8035 @opindex dylinker_install_name
8036 @opindex dynamic
8037 @opindex dynamiclib
8038 @opindex exported_symbols_list
8039 @opindex filelist
8040 @opindex flat_namespace
8041 @opindex force_cpusubtype_ALL
8042 @opindex force_flat_namespace
8043 @opindex headerpad_max_install_names
8044 @opindex image_base
8045 @opindex init
8046 @opindex install_name
8047 @opindex keep_private_externs
8048 @opindex multi_module
8049 @opindex multiply_defined
8050 @opindex multiply_defined_unused
8051 @opindex noall_load
8052 @opindex nofixprebinding
8053 @opindex nomultidefs
8054 @opindex noprebind
8055 @opindex noseglinkedit
8056 @opindex pagezero_size
8057 @opindex prebind
8058 @opindex prebind_all_twolevel_modules
8059 @opindex private_bundle
8060 @opindex read_only_relocs
8061 @opindex sectalign
8062 @opindex sectobjectsymbols
8063 @opindex whyload
8064 @opindex seg1addr
8065 @opindex sectcreate
8066 @opindex sectobjectsymbols
8067 @opindex sectorder
8068 @opindex seg_addr_table
8069 @opindex seg_addr_table_filename
8070 @opindex seglinkedit
8071 @opindex segprot
8072 @opindex segs_read_only_addr
8073 @opindex segs_read_write_addr
8074 @opindex single_module
8075 @opindex static
8076 @opindex sub_library
8077 @opindex sub_umbrella
8078 @opindex twolevel_namespace
8079 @opindex umbrella
8080 @opindex undefined
8081 @opindex unexported_symbols_list
8082 @opindex weak_reference_mismatches
8083 @opindex whatsloaded
8085 These options are available for Darwin linker. Darwin linker man page
8086 describes them in detail.
8087 @end table
8090 @node MIPS Options
8091 @subsection MIPS Options
8092 @cindex MIPS options
8094 @table @gcctabopt
8096 @item -EB
8097 @opindex EB
8098 Generate big-endian code.
8100 @item -EL
8101 @opindex EL
8102 Generate little-endian code.  This is the default for @samp{mips*el-*-*}
8103 configurations.
8105 @item -march=@var{arch}
8106 @opindex march
8107 Generate code that will run on @var{arch}, which can be the name of a
8108 generic MIPS ISA, or the name of a particular processor.
8109 The ISA names are:
8110 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
8111 @samp{mips32}, @samp{mips32r2}, and @samp{mips64}.
8112 The processor names are:
8113 @samp{4kc}, @samp{4kp}, @samp{5kc}, @samp{20kc},
8114 @samp{m4k},
8115 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
8116 @samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000}, @samp{rm7000},
8117 @samp{rm9000},
8118 @samp{orion},
8119 @samp{sb1},
8120 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
8121 @samp{vr5000}, @samp{vr5400} and @samp{vr5500}.
8122 The special value @samp{from-abi} selects the
8123 most compatible architecture for the selected ABI (that is,
8124 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
8126 In processor names, a final @samp{000} can be abbreviated as @samp{k}
8127 (for example, @samp{-march=r2k}).  Prefixes are optional, and
8128 @samp{vr} may be written @samp{r}.
8130 GCC defines two macros based on the value of this option.  The first
8131 is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
8132 a string.  The second has the form @samp{_MIPS_ARCH_@var{foo}},
8133 where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
8134 For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
8135 to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
8137 Note that the @samp{_MIPS_ARCH} macro uses the processor names given
8138 above.  In other words, it will have the full prefix and will not
8139 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
8140 the macro names the resolved architecture (either @samp{"mips1"} or
8141 @samp{"mips3"}).  It names the default architecture when no
8142 @option{-march} option is given.
8144 @item -mtune=@var{arch}
8145 @opindex mtune
8146 Optimize for @var{arch}.  Among other things, this option controls
8147 the way instructions are scheduled, and the perceived cost of arithmetic
8148 operations.  The list of @var{arch} values is the same as for
8149 @option{-march}.
8151 When this option is not used, GCC will optimize for the processor
8152 specified by @option{-march}.  By using @option{-march} and
8153 @option{-mtune} together, it is possible to generate code that will
8154 run on a family of processors, but optimize the code for one
8155 particular member of that family.
8157 @samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
8158 @samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
8159 @samp{-march} ones described above.
8161 @item -mips1
8162 @opindex mips1
8163 Equivalent to @samp{-march=mips1}.
8165 @item -mips2
8166 @opindex mips2
8167 Equivalent to @samp{-march=mips2}.
8169 @item -mips3
8170 @opindex mips3
8171 Equivalent to @samp{-march=mips3}.
8173 @item -mips4
8174 @opindex mips4
8175 Equivalent to @samp{-march=mips4}.
8177 @item -mips32
8178 @opindex mips32
8179 Equivalent to @samp{-march=mips32}.
8181 @item -mips32r2
8182 @opindex mips32r2
8183 Equivalent to @samp{-march=mips32r2}.
8185 @item -mips64
8186 @opindex mips64
8187 Equivalent to @samp{-march=mips64}.
8189 @item -mips16
8190 @itemx -mno-mips16
8191 @opindex mips16
8192 @opindex mno-mips16
8193 Use (do not use) the MIPS16 ISA.
8195 @item -mabi=32
8196 @itemx -mabi=o64
8197 @itemx -mabi=n32
8198 @itemx -mabi=64
8199 @itemx -mabi=eabi
8200 @opindex mabi=32
8201 @opindex mabi=o64
8202 @opindex mabi=n32
8203 @opindex mabi=64
8204 @opindex mabi=eabi
8205 Generate code for the given ABI@.
8207 Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
8208 generates 64-bit code when you select a 64-bit architecture, but you
8209 can use @option{-mgp32} to get 32-bit code instead.
8211 For information about the O64 ABI, see
8212 @w{@uref{http://gcc.gnu.org/projects/mipso64-abi.html}}.
8214 @item -mabicalls
8215 @itemx -mno-abicalls
8216 @opindex mabicalls
8217 @opindex mno-abicalls
8218 Generate (do not generate) SVR4-style position-independent code.
8219 @option{-mabicalls} is the default for SVR4-based systems.
8221 @item -mxgot
8222 @itemx -mno-xgot
8223 @opindex mxgot
8224 @opindex mno-xgot
8225 Lift (do not lift) the usual restrictions on the size of the global
8226 offset table.
8228 GCC normally uses a single instruction to load values from the GOT.
8229 While this is relatively efficient, it will only work if the GOT
8230 is smaller than about 64k.  Anything larger will cause the linker
8231 to report an error such as:
8233 @cindex relocation truncated to fit (MIPS)
8234 @smallexample
8235 relocation truncated to fit: R_MIPS_GOT16 foobar
8236 @end smallexample
8238 If this happens, you should recompile your code with @option{-mxgot}.
8239 It should then work with very large GOTs, although it will also be
8240 less efficient, since it will take three instructions to fetch the
8241 value of a global symbol.
8243 Note that some linkers can create multiple GOTs.  If you have such a
8244 linker, you should only need to use @option{-mxgot} when a single object
8245 file accesses more than 64k's worth of GOT entries.  Very few do.
8247 These options have no effect unless GCC is generating position
8248 independent code.
8250 @item -mgp32
8251 @opindex mgp32
8252 Assume that general-purpose registers are 32 bits wide.
8254 @item -mgp64
8255 @opindex mgp64
8256 Assume that general-purpose registers are 64 bits wide.
8258 @item -mfp32
8259 @opindex mfp32
8260 Assume that floating-point registers are 32 bits wide.
8262 @item -mfp64
8263 @opindex mfp64
8264 Assume that floating-point registers are 64 bits wide.
8266 @item -mhard-float
8267 @opindex mhard-float
8268 Use floating-point coprocessor instructions.
8270 @item -msoft-float
8271 @opindex msoft-float
8272 Do not use floating-point coprocessor instructions.  Implement
8273 floating-point calculations using library calls instead.
8275 @item -msingle-float
8276 @opindex msingle-float
8277 Assume that the floating-point coprocessor only supports single-precision
8278 operations.
8280 @itemx -mdouble-float
8281 @opindex mdouble-float
8282 Assume that the floating-point coprocessor supports double-precision
8283 operations.  This is the default.
8285 @item -mint64
8286 @opindex mint64
8287 Force @code{int} and @code{long} types to be 64 bits wide.  See
8288 @option{-mlong32} for an explanation of the default and the way
8289 that the pointer size is determined.
8291 @item -mlong64
8292 @opindex mlong64
8293 Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
8294 an explanation of the default and the way that the pointer size is
8295 determined.
8297 @item -mlong32
8298 @opindex mlong32
8299 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
8301 The default size of @code{int}s, @code{long}s and pointers depends on
8302 the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
8303 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
8304 32-bit @code{long}s.  Pointers are the same size as @code{long}s,
8305 or the same size as integer registers, whichever is smaller.
8307 @item -G @var{num}
8308 @opindex G
8309 @cindex smaller data references (MIPS)
8310 @cindex gp-relative references (MIPS)
8311 Put global and static items less than or equal to @var{num} bytes into
8312 the small data or bss section instead of the normal data or bss section.
8313 This allows the data to be accessed using a single instruction.
8315 All modules should be compiled with the same @option{-G @var{num}}
8316 value.
8318 @item -membedded-data
8319 @itemx -mno-embedded-data
8320 @opindex membedded-data
8321 @opindex mno-embedded-data
8322 Allocate variables to the read-only data section first if possible, then
8323 next in the small data section if possible, otherwise in data.  This gives
8324 slightly slower code than the default, but reduces the amount of RAM required
8325 when executing, and thus may be preferred for some embedded systems.
8327 @item -muninit-const-in-rodata
8328 @itemx -mno-uninit-const-in-rodata
8329 @opindex muninit-const-in-rodata
8330 @opindex mno-uninit-const-in-rodata
8331 Put uninitialized @code{const} variables in the read-only data section.
8332 This option is only meaningful in conjunction with @option{-membedded-data}.
8334 @item -msplit-addresses
8335 @itemx -mno-split-addresses
8336 @opindex msplit-addresses
8337 @opindex mno-split-addresses
8338 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
8339 relocation operators.  This option has been superceded by
8340 @option{-mexplicit-relocs} but is retained for backwards compatibility.
8342 @item -mexplicit-relocs
8343 @itemx -mno-explicit-relocs
8344 @opindex mexplicit-relocs
8345 @opindex mno-explicit-relocs
8346 Use (do not use) assembler relocation operators when dealing with symbolic
8347 addresses.  The alternative, selected by @option{-mno-explicit-relocs},
8348 is to use assembler macros instead.
8350 @option{-mexplicit-relocs} is usually the default if GCC was configured
8351 to use an assembler that supports relocation operators.  However, the
8352 combination of @option{-mabicalls} and @option{-fno-unit-at-a-time}
8353 implies @option{-mno-explicit-relocs} unless explicitly overridden.
8354 This is because, when generating abicalls, the choice of relocation
8355 depends on whether a symbol is local or global.  In some rare cases,
8356 GCC will not be able to decide this until the whole compilation unit
8357 has been read.
8359 @item -mrnames
8360 @itemx -mno-rnames
8361 @opindex mrnames
8362 @opindex mno-rnames
8363 Generate (do not generate) code that refers to registers using their
8364 software names.  The default is @option{-mno-rnames}, which tells GCC
8365 to use hardware names like @samp{$4} instead of software names like
8366 @samp{a0}.  The only assembler known to support @option{-rnames} is
8367 the Algorithmics assembler.
8369 @item -mcheck-zero-division
8370 @itemx -mno-check-zero-division
8371 @opindex mcheck-zero-division
8372 @opindex mno-check-zero-division
8373 Trap (do not trap) on integer division by zero.  The default is
8374 @option{-mcheck-zero-division}.
8376 @item -mmemcpy
8377 @itemx -mno-memcpy
8378 @opindex mmemcpy
8379 @opindex mno-memcpy
8380 Force (do not force) the use of @code{memcpy()} for non-trivial block
8381 moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
8382 most constant-sized copies.
8384 @item -mlong-calls
8385 @itemx -mno-long-calls
8386 @opindex mlong-calls
8387 @opindex mno-long-calls
8388 Disable (do not disable) use of the @code{jal} instruction.  Calling
8389 functions using @code{jal} is more efficient but requires the caller
8390 and callee to be in the same 256 megabyte segment.
8392 This option has no effect on abicalls code.  The default is
8393 @option{-mno-long-calls}.
8395 @item -mmad
8396 @itemx -mno-mad
8397 @opindex mmad
8398 @opindex mno-mad
8399 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
8400 instructions, as provided by the R4650 ISA.
8402 @item -mfused-madd
8403 @itemx -mno-fused-madd
8404 @opindex mfused-madd
8405 @opindex mno-fused-madd
8406 Enable (disable) use of the floating point multiply-accumulate
8407 instructions, when they are available.  The default is
8408 @option{-mfused-madd}.
8410 When multiply-accumulate instructions are used, the intermediate
8411 product is calculated to infinite precision and is not subject to
8412 the FCSR Flush to Zero bit.  This may be undesirable in some
8413 circumstances.
8415 @item -nocpp
8416 @opindex nocpp
8417 Tell the MIPS assembler to not run its preprocessor over user
8418 assembler files (with a @samp{.s} suffix) when assembling them.
8420 @item -mfix-r4000
8421 @itemx -mno-fix-r4000
8422 @opindex mfix-r4000
8423 @opindex mno-fix-r4000
8424 Work around certain R4000 CPU errata:
8425 @itemize @minus
8426 @item
8427 A double-word or a variable shift may give an incorrect result if executed
8428 immediately after starting an integer division.
8429 @item
8430 A double-word or a variable shift may give an incorrect result if executed
8431 while an integer multiplication is in progress.
8432 @item
8433 An integer division may give an incorrect result if started in a delay slot
8434 of a taken branch or a jump.
8435 @end itemize
8437 @item -mfix-r4400
8438 @itemx -mno-fix-r4400
8439 @opindex mfix-r4400
8440 @opindex mno-fix-r4400
8441 Work around certain R4400 CPU errata:
8442 @itemize @minus
8443 @item
8444 A double-word or a variable shift may give an incorrect result if executed
8445 immediately after starting an integer division.
8446 @end itemize
8448 @item -mfix-vr4120
8449 @itemx -mno-fix-vr4120
8450 @opindex mfix-vr4120
8451 Work around certain VR4120 errata:
8452 @itemize @minus
8453 @item
8454 @code{dmultu} does not always produce the correct result.
8455 @item
8456 @code{div} and @code{ddiv} do not always produce the correct result if one
8457 of the operands is negative.
8458 @end itemize
8459 The workarounds for the division errata rely on special functions in
8460 @file{libgcc.a}.  At present, these functions are only provided by
8461 the @code{mips64vr*-elf} configurations.
8463 Other VR4120 errata require a nop to be inserted between certain pairs of
8464 instructions.  These errata are handled by the assembler, not by GCC itself.
8466 @item -mfix-sb1
8467 @itemx -mno-fix-sb1
8468 @opindex mfix-sb1
8469 Work around certain SB-1 CPU core errata.
8470 (This flag currently works around the SB-1 revision 2
8471 ``F1'' and ``F2'' floating point errata.)
8473 @item -mflush-func=@var{func}
8474 @itemx -mno-flush-func
8475 @opindex mflush-func
8476 Specifies the function to call to flush the I and D caches, or to not
8477 call any such function.  If called, the function must take the same
8478 arguments as the common @code{_flush_func()}, that is, the address of the
8479 memory range for which the cache is being flushed, the size of the
8480 memory range, and the number 3 (to flush both caches).  The default
8481 depends on the target GCC was configured for, but commonly is either
8482 @samp{_flush_func} or @samp{__cpu_flush}.
8484 @item -mbranch-likely
8485 @itemx -mno-branch-likely
8486 @opindex mbranch-likely
8487 @opindex mno-branch-likely
8488 Enable or disable use of Branch Likely instructions, regardless of the
8489 default for the selected architecture.  By default, Branch Likely
8490 instructions may be generated if they are supported by the selected
8491 architecture.  An exception is for the MIPS32 and MIPS64 architectures
8492 and processors which implement those architectures; for those, Branch
8493 Likely instructions will not be generated by default because the MIPS32
8494 and MIPS64 architectures specifically deprecate their use.
8496 @item -mfp-exceptions
8497 @itemx -mno-fp-exceptions
8498 @opindex mfp-exceptions
8499 Specifies whether FP exceptions are enabled.  This affects how we schedule
8500 FP instructions for some processors.  The default is that FP exceptions are
8501 enabled.
8503 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
8504 64-bit code, then we can use both FP pipes.  Otherwise, we can only use one
8505 FP pipe.
8507 @item -mvr4130-align
8508 @itemx -mno-vr4130-align
8509 @opindex mvr4130-align
8510 The VR4130 pipeline is two-way superscalar, but can only issue two
8511 instructions together if the first one is 8-byte aligned.  When this
8512 option is enabled, GCC will align pairs of instructions that it
8513 thinks should execute in parallel.
8515 This option only has an effect when optimizing for the VR4130.
8516 It normally makes code faster, but at the expense of making it bigger.
8517 It is enabled by default at optimization level @option{-O3}.
8518 @end table
8520 @node i386 and x86-64 Options
8521 @subsection Intel 386 and AMD x86-64 Options
8522 @cindex i386 Options
8523 @cindex x86-64 Options
8524 @cindex Intel 386 Options
8525 @cindex AMD x86-64 Options
8527 These @samp{-m} options are defined for the i386 and x86-64 family of
8528 computers:
8530 @table @gcctabopt
8531 @item -mtune=@var{cpu-type}
8532 @opindex mtune
8533 Tune to @var{cpu-type} everything applicable about the generated code, except
8534 for the ABI and the set of available instructions.  The choices for
8535 @var{cpu-type} are:
8536 @table @emph
8537 @item i386
8538 Original Intel's i386 CPU.
8539 @item i486
8540 Intel's i486 CPU.  (No scheduling is implemented for this chip.)
8541 @item i586, pentium
8542 Intel Pentium CPU with no MMX support.
8543 @item pentium-mmx
8544 Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
8545 @item i686, pentiumpro
8546 Intel PentiumPro CPU.
8547 @item pentium2
8548 Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
8549 @item pentium3, pentium3m
8550 Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
8551 support.
8552 @item pentium-m
8553 Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set
8554 support.  Used by Centrino notebooks.
8555 @item pentium4, pentium4m
8556 Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
8557 @item prescott
8558 Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction
8559 set support.
8560 @item nocona
8561 Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE,
8562 SSE2 and SSE3 instruction set support.
8563 @item k6
8564 AMD K6 CPU with MMX instruction set support.
8565 @item k6-2, k6-3
8566 Improved versions of AMD K6 CPU with MMX and 3dNOW! instruction set support.
8567 @item athlon, athlon-tbird
8568 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE prefetch instructions
8569 support.
8570 @item athlon-4, athlon-xp, athlon-mp
8571 Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and full SSE
8572 instruction set support.
8573 @item k8, opteron, athlon64, athlon-fx
8574 AMD K8 core based CPUs with x86-64 instruction set support.  (This supersets
8575 MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.)
8576 @item winchip-c6
8577 IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
8578 set support.
8579 @item winchip2
8580 IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW!
8581 instruction set support.
8582 @item c3
8583 Via C3 CPU with MMX and 3dNOW!  instruction set support.  (No scheduling is
8584 implemented for this chip.)
8585 @item c3-2
8586 Via C3-2 CPU with MMX and SSE instruction set support.  (No scheduling is
8587 implemented for this chip.)
8588 @end table
8590 While picking a specific @var{cpu-type} will schedule things appropriately
8591 for that particular chip, the compiler will not generate any code that
8592 does not run on the i386 without the @option{-march=@var{cpu-type}} option
8593 being used.
8595 @item -march=@var{cpu-type}
8596 @opindex march
8597 Generate instructions for the machine type @var{cpu-type}.  The choices
8598 for @var{cpu-type} are the same as for @option{-mtune}.  Moreover,
8599 specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
8601 @item -mcpu=@var{cpu-type}
8602 @opindex mcpu
8603 A deprecated synonym for @option{-mtune}.
8605 @item -m386
8606 @itemx -m486
8607 @itemx -mpentium
8608 @itemx -mpentiumpro
8609 @opindex m386
8610 @opindex m486
8611 @opindex mpentium
8612 @opindex mpentiumpro
8613 These options are synonyms for @option{-mtune=i386}, @option{-mtune=i486},
8614 @option{-mtune=pentium}, and @option{-mtune=pentiumpro} respectively.
8615 These synonyms are deprecated.
8617 @item -mfpmath=@var{unit}
8618 @opindex march
8619 Generate floating point arithmetics for selected unit @var{unit}.  The choices
8620 for @var{unit} are:
8622 @table @samp
8623 @item 387
8624 Use the standard 387 floating point coprocessor present majority of chips and
8625 emulated otherwise.  Code compiled with this option will run almost everywhere.
8626 The temporary results are computed in 80bit precision instead of precision
8627 specified by the type resulting in slightly different results compared to most
8628 of other chips. See @option{-ffloat-store} for more detailed description.
8630 This is the default choice for i386 compiler.
8632 @item sse
8633 Use scalar floating point instructions present in the SSE instruction set.
8634 This instruction set is supported by Pentium3 and newer chips, in the AMD line
8635 by Athlon-4, Athlon-xp and Athlon-mp chips.  The earlier version of SSE
8636 instruction set supports only single precision arithmetics, thus the double and
8637 extended precision arithmetics is still done using 387.  Later version, present
8638 only in Pentium4 and the future AMD x86-64 chips supports double precision
8639 arithmetics too.
8641 For i387 you need to use @option{-march=@var{cpu-type}}, @option{-msse} or
8642 @option{-msse2} switches to enable SSE extensions and make this option
8643 effective.  For x86-64 compiler, these extensions are enabled by default.
8645 The resulting code should be considerably faster in the majority of cases and avoid
8646 the numerical instability problems of 387 code, but may break some existing
8647 code that expects temporaries to be 80bit.
8649 This is the default choice for the x86-64 compiler.
8651 @item sse,387
8652 Attempt to utilize both instruction sets at once.  This effectively double the
8653 amount of available registers and on chips with separate execution units for
8654 387 and SSE the execution resources too.  Use this option with care, as it is
8655 still experimental, because the GCC register allocator does not model separate
8656 functional units well resulting in instable performance.
8657 @end table
8659 @item -masm=@var{dialect}
8660 @opindex masm=@var{dialect}
8661 Output asm instructions using selected @var{dialect}. Supported choices are
8662 @samp{intel} or @samp{att} (the default one).
8664 @item -mieee-fp
8665 @itemx -mno-ieee-fp
8666 @opindex mieee-fp
8667 @opindex mno-ieee-fp
8668 Control whether or not the compiler uses IEEE floating point
8669 comparisons.  These handle correctly the case where the result of a
8670 comparison is unordered.
8672 @item -msoft-float
8673 @opindex msoft-float
8674 Generate output containing library calls for floating point.
8675 @strong{Warning:} the requisite libraries are not part of GCC@.
8676 Normally the facilities of the machine's usual C compiler are used, but
8677 this can't be done directly in cross-compilation.  You must make your
8678 own arrangements to provide suitable library functions for
8679 cross-compilation.
8681 On machines where a function returns floating point results in the 80387
8682 register stack, some floating point opcodes may be emitted even if
8683 @option{-msoft-float} is used.
8685 @item -mno-fp-ret-in-387
8686 @opindex mno-fp-ret-in-387
8687 Do not use the FPU registers for return values of functions.
8689 The usual calling convention has functions return values of types
8690 @code{float} and @code{double} in an FPU register, even if there
8691 is no FPU@.  The idea is that the operating system should emulate
8692 an FPU@.
8694 The option @option{-mno-fp-ret-in-387} causes such values to be returned
8695 in ordinary CPU registers instead.
8697 @item -mno-fancy-math-387
8698 @opindex mno-fancy-math-387
8699 Some 387 emulators do not support the @code{sin}, @code{cos} and
8700 @code{sqrt} instructions for the 387.  Specify this option to avoid
8701 generating those instructions.  This option is the default on FreeBSD,
8702 OpenBSD and NetBSD@.  This option is overridden when @option{-march}
8703 indicates that the target cpu will always have an FPU and so the
8704 instruction will not need emulation.  As of revision 2.6.1, these
8705 instructions are not generated unless you also use the
8706 @option{-funsafe-math-optimizations} switch.
8708 @item -malign-double
8709 @itemx -mno-align-double
8710 @opindex malign-double
8711 @opindex mno-align-double
8712 Control whether GCC aligns @code{double}, @code{long double}, and
8713 @code{long long} variables on a two word boundary or a one word
8714 boundary.  Aligning @code{double} variables on a two word boundary will
8715 produce code that runs somewhat faster on a @samp{Pentium} at the
8716 expense of more memory.
8718 @strong{Warning:} if you use the @option{-malign-double} switch,
8719 structures containing the above types will be aligned differently than
8720 the published application binary interface specifications for the 386
8721 and will not be binary compatible with structures in code compiled
8722 without that switch.
8724 @item -m96bit-long-double
8725 @itemx -m128bit-long-double
8726 @opindex m96bit-long-double
8727 @opindex m128bit-long-double
8728 These switches control the size of @code{long double} type. The i386
8729 application binary interface specifies the size to be 96 bits,
8730 so @option{-m96bit-long-double} is the default in 32 bit mode.
8732 Modern architectures (Pentium and newer) would prefer @code{long double}
8733 to be aligned to an 8 or 16 byte boundary.  In arrays or structures
8734 conforming to the ABI, this would not be possible.  So specifying a
8735 @option{-m128bit-long-double} will align @code{long double}
8736 to a 16 byte boundary by padding the @code{long double} with an additional
8737 32 bit zero.
8739 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
8740 its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
8742 Notice that neither of these options enable any extra precision over the x87
8743 standard of 80 bits for a @code{long double}.
8745 @strong{Warning:} if you override the default value for your target ABI, the
8746 structures and arrays containing @code{long double} variables will change
8747 their size as well as function calling convention for function taking
8748 @code{long double} will be modified.  Hence they will not be binary
8749 compatible with arrays or structures in code compiled without that switch.
8752 @item -msvr3-shlib
8753 @itemx -mno-svr3-shlib
8754 @opindex msvr3-shlib
8755 @opindex mno-svr3-shlib
8756 Control whether GCC places uninitialized local variables into the
8757 @code{bss} or @code{data} segments.  @option{-msvr3-shlib} places them
8758 into @code{bss}.  These options are meaningful only on System V Release 3.
8760 @item -mrtd
8761 @opindex mrtd
8762 Use a different function-calling convention, in which functions that
8763 take a fixed number of arguments return with the @code{ret} @var{num}
8764 instruction, which pops their arguments while returning.  This saves one
8765 instruction in the caller since there is no need to pop the arguments
8766 there.
8768 You can specify that an individual function is called with this calling
8769 sequence with the function attribute @samp{stdcall}.  You can also
8770 override the @option{-mrtd} option by using the function attribute
8771 @samp{cdecl}.  @xref{Function Attributes}.
8773 @strong{Warning:} this calling convention is incompatible with the one
8774 normally used on Unix, so you cannot use it if you need to call
8775 libraries compiled with the Unix compiler.
8777 Also, you must provide function prototypes for all functions that
8778 take variable numbers of arguments (including @code{printf});
8779 otherwise incorrect code will be generated for calls to those
8780 functions.
8782 In addition, seriously incorrect code will result if you call a
8783 function with too many arguments.  (Normally, extra arguments are
8784 harmlessly ignored.)
8786 @item -mregparm=@var{num}
8787 @opindex mregparm
8788 Control how many registers are used to pass integer arguments.  By
8789 default, no registers are used to pass arguments, and at most 3
8790 registers can be used.  You can control this behavior for a specific
8791 function by using the function attribute @samp{regparm}.
8792 @xref{Function Attributes}.
8794 @strong{Warning:} if you use this switch, and
8795 @var{num} is nonzero, then you must build all modules with the same
8796 value, including any libraries.  This includes the system libraries and
8797 startup modules.
8799 @item -mpreferred-stack-boundary=@var{num}
8800 @opindex mpreferred-stack-boundary
8801 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
8802 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
8803 the default is 4 (16 bytes or 128 bits), except when optimizing for code
8804 size (@option{-Os}), in which case the default is the minimum correct
8805 alignment (4 bytes for x86, and 8 bytes for x86-64).
8807 On Pentium and PentiumPro, @code{double} and @code{long double} values
8808 should be aligned to an 8 byte boundary (see @option{-malign-double}) or
8809 suffer significant run time performance penalties.  On Pentium III, the
8810 Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar
8811 penalties if it is not 16 byte aligned.
8813 To ensure proper alignment of this values on the stack, the stack boundary
8814 must be as aligned as that required by any value stored on the stack.
8815 Further, every function must be generated such that it keeps the stack
8816 aligned.  Thus calling a function compiled with a higher preferred
8817 stack boundary from a function compiled with a lower preferred stack
8818 boundary will most likely misalign the stack.  It is recommended that
8819 libraries that use callbacks always use the default setting.
8821 This extra alignment does consume extra stack space, and generally
8822 increases code size.  Code that is sensitive to stack space usage, such
8823 as embedded systems and operating system kernels, may want to reduce the
8824 preferred alignment to @option{-mpreferred-stack-boundary=2}.
8826 @item -mmmx
8827 @itemx -mno-mmx
8828 @item -msse
8829 @itemx -mno-sse
8830 @item -msse2
8831 @itemx -mno-sse2
8832 @item -msse3
8833 @itemx -mno-sse3
8834 @item -m3dnow
8835 @itemx -mno-3dnow
8836 @opindex mmmx
8837 @opindex mno-mmx
8838 @opindex msse
8839 @opindex mno-sse
8840 @opindex m3dnow
8841 @opindex mno-3dnow
8842 These switches enable or disable the use of built-in functions that allow
8843 direct access to the MMX, SSE, SSE2, SSE3 and 3Dnow extensions of the
8844 instruction set.
8846 @xref{X86 Built-in Functions}, for details of the functions enabled
8847 and disabled by these switches.
8849 To have SSE/SSE2 instructions generated automatically from floating-point
8850 code, see @option{-mfpmath=sse}.
8852 @item -mpush-args
8853 @itemx -mno-push-args
8854 @opindex mpush-args
8855 @opindex mno-push-args
8856 Use PUSH operations to store outgoing parameters.  This method is shorter
8857 and usually equally fast as method using SUB/MOV operations and is enabled
8858 by default.  In some cases disabling it may improve performance because of
8859 improved scheduling and reduced dependencies.
8861 @item -maccumulate-outgoing-args
8862 @opindex maccumulate-outgoing-args
8863 If enabled, the maximum amount of space required for outgoing arguments will be
8864 computed in the function prologue.  This is faster on most modern CPUs
8865 because of reduced dependencies, improved scheduling and reduced stack usage
8866 when preferred stack boundary is not equal to 2.  The drawback is a notable
8867 increase in code size.  This switch implies @option{-mno-push-args}.
8869 @item -mthreads
8870 @opindex mthreads
8871 Support thread-safe exception handling on @samp{Mingw32}.  Code that relies
8872 on thread-safe exception handling must compile and link all code with the
8873 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
8874 @option{-D_MT}; when linking, it links in a special thread helper library
8875 @option{-lmingwthrd} which cleans up per thread exception handling data.
8877 @item -mno-align-stringops
8878 @opindex mno-align-stringops
8879 Do not align destination of inlined string operations.  This switch reduces
8880 code size and improves performance in case the destination is already aligned,
8881 but GCC doesn't know about it.
8883 @item -minline-all-stringops
8884 @opindex minline-all-stringops
8885 By default GCC inlines string operations only when destination is known to be
8886 aligned at least to 4 byte boundary.  This enables more inlining, increase code
8887 size, but may improve performance of code that depends on fast memcpy, strlen
8888 and memset for short lengths.
8890 @item -momit-leaf-frame-pointer
8891 @opindex momit-leaf-frame-pointer
8892 Don't keep the frame pointer in a register for leaf functions.  This
8893 avoids the instructions to save, set up and restore frame pointers and
8894 makes an extra register available in leaf functions.  The option
8895 @option{-fomit-frame-pointer} removes the frame pointer for all functions
8896 which might make debugging harder.
8898 @item -mtls-direct-seg-refs
8899 @itemx -mno-tls-direct-seg-refs
8900 @opindex mtls-direct-seg-refs
8901 Controls whether TLS variables may be accessed with offsets from the
8902 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
8903 or whether the thread base pointer must be added.  Whether or not this
8904 is legal depends on the operating system, and whether it maps the
8905 segment to cover the entire TLS area.
8907 For systems that use GNU libc, the default is on.
8908 @end table
8910 These @samp{-m} switches are supported in addition to the above
8911 on AMD x86-64 processors in 64-bit environments.
8913 @table @gcctabopt
8914 @item -m32
8915 @itemx -m64
8916 @opindex m32
8917 @opindex m64
8918 Generate code for a 32-bit or 64-bit environment.
8919 The 32-bit environment sets int, long and pointer to 32 bits and
8920 generates code that runs on any i386 system.
8921 The 64-bit environment sets int to 32 bits and long and pointer
8922 to 64 bits and generates code for AMD's x86-64 architecture.
8924 @item -mno-red-zone
8925 @opindex no-red-zone
8926 Do not use a so called red zone for x86-64 code.  The red zone is mandated
8927 by the x86-64 ABI, it is a 128-byte area beyond the location of the
8928 stack pointer that will not be modified by signal or interrupt handlers
8929 and therefore can be used for temporary data without adjusting the stack
8930 pointer.  The flag @option{-mno-red-zone} disables this red zone.
8932 @item -mcmodel=small
8933 @opindex mcmodel=small
8934 Generate code for the small code model: the program and its symbols must
8935 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
8936 Programs can be statically or dynamically linked.  This is the default
8937 code model.
8939 @item -mcmodel=kernel
8940 @opindex mcmodel=kernel
8941 Generate code for the kernel code model.  The kernel runs in the
8942 negative 2 GB of the address space.
8943 This model has to be used for Linux kernel code.
8945 @item -mcmodel=medium
8946 @opindex mcmodel=medium
8947 Generate code for the medium model: The program is linked in the lower 2
8948 GB of the address space but symbols can be located anywhere in the
8949 address space.  Programs can be statically or dynamically linked, but
8950 building of shared libraries are not supported with the medium model.
8952 @item -mcmodel=large
8953 @opindex mcmodel=large
8954 Generate code for the large model: This model makes no assumptions
8955 about addresses and sizes of sections.  Currently GCC does not implement
8956 this model.
8957 @end table
8959 @node HPPA Options
8960 @subsection HPPA Options
8961 @cindex HPPA Options
8963 These @samp{-m} options are defined for the HPPA family of computers:
8965 @table @gcctabopt
8966 @item -march=@var{architecture-type}
8967 @opindex march
8968 Generate code for the specified architecture.  The choices for
8969 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
8970 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
8971 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
8972 architecture option for your machine.  Code compiled for lower numbered
8973 architectures will run on higher numbered architectures, but not the
8974 other way around.
8976 @item -mpa-risc-1-0
8977 @itemx -mpa-risc-1-1
8978 @itemx -mpa-risc-2-0
8979 @opindex mpa-risc-1-0
8980 @opindex mpa-risc-1-1
8981 @opindex mpa-risc-2-0
8982 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
8984 @item -mbig-switch
8985 @opindex mbig-switch
8986 Generate code suitable for big switch tables.  Use this option only if
8987 the assembler/linker complain about out of range branches within a switch
8988 table.
8990 @item -mjump-in-delay
8991 @opindex mjump-in-delay
8992 Fill delay slots of function calls with unconditional jump instructions
8993 by modifying the return pointer for the function call to be the target
8994 of the conditional jump.
8996 @item -mdisable-fpregs
8997 @opindex mdisable-fpregs
8998 Prevent floating point registers from being used in any manner.  This is
8999 necessary for compiling kernels which perform lazy context switching of
9000 floating point registers.  If you use this option and attempt to perform
9001 floating point operations, the compiler will abort.
9003 @item -mdisable-indexing
9004 @opindex mdisable-indexing
9005 Prevent the compiler from using indexing address modes.  This avoids some
9006 rather obscure problems when compiling MIG generated code under MACH@.
9008 @item -mno-space-regs
9009 @opindex mno-space-regs
9010 Generate code that assumes the target has no space registers.  This allows
9011 GCC to generate faster indirect calls and use unscaled index address modes.
9013 Such code is suitable for level 0 PA systems and kernels.
9015 @item -mfast-indirect-calls
9016 @opindex mfast-indirect-calls
9017 Generate code that assumes calls never cross space boundaries.  This
9018 allows GCC to emit code which performs faster indirect calls.
9020 This option will not work in the presence of shared libraries or nested
9021 functions.
9023 @item -mlong-load-store
9024 @opindex mlong-load-store
9025 Generate 3-instruction load and store sequences as sometimes required by
9026 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
9027 the HP compilers.
9029 @item -mportable-runtime
9030 @opindex mportable-runtime
9031 Use the portable calling conventions proposed by HP for ELF systems.
9033 @item -mgas
9034 @opindex mgas
9035 Enable the use of assembler directives only GAS understands.
9037 @item -mschedule=@var{cpu-type}
9038 @opindex mschedule
9039 Schedule code according to the constraints for the machine type
9040 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
9041 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
9042 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
9043 proper scheduling option for your machine.  The default scheduling is
9044 @samp{8000}.
9046 @item -mlinker-opt
9047 @opindex mlinker-opt
9048 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
9049 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
9050 linkers in which they give bogus error messages when linking some programs.
9052 @item -msoft-float
9053 @opindex msoft-float
9054 Generate output containing library calls for floating point.
9055 @strong{Warning:} the requisite libraries are not available for all HPPA
9056 targets.  Normally the facilities of the machine's usual C compiler are
9057 used, but this cannot be done directly in cross-compilation.  You must make
9058 your own arrangements to provide suitable library functions for
9059 cross-compilation.  The embedded target @samp{hppa1.1-*-pro}
9060 does provide software floating point support.
9062 @option{-msoft-float} changes the calling convention in the output file;
9063 therefore, it is only useful if you compile @emph{all} of a program with
9064 this option.  In particular, you need to compile @file{libgcc.a}, the
9065 library that comes with GCC, with @option{-msoft-float} in order for
9066 this to work.
9068 @item -msio
9069 @opindex msio
9070 Generate the predefine, @code{_SIO}, for server IO.  The default is
9071 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
9072 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO.  These
9073 options are available under HP-UX and HI-UX.
9075 @item -mgnu-ld
9076 @opindex gnu-ld
9077 Use GNU ld specific options.  This passes @option{-shared} to ld when
9078 building a shared library.  It is the default when GCC is configured,
9079 explicitly or implicitly, with the GNU linker.  This option does not
9080 have any affect on which ld is called, it only changes what parameters
9081 are passed to that ld.  The ld that is called is determined by the
9082 @option{--with-ld} configure option, GCC's program search path, and
9083 finally by the user's @env{PATH}.  The linker used by GCC can be printed
9084 using @samp{which `gcc -print-prog-name=ld`}.
9086 @item -mhp-ld
9087 @opindex hp-ld
9088 Use HP ld specific options.  This passes @option{-b} to ld when building
9089 a shared library and passes @option{+Accept TypeMismatch} to ld on all
9090 links.  It is the default when GCC is configured, explicitly or
9091 implicitly, with the HP linker.  This option does not have any affect on
9092 which ld is called, it only changes what parameters are passed to that
9093 ld.  The ld that is called is determined by the @option{--with-ld}
9094 configure option, GCC's program search path, and finally by the user's
9095 @env{PATH}.  The linker used by GCC can be printed using @samp{which
9096 `gcc -print-prog-name=ld`}.
9098 @item -mfdpic
9099 @opindex mfdpic
9101 Select the FDPIC ABI, that uses function descriptors to represent
9102 pointers to functions.  Without any PIC/PIE-related options, it
9103 implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
9104 assumes GOT entries and small data are within a 12-bit range from the
9105 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
9106 are computed with 32 bits.
9108 @item -minline-plt
9109 @opindex minline-plt
9111 Enable inlining of PLT entries in function calls to functions that are
9112 not known to bind locally.  It has no effect without @option{-mfdpic}.
9113 It's enabled by default if optimizing for speed and compiling for
9114 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
9115 optimization option such as @option{-O3} or above is present in the
9116 command line.
9118 @item -mgprel-ro
9119 @opindex mgprel-ro
9121 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
9122 that is known to be in read-only sections.  It's enabled by default,
9123 except for @option{-fpic} or @option{-fpie}: even though it may help
9124 make the global offset table smaller, it trades 1 instruction for 4.
9125 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
9126 one of which may be shared by multiple symbols, and it avoids the need
9127 for a GOT entry for the referenced symbol, so it's more likely to be a
9128 win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
9130 @item -multilib-library-pic
9131 @opindex multilib-library-pic
9133 Link with the (library, not FD) pic libraries.  It's implied by
9134 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
9135 @option{-fpic} without @option{-mfdpic}.  You should never have to use
9136 it explicitly.
9138 @item -mlinked-fp
9139 @opindex mlinked-fp
9141 Follow the EABI requirement of always creating a frame pointer whenever
9142 a stack frame is allocated.  This option is enabled by default and can
9143 be disabled with @option{-mno-linked-fp}.
9145 @item -mlong-calls
9146 @opindex mno-long-calls
9147 Generate code that uses long call sequences.  This ensures that a call
9148 is always able to reach linker generated stubs.  The default is to generate
9149 long calls only when the distance from the call site to the beginning
9150 of the function or translation unit, as the case may be, exceeds a
9151 predefined limit set by the branch type being used.  The limits for
9152 normal calls are 7,600,000 and 240,000 bytes, respectively for the
9153 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
9154 240,000 bytes.
9156 Distances are measured from the beginning of functions when using the
9157 @option{-ffunction-sections} option, or when using the @option{-mgas}
9158 and @option{-mno-portable-runtime} options together under HP-UX with
9159 the SOM linker.
9161 It is normally not desirable to use this option as it will degrade
9162 performance.  However, it may be useful in large applications,
9163 particularly when partial linking is used to build the application.
9165 The types of long calls used depends on the capabilities of the
9166 assembler and linker, and the type of code being generated.  The
9167 impact on systems that support long absolute calls, and long pic
9168 symbol-difference or pc-relative calls should be relatively small.
9169 However, an indirect call is used on 32-bit ELF systems in pic code
9170 and it is quite long.
9172 @item -nolibdld
9173 @opindex nolibdld
9174 Suppress the generation of link options to search libdld.sl when the
9175 @option{-static} option is specified on HP-UX 10 and later.
9177 @item -static
9178 @opindex static
9179 The HP-UX implementation of setlocale in libc has a dependency on
9180 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
9181 when the @option{-static} option is specified, special link options
9182 are needed to resolve this dependency.
9184 On HP-UX 10 and later, the GCC driver adds the necessary options to
9185 link with libdld.sl when the @option{-static} option is specified.
9186 This causes the resulting binary to be dynamic.  On the 64-bit port,
9187 the linkers generate dynamic binaries by default in any case.  The
9188 @option{-nolibdld} option can be used to prevent the GCC driver from
9189 adding these link options.
9191 @item -threads
9192 @opindex threads
9193 Add support for multithreading with the @dfn{dce thread} library
9194 under HP-UX.  This option sets flags for both the preprocessor and
9195 linker.
9196 @end table
9198 @node DEC Alpha Options
9199 @subsection DEC Alpha Options
9201 These @samp{-m} options are defined for the DEC Alpha implementations:
9203 @table @gcctabopt
9204 @item -mno-soft-float
9205 @itemx -msoft-float
9206 @opindex mno-soft-float
9207 @opindex msoft-float
9208 Use (do not use) the hardware floating-point instructions for
9209 floating-point operations.  When @option{-msoft-float} is specified,
9210 functions in @file{libgcc.a} will be used to perform floating-point
9211 operations.  Unless they are replaced by routines that emulate the
9212 floating-point operations, or compiled in such a way as to call such
9213 emulations routines, these routines will issue floating-point
9214 operations.   If you are compiling for an Alpha without floating-point
9215 operations, you must ensure that the library is built so as not to call
9216 them.
9218 Note that Alpha implementations without floating-point operations are
9219 required to have floating-point registers.
9221 @item -mfp-reg
9222 @itemx -mno-fp-regs
9223 @opindex mfp-reg
9224 @opindex mno-fp-regs
9225 Generate code that uses (does not use) the floating-point register set.
9226 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
9227 register set is not used, floating point operands are passed in integer
9228 registers as if they were integers and floating-point results are passed
9229 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
9230 so any function with a floating-point argument or return value called by code
9231 compiled with @option{-mno-fp-regs} must also be compiled with that
9232 option.
9234 A typical use of this option is building a kernel that does not use,
9235 and hence need not save and restore, any floating-point registers.
9237 @item -mieee
9238 @opindex mieee
9239 The Alpha architecture implements floating-point hardware optimized for
9240 maximum performance.  It is mostly compliant with the IEEE floating
9241 point standard.  However, for full compliance, software assistance is
9242 required.  This option generates code fully IEEE compliant code
9243 @emph{except} that the @var{inexact-flag} is not maintained (see below).
9244 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
9245 defined during compilation.  The resulting code is less efficient but is
9246 able to correctly support denormalized numbers and exceptional IEEE
9247 values such as not-a-number and plus/minus infinity.  Other Alpha
9248 compilers call this option @option{-ieee_with_no_inexact}.
9250 @item -mieee-with-inexact
9251 @opindex mieee-with-inexact
9252 This is like @option{-mieee} except the generated code also maintains
9253 the IEEE @var{inexact-flag}.  Turning on this option causes the
9254 generated code to implement fully-compliant IEEE math.  In addition to
9255 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
9256 macro.  On some Alpha implementations the resulting code may execute
9257 significantly slower than the code generated by default.  Since there is
9258 very little code that depends on the @var{inexact-flag}, you should
9259 normally not specify this option.  Other Alpha compilers call this
9260 option @option{-ieee_with_inexact}.
9262 @item -mfp-trap-mode=@var{trap-mode}
9263 @opindex mfp-trap-mode
9264 This option controls what floating-point related traps are enabled.
9265 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
9266 The trap mode can be set to one of four values:
9268 @table @samp
9269 @item n
9270 This is the default (normal) setting.  The only traps that are enabled
9271 are the ones that cannot be disabled in software (e.g., division by zero
9272 trap).
9274 @item u
9275 In addition to the traps enabled by @samp{n}, underflow traps are enabled
9276 as well.
9278 @item su
9279 Like @samp{su}, but the instructions are marked to be safe for software
9280 completion (see Alpha architecture manual for details).
9282 @item sui
9283 Like @samp{su}, but inexact traps are enabled as well.
9284 @end table
9286 @item -mfp-rounding-mode=@var{rounding-mode}
9287 @opindex mfp-rounding-mode
9288 Selects the IEEE rounding mode.  Other Alpha compilers call this option
9289 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
9292 @table @samp
9293 @item n
9294 Normal IEEE rounding mode.  Floating point numbers are rounded towards
9295 the nearest machine number or towards the even machine number in case
9296 of a tie.
9298 @item m
9299 Round towards minus infinity.
9301 @item c
9302 Chopped rounding mode.  Floating point numbers are rounded towards zero.
9304 @item d
9305 Dynamic rounding mode.  A field in the floating point control register
9306 (@var{fpcr}, see Alpha architecture reference manual) controls the
9307 rounding mode in effect.  The C library initializes this register for
9308 rounding towards plus infinity.  Thus, unless your program modifies the
9309 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
9310 @end table
9312 @item -mtrap-precision=@var{trap-precision}
9313 @opindex mtrap-precision
9314 In the Alpha architecture, floating point traps are imprecise.  This
9315 means without software assistance it is impossible to recover from a
9316 floating trap and program execution normally needs to be terminated.
9317 GCC can generate code that can assist operating system trap handlers
9318 in determining the exact location that caused a floating point trap.
9319 Depending on the requirements of an application, different levels of
9320 precisions can be selected:
9322 @table @samp
9323 @item p
9324 Program precision.  This option is the default and means a trap handler
9325 can only identify which program caused a floating point exception.
9327 @item f
9328 Function precision.  The trap handler can determine the function that
9329 caused a floating point exception.
9331 @item i
9332 Instruction precision.  The trap handler can determine the exact
9333 instruction that caused a floating point exception.
9334 @end table
9336 Other Alpha compilers provide the equivalent options called
9337 @option{-scope_safe} and @option{-resumption_safe}.
9339 @item -mieee-conformant
9340 @opindex mieee-conformant
9341 This option marks the generated code as IEEE conformant.  You must not
9342 use this option unless you also specify @option{-mtrap-precision=i} and either
9343 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
9344 is to emit the line @samp{.eflag 48} in the function prologue of the
9345 generated assembly file.  Under DEC Unix, this has the effect that
9346 IEEE-conformant math library routines will be linked in.
9348 @item -mbuild-constants
9349 @opindex mbuild-constants
9350 Normally GCC examines a 32- or 64-bit integer constant to
9351 see if it can construct it from smaller constants in two or three
9352 instructions.  If it cannot, it will output the constant as a literal and
9353 generate code to load it from the data segment at runtime.
9355 Use this option to require GCC to construct @emph{all} integer constants
9356 using code, even if it takes more instructions (the maximum is six).
9358 You would typically use this option to build a shared library dynamic
9359 loader.  Itself a shared library, it must relocate itself in memory
9360 before it can find the variables and constants in its own data segment.
9362 @item -malpha-as
9363 @itemx -mgas
9364 @opindex malpha-as
9365 @opindex mgas
9366 Select whether to generate code to be assembled by the vendor-supplied
9367 assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
9369 @item -mbwx
9370 @itemx -mno-bwx
9371 @itemx -mcix
9372 @itemx -mno-cix
9373 @itemx -mfix
9374 @itemx -mno-fix
9375 @itemx -mmax
9376 @itemx -mno-max
9377 @opindex mbwx
9378 @opindex mno-bwx
9379 @opindex mcix
9380 @opindex mno-cix
9381 @opindex mfix
9382 @opindex mno-fix
9383 @opindex mmax
9384 @opindex mno-max
9385 Indicate whether GCC should generate code to use the optional BWX,
9386 CIX, FIX and MAX instruction sets.  The default is to use the instruction
9387 sets supported by the CPU type specified via @option{-mcpu=} option or that
9388 of the CPU on which GCC was built if none was specified.
9390 @item -mfloat-vax
9391 @itemx -mfloat-ieee
9392 @opindex mfloat-vax
9393 @opindex mfloat-ieee
9394 Generate code that uses (does not use) VAX F and G floating point
9395 arithmetic instead of IEEE single and double precision.
9397 @item -mexplicit-relocs
9398 @itemx -mno-explicit-relocs
9399 @opindex mexplicit-relocs
9400 @opindex mno-explicit-relocs
9401 Older Alpha assemblers provided no way to generate symbol relocations
9402 except via assembler macros.  Use of these macros does not allow
9403 optimal instruction scheduling.  GNU binutils as of version 2.12
9404 supports a new syntax that allows the compiler to explicitly mark
9405 which relocations should apply to which instructions.  This option
9406 is mostly useful for debugging, as GCC detects the capabilities of
9407 the assembler when it is built and sets the default accordingly.
9409 @item -msmall-data
9410 @itemx -mlarge-data
9411 @opindex msmall-data
9412 @opindex mlarge-data
9413 When @option{-mexplicit-relocs} is in effect, static data is
9414 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
9415 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
9416 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
9417 16-bit relocations off of the @code{$gp} register.  This limits the
9418 size of the small data area to 64KB, but allows the variables to be
9419 directly accessed via a single instruction.
9421 The default is @option{-mlarge-data}.  With this option the data area
9422 is limited to just below 2GB.  Programs that require more than 2GB of
9423 data must use @code{malloc} or @code{mmap} to allocate the data in the
9424 heap instead of in the program's data segment.
9426 When generating code for shared libraries, @option{-fpic} implies
9427 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
9429 @item -msmall-text
9430 @itemx -mlarge-text
9431 @opindex msmall-text
9432 @opindex mlarge-text
9433 When @option{-msmall-text} is used, the compiler assumes that the
9434 code of the entire program (or shared library) fits in 4MB, and is
9435 thus reachable with a branch instruction.  When @option{-msmall-data}
9436 is used, the compiler can assume that all local symbols share the
9437 same @code{$gp} value, and thus reduce the number of instructions
9438 required for a function call from 4 to 1.
9440 The default is @option{-mlarge-text}.
9442 @item -mcpu=@var{cpu_type}
9443 @opindex mcpu
9444 Set the instruction set and instruction scheduling parameters for
9445 machine type @var{cpu_type}.  You can specify either the @samp{EV}
9446 style name or the corresponding chip number.  GCC supports scheduling
9447 parameters for the EV4, EV5 and EV6 family of processors and will
9448 choose the default values for the instruction set from the processor
9449 you specify.  If you do not specify a processor type, GCC will default
9450 to the processor on which the compiler was built.
9452 Supported values for @var{cpu_type} are
9454 @table @samp
9455 @item ev4
9456 @itemx ev45
9457 @itemx 21064
9458 Schedules as an EV4 and has no instruction set extensions.
9460 @item ev5
9461 @itemx 21164
9462 Schedules as an EV5 and has no instruction set extensions.
9464 @item ev56
9465 @itemx 21164a
9466 Schedules as an EV5 and supports the BWX extension.
9468 @item pca56
9469 @itemx 21164pc
9470 @itemx 21164PC
9471 Schedules as an EV5 and supports the BWX and MAX extensions.
9473 @item ev6
9474 @itemx 21264
9475 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
9477 @item ev67
9478 @itemx 21264a
9479 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
9480 @end table
9482 @item -mtune=@var{cpu_type}
9483 @opindex mtune
9484 Set only the instruction scheduling parameters for machine type
9485 @var{cpu_type}.  The instruction set is not changed.
9487 @item -mmemory-latency=@var{time}
9488 @opindex mmemory-latency
9489 Sets the latency the scheduler should assume for typical memory
9490 references as seen by the application.  This number is highly
9491 dependent on the memory access patterns used by the application
9492 and the size of the external cache on the machine.
9494 Valid options for @var{time} are
9496 @table @samp
9497 @item @var{number}
9498 A decimal number representing clock cycles.
9500 @item L1
9501 @itemx L2
9502 @itemx L3
9503 @itemx main
9504 The compiler contains estimates of the number of clock cycles for
9505 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
9506 (also called Dcache, Scache, and Bcache), as well as to main memory.
9507 Note that L3 is only valid for EV5.
9509 @end table
9510 @end table
9512 @node DEC Alpha/VMS Options
9513 @subsection DEC Alpha/VMS Options
9515 These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
9517 @table @gcctabopt
9518 @item -mvms-return-codes
9519 @opindex mvms-return-codes
9520 Return VMS condition codes from main.  The default is to return POSIX
9521 style condition (e.g.@ error) codes.
9522 @end table
9524 @node H8/300 Options
9525 @subsection H8/300 Options
9527 These @samp{-m} options are defined for the H8/300 implementations:
9529 @table @gcctabopt
9530 @item -mrelax
9531 @opindex mrelax
9532 Shorten some address references at link time, when possible; uses the
9533 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
9534 ld, Using ld}, for a fuller description.
9536 @item -mh
9537 @opindex mh
9538 Generate code for the H8/300H@.
9540 @item -ms
9541 @opindex ms
9542 Generate code for the H8S@.
9544 @item -mn
9545 @opindex mn
9546 Generate code for the H8S and H8/300H in the normal mode.  This switch
9547 must be used either with -mh or -ms.
9549 @item -ms2600
9550 @opindex ms2600
9551 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
9553 @item -mint32
9554 @opindex mint32
9555 Make @code{int} data 32 bits by default.
9557 @item -malign-300
9558 @opindex malign-300
9559 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
9560 The default for the H8/300H and H8S is to align longs and floats on 4
9561 byte boundaries.
9562 @option{-malign-300} causes them to be aligned on 2 byte boundaries.
9563 This option has no effect on the H8/300.
9564 @end table
9566 @node SH Options
9567 @subsection SH Options
9569 These @samp{-m} options are defined for the SH implementations:
9571 @table @gcctabopt
9572 @item -m1
9573 @opindex m1
9574 Generate code for the SH1.
9576 @item -m2
9577 @opindex m2
9578 Generate code for the SH2.
9580 @item -m2e
9581 Generate code for the SH2e.
9583 @item -m3
9584 @opindex m3
9585 Generate code for the SH3.
9587 @item -m3e
9588 @opindex m3e
9589 Generate code for the SH3e.
9591 @item -m4-nofpu
9592 @opindex m4-nofpu
9593 Generate code for the SH4 without a floating-point unit.
9595 @item -m4-single-only
9596 @opindex m4-single-only
9597 Generate code for the SH4 with a floating-point unit that only
9598 supports single-precision arithmetic.
9600 @item -m4-single
9601 @opindex m4-single
9602 Generate code for the SH4 assuming the floating-point unit is in
9603 single-precision mode by default.
9605 @item -m4
9606 @opindex m4
9607 Generate code for the SH4.
9609 @item -mb
9610 @opindex mb
9611 Compile code for the processor in big endian mode.
9613 @item -ml
9614 @opindex ml
9615 Compile code for the processor in little endian mode.
9617 @item -mdalign
9618 @opindex mdalign
9619 Align doubles at 64-bit boundaries.  Note that this changes the calling
9620 conventions, and thus some functions from the standard C library will
9621 not work unless you recompile it first with @option{-mdalign}.
9623 @item -mrelax
9624 @opindex mrelax
9625 Shorten some address references at link time, when possible; uses the
9626 linker option @option{-relax}.
9628 @item -mbigtable
9629 @opindex mbigtable
9630 Use 32-bit offsets in @code{switch} tables.  The default is to use
9631 16-bit offsets.
9633 @item -mfmovd
9634 @opindex mfmovd
9635 Enable the use of the instruction @code{fmovd}.
9637 @item -mhitachi
9638 @opindex mhitachi
9639 Comply with the calling conventions defined by Renesas.
9641 @item -mnomacsave
9642 @opindex mnomacsave
9643 Mark the @code{MAC} register as call-clobbered, even if
9644 @option{-mhitachi} is given.
9646 @item -mieee
9647 @opindex mieee
9648 Increase IEEE-compliance of floating-point code.
9650 @item -misize
9651 @opindex misize
9652 Dump instruction size and location in the assembly code.
9654 @item -mpadstruct
9655 @opindex mpadstruct
9656 This option is deprecated.  It pads structures to multiple of 4 bytes,
9657 which is incompatible with the SH ABI@.
9659 @item -mspace
9660 @opindex mspace
9661 Optimize for space instead of speed.  Implied by @option{-Os}.
9663 @item -mprefergot
9664 @opindex mprefergot
9665 When generating position-independent code, emit function calls using
9666 the Global Offset Table instead of the Procedure Linkage Table.
9668 @item -musermode
9669 @opindex musermode
9670 Generate a library function call to invalidate instruction cache
9671 entries, after fixing up a trampoline.  This library function call
9672 doesn't assume it can write to the whole memory address space.  This
9673 is the default when the target is @code{sh-*-linux*}.
9674 @end table
9676 @node System V Options
9677 @subsection Options for System V
9679 These additional options are available on System V Release 4 for
9680 compatibility with other compilers on those systems:
9682 @table @gcctabopt
9683 @item -G
9684 @opindex G
9685 Create a shared object.
9686 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
9688 @item -Qy
9689 @opindex Qy
9690 Identify the versions of each tool used by the compiler, in a
9691 @code{.ident} assembler directive in the output.
9693 @item -Qn
9694 @opindex Qn
9695 Refrain from adding @code{.ident} directives to the output file (this is
9696 the default).
9698 @item -YP,@var{dirs}
9699 @opindex YP
9700 Search the directories @var{dirs}, and no others, for libraries
9701 specified with @option{-l}.
9703 @item -Ym,@var{dir}
9704 @opindex Ym
9705 Look in the directory @var{dir} to find the M4 preprocessor.
9706 The assembler uses this option.
9707 @c This is supposed to go with a -Yd for predefined M4 macro files, but
9708 @c the generic assembler that comes with Solaris takes just -Ym.
9709 @end table
9711 @node TMS320C3x/C4x Options
9712 @subsection TMS320C3x/C4x Options
9713 @cindex TMS320C3x/C4x Options
9715 These @samp{-m} options are defined for TMS320C3x/C4x implementations:
9717 @table @gcctabopt
9719 @item -mcpu=@var{cpu_type}
9720 @opindex mcpu
9721 Set the instruction set, register set, and instruction scheduling
9722 parameters for machine type @var{cpu_type}.  Supported values for
9723 @var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
9724 @samp{c44}.  The default is @samp{c40} to generate code for the
9725 TMS320C40.
9727 @item -mbig-memory
9728 @itemx -mbig
9729 @itemx -msmall-memory
9730 @itemx -msmall
9731 @opindex mbig-memory
9732 @opindex mbig
9733 @opindex msmall-memory
9734 @opindex msmall
9735 Generates code for the big or small memory model.  The small memory
9736 model assumed that all data fits into one 64K word page.  At run-time
9737 the data page (DP) register must be set to point to the 64K page
9738 containing the .bss and .data program sections.  The big memory model is
9739 the default and requires reloading of the DP register for every direct
9740 memory access.
9742 @item -mbk
9743 @itemx -mno-bk
9744 @opindex mbk
9745 @opindex mno-bk
9746 Allow (disallow) allocation of general integer operands into the block
9747 count register BK@.
9749 @item -mdb
9750 @itemx -mno-db
9751 @opindex mdb
9752 @opindex mno-db
9753 Enable (disable) generation of code using decrement and branch,
9754 DBcond(D), instructions.  This is enabled by default for the C4x.  To be
9755 on the safe side, this is disabled for the C3x, since the maximum
9756 iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than
9757 @math{2^{23}} times on the C3x?).  Note that GCC will try to reverse a loop so
9758 that it can utilize the decrement and branch instruction, but will give
9759 up if there is more than one memory reference in the loop.  Thus a loop
9760 where the loop counter is decremented can generate slightly more
9761 efficient code, in cases where the RPTB instruction cannot be utilized.
9763 @item -mdp-isr-reload
9764 @itemx -mparanoid
9765 @opindex mdp-isr-reload
9766 @opindex mparanoid
9767 Force the DP register to be saved on entry to an interrupt service
9768 routine (ISR), reloaded to point to the data section, and restored on
9769 exit from the ISR@.  This should not be required unless someone has
9770 violated the small memory model by modifying the DP register, say within
9771 an object library.
9773 @item -mmpyi
9774 @itemx -mno-mpyi
9775 @opindex mmpyi
9776 @opindex mno-mpyi
9777 For the C3x use the 24-bit MPYI instruction for integer multiplies
9778 instead of a library call to guarantee 32-bit results.  Note that if one
9779 of the operands is a constant, then the multiplication will be performed
9780 using shifts and adds.  If the @option{-mmpyi} option is not specified for the C3x,
9781 then squaring operations are performed inline instead of a library call.
9783 @item -mfast-fix
9784 @itemx -mno-fast-fix
9785 @opindex mfast-fix
9786 @opindex mno-fast-fix
9787 The C3x/C4x FIX instruction to convert a floating point value to an
9788 integer value chooses the nearest integer less than or equal to the
9789 floating point value rather than to the nearest integer.  Thus if the
9790 floating point number is negative, the result will be incorrectly
9791 truncated an additional code is necessary to detect and correct this
9792 case.  This option can be used to disable generation of the additional
9793 code required to correct the result.
9795 @item -mrptb
9796 @itemx -mno-rptb
9797 @opindex mrptb
9798 @opindex mno-rptb
9799 Enable (disable) generation of repeat block sequences using the RPTB
9800 instruction for zero overhead looping.  The RPTB construct is only used
9801 for innermost loops that do not call functions or jump across the loop
9802 boundaries.  There is no advantage having nested RPTB loops due to the
9803 overhead required to save and restore the RC, RS, and RE registers.
9804 This is enabled by default with @option{-O2}.
9806 @item -mrpts=@var{count}
9807 @itemx -mno-rpts
9808 @opindex mrpts
9809 @opindex mno-rpts
9810 Enable (disable) the use of the single instruction repeat instruction
9811 RPTS@.  If a repeat block contains a single instruction, and the loop
9812 count can be guaranteed to be less than the value @var{count}, GCC will
9813 emit a RPTS instruction instead of a RPTB@.  If no value is specified,
9814 then a RPTS will be emitted even if the loop count cannot be determined
9815 at compile time.  Note that the repeated instruction following RPTS does
9816 not have to be reloaded from memory each iteration, thus freeing up the
9817 CPU buses for operands.  However, since interrupts are blocked by this
9818 instruction, it is disabled by default.
9820 @item -mloop-unsigned
9821 @itemx -mno-loop-unsigned
9822 @opindex mloop-unsigned
9823 @opindex mno-loop-unsigned
9824 The maximum iteration count when using RPTS and RPTB (and DB on the C40)
9825 is @math{2^{31} + 1} since these instructions test if the iteration count is
9826 negative to terminate the loop.  If the iteration count is unsigned
9827 there is a possibility than the @math{2^{31} + 1} maximum iteration count may be
9828 exceeded.  This switch allows an unsigned iteration count.
9830 @item -mti
9831 @opindex mti
9832 Try to emit an assembler syntax that the TI assembler (asm30) is happy
9833 with.  This also enforces compatibility with the API employed by the TI
9834 C3x C compiler.  For example, long doubles are passed as structures
9835 rather than in floating point registers.
9837 @item -mregparm
9838 @itemx -mmemparm
9839 @opindex mregparm
9840 @opindex mmemparm
9841 Generate code that uses registers (stack) for passing arguments to functions.
9842 By default, arguments are passed in registers where possible rather
9843 than by pushing arguments on to the stack.
9845 @item -mparallel-insns
9846 @itemx -mno-parallel-insns
9847 @opindex mparallel-insns
9848 @opindex mno-parallel-insns
9849 Allow the generation of parallel instructions.  This is enabled by
9850 default with @option{-O2}.
9852 @item -mparallel-mpy
9853 @itemx -mno-parallel-mpy
9854 @opindex mparallel-mpy
9855 @opindex mno-parallel-mpy
9856 Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
9857 provided @option{-mparallel-insns} is also specified.  These instructions have
9858 tight register constraints which can pessimize the code generation
9859 of large functions.
9861 @end table
9863 @node V850 Options
9864 @subsection V850 Options
9865 @cindex V850 Options
9867 These @samp{-m} options are defined for V850 implementations:
9869 @table @gcctabopt
9870 @item -mlong-calls
9871 @itemx -mno-long-calls
9872 @opindex mlong-calls
9873 @opindex mno-long-calls
9874 Treat all calls as being far away (near).  If calls are assumed to be
9875 far away, the compiler will always load the functions address up into a
9876 register, and call indirect through the pointer.
9878 @item -mno-ep
9879 @itemx -mep
9880 @opindex mno-ep
9881 @opindex mep
9882 Do not optimize (do optimize) basic blocks that use the same index
9883 pointer 4 or more times to copy pointer into the @code{ep} register, and
9884 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
9885 option is on by default if you optimize.
9887 @item -mno-prolog-function
9888 @itemx -mprolog-function
9889 @opindex mno-prolog-function
9890 @opindex mprolog-function
9891 Do not use (do use) external functions to save and restore registers
9892 at the prologue and epilogue of a function.  The external functions
9893 are slower, but use less code space if more than one function saves
9894 the same number of registers.  The @option{-mprolog-function} option
9895 is on by default if you optimize.
9897 @item -mspace
9898 @opindex mspace
9899 Try to make the code as small as possible.  At present, this just turns
9900 on the @option{-mep} and @option{-mprolog-function} options.
9902 @item -mtda=@var{n}
9903 @opindex mtda
9904 Put static or global variables whose size is @var{n} bytes or less into
9905 the tiny data area that register @code{ep} points to.  The tiny data
9906 area can hold up to 256 bytes in total (128 bytes for byte references).
9908 @item -msda=@var{n}
9909 @opindex msda
9910 Put static or global variables whose size is @var{n} bytes or less into
9911 the small data area that register @code{gp} points to.  The small data
9912 area can hold up to 64 kilobytes.
9914 @item -mzda=@var{n}
9915 @opindex mzda
9916 Put static or global variables whose size is @var{n} bytes or less into
9917 the first 32 kilobytes of memory.
9919 @item -mv850
9920 @opindex mv850
9921 Specify that the target processor is the V850.
9923 @item -mbig-switch
9924 @opindex mbig-switch
9925 Generate code suitable for big switch tables.  Use this option only if
9926 the assembler/linker complain about out of range branches within a switch
9927 table.
9929 @item -mapp-regs
9930 @opindex mapp-regs
9931 This option will cause r2 and r5 to be used in the code generated by
9932 the compiler.  This setting is the default.
9934 @item -mno-app-regs
9935 @opindex mno-app-regs
9936 This option will cause r2 and r5 to be treated as fixed registers.
9938 @item -mv850e1
9939 @opindex mv850e1
9940 Specify that the target processor is the V850E1.  The preprocessor
9941 constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
9942 this option is used.
9944 @item -mv850e
9945 @opindex mv850e
9946 Specify that the target processor is the V850E.  The preprocessor
9947 constant @samp{__v850e__} will be defined if this option is used.
9949 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
9950 are defined then a default target processor will be chosen and the
9951 relevant @samp{__v850*__} preprocessor constant will be defined.
9953 The preprocessor constants @samp{__v850} and @samp{__v851__} are always
9954 defined, regardless of which processor variant is the target.
9956 @item -mdisable-callt
9957 @opindex mdisable-callt
9958 This option will suppress generation of the CALLT instruction for the
9959 v850e and v850e1 flavors of the v850 architecture.  The default is
9960 @option{-mno-disable-callt} which allows the CALLT instruction to be used.
9962 @end table
9964 @node ARC Options
9965 @subsection ARC Options
9966 @cindex ARC Options
9968 These options are defined for ARC implementations:
9970 @table @gcctabopt
9971 @item -EL
9972 @opindex EL
9973 Compile code for little endian mode.  This is the default.
9975 @item -EB
9976 @opindex EB
9977 Compile code for big endian mode.
9979 @item -mmangle-cpu
9980 @opindex mmangle-cpu
9981 Prepend the name of the cpu to all public symbol names.
9982 In multiple-processor systems, there are many ARC variants with different
9983 instruction and register set characteristics.  This flag prevents code
9984 compiled for one cpu to be linked with code compiled for another.
9985 No facility exists for handling variants that are ``almost identical''.
9986 This is an all or nothing option.
9988 @item -mcpu=@var{cpu}
9989 @opindex mcpu
9990 Compile code for ARC variant @var{cpu}.
9991 Which variants are supported depend on the configuration.
9992 All variants support @option{-mcpu=base}, this is the default.
9994 @item -mtext=@var{text-section}
9995 @itemx -mdata=@var{data-section}
9996 @itemx -mrodata=@var{readonly-data-section}
9997 @opindex mtext
9998 @opindex mdata
9999 @opindex mrodata
10000 Put functions, data, and readonly data in @var{text-section},
10001 @var{data-section}, and @var{readonly-data-section} respectively
10002 by default.  This can be overridden with the @code{section} attribute.
10003 @xref{Variable Attributes}.
10005 @end table
10007 @node NS32K Options
10008 @subsection NS32K Options
10009 @cindex NS32K options
10011 These are the @samp{-m} options defined for the 32000 series.  The default
10012 values for these options depends on which style of 32000 was selected when
10013 the compiler was configured; the defaults for the most common choices are
10014 given below.
10016 @table @gcctabopt
10017 @item -m32032
10018 @itemx -m32032
10019 @opindex m32032
10020 @opindex m32032
10021 Generate output for a 32032.  This is the default
10022 when the compiler is configured for 32032 and 32016 based systems.
10024 @item -m32332
10025 @itemx -m32332
10026 @opindex m32332
10027 @opindex m32332
10028 Generate output for a 32332.  This is the default
10029 when the compiler is configured for 32332-based systems.
10031 @item -m32532
10032 @itemx -m32532
10033 @opindex m32532
10034 @opindex m32532
10035 Generate output for a 32532.  This is the default
10036 when the compiler is configured for 32532-based systems.
10038 @item -m32081
10039 @opindex m32081
10040 Generate output containing 32081 instructions for floating point.
10041 This is the default for all systems.
10043 @item -m32381
10044 @opindex m32381
10045 Generate output containing 32381 instructions for floating point.  This
10046 also implies @option{-m32081}.  The 32381 is only compatible with the 32332
10047 and 32532 cpus.  This is the default for the pc532-netbsd configuration.
10049 @item -mmulti-add
10050 @opindex mmulti-add
10051 Try and generate multiply-add floating point instructions @code{polyF}
10052 and @code{dotF}.  This option is only available if the @option{-m32381}
10053 option is in effect.  Using these instructions requires changes to
10054 register allocation which generally has a negative impact on
10055 performance.  This option should only be enabled when compiling code
10056 particularly likely to make heavy use of multiply-add instructions.
10058 @item -mnomulti-add
10059 @opindex mnomulti-add
10060 Do not try and generate multiply-add floating point instructions
10061 @code{polyF} and @code{dotF}.  This is the default on all platforms.
10063 @item -msoft-float
10064 @opindex msoft-float
10065 Generate output containing library calls for floating point.
10066 @strong{Warning:} the requisite libraries may not be available.
10068 @item -mieee-compare
10069 @itemx -mno-ieee-compare
10070 @opindex mieee-compare
10071 @opindex mno-ieee-compare
10072 Control whether or not the compiler uses IEEE floating point
10073 comparisons.  These handle correctly the case where the result of a
10074 comparison is unordered.
10075 @strong{Warning:} the requisite kernel support may not be available.
10077 @item -mnobitfield
10078 @opindex mnobitfield
10079 Do not use the bit-field instructions.  On some machines it is faster to
10080 use shifting and masking operations.  This is the default for the pc532.
10082 @item -mbitfield
10083 @opindex mbitfield
10084 Do use the bit-field instructions.  This is the default for all platforms
10085 except the pc532.
10087 @item -mrtd
10088 @opindex mrtd
10089 Use a different function-calling convention, in which functions
10090 that take a fixed number of arguments return pop their
10091 arguments on return with the @code{ret} instruction.
10093 This calling convention is incompatible with the one normally
10094 used on Unix, so you cannot use it if you need to call libraries
10095 compiled with the Unix compiler.
10097 Also, you must provide function prototypes for all functions that
10098 take variable numbers of arguments (including @code{printf});
10099 otherwise incorrect code will be generated for calls to those
10100 functions.
10102 In addition, seriously incorrect code will result if you call a
10103 function with too many arguments.  (Normally, extra arguments are
10104 harmlessly ignored.)
10106 This option takes its name from the 680x0 @code{rtd} instruction.
10109 @item -mregparam
10110 @opindex mregparam
10111 Use a different function-calling convention where the first two arguments
10112 are passed in registers.
10114 This calling convention is incompatible with the one normally
10115 used on Unix, so you cannot use it if you need to call libraries
10116 compiled with the Unix compiler.
10118 @item -mnoregparam
10119 @opindex mnoregparam
10120 Do not pass any arguments in registers.  This is the default for all
10121 targets.
10123 @item -msb
10124 @opindex msb
10125 It is OK to use the sb as an index register which is always loaded with
10126 zero.  This is the default for the pc532-netbsd target.
10128 @item -mnosb
10129 @opindex mnosb
10130 The sb register is not available for use or has not been initialized to
10131 zero by the run time system.  This is the default for all targets except
10132 the pc532-netbsd.  It is also implied whenever @option{-mhimem} or
10133 @option{-fpic} is set.
10135 @item -mhimem
10136 @opindex mhimem
10137 Many ns32000 series addressing modes use displacements of up to 512MB@.
10138 If an address is above 512MB then displacements from zero can not be used.
10139 This option causes code to be generated which can be loaded above 512MB@.
10140 This may be useful for operating systems or ROM code.
10142 @item -mnohimem
10143 @opindex mnohimem
10144 Assume code will be loaded in the first 512MB of virtual address space.
10145 This is the default for all platforms.
10148 @end table
10150 @node AVR Options
10151 @subsection AVR Options
10152 @cindex AVR Options
10154 These options are defined for AVR implementations:
10156 @table @gcctabopt
10157 @item -mmcu=@var{mcu}
10158 @opindex mmcu
10159 Specify ATMEL AVR instruction set or MCU type.
10161 Instruction set avr1 is for the minimal AVR core, not supported by the C
10162 compiler, only for assembler programs (MCU types: at90s1200, attiny10,
10163 attiny11, attiny12, attiny15, attiny28).
10165 Instruction set avr2 (default) is for the classic AVR core with up to
10166 8K program memory space (MCU types: at90s2313, at90s2323, attiny22,
10167 at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
10168 at90c8534, at90s8535).
10170 Instruction set avr3 is for the classic AVR core with up to 128K program
10171 memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
10173 Instruction set avr4 is for the enhanced AVR core with up to 8K program
10174 memory space (MCU types: atmega8, atmega83, atmega85).
10176 Instruction set avr5 is for the enhanced AVR core with up to 128K program
10177 memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
10178 atmega64, atmega128, at43usb355, at94k).
10180 @item -msize
10181 @opindex msize
10182 Output instruction sizes to the asm file.
10184 @item -minit-stack=@var{N}
10185 @opindex minit-stack
10186 Specify the initial stack address, which may be a symbol or numeric value,
10187 @samp{__stack} is the default.
10189 @item -mno-interrupts
10190 @opindex mno-interrupts
10191 Generated code is not compatible with hardware interrupts.
10192 Code size will be smaller.
10194 @item -mcall-prologues
10195 @opindex mcall-prologues
10196 Functions prologues/epilogues expanded as call to appropriate
10197 subroutines.  Code size will be smaller.
10199 @item -mno-tablejump
10200 @opindex mno-tablejump
10201 Do not generate tablejump insns which sometimes increase code size.
10203 @item -mtiny-stack
10204 @opindex mtiny-stack
10205 Change only the low 8 bits of the stack pointer.
10207 @item -mint8
10208 @opindex mint8
10209 Assume int to be 8 bit integer. This affects the sizes of all types: A
10210 char will be 1 byte, an int will be 1 byte, an long will be 2 bytes
10211 and long long will be 4 bytes. Please note that this option does not
10212 comply to the C standards, but it will provide you with smaller code
10213 size.
10214 @end table
10216 @node MCore Options
10217 @subsection MCore Options
10218 @cindex MCore options
10220 These are the @samp{-m} options defined for the Motorola M*Core
10221 processors.
10223 @table @gcctabopt
10225 @item -mhardlit
10226 @itemx -mno-hardlit
10227 @opindex mhardlit
10228 @opindex mno-hardlit
10229 Inline constants into the code stream if it can be done in two
10230 instructions or less.
10232 @item -mdiv
10233 @itemx -mno-div
10234 @opindex mdiv
10235 @opindex mno-div
10236 Use the divide instruction.  (Enabled by default).
10238 @item -mrelax-immediate
10239 @itemx -mno-relax-immediate
10240 @opindex mrelax-immediate
10241 @opindex mno-relax-immediate
10242 Allow arbitrary sized immediates in bit operations.
10244 @item -mwide-bitfields
10245 @itemx -mno-wide-bitfields
10246 @opindex mwide-bitfields
10247 @opindex mno-wide-bitfields
10248 Always treat bit-fields as int-sized.
10250 @item -m4byte-functions
10251 @itemx -mno-4byte-functions
10252 @opindex m4byte-functions
10253 @opindex mno-4byte-functions
10254 Force all functions to be aligned to a four byte boundary.
10256 @item -mcallgraph-data
10257 @itemx -mno-callgraph-data
10258 @opindex mcallgraph-data
10259 @opindex mno-callgraph-data
10260 Emit callgraph information.
10262 @item -mslow-bytes
10263 @itemx -mno-slow-bytes
10264 @opindex mslow-bytes
10265 @opindex mno-slow-bytes
10266 Prefer word access when reading byte quantities.
10268 @item -mlittle-endian
10269 @itemx -mbig-endian
10270 @opindex mlittle-endian
10271 @opindex mbig-endian
10272 Generate code for a little endian target.
10274 @item -m210
10275 @itemx -m340
10276 @opindex m210
10277 @opindex m340
10278 Generate code for the 210 processor.
10279 @end table
10281 @node IA-64 Options
10282 @subsection IA-64 Options
10283 @cindex IA-64 Options
10285 These are the @samp{-m} options defined for the Intel IA-64 architecture.
10287 @table @gcctabopt
10288 @item -mbig-endian
10289 @opindex mbig-endian
10290 Generate code for a big endian target.  This is the default for HP-UX@.
10292 @item -mlittle-endian
10293 @opindex mlittle-endian
10294 Generate code for a little endian target.  This is the default for AIX5
10295 and GNU/Linux.
10297 @item -mgnu-as
10298 @itemx -mno-gnu-as
10299 @opindex mgnu-as
10300 @opindex mno-gnu-as
10301 Generate (or don't) code for the GNU assembler.  This is the default.
10302 @c Also, this is the default if the configure option @option{--with-gnu-as}
10303 @c is used.
10305 @item -mgnu-ld
10306 @itemx -mno-gnu-ld
10307 @opindex mgnu-ld
10308 @opindex mno-gnu-ld
10309 Generate (or don't) code for the GNU linker.  This is the default.
10310 @c Also, this is the default if the configure option @option{--with-gnu-ld}
10311 @c is used.
10313 @item -mno-pic
10314 @opindex mno-pic
10315 Generate code that does not use a global pointer register.  The result
10316 is not position independent code, and violates the IA-64 ABI@.
10318 @item -mvolatile-asm-stop
10319 @itemx -mno-volatile-asm-stop
10320 @opindex mvolatile-asm-stop
10321 @opindex mno-volatile-asm-stop
10322 Generate (or don't) a stop bit immediately before and after volatile asm
10323 statements.
10325 @item -mb-step
10326 @opindex mb-step
10327 Generate code that works around Itanium B step errata.
10329 @item -mregister-names
10330 @itemx -mno-register-names
10331 @opindex mregister-names
10332 @opindex mno-register-names
10333 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
10334 the stacked registers.  This may make assembler output more readable.
10336 @item -mno-sdata
10337 @itemx -msdata
10338 @opindex mno-sdata
10339 @opindex msdata
10340 Disable (or enable) optimizations that use the small data section.  This may
10341 be useful for working around optimizer bugs.
10343 @item -mconstant-gp
10344 @opindex mconstant-gp
10345 Generate code that uses a single constant global pointer value.  This is
10346 useful when compiling kernel code.
10348 @item -mauto-pic
10349 @opindex mauto-pic
10350 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
10351 This is useful when compiling firmware code.
10353 @item -minline-float-divide-min-latency
10354 @opindex minline-float-divide-min-latency
10355 Generate code for inline divides of floating point values
10356 using the minimum latency algorithm.
10358 @item -minline-float-divide-max-throughput
10359 @opindex minline-float-divide-max-throughput
10360 Generate code for inline divides of floating point values
10361 using the maximum throughput algorithm.
10363 @item -minline-int-divide-min-latency
10364 @opindex minline-int-divide-min-latency
10365 Generate code for inline divides of integer values
10366 using the minimum latency algorithm.
10368 @item -minline-int-divide-max-throughput
10369 @opindex minline-int-divide-max-throughput
10370 Generate code for inline divides of integer values
10371 using the maximum throughput algorithm.
10373 @item -mno-dwarf2-asm
10374 @itemx -mdwarf2-asm
10375 @opindex mno-dwarf2-asm
10376 @opindex mdwarf2-asm
10377 Don't (or do) generate assembler code for the DWARF2 line number debugging
10378 info.  This may be useful when not using the GNU assembler.
10380 @item -mfixed-range=@var{register-range}
10381 @opindex mfixed-range
10382 Generate code treating the given register range as fixed registers.
10383 A fixed register is one that the register allocator can not use.  This is
10384 useful when compiling kernel code.  A register range is specified as
10385 two registers separated by a dash.  Multiple register ranges can be
10386 specified separated by a comma.
10388 @item -mearly-stop-bits
10389 @itemx -mno-early-stop-bits
10390 @opindex mearly-stop-bits
10391 @opindex mno-early-stop-bits
10392 Allow stop bits to be placed earlier than immediately preceding the
10393 instruction that triggered the stop bit.  This can improve instruction
10394 scheduling, but does not always do so.
10395 @end table
10397 @node S/390 and zSeries Options
10398 @subsection S/390 and zSeries Options
10399 @cindex S/390 and zSeries Options
10401 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
10403 @table @gcctabopt
10404 @item -mhard-float
10405 @itemx -msoft-float
10406 @opindex mhard-float
10407 @opindex msoft-float
10408 Use (do not use) the hardware floating-point instructions and registers
10409 for floating-point operations.  When @option{-msoft-float} is specified,
10410 functions in @file{libgcc.a} will be used to perform floating-point
10411 operations.  When @option{-mhard-float} is specified, the compiler
10412 generates IEEE floating-point instructions.  This is the default.
10414 @item -mbackchain
10415 @itemx -mno-backchain
10416 @opindex mbackchain
10417 @opindex mno-backchain
10418 Generate (or do not generate) code which maintains an explicit
10419 backchain within the stack frame that points to the caller's frame.
10420 This may be needed to allow debugging using tools that do not understand
10421 DWARF-2 call frame information.  The default is not to generate the
10422 backchain.
10424 @item -msmall-exec
10425 @itemx -mno-small-exec
10426 @opindex msmall-exec
10427 @opindex mno-small-exec
10428 Generate (or do not generate) code using the @code{bras} instruction
10429 to do subroutine calls.
10430 This only works reliably if the total executable size does not
10431 exceed 64k.  The default is to use the @code{basr} instruction instead,
10432 which does not have this limitation.
10434 @item -m64
10435 @itemx -m31
10436 @opindex m64
10437 @opindex m31
10438 When @option{-m31} is specified, generate code compliant to the
10439 GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
10440 code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
10441 particular to generate 64-bit instructions.  For the @samp{s390}
10442 targets, the default is @option{-m31}, while the @samp{s390x}
10443 targets default to @option{-m64}.
10445 @item -mzarch
10446 @itemx -mesa
10447 @opindex mzarch
10448 @opindex mesa
10449 When @option{-mzarch} is specified, generate code using the
10450 instructions available on z/Architecture.
10451 When @option{-mesa} is specified, generate code using the
10452 instructions available on ESA/390. Note that @option{-mesa} is
10453 not possible with @option{-m64}.
10454 When generating code compliant to the GNU/Linux for S/390 ABI,
10455 the default is @option{-mesa}.  When generating code compliant
10456 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
10458 @item -mmvcle
10459 @itemx -mno-mvcle
10460 @opindex mmvcle
10461 @opindex mno-mvcle
10462 Generate (or do not generate) code using the @code{mvcle} instruction
10463 to perform block moves.  When @option{-mno-mvcle} is specified,
10464 use a @code{mvc} loop instead.  This is the default.
10466 @item -mdebug
10467 @itemx -mno-debug
10468 @opindex mdebug
10469 @opindex mno-debug
10470 Print (or do not print) additional debug information when compiling.
10471 The default is to not print debug information.
10473 @item -march=@var{cpu-type}
10474 @opindex march
10475 Generate code that will run on @var{cpu-type}, which is the name of a system
10476 representing a certain processor type. Possible values for
10477 @var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}.
10478 When generating code using the instructions available on z/Architecture,
10479 the default is @option{-march=z900}.  Otherwise, the default is
10480 @option{-march=g5}.
10482 @item -mtune=@var{cpu-type}
10483 @opindex mtune
10484 Tune to @var{cpu-type} everything applicable about the generated code,
10485 except for the ABI and the set of available instructions.
10486 The list of @var{cpu-type} values is the same as for @option{-march}.
10487 The default is the value used for @option{-march}.
10489 @item -mtpf-trace
10490 @itemx -mno-tpf-trace
10491 @opindex mtpf-trace
10492 @opindex mno-tpf-trace
10493 Generate code that adds (does not add) in TPF OS specific branches to trace
10494 routines in the operating system.  This option is off by default, even
10495 when compiling for the TPF OS.
10497 @item -mfused-madd
10498 @itemx -mno-fused-madd
10499 @opindex mfused-madd
10500 @opindex mno-fused-madd
10501 Generate code that uses (does not use) the floating point multiply and
10502 accumulate instructions.  These instructions are generated by default if
10503 hardware floating point is used.
10504 @end table
10506 @node CRIS Options
10507 @subsection CRIS Options
10508 @cindex CRIS Options
10510 These options are defined specifically for the CRIS ports.
10512 @table @gcctabopt
10513 @item -march=@var{architecture-type}
10514 @itemx -mcpu=@var{architecture-type}
10515 @opindex march
10516 @opindex mcpu
10517 Generate code for the specified architecture.  The choices for
10518 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
10519 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX.
10520 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
10521 @samp{v10}.
10523 @item -mtune=@var{architecture-type}
10524 @opindex mtune
10525 Tune to @var{architecture-type} everything applicable about the generated
10526 code, except for the ABI and the set of available instructions.  The
10527 choices for @var{architecture-type} are the same as for
10528 @option{-march=@var{architecture-type}}.
10530 @item -mmax-stack-frame=@var{n}
10531 @opindex mmax-stack-frame
10532 Warn when the stack frame of a function exceeds @var{n} bytes.
10534 @item -melinux-stacksize=@var{n}
10535 @opindex melinux-stacksize
10536 Only available with the @samp{cris-axis-aout} target.  Arranges for
10537 indications in the program to the kernel loader that the stack of the
10538 program should be set to @var{n} bytes.
10540 @item -metrax4
10541 @itemx -metrax100
10542 @opindex metrax4
10543 @opindex metrax100
10544 The options @option{-metrax4} and @option{-metrax100} are synonyms for
10545 @option{-march=v3} and @option{-march=v8} respectively.
10547 @item -mmul-bug-workaround
10548 @itemx -mno-mul-bug-workaround
10549 @opindex mmul-bug-workaround
10550 @opindex mno-mul-bug-workaround
10551 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
10552 models where it applies.  This option is active by default.
10554 @item -mpdebug
10555 @opindex mpdebug
10556 Enable CRIS-specific verbose debug-related information in the assembly
10557 code.  This option also has the effect to turn off the @samp{#NO_APP}
10558 formatted-code indicator to the assembler at the beginning of the
10559 assembly file.
10561 @item -mcc-init
10562 @opindex mcc-init
10563 Do not use condition-code results from previous instruction; always emit
10564 compare and test instructions before use of condition codes.
10566 @item -mno-side-effects
10567 @opindex mno-side-effects
10568 Do not emit instructions with side-effects in addressing modes other than
10569 post-increment.
10571 @item -mstack-align
10572 @itemx -mno-stack-align
10573 @itemx -mdata-align
10574 @itemx -mno-data-align
10575 @itemx -mconst-align
10576 @itemx -mno-const-align
10577 @opindex mstack-align
10578 @opindex mno-stack-align
10579 @opindex mdata-align
10580 @opindex mno-data-align
10581 @opindex mconst-align
10582 @opindex mno-const-align
10583 These options (no-options) arranges (eliminate arrangements) for the
10584 stack-frame, individual data and constants to be aligned for the maximum
10585 single data access size for the chosen CPU model.  The default is to
10586 arrange for 32-bit alignment.  ABI details such as structure layout are
10587 not affected by these options.
10589 @item -m32-bit
10590 @itemx -m16-bit
10591 @itemx -m8-bit
10592 @opindex m32-bit
10593 @opindex m16-bit
10594 @opindex m8-bit
10595 Similar to the stack- data- and const-align options above, these options
10596 arrange for stack-frame, writable data and constants to all be 32-bit,
10597 16-bit or 8-bit aligned.  The default is 32-bit alignment.
10599 @item -mno-prologue-epilogue
10600 @itemx -mprologue-epilogue
10601 @opindex mno-prologue-epilogue
10602 @opindex mprologue-epilogue
10603 With @option{-mno-prologue-epilogue}, the normal function prologue and
10604 epilogue that sets up the stack-frame are omitted and no return
10605 instructions or return sequences are generated in the code.  Use this
10606 option only together with visual inspection of the compiled code: no
10607 warnings or errors are generated when call-saved registers must be saved,
10608 or storage for local variable needs to be allocated.
10610 @item -mno-gotplt
10611 @itemx -mgotplt
10612 @opindex mno-gotplt
10613 @opindex mgotplt
10614 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
10615 instruction sequences that load addresses for functions from the PLT part
10616 of the GOT rather than (traditional on other architectures) calls to the
10617 PLT.  The default is @option{-mgotplt}.
10619 @item -maout
10620 @opindex maout
10621 Legacy no-op option only recognized with the cris-axis-aout target.
10623 @item -melf
10624 @opindex melf
10625 Legacy no-op option only recognized with the cris-axis-elf and
10626 cris-axis-linux-gnu targets.
10628 @item -melinux
10629 @opindex melinux
10630 Only recognized with the cris-axis-aout target, where it selects a
10631 GNU/linux-like multilib, include files and instruction set for
10632 @option{-march=v8}.
10634 @item -mlinux
10635 @opindex mlinux
10636 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
10638 @item -sim
10639 @opindex sim
10640 This option, recognized for the cris-axis-aout and cris-axis-elf arranges
10641 to link with input-output functions from a simulator library.  Code,
10642 initialized data and zero-initialized data are allocated consecutively.
10644 @item -sim2
10645 @opindex sim2
10646 Like @option{-sim}, but pass linker options to locate initialized data at
10647 0x40000000 and zero-initialized data at 0x80000000.
10648 @end table
10650 @node MMIX Options
10651 @subsection MMIX Options
10652 @cindex MMIX Options
10654 These options are defined for the MMIX:
10656 @table @gcctabopt
10657 @item -mlibfuncs
10658 @itemx -mno-libfuncs
10659 @opindex mlibfuncs
10660 @opindex mno-libfuncs
10661 Specify that intrinsic library functions are being compiled, passing all
10662 values in registers, no matter the size.
10664 @item -mepsilon
10665 @itemx -mno-epsilon
10666 @opindex mepsilon
10667 @opindex mno-epsilon
10668 Generate floating-point comparison instructions that compare with respect
10669 to the @code{rE} epsilon register.
10671 @item -mabi=mmixware
10672 @itemx -mabi=gnu
10673 @opindex mabi-mmixware
10674 @opindex mabi=gnu
10675 Generate code that passes function parameters and return values that (in
10676 the called function) are seen as registers @code{$0} and up, as opposed to
10677 the GNU ABI which uses global registers @code{$231} and up.
10679 @item -mzero-extend
10680 @itemx -mno-zero-extend
10681 @opindex mzero-extend
10682 @opindex mno-zero-extend
10683 When reading data from memory in sizes shorter than 64 bits, use (do not
10684 use) zero-extending load instructions by default, rather than
10685 sign-extending ones.
10687 @item -mknuthdiv
10688 @itemx -mno-knuthdiv
10689 @opindex mknuthdiv
10690 @opindex mno-knuthdiv
10691 Make the result of a division yielding a remainder have the same sign as
10692 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
10693 remainder follows the sign of the dividend.  Both methods are
10694 arithmetically valid, the latter being almost exclusively used.
10696 @item -mtoplevel-symbols
10697 @itemx -mno-toplevel-symbols
10698 @opindex mtoplevel-symbols
10699 @opindex mno-toplevel-symbols
10700 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
10701 code can be used with the @code{PREFIX} assembly directive.
10703 @item -melf
10704 @opindex melf
10705 Generate an executable in the ELF format, rather than the default
10706 @samp{mmo} format used by the @command{mmix} simulator.
10708 @item -mbranch-predict
10709 @itemx -mno-branch-predict
10710 @opindex mbranch-predict
10711 @opindex mno-branch-predict
10712 Use (do not use) the probable-branch instructions, when static branch
10713 prediction indicates a probable branch.
10715 @item -mbase-addresses
10716 @itemx -mno-base-addresses
10717 @opindex mbase-addresses
10718 @opindex mno-base-addresses
10719 Generate (do not generate) code that uses @emph{base addresses}.  Using a
10720 base address automatically generates a request (handled by the assembler
10721 and the linker) for a constant to be set up in a global register.  The
10722 register is used for one or more base address requests within the range 0
10723 to 255 from the value held in the register.  The generally leads to short
10724 and fast code, but the number of different data items that can be
10725 addressed is limited.  This means that a program that uses lots of static
10726 data may require @option{-mno-base-addresses}.
10728 @item -msingle-exit
10729 @itemx -mno-single-exit
10730 @opindex msingle-exit
10731 @opindex mno-single-exit
10732 Force (do not force) generated code to have a single exit point in each
10733 function.
10734 @end table
10736 @node PDP-11 Options
10737 @subsection PDP-11 Options
10738 @cindex PDP-11 Options
10740 These options are defined for the PDP-11:
10742 @table @gcctabopt
10743 @item -mfpu
10744 @opindex mfpu
10745 Use hardware FPP floating point.  This is the default.  (FIS floating
10746 point on the PDP-11/40 is not supported.)
10748 @item -msoft-float
10749 @opindex msoft-float
10750 Do not use hardware floating point.
10752 @item -mac0
10753 @opindex mac0
10754 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
10756 @item -mno-ac0
10757 @opindex mno-ac0
10758 Return floating-point results in memory.  This is the default.
10760 @item -m40
10761 @opindex m40
10762 Generate code for a PDP-11/40.
10764 @item -m45
10765 @opindex m45
10766 Generate code for a PDP-11/45.  This is the default.
10768 @item -m10
10769 @opindex m10
10770 Generate code for a PDP-11/10.
10772 @item -mbcopy-builtin
10773 @opindex bcopy-builtin
10774 Use inline @code{movstrhi} patterns for copying memory.  This is the
10775 default.
10777 @item -mbcopy
10778 @opindex mbcopy
10779 Do not use inline @code{movstrhi} patterns for copying memory.
10781 @item -mint16
10782 @itemx -mno-int32
10783 @opindex mint16
10784 @opindex mno-int32
10785 Use 16-bit @code{int}.  This is the default.
10787 @item -mint32
10788 @itemx -mno-int16
10789 @opindex mint32
10790 @opindex mno-int16
10791 Use 32-bit @code{int}.
10793 @item -mfloat64
10794 @itemx -mno-float32
10795 @opindex mfloat64
10796 @opindex mno-float32
10797 Use 64-bit @code{float}.  This is the default.
10799 @item -mfloat32
10800 @itemx -mno-float64
10801 @opindex mfloat32
10802 @opindex mno-float64
10803 Use 32-bit @code{float}.
10805 @item -mabshi
10806 @opindex mabshi
10807 Use @code{abshi2} pattern.  This is the default.
10809 @item -mno-abshi
10810 @opindex mno-abshi
10811 Do not use @code{abshi2} pattern.
10813 @item -mbranch-expensive
10814 @opindex mbranch-expensive
10815 Pretend that branches are expensive.  This is for experimenting with
10816 code generation only.
10818 @item -mbranch-cheap
10819 @opindex mbranch-cheap
10820 Do not pretend that branches are expensive.  This is the default.
10822 @item -msplit
10823 @opindex msplit
10824 Generate code for a system with split I&D.
10826 @item -mno-split
10827 @opindex mno-split
10828 Generate code for a system without split I&D.  This is the default.
10830 @item -munix-asm
10831 @opindex munix-asm
10832 Use Unix assembler syntax.  This is the default when configured for
10833 @samp{pdp11-*-bsd}.
10835 @item -mdec-asm
10836 @opindex mdec-asm
10837 Use DEC assembler syntax.  This is the default when configured for any
10838 PDP-11 target other than @samp{pdp11-*-bsd}.
10839 @end table
10841 @node Xstormy16 Options
10842 @subsection Xstormy16 Options
10843 @cindex Xstormy16 Options
10845 These options are defined for Xstormy16:
10847 @table @gcctabopt
10848 @item -msim
10849 @opindex msim
10850 Choose startup files and linker script suitable for the simulator.
10851 @end table
10853 @node FRV Options
10854 @subsection FRV Options
10855 @cindex FRV Options
10857 @table @gcctabopt
10858 @item -mgpr-32
10859 @opindex mgpr-32
10861 Only use the first 32 general purpose registers.
10863 @item -mgpr-64
10864 @opindex mgpr-64
10866 Use all 64 general purpose registers.
10868 @item -mfpr-32
10869 @opindex mfpr-32
10871 Use only the first 32 floating point registers.
10873 @item -mfpr-64
10874 @opindex mfpr-64
10876 Use all 64 floating point registers
10878 @item -mhard-float
10879 @opindex mhard-float
10881 Use hardware instructions for floating point operations.
10883 @item -msoft-float
10884 @opindex msoft-float
10886 Use library routines for floating point operations.
10888 @item -malloc-cc
10889 @opindex malloc-cc
10891 Dynamically allocate condition code registers.
10893 @item -mfixed-cc
10894 @opindex mfixed-cc
10896 Do not try to dynamically allocate condition code registers, only
10897 use @code{icc0} and @code{fcc0}.
10899 @item -mdword
10900 @opindex mdword
10902 Change ABI to use double word insns.
10904 @item -mno-dword
10905 @opindex mno-dword
10907 Do not use double word instructions.
10909 @item -mdouble
10910 @opindex mdouble
10912 Use floating point double instructions.
10914 @item -mno-double
10915 @opindex mno-double
10917 Do not use floating point double instructions.
10919 @item -mmedia
10920 @opindex mmedia
10922 Use media instructions.
10924 @item -mno-media
10925 @opindex mno-media
10927 Do not use media instructions.
10929 @item -mmuladd
10930 @opindex mmuladd
10932 Use multiply and add/subtract instructions.
10934 @item -mno-muladd
10935 @opindex mno-muladd
10937 Do not use multiply and add/subtract instructions.
10939 @item -mlibrary-pic
10940 @opindex mlibrary-pic
10942 Generate position-independent EABI code.
10944 @item -macc-4
10945 @opindex macc-4
10947 Use only the first four media accumulator registers.
10949 @item -macc-8
10950 @opindex macc-8
10952 Use all eight media accumulator registers.
10954 @item -mpack
10955 @opindex mpack
10957 Pack VLIW instructions.
10959 @item -mno-pack
10960 @opindex mno-pack
10962 Do not pack VLIW instructions.
10964 @item -mno-eflags
10965 @opindex mno-eflags
10967 Do not mark ABI switches in e_flags.
10969 @item -mcond-move
10970 @opindex mcond-move
10972 Enable the use of conditional-move instructions (default).
10974 This switch is mainly for debugging the compiler and will likely be removed
10975 in a future version.
10977 @item -mno-cond-move
10978 @opindex mno-cond-move
10980 Disable the use of conditional-move instructions.
10982 This switch is mainly for debugging the compiler and will likely be removed
10983 in a future version.
10985 @item -mscc
10986 @opindex mscc
10988 Enable the use of conditional set instructions (default).
10990 This switch is mainly for debugging the compiler and will likely be removed
10991 in a future version.
10993 @item -mno-scc
10994 @opindex mno-scc
10996 Disable the use of conditional set instructions.
10998 This switch is mainly for debugging the compiler and will likely be removed
10999 in a future version.
11001 @item -mcond-exec
11002 @opindex mcond-exec
11004 Enable the use of conditional execution (default).
11006 This switch is mainly for debugging the compiler and will likely be removed
11007 in a future version.
11009 @item -mno-cond-exec
11010 @opindex mno-cond-exec
11012 Disable the use of conditional execution.
11014 This switch is mainly for debugging the compiler and will likely be removed
11015 in a future version.
11017 @item -mvliw-branch
11018 @opindex mvliw-branch
11020 Run a pass to pack branches into VLIW instructions (default).
11022 This switch is mainly for debugging the compiler and will likely be removed
11023 in a future version.
11025 @item -mno-vliw-branch
11026 @opindex mno-vliw-branch
11028 Do not run a pass to pack branches into VLIW instructions.
11030 This switch is mainly for debugging the compiler and will likely be removed
11031 in a future version.
11033 @item -mmulti-cond-exec
11034 @opindex mmulti-cond-exec
11036 Enable optimization of @code{&&} and @code{||} in conditional execution
11037 (default).
11039 This switch is mainly for debugging the compiler and will likely be removed
11040 in a future version.
11042 @item -mno-multi-cond-exec
11043 @opindex mno-multi-cond-exec
11045 Disable optimization of @code{&&} and @code{||} in conditional execution.
11047 This switch is mainly for debugging the compiler and will likely be removed
11048 in a future version.
11050 @item -mnested-cond-exec
11051 @opindex mnested-cond-exec
11053 Enable nested conditional execution optimizations (default).
11055 This switch is mainly for debugging the compiler and will likely be removed
11056 in a future version.
11058 @item -mno-nested-cond-exec
11059 @opindex mno-nested-cond-exec
11061 Disable nested conditional execution optimizations.
11063 This switch is mainly for debugging the compiler and will likely be removed
11064 in a future version.
11066 @item -mtomcat-stats
11067 @opindex mtomcat-stats
11069 Cause gas to print out tomcat statistics.
11071 @item -mcpu=@var{cpu}
11072 @opindex mcpu
11074 Select the processor type for which to generate code.  Possible values are
11075 @samp{simple}, @samp{tomcat}, @samp{fr500}, @samp{fr400}, @samp{fr300},
11076 @samp{frv}.
11078 @end table
11080 @node Xtensa Options
11081 @subsection Xtensa Options
11082 @cindex Xtensa Options
11084 These options are supported for Xtensa targets:
11086 @table @gcctabopt
11087 @item -mconst16
11088 @itemx -mno-const16
11089 @opindex mconst16
11090 @opindex mno-const16
11091 Enable or disable use of @code{CONST16} instructions for loading
11092 constant values.  The @code{CONST16} instruction is currently not a
11093 standard option from Tensilica.  When enabled, @code{CONST16}
11094 instructions are always used in place of the standard @code{L32R}
11095 instructions.  The use of @code{CONST16} is enabled by default only if
11096 the @code{L32R} instruction is not available.
11098 @item -mfused-madd
11099 @itemx -mno-fused-madd
11100 @opindex mfused-madd
11101 @opindex mno-fused-madd
11102 Enable or disable use of fused multiply/add and multiply/subtract
11103 instructions in the floating-point option.  This has no effect if the
11104 floating-point option is not also enabled.  Disabling fused multiply/add
11105 and multiply/subtract instructions forces the compiler to use separate
11106 instructions for the multiply and add/subtract operations.  This may be
11107 desirable in some cases where strict IEEE 754-compliant results are
11108 required: the fused multiply add/subtract instructions do not round the
11109 intermediate result, thereby producing results with @emph{more} bits of
11110 precision than specified by the IEEE standard.  Disabling fused multiply
11111 add/subtract instructions also ensures that the program output is not
11112 sensitive to the compiler's ability to combine multiply and add/subtract
11113 operations.
11115 @item -mtext-section-literals
11116 @itemx -mno-text-section-literals
11117 @opindex mtext-section-literals
11118 @opindex mno-text-section-literals
11119 Control the treatment of literal pools.  The default is
11120 @option{-mno-text-section-literals}, which places literals in a separate
11121 section in the output file.  This allows the literal pool to be placed
11122 in a data RAM/ROM, and it also allows the linker to combine literal
11123 pools from separate object files to remove redundant literals and
11124 improve code size.  With @option{-mtext-section-literals}, the literals
11125 are interspersed in the text section in order to keep them as close as
11126 possible to their references.  This may be necessary for large assembly
11127 files.
11129 @item -mtarget-align
11130 @itemx -mno-target-align
11131 @opindex mtarget-align
11132 @opindex mno-target-align
11133 When this option is enabled, GCC instructs the assembler to
11134 automatically align instructions to reduce branch penalties at the
11135 expense of some code density.  The assembler attempts to widen density
11136 instructions to align branch targets and the instructions following call
11137 instructions.  If there are not enough preceding safe density
11138 instructions to align a target, no widening will be performed.  The
11139 default is @option{-mtarget-align}.  These options do not affect the
11140 treatment of auto-aligned instructions like @code{LOOP}, which the
11141 assembler will always align, either by widening density instructions or
11142 by inserting no-op instructions.
11144 @item -mlongcalls
11145 @itemx -mno-longcalls
11146 @opindex mlongcalls
11147 @opindex mno-longcalls
11148 When this option is enabled, GCC instructs the assembler to translate
11149 direct calls to indirect calls unless it can determine that the target
11150 of a direct call is in the range allowed by the call instruction.  This
11151 translation typically occurs for calls to functions in other source
11152 files.  Specifically, the assembler translates a direct @code{CALL}
11153 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
11154 The default is @option{-mno-longcalls}.  This option should be used in
11155 programs where the call target can potentially be out of range.  This
11156 option is implemented in the assembler, not the compiler, so the
11157 assembly code generated by GCC will still show direct call
11158 instructions---look at the disassembled object code to see the actual
11159 instructions.  Note that the assembler will use an indirect call for
11160 every cross-file call, not just those that really will be out of range.
11161 @end table
11163 @node Code Gen Options
11164 @section Options for Code Generation Conventions
11165 @cindex code generation conventions
11166 @cindex options, code generation
11167 @cindex run-time options
11169 These machine-independent options control the interface conventions
11170 used in code generation.
11172 Most of them have both positive and negative forms; the negative form
11173 of @option{-ffoo} would be @option{-fno-foo}.  In the table below, only
11174 one of the forms is listed---the one which is not the default.  You
11175 can figure out the other form by either removing @samp{no-} or adding
11178 @table @gcctabopt
11179 @item -fbounds-check
11180 @opindex fbounds-check
11181 For front-ends that support it, generate additional code to check that
11182 indices used to access arrays are within the declared range.  This is
11183 currently only supported by the Java and Fortran 77 front-ends, where
11184 this option defaults to true and false respectively.
11186 @item -ftrapv
11187 @opindex ftrapv
11188 This option generates traps for signed overflow on addition, subtraction,
11189 multiplication operations.
11191 @item -fwrapv
11192 @opindex fwrapv
11193 This option instructs the compiler to assume that signed arithmetic
11194 overflow of addition, subtraction and multiplication wraps around
11195 using twos-complement representation.  This flag enables some optimizations
11196 and disables other.  This option is enabled by default for the Java
11197 front-end, as required by the Java language specification.
11199 @item -fexceptions
11200 @opindex fexceptions
11201 Enable exception handling.  Generates extra code needed to propagate
11202 exceptions.  For some targets, this implies GCC will generate frame
11203 unwind information for all functions, which can produce significant data
11204 size overhead, although it does not affect execution.  If you do not
11205 specify this option, GCC will enable it by default for languages like
11206 C++ which normally require exception handling, and disable it for
11207 languages like C that do not normally require it.  However, you may need
11208 to enable this option when compiling C code that needs to interoperate
11209 properly with exception handlers written in C++.  You may also wish to
11210 disable this option if you are compiling older C++ programs that don't
11211 use exception handling.
11213 @item -fnon-call-exceptions
11214 @opindex fnon-call-exceptions
11215 Generate code that allows trapping instructions to throw exceptions.
11216 Note that this requires platform-specific runtime support that does
11217 not exist everywhere.  Moreover, it only allows @emph{trapping}
11218 instructions to throw exceptions, i.e.@: memory references or floating
11219 point instructions.  It does not allow exceptions to be thrown from
11220 arbitrary signal handlers such as @code{SIGALRM}.
11222 @item -funwind-tables
11223 @opindex funwind-tables
11224 Similar to @option{-fexceptions}, except that it will just generate any needed
11225 static data, but will not affect the generated code in any other way.
11226 You will normally not enable this option; instead, a language processor
11227 that needs this handling would enable it on your behalf.
11229 @item -fasynchronous-unwind-tables
11230 @opindex funwind-tables
11231 Generate unwind table in dwarf2 format, if supported by target machine.  The
11232 table is exact at each instruction boundary, so it can be used for stack
11233 unwinding from asynchronous events (such as debugger or garbage collector).
11235 @item -fpcc-struct-return
11236 @opindex fpcc-struct-return
11237 Return ``short'' @code{struct} and @code{union} values in memory like
11238 longer ones, rather than in registers.  This convention is less
11239 efficient, but it has the advantage of allowing intercallability between
11240 GCC-compiled files and files compiled with other compilers, particularly
11241 the Portable C Compiler (pcc).
11243 The precise convention for returning structures in memory depends
11244 on the target configuration macros.
11246 Short structures and unions are those whose size and alignment match
11247 that of some integer type.
11249 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
11250 switch is not binary compatible with code compiled with the
11251 @option{-freg-struct-return} switch.
11252 Use it to conform to a non-default application binary interface.
11254 @item -freg-struct-return
11255 @opindex freg-struct-return
11256 Return @code{struct} and @code{union} values in registers when possible.
11257 This is more efficient for small structures than
11258 @option{-fpcc-struct-return}.
11260 If you specify neither @option{-fpcc-struct-return} nor
11261 @option{-freg-struct-return}, GCC defaults to whichever convention is
11262 standard for the target.  If there is no standard convention, GCC
11263 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
11264 the principal compiler.  In those cases, we can choose the standard, and
11265 we chose the more efficient register return alternative.
11267 @strong{Warning:} code compiled with the @option{-freg-struct-return}
11268 switch is not binary compatible with code compiled with the
11269 @option{-fpcc-struct-return} switch.
11270 Use it to conform to a non-default application binary interface.
11272 @item -fshort-enums
11273 @opindex fshort-enums
11274 Allocate to an @code{enum} type only as many bytes as it needs for the
11275 declared range of possible values.  Specifically, the @code{enum} type
11276 will be equivalent to the smallest integer type which has enough room.
11278 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
11279 code that is not binary compatible with code generated without that switch.
11280 Use it to conform to a non-default application binary interface.
11282 @item -fshort-double
11283 @opindex fshort-double
11284 Use the same size for @code{double} as for @code{float}.
11286 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
11287 code that is not binary compatible with code generated without that switch.
11288 Use it to conform to a non-default application binary interface.
11290 @item -fshort-wchar
11291 @opindex fshort-wchar
11292 Override the underlying type for @samp{wchar_t} to be @samp{short
11293 unsigned int} instead of the default for the target.  This option is
11294 useful for building programs to run under WINE@.
11296 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
11297 code that is not binary compatible with code generated without that switch.
11298 Use it to conform to a non-default application binary interface.
11300 @item -fshared-data
11301 @opindex fshared-data
11302 Requests that the data and non-@code{const} variables of this
11303 compilation be shared data rather than private data.  The distinction
11304 makes sense only on certain operating systems, where shared data is
11305 shared between processes running the same program, while private data
11306 exists in one copy per process.
11308 @item -fno-common
11309 @opindex fno-common
11310 In C, allocate even uninitialized global variables in the data section of the
11311 object file, rather than generating them as common blocks.  This has the
11312 effect that if the same variable is declared (without @code{extern}) in
11313 two different compilations, you will get an error when you link them.
11314 The only reason this might be useful is if you wish to verify that the
11315 program will work on other systems which always work this way.
11317 @item -fno-ident
11318 @opindex fno-ident
11319 Ignore the @samp{#ident} directive.
11321 @item -finhibit-size-directive
11322 @opindex finhibit-size-directive
11323 Don't output a @code{.size} assembler directive, or anything else that
11324 would cause trouble if the function is split in the middle, and the
11325 two halves are placed at locations far apart in memory.  This option is
11326 used when compiling @file{crtstuff.c}; you should not need to use it
11327 for anything else.
11329 @item -fverbose-asm
11330 @opindex fverbose-asm
11331 Put extra commentary information in the generated assembly code to
11332 make it more readable.  This option is generally only of use to those
11333 who actually need to read the generated assembly code (perhaps while
11334 debugging the compiler itself).
11336 @option{-fno-verbose-asm}, the default, causes the
11337 extra information to be omitted and is useful when comparing two assembler
11338 files.
11340 @item -fpic
11341 @opindex fpic
11342 @cindex global offset table
11343 @cindex PIC
11344 Generate position-independent code (PIC) suitable for use in a shared
11345 library, if supported for the target machine.  Such code accesses all
11346 constant addresses through a global offset table (GOT)@.  The dynamic
11347 loader resolves the GOT entries when the program starts (the dynamic
11348 loader is not part of GCC; it is part of the operating system).  If
11349 the GOT size for the linked executable exceeds a machine-specific
11350 maximum size, you get an error message from the linker indicating that
11351 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
11352 instead.  (These maximums are 8k on the SPARC and 32k
11353 on the m68k and RS/6000.  The 386 has no such limit.)
11355 Position-independent code requires special support, and therefore works
11356 only on certain machines.  For the 386, GCC supports PIC for System V
11357 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
11358 position-independent.
11360 @item -fPIC
11361 @opindex fPIC
11362 If supported for the target machine, emit position-independent code,
11363 suitable for dynamic linking and avoiding any limit on the size of the
11364 global offset table.  This option makes a difference on the m68k
11365 and the SPARC.
11367 Position-independent code requires special support, and therefore works
11368 only on certain machines.
11370 @item -fpie
11371 @itemx -fPIE
11372 @opindex fpie
11373 @opindex fPIE
11374 These options are similar to @option{-fpic} and @option{-fPIC}, but
11375 generated position independent code can be only linked into executables.
11376 Usually these options are used when @option{-pie} GCC option will be
11377 used during linking.
11379 @item -ffixed-@var{reg}
11380 @opindex ffixed
11381 Treat the register named @var{reg} as a fixed register; generated code
11382 should never refer to it (except perhaps as a stack pointer, frame
11383 pointer or in some other fixed role).
11385 @var{reg} must be the name of a register.  The register names accepted
11386 are machine-specific and are defined in the @code{REGISTER_NAMES}
11387 macro in the machine description macro file.
11389 This flag does not have a negative form, because it specifies a
11390 three-way choice.
11392 @item -fcall-used-@var{reg}
11393 @opindex fcall-used
11394 Treat the register named @var{reg} as an allocable register that is
11395 clobbered by function calls.  It may be allocated for temporaries or
11396 variables that do not live across a call.  Functions compiled this way
11397 will not save and restore the register @var{reg}.
11399 It is an error to used this flag with the frame pointer or stack pointer.
11400 Use of this flag for other registers that have fixed pervasive roles in
11401 the machine's execution model will produce disastrous results.
11403 This flag does not have a negative form, because it specifies a
11404 three-way choice.
11406 @item -fcall-saved-@var{reg}
11407 @opindex fcall-saved
11408 Treat the register named @var{reg} as an allocable register saved by
11409 functions.  It may be allocated even for temporaries or variables that
11410 live across a call.  Functions compiled this way will save and restore
11411 the register @var{reg} if they use it.
11413 It is an error to used this flag with the frame pointer or stack pointer.
11414 Use of this flag for other registers that have fixed pervasive roles in
11415 the machine's execution model will produce disastrous results.
11417 A different sort of disaster will result from the use of this flag for
11418 a register in which function values may be returned.
11420 This flag does not have a negative form, because it specifies a
11421 three-way choice.
11423 @item -fpack-struct
11424 @opindex fpack-struct
11425 Pack all structure members together without holes.
11427 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
11428 code that is not binary compatible with code generated without that switch.
11429 Additionally, it makes the code suboptimal.
11430 Use it to conform to a non-default application binary interface.
11432 @item -finstrument-functions
11433 @opindex finstrument-functions
11434 Generate instrumentation calls for entry and exit to functions.  Just
11435 after function entry and just before function exit, the following
11436 profiling functions will be called with the address of the current
11437 function and its call site.  (On some platforms,
11438 @code{__builtin_return_address} does not work beyond the current
11439 function, so the call site information may not be available to the
11440 profiling functions otherwise.)
11442 @smallexample
11443 void __cyg_profile_func_enter (void *this_fn,
11444                                void *call_site);
11445 void __cyg_profile_func_exit  (void *this_fn,
11446                                void *call_site);
11447 @end smallexample
11449 The first argument is the address of the start of the current function,
11450 which may be looked up exactly in the symbol table.
11452 This instrumentation is also done for functions expanded inline in other
11453 functions.  The profiling calls will indicate where, conceptually, the
11454 inline function is entered and exited.  This means that addressable
11455 versions of such functions must be available.  If all your uses of a
11456 function are expanded inline, this may mean an additional expansion of
11457 code size.  If you use @samp{extern inline} in your C code, an
11458 addressable version of such functions must be provided.  (This is
11459 normally the case anyways, but if you get lucky and the optimizer always
11460 expands the functions inline, you might have gotten away without
11461 providing static copies.)
11463 A function may be given the attribute @code{no_instrument_function}, in
11464 which case this instrumentation will not be done.  This can be used, for
11465 example, for the profiling functions listed above, high-priority
11466 interrupt routines, and any functions from which the profiling functions
11467 cannot safely be called (perhaps signal handlers, if the profiling
11468 routines generate output or allocate memory).
11470 @item -fstack-check
11471 @opindex fstack-check
11472 Generate code to verify that you do not go beyond the boundary of the
11473 stack.  You should specify this flag if you are running in an
11474 environment with multiple threads, but only rarely need to specify it in
11475 a single-threaded environment since stack overflow is automatically
11476 detected on nearly all systems if there is only one stack.
11478 Note that this switch does not actually cause checking to be done; the
11479 operating system must do that.  The switch causes generation of code
11480 to ensure that the operating system sees the stack being extended.
11482 @item -fstack-limit-register=@var{reg}
11483 @itemx -fstack-limit-symbol=@var{sym}
11484 @itemx -fno-stack-limit
11485 @opindex fstack-limit-register
11486 @opindex fstack-limit-symbol
11487 @opindex fno-stack-limit
11488 Generate code to ensure that the stack does not grow beyond a certain value,
11489 either the value of a register or the address of a symbol.  If the stack
11490 would grow beyond the value, a signal is raised.  For most targets,
11491 the signal is raised before the stack overruns the boundary, so
11492 it is possible to catch the signal without taking special precautions.
11494 For instance, if the stack starts at absolute address @samp{0x80000000}
11495 and grows downwards, you can use the flags
11496 @option{-fstack-limit-symbol=__stack_limit} and
11497 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
11498 of 128KB@.  Note that this may only work with the GNU linker.
11500 @cindex aliasing of parameters
11501 @cindex parameters, aliased
11502 @item -fargument-alias
11503 @itemx -fargument-noalias
11504 @itemx -fargument-noalias-global
11505 @opindex fargument-alias
11506 @opindex fargument-noalias
11507 @opindex fargument-noalias-global
11508 Specify the possible relationships among parameters and between
11509 parameters and global data.
11511 @option{-fargument-alias} specifies that arguments (parameters) may
11512 alias each other and may alias global storage.@*
11513 @option{-fargument-noalias} specifies that arguments do not alias
11514 each other, but may alias global storage.@*
11515 @option{-fargument-noalias-global} specifies that arguments do not
11516 alias each other and do not alias global storage.
11518 Each language will automatically use whatever option is required by
11519 the language standard.  You should not need to use these options yourself.
11521 @item -fleading-underscore
11522 @opindex fleading-underscore
11523 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
11524 change the way C symbols are represented in the object file.  One use
11525 is to help link with legacy assembly code.
11527 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
11528 generate code that is not binary compatible with code generated without that
11529 switch.  Use it to conform to a non-default application binary interface.
11530 Not all targets provide complete support for this switch.
11532 @item -ftls-model=@var{model}
11533 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
11534 The @var{model} argument should be one of @code{global-dynamic},
11535 @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
11537 The default without @option{-fpic} is @code{initial-exec}; with
11538 @option{-fpic} the default is @code{global-dynamic}.
11539 @end table
11541 @c man end
11543 @node Environment Variables
11544 @section Environment Variables Affecting GCC
11545 @cindex environment variables
11547 @c man begin ENVIRONMENT
11548 This section describes several environment variables that affect how GCC
11549 operates.  Some of them work by specifying directories or prefixes to use
11550 when searching for various kinds of files.  Some are used to specify other
11551 aspects of the compilation environment.
11553 Note that you can also specify places to search using options such as
11554 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
11555 take precedence over places specified using environment variables, which
11556 in turn take precedence over those specified by the configuration of GCC@.
11557 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
11558 GNU Compiler Collection (GCC) Internals}.
11560 @table @env
11561 @item LANG
11562 @itemx LC_CTYPE
11563 @c @itemx LC_COLLATE
11564 @itemx LC_MESSAGES
11565 @c @itemx LC_MONETARY
11566 @c @itemx LC_NUMERIC
11567 @c @itemx LC_TIME
11568 @itemx LC_ALL
11569 @findex LANG
11570 @findex LC_CTYPE
11571 @c @findex LC_COLLATE
11572 @findex LC_MESSAGES
11573 @c @findex LC_MONETARY
11574 @c @findex LC_NUMERIC
11575 @c @findex LC_TIME
11576 @findex LC_ALL
11577 @cindex locale
11578 These environment variables control the way that GCC uses
11579 localization information that allow GCC to work with different
11580 national conventions.  GCC inspects the locale categories
11581 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
11582 so.  These locale categories can be set to any value supported by your
11583 installation.  A typical value is @samp{en_UK} for English in the United
11584 Kingdom.
11586 The @env{LC_CTYPE} environment variable specifies character
11587 classification.  GCC uses it to determine the character boundaries in
11588 a string; this is needed for some multibyte encodings that contain quote
11589 and escape characters that would otherwise be interpreted as a string
11590 end or escape.
11592 The @env{LC_MESSAGES} environment variable specifies the language to
11593 use in diagnostic messages.
11595 If the @env{LC_ALL} environment variable is set, it overrides the value
11596 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
11597 and @env{LC_MESSAGES} default to the value of the @env{LANG}
11598 environment variable.  If none of these variables are set, GCC
11599 defaults to traditional C English behavior.
11601 @item TMPDIR
11602 @findex TMPDIR
11603 If @env{TMPDIR} is set, it specifies the directory to use for temporary
11604 files.  GCC uses temporary files to hold the output of one stage of
11605 compilation which is to be used as input to the next stage: for example,
11606 the output of the preprocessor, which is the input to the compiler
11607 proper.
11609 @item GCC_EXEC_PREFIX
11610 @findex GCC_EXEC_PREFIX
11611 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
11612 names of the subprograms executed by the compiler.  No slash is added
11613 when this prefix is combined with the name of a subprogram, but you can
11614 specify a prefix that ends with a slash if you wish.
11616 If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
11617 an appropriate prefix to use based on the pathname it was invoked with.
11619 If GCC cannot find the subprogram using the specified prefix, it
11620 tries looking in the usual places for the subprogram.
11622 The default value of @env{GCC_EXEC_PREFIX} is
11623 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the value
11624 of @code{prefix} when you ran the @file{configure} script.
11626 Other prefixes specified with @option{-B} take precedence over this prefix.
11628 This prefix is also used for finding files such as @file{crt0.o} that are
11629 used for linking.
11631 In addition, the prefix is used in an unusual way in finding the
11632 directories to search for header files.  For each of the standard
11633 directories whose name normally begins with @samp{/usr/local/lib/gcc}
11634 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
11635 replacing that beginning with the specified prefix to produce an
11636 alternate directory name.  Thus, with @option{-Bfoo/}, GCC will search
11637 @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
11638 These alternate directories are searched first; the standard directories
11639 come next.
11641 @item COMPILER_PATH
11642 @findex COMPILER_PATH
11643 The value of @env{COMPILER_PATH} is a colon-separated list of
11644 directories, much like @env{PATH}.  GCC tries the directories thus
11645 specified when searching for subprograms, if it can't find the
11646 subprograms using @env{GCC_EXEC_PREFIX}.
11648 @item LIBRARY_PATH
11649 @findex LIBRARY_PATH
11650 The value of @env{LIBRARY_PATH} is a colon-separated list of
11651 directories, much like @env{PATH}.  When configured as a native compiler,
11652 GCC tries the directories thus specified when searching for special
11653 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}.  Linking
11654 using GCC also uses these directories when searching for ordinary
11655 libraries for the @option{-l} option (but directories specified with
11656 @option{-L} come first).
11658 @item LANG
11659 @findex LANG
11660 @cindex locale definition
11661 This variable is used to pass locale information to the compiler.  One way in
11662 which this information is used is to determine the character set to be used
11663 when character literals, string literals and comments are parsed in C and C++.
11664 When the compiler is configured to allow multibyte characters,
11665 the following values for @env{LANG} are recognized:
11667 @table @samp
11668 @item C-JIS
11669 Recognize JIS characters.
11670 @item C-SJIS
11671 Recognize SJIS characters.
11672 @item C-EUCJP
11673 Recognize EUCJP characters.
11674 @end table
11676 If @env{LANG} is not defined, or if it has some other value, then the
11677 compiler will use mblen and mbtowc as defined by the default locale to
11678 recognize and translate multibyte characters.
11679 @end table
11681 @noindent
11682 Some additional environments variables affect the behavior of the
11683 preprocessor.
11685 @include cppenv.texi
11687 @c man end
11689 @node Precompiled Headers
11690 @section Using Precompiled Headers
11691 @cindex precompiled headers
11692 @cindex speed of compilation
11694 Often large projects have many header files that are included in every
11695 source file.  The time the compiler takes to process these header files
11696 over and over again can account for nearly all of the time required to
11697 build the project.  To make builds faster, GCC allows users to
11698 `precompile' a header file; then, if builds can use the precompiled
11699 header file they will be much faster.
11701 @strong{Caution:} There are a few known situations where GCC will
11702 crash when trying to use a precompiled header.  If you have trouble
11703 with a precompiled header, you should remove the precompiled header
11704 and compile without it.  In addition, please use GCC's on-line
11705 defect-tracking system to report any problems you encounter with
11706 precompiled headers.  @xref{Bugs}.
11708 To create a precompiled header file, simply compile it as you would any
11709 other file, if necessary using the @option{-x} option to make the driver
11710 treat it as a C or C++ header file.  You will probably want to use a
11711 tool like @command{make} to keep the precompiled header up-to-date when
11712 the headers it contains change.
11714 A precompiled header file will be searched for when @code{#include} is
11715 seen in the compilation.  As it searches for the included file
11716 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
11717 compiler looks for a precompiled header in each directory just before it
11718 looks for the include file in that directory.  The name searched for is
11719 the name specified in the @code{#include} with @samp{.gch} appended.  If
11720 the precompiled header file can't be used, it is ignored.
11722 For instance, if you have @code{#include "all.h"}, and you have
11723 @file{all.h.gch} in the same directory as @file{all.h}, then the
11724 precompiled header file will be used if possible, and the original
11725 header will be used otherwise.
11727 Alternatively, you might decide to put the precompiled header file in a
11728 directory and use @option{-I} to ensure that directory is searched
11729 before (or instead of) the directory containing the original header.
11730 Then, if you want to check that the precompiled header file is always
11731 used, you can put a file of the same name as the original header in this
11732 directory containing an @code{#error} command.
11734 This also works with @option{-include}.  So yet another way to use
11735 precompiled headers, good for projects not designed with precompiled
11736 header files in mind, is to simply take most of the header files used by
11737 a project, include them from another header file, precompile that header
11738 file, and @option{-include} the precompiled header.  If the header files
11739 have guards against multiple inclusion, they will be skipped because
11740 they've already been included (in the precompiled header).
11742 If you need to precompile the same header file for different
11743 languages, targets, or compiler options, you can instead make a
11744 @emph{directory} named like @file{all.h.gch}, and put each precompiled
11745 header in the directory, perhaps using @option{-o}.  It doesn't matter
11746 what you call the files in the directory, every precompiled header in
11747 the directory will be considered.  The first precompiled header
11748 encountered in the directory that is valid for this compilation will
11749 be used; they're searched in no particular order.
11751 There are many other possibilities, limited only by your imagination,
11752 good sense, and the constraints of your build system.
11754 A precompiled header file can be used only when these conditions apply:
11756 @itemize
11757 @item
11758 Only one precompiled header can be used in a particular compilation.
11760 @item
11761 A precompiled header can't be used once the first C token is seen.  You
11762 can have preprocessor directives before a precompiled header; you can
11763 even include a precompiled header from inside another header, so long as
11764 there are no C tokens before the @code{#include}.
11766 @item
11767 The precompiled header file must be produced for the same language as
11768 the current compilation.  You can't use a C precompiled header for a C++
11769 compilation.
11771 @item
11772 The precompiled header file must be produced by the same compiler
11773 version and configuration as the current compilation is using.
11774 The easiest way to guarantee this is to use the same compiler binary
11775 for creating and using precompiled headers.
11777 @item
11778 Any macros defined before the precompiled header is included must
11779 either be defined in the same way as when the precompiled header was
11780 generated, or must not affect the precompiled header, which usually
11781 means that the they don't appear in the precompiled header at all.
11783 The @option{-D} option is one way to define a macro before a
11784 precompiled header is included; using a @code{#define} can also do it.
11785 There are also some options that define macros implicitly, like
11786 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
11787 defined this way.
11789 @item If debugging information is output when using the precompiled
11790 header, using @option{-g} or similar, the same kind of debugging information
11791 must have been output when building the precompiled header.  However,
11792 a precompiled header built using @option{-g} can be used in a compilation
11793 when no debugging information is being output.
11795 @item The same @option{-m} options must generally be used when building
11796 and using the precompiled header.  @xref{Submodel Options},
11797 for any cases where this rule is relaxed.
11799 @item Each of the following options must be the same when building and using
11800 the precompiled header:
11802 @gccoptlist{-fexceptions -funit-at-a-time}
11804 @item
11805 Some other command-line options starting with @option{-f},
11806 @option{-p}, or @option{-O} must be defined in the same way as when
11807 the precompiled header was generated.  At present, it's not clear
11808 which options are safe to change and which are not; the safest choice
11809 is to use exactly the same options when generating and using the
11810 precompiled header.  The following are known to be safe:
11812 @gccoptlist{-pedantic-errors}
11814 @end itemize
11816 For all of these except the last, the compiler will automatically
11817 ignore the precompiled header if the conditions aren't met.  If you
11818 find an option combination that doesn't work and doesn't cause the
11819 precompiled header to be ignored, please consider filing a bug report,
11820 see @ref{Bugs}.
11822 @node Running Protoize
11823 @section Running Protoize
11825 The program @code{protoize} is an optional part of GCC@.  You can use
11826 it to add prototypes to a program, thus converting the program to ISO
11827 C in one respect.  The companion program @code{unprotoize} does the
11828 reverse: it removes argument types from any prototypes that are found.
11830 When you run these programs, you must specify a set of source files as
11831 command line arguments.  The conversion programs start out by compiling
11832 these files to see what functions they define.  The information gathered
11833 about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
11835 After scanning comes actual conversion.  The specified files are all
11836 eligible to be converted; any files they include (whether sources or
11837 just headers) are eligible as well.
11839 But not all the eligible files are converted.  By default,
11840 @code{protoize} and @code{unprotoize} convert only source and header
11841 files in the current directory.  You can specify additional directories
11842 whose files should be converted with the @option{-d @var{directory}}
11843 option.  You can also specify particular files to exclude with the
11844 @option{-x @var{file}} option.  A file is converted if it is eligible, its
11845 directory name matches one of the specified directory names, and its
11846 name within the directory has not been excluded.
11848 Basic conversion with @code{protoize} consists of rewriting most
11849 function definitions and function declarations to specify the types of
11850 the arguments.  The only ones not rewritten are those for varargs
11851 functions.
11853 @code{protoize} optionally inserts prototype declarations at the
11854 beginning of the source file, to make them available for any calls that
11855 precede the function's definition.  Or it can insert prototype
11856 declarations with block scope in the blocks where undeclared functions
11857 are called.
11859 Basic conversion with @code{unprotoize} consists of rewriting most
11860 function declarations to remove any argument types, and rewriting
11861 function definitions to the old-style pre-ISO form.
11863 Both conversion programs print a warning for any function declaration or
11864 definition that they can't convert.  You can suppress these warnings
11865 with @option{-q}.
11867 The output from @code{protoize} or @code{unprotoize} replaces the
11868 original source file.  The original file is renamed to a name ending
11869 with @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
11870 without the original @samp{.c} suffix).  If the @samp{.save} (@samp{.sav}
11871 for DOS) file already exists, then the source file is simply discarded.
11873 @code{protoize} and @code{unprotoize} both depend on GCC itself to
11874 scan the program and collect information about the functions it uses.
11875 So neither of these programs will work until GCC is installed.
11877 Here is a table of the options you can use with @code{protoize} and
11878 @code{unprotoize}.  Each option works with both programs unless
11879 otherwise stated.
11881 @table @code
11882 @item -B @var{directory}
11883 Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
11884 usual directory (normally @file{/usr/local/lib}).  This file contains
11885 prototype information about standard system functions.  This option
11886 applies only to @code{protoize}.
11888 @item -c @var{compilation-options}
11889 Use @var{compilation-options} as the options when running @command{gcc} to
11890 produce the @samp{.X} files.  The special option @option{-aux-info} is
11891 always passed in addition, to tell @command{gcc} to write a @samp{.X} file.
11893 Note that the compilation options must be given as a single argument to
11894 @code{protoize} or @code{unprotoize}.  If you want to specify several
11895 @command{gcc} options, you must quote the entire set of compilation options
11896 to make them a single word in the shell.
11898 There are certain @command{gcc} arguments that you cannot use, because they
11899 would produce the wrong kind of output.  These include @option{-g},
11900 @option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
11901 the @var{compilation-options}, they are ignored.
11903 @item -C
11904 Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file
11905 systems) instead of @samp{.c}.  This is convenient if you are converting
11906 a C program to C++.  This option applies only to @code{protoize}.
11908 @item -g
11909 Add explicit global declarations.  This means inserting explicit
11910 declarations at the beginning of each source file for each function
11911 that is called in the file and was not declared.  These declarations
11912 precede the first function definition that contains a call to an
11913 undeclared function.  This option applies only to @code{protoize}.
11915 @item -i @var{string}
11916 Indent old-style parameter declarations with the string @var{string}.
11917 This option applies only to @code{protoize}.
11919 @code{unprotoize} converts prototyped function definitions to old-style
11920 function definitions, where the arguments are declared between the
11921 argument list and the initial @samp{@{}.  By default, @code{unprotoize}
11922 uses five spaces as the indentation.  If you want to indent with just
11923 one space instead, use @option{-i " "}.
11925 @item -k
11926 Keep the @samp{.X} files.  Normally, they are deleted after conversion
11927 is finished.
11929 @item -l
11930 Add explicit local declarations.  @code{protoize} with @option{-l} inserts
11931 a prototype declaration for each function in each block which calls the
11932 function without any declaration.  This option applies only to
11933 @code{protoize}.
11935 @item -n
11936 Make no real changes.  This mode just prints information about the conversions
11937 that would have been done without @option{-n}.
11939 @item -N
11940 Make no @samp{.save} files.  The original files are simply deleted.
11941 Use this option with caution.
11943 @item -p @var{program}
11944 Use the program @var{program} as the compiler.  Normally, the name
11945 @file{gcc} is used.
11947 @item -q
11948 Work quietly.  Most warnings are suppressed.
11950 @item -v
11951 Print the version number, just like @option{-v} for @command{gcc}.
11952 @end table
11954 If you need special compiler options to compile one of your program's
11955 source files, then you should generate that file's @samp{.X} file
11956 specially, by running @command{gcc} on that source file with the
11957 appropriate options and the option @option{-aux-info}.  Then run
11958 @code{protoize} on the entire set of files.  @code{protoize} will use
11959 the existing @samp{.X} file because it is newer than the source file.
11960 For example:
11962 @smallexample
11963 gcc -Dfoo=bar file1.c -aux-info file1.X
11964 protoize *.c
11965 @end smallexample
11967 @noindent
11968 You need to include the special files along with the rest in the
11969 @code{protoize} command, even though their @samp{.X} files already
11970 exist, because otherwise they won't get converted.
11972 @xref{Protoize Caveats}, for more information on how to use
11973 @code{protoize} successfully.