OSDN Git Service

fixincludes:
[pf3gnuchains/gcc-fork.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2 @c 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
3 @c Free Software Foundation, Inc.
4 @c This is part of the GCC manual.
5 @c For copying conditions, see the file gcc.texi.
6
7 @ignore
8 @c man begin INCLUDE
9 @include gcc-vers.texi
10 @c man end
11
12 @c man begin COPYRIGHT
13 Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
14 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
15
16 Permission is granted to copy, distribute and/or modify this document
17 under the terms of the GNU Free Documentation License, Version 1.2 or
18 any later version published by the Free Software Foundation; with the
19 Invariant Sections being ``GNU General Public License'' and ``Funding
20 Free Software'', the Front-Cover texts being (a) (see below), and with
21 the Back-Cover Texts being (b) (see below).  A copy of the license is
22 included in the gfdl(7) man page.
23
24 (a) The FSF's Front-Cover Text is:
25
26      A GNU Manual
27
28 (b) The FSF's Back-Cover Text is:
29
30      You have freedom to copy and modify this GNU Manual, like GNU
31      software.  Copies published by the Free Software Foundation raise
32      funds for GNU development.
33 @c man end
34 @c Set file name and title for the man page.
35 @setfilename gcc
36 @settitle GNU project C and C++ compiler
37 @c man begin SYNOPSIS
38 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
39     [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
40     [@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
41     [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
42     [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
43     [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
44     [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
45
46 Only the most useful options are listed here; see below for the
47 remainder.  @samp{g++} accepts mostly the same options as @samp{gcc}.
48 @c man end
49 @c man begin SEEALSO
50 gpl(7), gfdl(7), fsf-funding(7),
51 cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
52 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
53 @file{ld}, @file{binutils} and @file{gdb}.
54 @c man end
55 @c man begin BUGS
56 For instructions on reporting bugs, see
57 @w{@uref{http://gcc.gnu.org/bugs.html}}.
58 @c man end
59 @c man begin AUTHOR
60 See the Info entry for @command{gcc}, or
61 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
62 for contributors to GCC@.
63 @c man end
64 @end ignore
65
66 @node Invoking GCC
67 @chapter GCC Command Options
68 @cindex GCC command options
69 @cindex command options
70 @cindex options, GCC command
71
72 @c man begin DESCRIPTION
73 When you invoke GCC, it normally does preprocessing, compilation,
74 assembly and linking.  The ``overall options'' allow you to stop this
75 process at an intermediate stage.  For example, the @option{-c} option
76 says not to run the linker.  Then the output consists of object files
77 output by the assembler.
78
79 Other options are passed on to one stage of processing.  Some options
80 control the preprocessor and others the compiler itself.  Yet other
81 options control the assembler and linker; most of these are not
82 documented here, since you rarely need to use any of them.
83
84 @cindex C compilation options
85 Most of the command line options that you can use with GCC are useful
86 for C programs; when an option is only useful with another language
87 (usually C++), the explanation says so explicitly.  If the description
88 for a particular option does not mention a source language, you can use
89 that option with all supported languages.
90
91 @cindex C++ compilation options
92 @xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
93 options for compiling C++ programs.
94
95 @cindex grouping options
96 @cindex options, grouping
97 The @command{gcc} program accepts options and file names as operands.  Many
98 options have multi-letter names; therefore multiple single-letter options
99 may @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d
100 -r}}.
101
102 @cindex order of options
103 @cindex options, order
104 You can mix options and other arguments.  For the most part, the order
105 you use doesn't matter.  Order does matter when you use several options
106 of the same kind; for example, if you specify @option{-L} more than once,
107 the directories are searched in the order specified.
108
109 Many options have long names starting with @samp{-f} or with
110 @samp{-W}---for example, 
111 @option{-fmove-loop-invariants}, @option{-Wformat} and so on.  Most of
112 these have both positive and negative forms; the negative form of
113 @option{-ffoo} would be @option{-fno-foo}.  This manual documents
114 only one of these two forms, whichever one is not the default.
115
116 @c man end
117
118 @xref{Option Index}, for an index to GCC's options.
119
120 @menu
121 * Option Summary::      Brief list of all options, without explanations.
122 * Overall Options::     Controlling the kind of output:
123                         an executable, object files, assembler files,
124                         or preprocessed source.
125 * Invoking G++::        Compiling C++ programs.
126 * C Dialect Options::   Controlling the variant of C language compiled.
127 * C++ Dialect Options:: Variations on C++.
128 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
129                         and Objective-C++.
130 * Language Independent Options:: Controlling how diagnostics should be
131                         formatted.
132 * Warning Options::     How picky should the compiler be?
133 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
134 * Optimize Options::    How much optimization?
135 * Preprocessor Options:: Controlling header files and macro definitions.
136                          Also, getting dependency information for Make.
137 * Assembler Options::   Passing options to the assembler.
138 * Link Options::        Specifying libraries and so on.
139 * Directory Options::   Where to find header files and libraries.
140                         Where to find the compiler executable files.
141 * Spec Files::          How to pass switches to sub-processes.
142 * Target Options::      Running a cross-compiler, or an old version of GCC.
143 * Submodel Options::    Specifying minor hardware or convention variations,
144                         such as 68010 vs 68020.
145 * Code Gen Options::    Specifying conventions for function calls, data layout
146                         and register usage.
147 * Environment Variables:: Env vars that affect GCC.
148 * Precompiled Headers:: Compiling a header once, and using it many times.
149 * Running Protoize::    Automatically adding or removing function prototypes.
150 @end menu
151
152 @c man begin OPTIONS
153
154 @node Option Summary
155 @section Option Summary
156
157 Here is a summary of all the options, grouped by type.  Explanations are
158 in the following sections.
159
160 @table @emph
161 @item Overall Options
162 @xref{Overall Options,,Options Controlling the Kind of Output}.
163 @gccoptlist{-c  -S  -E  -o @var{file}  -combine  -pipe  -pass-exit-codes  @gol
164 -x @var{language}  -v  -###  --help@r{[}=@var{class}@r{]}  --target-help  @gol 
165 --version @@@var{file}}
166
167 @item C Language Options
168 @xref{C Dialect Options,,Options Controlling C Dialect}.
169 @gccoptlist{-ansi  -std=@var{standard}  -fgnu89-inline @gol
170 -aux-info @var{filename} @gol
171 -fno-asm  -fno-builtin  -fno-builtin-@var{function} @gol
172 -fhosted  -ffreestanding -fopenmp -fms-extensions @gol
173 -trigraphs  -no-integrated-cpp  -traditional  -traditional-cpp @gol
174 -fallow-single-precision  -fcond-mismatch -flax-vector-conversions @gol
175 -fsigned-bitfields  -fsigned-char @gol
176 -funsigned-bitfields  -funsigned-char}
177
178 @item C++ Language Options
179 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
180 @gccoptlist{-fabi-version=@var{n}  -fno-access-control  -fcheck-new @gol
181 -fconserve-space  -ffriend-injection @gol
182 -fno-elide-constructors @gol
183 -fno-enforce-eh-specs @gol
184 -ffor-scope  -fno-for-scope  -fno-gnu-keywords @gol
185 -fno-implicit-templates @gol
186 -fno-implicit-inline-templates @gol
187 -fno-implement-inlines  -fms-extensions @gol
188 -fno-nonansi-builtins  -fno-operator-names @gol
189 -fno-optional-diags  -fpermissive @gol
190 -frepo  -fno-rtti  -fstats  -ftemplate-depth-@var{n} @gol
191 -fno-threadsafe-statics -fuse-cxa-atexit  -fno-weak  -nostdinc++ @gol
192 -fno-default-inline  -fvisibility-inlines-hidden @gol
193 -Wabi  -Wctor-dtor-privacy @gol
194 -Wnon-virtual-dtor  -Wreorder @gol
195 -Weffc++  -Wno-deprecated  -Wstrict-null-sentinel @gol
196 -Wno-non-template-friend  -Wold-style-cast @gol
197 -Woverloaded-virtual  -Wno-pmf-conversions @gol
198 -Wsign-promo}
199
200 @item Objective-C and Objective-C++ Language Options
201 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
202 Objective-C and Objective-C++ Dialects}.
203 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
204 -fgnu-runtime  -fnext-runtime @gol
205 -fno-nil-receivers @gol
206 -fobjc-call-cxx-cdtors @gol
207 -fobjc-direct-dispatch @gol
208 -fobjc-exceptions @gol
209 -fobjc-gc @gol
210 -freplace-objc-classes @gol
211 -fzero-link @gol
212 -gen-decls @gol
213 -Wassign-intercept @gol
214 -Wno-protocol  -Wselector @gol
215 -Wstrict-selector-match @gol
216 -Wundeclared-selector}
217
218 @item Language Independent Options
219 @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
220 @gccoptlist{-fmessage-length=@var{n}  @gol
221 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}  @gol
222 -fdiagnostics-show-option}
223
224 @item Warning Options
225 @xref{Warning Options,,Options to Request or Suppress Warnings}.
226 @gccoptlist{-fsyntax-only  -pedantic  -pedantic-errors @gol
227 -w  -Wextra  -Wall  -Waddress  -Waggregate-return -Warray-bounds @gol
228 -Wno-attributes -Wc++-compat -Wc++0x-compat -Wcast-align  -Wcast-qual  @gol
229 -Wchar-subscripts -Wclobbered  -Wcomment @gol
230 -Wconversion -Wcoverage-mismatch -Wno-deprecated-declarations @gol
231 -Wdisabled-optimization  -Wno-div-by-zero  @gol
232 -Wempty-body  -Wno-endif-labels @gol
233 -Werror  -Werror=* @gol
234 -Wfatal-errors  -Wfloat-equal  -Wformat  -Wformat=2 @gol
235 -Wno-format-extra-args -Wformat-nonliteral @gol
236 -Wformat-security  -Wformat-y2k @gol
237 -Wimplicit  -Wimplicit-function-declaration  -Wimplicit-int @gol
238 -Wimport  -Wno-import  -Winit-self  -Winline @gol
239 -Wno-int-to-pointer-cast @gol
240 -Wno-invalid-offsetof  -Winvalid-pch @gol
241 -Wlarger-than-@var{len}  -Wunsafe-loop-optimizations  -Wlong-long @gol
242 -Wmain  -Wmissing-braces  -Wmissing-field-initializers @gol
243 -Wmissing-format-attribute  -Wmissing-include-dirs @gol
244 -Wmissing-noreturn @gol
245 -Wno-multichar  -Wnonnull  -Wno-overflow @gol
246 -Woverlength-strings  -Wpacked  -Wpadded @gol
247 -Wparentheses  -Wpointer-arith  -Wno-pointer-to-int-cast @gol
248 -Wredundant-decls @gol
249 -Wreturn-type  -Wsequence-point  -Wshadow @gol
250 -Wsign-compare  -Wstack-protector @gol
251 -Wstrict-aliasing -Wstrict-aliasing=2 @gol
252 -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
253 -Wswitch  -Wswitch-default  -Wswitch-enum @gol
254 -Wsystem-headers  -Wtrigraphs  -Wundef  -Wuninitialized @gol
255 -Wunknown-pragmas  -Wno-pragmas -Wunreachable-code @gol
256 -Wunused  -Wunused-function  -Wunused-label  -Wunused-parameter @gol
257 -Wunused-value  -Wunused-variable  -Wvariadic-macros @gol
258 -Wvolatile-register-var  -Wwrite-strings}
259
260 @item C-only Warning Options
261 @gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
262 -Wmissing-parameter-type  -Wmissing-prototypes  -Wnested-externs @gol
263 -Wold-style-declaration  -Wold-style-definition @gol
264 -Wstrict-prototypes  -Wtraditional  -Wtraditional-conversion @gol
265 -Wdeclaration-after-statement -Wpointer-sign}
266
267 @item Debugging Options
268 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
269 @gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
270 -fdump-noaddr -fdump-unnumbered  -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
271 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
272 -fdump-ipa-all -fdump-ipa-cgraph @gol
273 -fdump-tree-all @gol
274 -fdump-tree-original@r{[}-@var{n}@r{]}  @gol
275 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
276 -fdump-tree-inlined@r{[}-@var{n}@r{]} @gol
277 -fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol
278 -fdump-tree-ch @gol
279 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
280 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
281 -fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
282 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
283 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
284 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
285 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
286 -fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
287 -fdump-tree-nrv -fdump-tree-vect @gol
288 -fdump-tree-sink @gol
289 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
290 -fdump-tree-salias @gol
291 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
292 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
293 -ftree-vectorizer-verbose=@var{n} @gol
294 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
295 -feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
296 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
297 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
298 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
299 -ftest-coverage  -ftime-report -fvar-tracking @gol
300 -g  -g@var{level}  -gcoff -gdwarf-2 @gol
301 -ggdb  -gstabs  -gstabs+  -gvms  -gxcoff  -gxcoff+ @gol
302 -p  -pg  -print-file-name=@var{library}  -print-libgcc-file-name @gol
303 -print-multi-directory  -print-multi-lib @gol
304 -print-prog-name=@var{program}  -print-search-dirs  -Q @gol
305 -print-sysroot-headers-suffix @gol
306 -save-temps  -time}
307
308 @item Optimization Options
309 @xref{Optimize Options,,Options that Control Optimization}.
310 @gccoptlist{-falign-functions=@var{n}  -falign-jumps=@var{n} @gol
311 -falign-labels=@var{n}  -falign-loops=@var{n}  @gol
312 -fbounds-check -fmudflap -fmudflapth -fmudflapir @gol
313 -fbranch-probabilities -fprofile-values -fvpt -fbranch-target-load-optimize @gol
314 -fbranch-target-load-optimize2 -fbtr-bb-exclusive @gol
315 -fcaller-saves  -fcprop-registers  -fcse-follow-jumps @gol
316 -fcse-skip-blocks  -fcx-limited-range  -fdata-sections @gol
317 -fdelayed-branch  -fdelete-null-pointer-checks -fearly-inlining @gol
318 -fexpensive-optimizations  -ffast-math  -ffloat-store @gol
319 -fforce-addr  -fforward-propagate  -ffunction-sections @gol
320 -fgcse  -fgcse-lm  -fgcse-sm  -fgcse-las  -fgcse-after-reload @gol
321 -fcrossjumping  -fif-conversion  -fif-conversion2 @gol
322 -finline-functions  -finline-functions-called-once @gol
323 -finline-limit=@var{n}  -fkeep-inline-functions @gol
324 -fkeep-static-consts  -fmerge-constants  -fmerge-all-constants @gol
325 -fmodulo-sched -fno-branch-count-reg @gol
326 -fno-default-inline  -fno-defer-pop -fmove-loop-invariants @gol
327 -fno-function-cse  -fno-guess-branch-probability @gol
328 -fno-inline  -fno-math-errno  -fno-peephole  -fno-peephole2 @gol
329 -funsafe-math-optimizations  -funsafe-loop-optimizations @gol
330 -ffinite-math-only  -fno-signed-zeros @gol
331 -fno-toplevel-reorder -fno-trapping-math  -fno-zero-initialized-in-bss @gol
332 -fomit-frame-pointer  -foptimize-register-move @gol
333 -foptimize-sibling-calls  -fprefetch-loop-arrays @gol
334 -fprofile-generate -fprofile-use @gol
335 -fregmove  -frename-registers @gol
336 -freorder-blocks  -freorder-blocks-and-partition -freorder-functions @gol
337 -frerun-cse-after-loop @gol
338 -frounding-math -frtl-abstract-sequences @gol
339 -fschedule-insns  -fschedule-insns2 @gol
340 -fno-sched-interblock  -fno-sched-spec  -fsched-spec-load @gol
341 -fsched-spec-load-dangerous  @gol
342 -fsched-stalled-insns=@var{n} -fsched-stalled-insns-dep=@var{n} @gol
343 -fsched2-use-superblocks @gol
344 -fsched2-use-traces -fsee -freschedule-modulo-scheduled-loops @gol
345 -fsection-anchors  -fsignaling-nans  -fsingle-precision-constant @gol
346 -fno-split-wide-types -fstack-protector  -fstack-protector-all @gol
347 -fstrict-aliasing  -fstrict-overflow  -ftracer  -fthread-jumps @gol
348 -funroll-all-loops  -funroll-loops  -fpeel-loops @gol
349 -fsplit-ivs-in-unroller -funswitch-loops @gol
350 -fvariable-expansion-in-unroller @gol
351 -ftree-pre  -ftree-ccp  -ftree-dce -ftree-loop-optimize @gol
352 -ftree-loop-linear -ftree-loop-im -ftree-loop-ivcanon -fivopts @gol
353 -ftree-dominator-opts -ftree-dse -ftree-copyrename -ftree-sink @gol
354 -ftree-ch -ftree-sra -ftree-ter -ftree-fre -ftree-vectorize @gol
355 -ftree-vect-loop-version -ftree-salias -fipa-pta -fweb @gol
356 -ftree-copy-prop -ftree-store-ccp -ftree-store-copy-prop -fwhole-program @gol
357 --param @var{name}=@var{value}
358 -O  -O0  -O1  -O2  -O3  -Os}
359
360 @item Preprocessor Options
361 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
362 @gccoptlist{-A@var{question}=@var{answer} @gol
363 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
364 -C  -dD  -dI  -dM  -dN @gol
365 -D@var{macro}@r{[}=@var{defn}@r{]}  -E  -H @gol
366 -idirafter @var{dir} @gol
367 -include @var{file}  -imacros @var{file} @gol
368 -iprefix @var{file}  -iwithprefix @var{dir} @gol
369 -iwithprefixbefore @var{dir}  -isystem @var{dir} @gol
370 -imultilib @var{dir} -isysroot @var{dir} @gol
371 -M  -MM  -MF  -MG  -MP  -MQ  -MT  -nostdinc  @gol
372 -P  -fworking-directory  -remap @gol
373 -trigraphs  -undef  -U@var{macro}  -Wp,@var{option} @gol
374 -Xpreprocessor @var{option}}
375
376 @item Assembler Option
377 @xref{Assembler Options,,Passing Options to the Assembler}.
378 @gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
379
380 @item Linker Options
381 @xref{Link Options,,Options for Linking}.
382 @gccoptlist{@var{object-file-name}  -l@var{library} @gol
383 -nostartfiles  -nodefaultlibs  -nostdlib -pie -rdynamic @gol
384 -s  -static  -static-libgcc  -shared  -shared-libgcc  -symbolic @gol
385 -Wl,@var{option}  -Xlinker @var{option} @gol
386 -u @var{symbol}}
387
388 @item Directory Options
389 @xref{Directory Options,,Options for Directory Search}.
390 @gccoptlist{-B@var{prefix}  -I@var{dir}  -iquote@var{dir}  -L@var{dir}
391 -specs=@var{file}  -I- --sysroot=@var{dir}}
392
393 @item Target Options
394 @c I wrote this xref this way to avoid overfull hbox. -- rms
395 @xref{Target Options}.
396 @gccoptlist{-V @var{version}  -b @var{machine}}
397
398 @item Machine Dependent Options
399 @xref{Submodel Options,,Hardware Models and Configurations}.
400 @c This list is ordered alphanumerically by subsection name.
401 @c Try and put the significant identifier (CPU or system) first,
402 @c so users have a clue at guessing where the ones they want will be.
403
404 @emph{ARC Options}
405 @gccoptlist{-EB  -EL @gol
406 -mmangle-cpu  -mcpu=@var{cpu}  -mtext=@var{text-section} @gol
407 -mdata=@var{data-section}  -mrodata=@var{readonly-data-section}}
408
409 @emph{ARM Options}
410 @gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
411 -mabi=@var{name} @gol
412 -mapcs-stack-check  -mno-apcs-stack-check @gol
413 -mapcs-float  -mno-apcs-float @gol
414 -mapcs-reentrant  -mno-apcs-reentrant @gol
415 -msched-prolog  -mno-sched-prolog @gol
416 -mlittle-endian  -mbig-endian  -mwords-little-endian @gol
417 -mfloat-abi=@var{name}  -msoft-float  -mhard-float  -mfpe @gol
418 -mthumb-interwork  -mno-thumb-interwork @gol
419 -mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
420 -mstructure-size-boundary=@var{n} @gol
421 -mabort-on-noreturn @gol
422 -mlong-calls  -mno-long-calls @gol
423 -msingle-pic-base  -mno-single-pic-base @gol
424 -mpic-register=@var{reg} @gol
425 -mnop-fun-dllimport @gol
426 -mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
427 -mpoke-function-name @gol
428 -mthumb  -marm @gol
429 -mtpcs-frame  -mtpcs-leaf-frame @gol
430 -mcaller-super-interworking  -mcallee-super-interworking @gol
431 -mtp=@var{name}}
432
433 @emph{AVR Options}
434 @gccoptlist{-mmcu=@var{mcu}  -msize  -minit-stack=@var{n}  -mno-interrupts @gol
435 -mcall-prologues  -mno-tablejump  -mtiny-stack  -mint8}
436
437 @emph{Blackfin Options}
438 @gccoptlist{-momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
439 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
440 -mlow-64k  -mno-low64k  -mstack-check-l1  -mid-shared-library @gol
441 -mno-id-shared-library -mshared-library-id=@var{n} @gol
442 -mleaf-id-shared-library  -mno-leaf-id-shared-library @gol
443 -msep-data  -mno-sep-data  -mlong-calls  -mno-long-calls}
444
445 @emph{CRIS Options}
446 @gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}  -mtune=@var{cpu} @gol
447 -mmax-stack-frame=@var{n}  -melinux-stacksize=@var{n} @gol
448 -metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
449 -mstack-align  -mdata-align  -mconst-align @gol
450 -m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue  -mno-gotplt @gol
451 -melf  -maout  -melinux  -mlinux  -sim  -sim2 @gol
452 -mmul-bug-workaround  -mno-mul-bug-workaround}
453
454 @emph{CRX Options}
455 @gccoptlist{-mmac -mpush-args}
456
457 @emph{Darwin Options}
458 @gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal @gol
459 -arch_only  -bind_at_load  -bundle  -bundle_loader @gol
460 -client_name  -compatibility_version  -current_version @gol
461 -dead_strip @gol
462 -dependency-file  -dylib_file  -dylinker_install_name @gol
463 -dynamic  -dynamiclib  -exported_symbols_list @gol
464 -filelist  -flat_namespace  -force_cpusubtype_ALL @gol
465 -force_flat_namespace  -headerpad_max_install_names @gol
466 -iframework @gol
467 -image_base  -init  -install_name  -keep_private_externs @gol
468 -multi_module  -multiply_defined  -multiply_defined_unused @gol
469 -noall_load   -no_dead_strip_inits_and_terms @gol
470 -nofixprebinding -nomultidefs  -noprebind  -noseglinkedit @gol
471 -pagezero_size  -prebind  -prebind_all_twolevel_modules @gol
472 -private_bundle  -read_only_relocs  -sectalign @gol
473 -sectobjectsymbols  -whyload  -seg1addr @gol
474 -sectcreate  -sectobjectsymbols  -sectorder @gol
475 -segaddr -segs_read_only_addr -segs_read_write_addr @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 -gused -gfull -mmacosx-version-min=@var{version} @gol
482 -mkernel -mone-byte-bool}
483
484 @emph{DEC Alpha Options}
485 @gccoptlist{-mno-fp-regs  -msoft-float  -malpha-as  -mgas @gol
486 -mieee  -mieee-with-inexact  -mieee-conformant @gol
487 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
488 -mtrap-precision=@var{mode}  -mbuild-constants @gol
489 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
490 -mbwx  -mmax  -mfix  -mcix @gol
491 -mfloat-vax  -mfloat-ieee @gol
492 -mexplicit-relocs  -msmall-data  -mlarge-data @gol
493 -msmall-text  -mlarge-text @gol
494 -mmemory-latency=@var{time}}
495
496 @emph{DEC Alpha/VMS Options}
497 @gccoptlist{-mvms-return-codes}
498
499 @emph{FRV Options}
500 @gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
501 -mhard-float  -msoft-float @gol
502 -malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
503 -mdouble  -mno-double @gol
504 -mmedia  -mno-media  -mmuladd  -mno-muladd @gol
505 -mfdpic  -minline-plt -mgprel-ro  -multilib-library-pic @gol
506 -mlinked-fp  -mlong-calls  -malign-labels @gol
507 -mlibrary-pic  -macc-4  -macc-8 @gol
508 -mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
509 -moptimize-membar -mno-optimize-membar @gol
510 -mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
511 -mvliw-branch  -mno-vliw-branch @gol
512 -mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
513 -mno-nested-cond-exec  -mtomcat-stats @gol
514 -mTLS -mtls @gol
515 -mcpu=@var{cpu}}
516
517 @emph{GNU/Linux Options}
518 @gccoptlist{-muclibc}
519
520 @emph{H8/300 Options}
521 @gccoptlist{-mrelax  -mh  -ms  -mn  -mint32  -malign-300}
522
523 @emph{HPPA Options}
524 @gccoptlist{-march=@var{architecture-type} @gol
525 -mbig-switch  -mdisable-fpregs  -mdisable-indexing @gol
526 -mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
527 -mfixed-range=@var{register-range} @gol
528 -mjump-in-delay -mlinker-opt -mlong-calls @gol
529 -mlong-load-store  -mno-big-switch  -mno-disable-fpregs @gol
530 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
531 -mno-jump-in-delay  -mno-long-load-store @gol
532 -mno-portable-runtime  -mno-soft-float @gol
533 -mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
534 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
535 -mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
536 -munix=@var{unix-std}  -nolibdld  -static  -threads}
537
538 @emph{i386 and x86-64 Options}
539 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
540 -mfpmath=@var{unit} @gol
541 -masm=@var{dialect}  -mno-fancy-math-387 @gol
542 -mno-fp-ret-in-387  -msoft-float  -msvr3-shlib @gol
543 -mno-wide-multiply  -mrtd  -malign-double @gol
544 -mpreferred-stack-boundary=@var{num} @gol
545 -mmmx  -msse  -msse2 -msse3 -mssse3 -msse4a -m3dnow -mpopcnt -mabm @gol
546 -mthreads  -mno-align-stringops  -minline-all-stringops @gol
547 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
548 -m96bit-long-double  -mregparm=@var{num}  -msseregparm @gol
549 -mstackrealign @gol
550 -momit-leaf-frame-pointer  -mno-red-zone -mno-tls-direct-seg-refs @gol
551 -mcmodel=@var{code-model} @gol
552 -m32  -m64 -mlarge-data-threshold=@var{num}}
553
554 @emph{IA-64 Options}
555 @gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
556 -mvolatile-asm-stop  -mregister-names  -mno-sdata @gol
557 -mconstant-gp  -mauto-pic  -minline-float-divide-min-latency @gol
558 -minline-float-divide-max-throughput @gol
559 -minline-int-divide-min-latency @gol
560 -minline-int-divide-max-throughput  @gol
561 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
562 -mno-dwarf2-asm -mearly-stop-bits @gol
563 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
564 -mtune=@var{cpu-type} -mt -pthread -milp32 -mlp64 @gol
565 -mno-sched-br-data-spec -msched-ar-data-spec -mno-sched-control-spec @gol
566 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
567 -msched-ldc -mno-sched-control-ldc -mno-sched-spec-verbose @gol
568 -mno-sched-prefer-non-data-spec-insns @gol
569 -mno-sched-prefer-non-control-spec-insns @gol
570 -mno-sched-count-spec-in-critical-path}
571
572 @emph{M32R/D Options}
573 @gccoptlist{-m32r2 -m32rx -m32r @gol
574 -mdebug @gol
575 -malign-loops -mno-align-loops @gol
576 -missue-rate=@var{number} @gol
577 -mbranch-cost=@var{number} @gol
578 -mmodel=@var{code-size-model-type} @gol
579 -msdata=@var{sdata-type} @gol
580 -mno-flush-func -mflush-func=@var{name} @gol
581 -mno-flush-trap -mflush-trap=@var{number} @gol
582 -G @var{num}}
583
584 @emph{M32C Options}
585 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
586
587 @emph{M680x0 Options}
588 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}  -mtune=@var{tune}
589 -m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
590 -m68060  -mcpu32  -m5200  -m5206e  -m528x  -m5307  -m5407 @gol
591 -mcfv4e  -mbitfield  -mno-bitfield  -mc68000  -mc68020 @gol
592 -mnobitfield  -mrtd  -mno-rtd  -mdiv  -mno-div  -mshort @gol
593 -mno-short  -mhard-float  -m68881  -msoft-float  -mpcrel @gol
594 -malign-int  -mstrict-align  -msep-data  -mno-sep-data @gol
595 -mshared-library-id=n  -mid-shared-library  -mno-id-shared-library}
596
597 @emph{M68hc1x Options}
598 @gccoptlist{-m6811  -m6812  -m68hc11  -m68hc12   -m68hcs12 @gol
599 -mauto-incdec  -minmax  -mlong-calls  -mshort @gol
600 -msoft-reg-count=@var{count}}
601
602 @emph{MCore Options}
603 @gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
604 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
605 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
606 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
607 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
608
609 @emph{MIPS Options}
610 @gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
611 -mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips64 @gol
612 -mips16  -mno-mips16  -mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
613 -mshared  -mno-shared  -mxgot  -mno-xgot  -mgp32  -mgp64  @gol
614 -mfp32  -mfp64  -mhard-float  -msoft-float  @gol
615 -msingle-float  -mdouble-float  -mdsp  -mpaired-single  -mips3d @gol
616 -mlong64  -mlong32  -msym32  -mno-sym32 @gol
617 -G@var{num}  -membedded-data  -mno-embedded-data @gol
618 -muninit-const-in-rodata  -mno-uninit-const-in-rodata @gol
619 -msplit-addresses  -mno-split-addresses  @gol
620 -mexplicit-relocs  -mno-explicit-relocs  @gol
621 -mcheck-zero-division  -mno-check-zero-division @gol
622 -mdivide-traps  -mdivide-breaks @gol
623 -mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls @gol
624 -mmad  -mno-mad  -mfused-madd  -mno-fused-madd  -nocpp @gol
625 -mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400 @gol
626 -mfix-vr4120  -mno-fix-vr4120  -mfix-vr4130 @gol
627 -mfix-sb1  -mno-fix-sb1 @gol
628 -mflush-func=@var{func}  -mno-flush-func @gol
629 -mbranch-likely  -mno-branch-likely @gol
630 -mfp-exceptions -mno-fp-exceptions @gol
631 -mvr4130-align -mno-vr4130-align}
632
633 @emph{MMIX Options}
634 @gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
635 -mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
636 -melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
637 -mno-base-addresses  -msingle-exit  -mno-single-exit}
638
639 @emph{MN10300 Options}
640 @gccoptlist{-mmult-bug  -mno-mult-bug @gol
641 -mam33  -mno-am33 @gol
642 -mam33-2  -mno-am33-2 @gol
643 -mreturn-pointer-on-d0 @gol
644 -mno-crt0  -mrelax}
645
646 @emph{MT Options}
647 @gccoptlist{-mno-crt0 -mbacc -msim @gol
648 -march=@var{cpu-type} }
649
650 @emph{PDP-11 Options}
651 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
652 -mbcopy  -mbcopy-builtin  -mint32  -mno-int16 @gol
653 -mint16  -mno-int32  -mfloat32  -mno-float64 @gol
654 -mfloat64  -mno-float32  -mabshi  -mno-abshi @gol
655 -mbranch-expensive  -mbranch-cheap @gol
656 -msplit  -mno-split  -munix-asm  -mdec-asm}
657
658 @emph{PowerPC Options}
659 See RS/6000 and PowerPC Options.
660
661 @emph{RS/6000 and PowerPC Options}
662 @gccoptlist{-mcpu=@var{cpu-type} @gol
663 -mtune=@var{cpu-type} @gol
664 -mpower  -mno-power  -mpower2  -mno-power2 @gol
665 -mpowerpc  -mpowerpc64  -mno-powerpc @gol
666 -maltivec  -mno-altivec @gol
667 -mpowerpc-gpopt  -mno-powerpc-gpopt @gol
668 -mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
669 -mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb  -mfprnd  -mno-fprnd @gol
670 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mdfp -mno-dfp @gol
671 -mnew-mnemonics  -mold-mnemonics @gol
672 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
673 -m64  -m32  -mxl-compat  -mno-xl-compat  -mpe @gol
674 -malign-power  -malign-natural @gol
675 -msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
676 -mstring  -mno-string  -mupdate  -mno-update @gol
677 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
678 -mstrict-align  -mno-strict-align  -mrelocatable @gol
679 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
680 -mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
681 -mdynamic-no-pic  -maltivec  -mswdiv @gol
682 -mprioritize-restricted-insns=@var{priority} @gol
683 -msched-costly-dep=@var{dependence_type} @gol
684 -minsert-sched-nops=@var{scheme} @gol
685 -mcall-sysv  -mcall-netbsd @gol
686 -maix-struct-return  -msvr4-struct-return @gol
687 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
688 -misel -mno-isel @gol
689 -misel=yes  -misel=no @gol
690 -mspe -mno-spe @gol
691 -mspe=yes  -mspe=no @gol
692 -mvrsave -mno-vrsave @gol
693 -mmulhw -mno-mulhw @gol
694 -mdlmzb -mno-dlmzb @gol
695 -mfloat-gprs=yes  -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
696 -mprototype  -mno-prototype @gol
697 -msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
698 -msdata=@var{opt}  -mvxworks  -mwindiss  -G @var{num}  -pthread}
699
700 @emph{S/390 and zSeries Options}
701 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
702 -mhard-float  -msoft-float -mlong-double-64 -mlong-double-128 @gol
703 -mbackchain  -mno-backchain -mpacked-stack  -mno-packed-stack @gol
704 -msmall-exec  -mno-small-exec  -mmvcle -mno-mvcle @gol
705 -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch @gol
706 -mtpf-trace -mno-tpf-trace  -mfused-madd  -mno-fused-madd @gol
707 -mwarn-framesize  -mwarn-dynamicstack  -mstack-size -mstack-guard}
708
709 @emph{Score Options}
710 @gccoptlist{-mel -mel @gol
711 -mmac @gol
712 -mscore5u -mscore7}
713  
714 @emph{SH Options}
715 @gccoptlist{-m1  -m2  -m2e  -m3  -m3e @gol
716 -m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
717 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
718 -m5-64media  -m5-64media-nofpu @gol
719 -m5-32media  -m5-32media-nofpu @gol
720 -m5-compact  -m5-compact-nofpu @gol
721 -mb  -ml  -mdalign  -mrelax @gol
722 -mbigtable  -mfmovd  -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
723 -mieee  -misize  -minline-ic_invalidate -mpadstruct  -mspace @gol
724 -mprefergot  -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
725 -mdivsi3_libfunc=@var{name}  @gol
726 -madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
727  -minvalid-symbols}
728
729 @emph{SPARC Options}
730 @gccoptlist{-mcpu=@var{cpu-type} @gol
731 -mtune=@var{cpu-type} @gol
732 -mcmodel=@var{code-model} @gol
733 -m32  -m64  -mapp-regs  -mno-app-regs @gol
734 -mfaster-structs  -mno-faster-structs @gol
735 -mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
736 -mhard-quad-float  -msoft-quad-float @gol
737 -mimpure-text  -mno-impure-text  -mlittle-endian @gol
738 -mstack-bias  -mno-stack-bias @gol
739 -munaligned-doubles  -mno-unaligned-doubles @gol
740 -mv8plus  -mno-v8plus  -mvis  -mno-vis
741 -threads -pthreads -pthread}
742
743 @emph{SPU Options}
744 @gccoptlist{-mwarn-reloc -merror-reloc @gol
745 -msafe-dma -munsafe-dma @gol
746 -mbranch-hints @gol
747 -msmall-mem -mlarge-mem -mstdmain @gol
748 -mfixed-range=@var{register-range}}
749
750 @emph{System V Options}
751 @gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
752
753 @emph{TMS320C3x/C4x Options}
754 @gccoptlist{-mcpu=@var{cpu}  -mbig  -msmall  -mregparm  -mmemparm @gol
755 -mfast-fix  -mmpyi  -mbk  -mti  -mdp-isr-reload @gol
756 -mrpts=@var{count}  -mrptb  -mdb  -mloop-unsigned @gol
757 -mparallel-insns  -mparallel-mpy  -mpreserve-float}
758
759 @emph{V850 Options}
760 @gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
761 -mprolog-function  -mno-prolog-function  -mspace @gol
762 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
763 -mapp-regs  -mno-app-regs @gol
764 -mdisable-callt  -mno-disable-callt @gol
765 -mv850e1 @gol
766 -mv850e @gol
767 -mv850  -mbig-switch}
768
769 @emph{VAX Options}
770 @gccoptlist{-mg  -mgnu  -munix}
771
772 @emph{x86-64 Options}
773 See i386 and x86-64 Options.
774
775 @emph{Xstormy16 Options}
776 @gccoptlist{-msim}
777
778 @emph{Xtensa Options}
779 @gccoptlist{-mconst16 -mno-const16 @gol
780 -mfused-madd  -mno-fused-madd @gol
781 -mtext-section-literals  -mno-text-section-literals @gol
782 -mtarget-align  -mno-target-align @gol
783 -mlongcalls  -mno-longcalls}
784
785 @emph{zSeries Options}
786 See S/390 and zSeries Options.
787
788 @item Code Generation Options
789 @xref{Code Gen Options,,Options for Code Generation Conventions}.
790 @gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
791 -ffixed-@var{reg}  -fexceptions @gol
792 -fnon-call-exceptions  -funwind-tables @gol
793 -fasynchronous-unwind-tables @gol
794 -finhibit-size-directive  -finstrument-functions @gol
795 -fno-common  -fno-ident @gol
796 -fpcc-struct-return  -fpic  -fPIC -fpie -fPIE @gol
797 -fno-jump-tables @gol
798 -frecord-gcc-switches @gol
799 -freg-struct-return  -fshort-enums @gol
800 -fshort-double  -fshort-wchar @gol
801 -fverbose-asm  -fpack-struct[=@var{n}]  -fstack-check @gol
802 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
803 -fargument-alias  -fargument-noalias @gol
804 -fargument-noalias-global  -fargument-noalias-anything
805 -fleading-underscore  -ftls-model=@var{model} @gol
806 -ftrapv  -fwrapv  -fbounds-check @gol
807 -fvisibility}
808 @end table
809
810 @menu
811 * Overall Options::     Controlling the kind of output:
812                         an executable, object files, assembler files,
813                         or preprocessed source.
814 * C Dialect Options::   Controlling the variant of C language compiled.
815 * C++ Dialect Options:: Variations on C++.
816 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
817                         and Objective-C++.
818 * Language Independent Options:: Controlling how diagnostics should be
819                         formatted.
820 * Warning Options::     How picky should the compiler be?
821 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
822 * Optimize Options::    How much optimization?
823 * Preprocessor Options:: Controlling header files and macro definitions.
824                          Also, getting dependency information for Make.
825 * Assembler Options::   Passing options to the assembler.
826 * Link Options::        Specifying libraries and so on.
827 * Directory Options::   Where to find header files and libraries.
828                         Where to find the compiler executable files.
829 * Spec Files::          How to pass switches to sub-processes.
830 * Target Options::      Running a cross-compiler, or an old version of GCC.
831 @end menu
832
833 @node Overall Options
834 @section Options Controlling the Kind of Output
835
836 Compilation can involve up to four stages: preprocessing, compilation
837 proper, assembly and linking, always in that order.  GCC is capable of
838 preprocessing and compiling several files either into several
839 assembler input files, or into one assembler input file; then each
840 assembler input file produces an object file, and linking combines all
841 the object files (those newly compiled, and those specified as input)
842 into an executable file.
843
844 @cindex file name suffix
845 For any given input file, the file name suffix determines what kind of
846 compilation is done:
847
848 @table @gcctabopt
849 @item @var{file}.c
850 C source code which must be preprocessed.
851
852 @item @var{file}.i
853 C source code which should not be preprocessed.
854
855 @item @var{file}.ii
856 C++ source code which should not be preprocessed.
857
858 @item @var{file}.m
859 Objective-C source code.  Note that you must link with the @file{libobjc}
860 library to make an Objective-C program work.
861
862 @item @var{file}.mi
863 Objective-C source code which should not be preprocessed.
864
865 @item @var{file}.mm
866 @itemx @var{file}.M
867 Objective-C++ source code.  Note that you must link with the @file{libobjc}
868 library to make an Objective-C++ program work.  Note that @samp{.M} refers
869 to a literal capital M@.
870
871 @item @var{file}.mii
872 Objective-C++ source code which should not be preprocessed.
873
874 @item @var{file}.h
875 C, C++, Objective-C or Objective-C++ header file to be turned into a
876 precompiled header.
877
878 @item @var{file}.cc
879 @itemx @var{file}.cp
880 @itemx @var{file}.cxx
881 @itemx @var{file}.cpp
882 @itemx @var{file}.CPP
883 @itemx @var{file}.c++
884 @itemx @var{file}.C
885 C++ source code which must be preprocessed.  Note that in @samp{.cxx},
886 the last two letters must both be literally @samp{x}.  Likewise,
887 @samp{.C} refers to a literal capital C@.
888
889 @item @var{file}.mm
890 @itemx @var{file}.M
891 Objective-C++ source code which must be preprocessed.
892
893 @item @var{file}.mii
894 Objective-C++ source code which should not be preprocessed.
895
896 @item @var{file}.hh
897 @itemx @var{file}.H
898 C++ header file to be turned into a precompiled header.
899
900 @item @var{file}.f
901 @itemx @var{file}.for
902 @itemx @var{file}.FOR
903 Fixed form Fortran source code which should not be preprocessed.
904
905 @item @var{file}.F
906 @itemx @var{file}.fpp
907 @itemx @var{file}.FPP
908 Fixed form Fortran source code which must be preprocessed (with the traditional
909 preprocessor).
910
911 @item @var{file}.f90
912 @itemx @var{file}.f95
913 Free form Fortran source code which should not be preprocessed.
914
915 @item @var{file}.F90
916 @itemx @var{file}.F95
917 Free form Fortran source code which must be preprocessed (with the
918 traditional preprocessor).
919
920 @c FIXME: Descriptions of Java file types.
921 @c @var{file}.java
922 @c @var{file}.class
923 @c @var{file}.zip
924 @c @var{file}.jar
925
926 @item @var{file}.ads
927 Ada source code file which contains a library unit declaration (a
928 declaration of a package, subprogram, or generic, or a generic
929 instantiation), or a library unit renaming declaration (a package,
930 generic, or subprogram renaming declaration).  Such files are also
931 called @dfn{specs}.
932
933 @itemx @var{file}.adb
934 Ada source code file containing a library unit body (a subprogram or
935 package body).  Such files are also called @dfn{bodies}.
936
937 @c GCC also knows about some suffixes for languages not yet included:
938 @c Pascal:
939 @c @var{file}.p
940 @c @var{file}.pas
941 @c Ratfor:
942 @c @var{file}.r
943
944 @item @var{file}.s
945 Assembler code.
946
947 @item @var{file}.S
948 Assembler code which must be preprocessed.
949
950 @item @var{other}
951 An object file to be fed straight into linking.
952 Any file name with no recognized suffix is treated this way.
953 @end table
954
955 @opindex x
956 You can specify the input language explicitly with the @option{-x} option:
957
958 @table @gcctabopt
959 @item -x @var{language}
960 Specify explicitly the @var{language} for the following input files
961 (rather than letting the compiler choose a default based on the file
962 name suffix).  This option applies to all following input files until
963 the next @option{-x} option.  Possible values for @var{language} are:
964 @smallexample
965 c  c-header  c-cpp-output
966 c++  c++-header  c++-cpp-output
967 objective-c  objective-c-header  objective-c-cpp-output
968 objective-c++ objective-c++-header objective-c++-cpp-output
969 assembler  assembler-with-cpp
970 ada
971 f95  f95-cpp-input
972 java
973 treelang
974 @end smallexample
975
976 @item -x none
977 Turn off any specification of a language, so that subsequent files are
978 handled according to their file name suffixes (as they are if @option{-x}
979 has not been used at all).
980
981 @item -pass-exit-codes
982 @opindex pass-exit-codes
983 Normally the @command{gcc} program will exit with the code of 1 if any
984 phase of the compiler returns a non-success return code.  If you specify
985 @option{-pass-exit-codes}, the @command{gcc} program will instead return with
986 numerically highest error produced by any phase that returned an error
987 indication.  The C, C++, and Fortran frontends return 4, if an internal
988 compiler error is encountered.
989 @end table
990
991 If you only want some of the stages of compilation, you can use
992 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
993 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
994 @command{gcc} is to stop.  Note that some combinations (for example,
995 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
996
997 @table @gcctabopt
998 @item -c
999 @opindex c
1000 Compile or assemble the source files, but do not link.  The linking
1001 stage simply is not done.  The ultimate output is in the form of an
1002 object file for each source file.
1003
1004 By default, the object file name for a source file is made by replacing
1005 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1006
1007 Unrecognized input files, not requiring compilation or assembly, are
1008 ignored.
1009
1010 @item -S
1011 @opindex S
1012 Stop after the stage of compilation proper; do not assemble.  The output
1013 is in the form of an assembler code file for each non-assembler input
1014 file specified.
1015
1016 By default, the assembler file name for a source file is made by
1017 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1018
1019 Input files that don't require compilation are ignored.
1020
1021 @item -E
1022 @opindex E
1023 Stop after the preprocessing stage; do not run the compiler proper.  The
1024 output is in the form of preprocessed source code, which is sent to the
1025 standard output.
1026
1027 Input files which don't require preprocessing are ignored.
1028
1029 @cindex output file option
1030 @item -o @var{file}
1031 @opindex o
1032 Place output in file @var{file}.  This applies regardless to whatever
1033 sort of output is being produced, whether it be an executable file,
1034 an object file, an assembler file or preprocessed C code.
1035
1036 If @option{-o} is not specified, the default is to put an executable
1037 file in @file{a.out}, the object file for
1038 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1039 assembler file in @file{@var{source}.s}, a precompiled header file in
1040 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1041 standard output.
1042
1043 @item -v
1044 @opindex v
1045 Print (on standard error output) the commands executed to run the stages
1046 of compilation.  Also print the version number of the compiler driver
1047 program and of the preprocessor and the compiler proper.
1048
1049 @item -###
1050 @opindex ###
1051 Like @option{-v} except the commands are not executed and all command
1052 arguments are quoted.  This is useful for shell scripts to capture the
1053 driver-generated command lines.
1054
1055 @item -pipe
1056 @opindex pipe
1057 Use pipes rather than temporary files for communication between the
1058 various stages of compilation.  This fails to work on some systems where
1059 the assembler is unable to read from a pipe; but the GNU assembler has
1060 no trouble.
1061
1062 @item -combine
1063 @opindex combine
1064 If you are compiling multiple source files, this option tells the driver
1065 to pass all the source files to the compiler at once (for those
1066 languages for which the compiler can handle this).  This will allow
1067 intermodule analysis (IMA) to be performed by the compiler.  Currently the only
1068 language for which this is supported is C@.  If you pass source files for
1069 multiple languages to the driver, using this option, the driver will invoke
1070 the compiler(s) that support IMA once each, passing each compiler all the
1071 source files appropriate for it.  For those languages that do not support
1072 IMA this option will be ignored, and the compiler will be invoked once for
1073 each source file in that language.  If you use this option in conjunction
1074 with @option{-save-temps}, the compiler will generate multiple
1075 pre-processed files
1076 (one for each source file), but only one (combined) @file{.o} or
1077 @file{.s} file.
1078
1079 @item --help
1080 @opindex help
1081 Print (on the standard output) a description of the command line options
1082 understood by @command{gcc}.  If the @option{-v} option is also specified
1083 then @option{--help} will also be passed on to the various processes
1084 invoked by @command{gcc}, so that they can display the command line options
1085 they accept.  If the @option{-Wextra} option has also been specified
1086 (prior to the @option{--help} option), then command line options which
1087 have no documentation associated with them will also be displayed.
1088
1089 @item --target-help
1090 @opindex target-help
1091 Print (on the standard output) a description of target-specific command
1092 line options for each tool.
1093
1094 @item --help=@var{class}@r{[},@var{qualifier}@r{]}
1095 Print (on the standard output) a description of the command line
1096 options understood by the compiler that fit into a specific class.
1097 The class can be one of @var{optimizers}, @var{warnings}, @var{target}
1098 or @var{params}:
1099
1100 @table @gcctabopt
1101 @item @var{optimizers}
1102 This will display all of the optimization options supported by the
1103 compiler.
1104
1105 @item @var{warnings}
1106 This will display all of the options controlling warning messages
1107 produced by the compiler.
1108
1109 @item @var{target}
1110 This will display target-specific options.  Unlike the
1111 @option{--target-help} option however, target-specific options of the
1112 linker and assembler will not be displayed.  This is because those
1113 tools do not currently support the extended @option{--help=} syntax.
1114
1115 @item @var{params}
1116 This will display the values recognized by the @option{--param}
1117 option.
1118 @end table
1119
1120 It is possible to further refine the output of the @option{--help=}
1121 option by adding a comma separated list of qualifiers after the
1122 class.  These can be any from the following list:
1123
1124 @table @gcctabopt
1125 @item undocumented
1126 Display only those options which are undocumented.
1127
1128 @item joined
1129 Display options which take an argument that appears after an equal
1130 sign in the same continuous piece of text, such as:
1131 @samp{--help=target}.
1132
1133 @item separate
1134 Display options which take an argument that appears as a separate word
1135 following the original option, such as: @samp{-o output-file}.
1136 @end table
1137
1138 Thus for example to display all the undocumented target-specific
1139 switches supported by the compiler the following can be used:
1140
1141 @smallexample
1142 --help=target,undocumented
1143 @end smallexample
1144
1145 The sense of a qualifier can be inverted by prefixing it with the
1146 @var{^} character, so for example to display all binary warning
1147 options (i.e. ones that are either on or off and that do not take an
1148 argument), which have a description the following can be used:
1149
1150 @smallexample
1151 --help=warnings,^joined,^undocumented
1152 @end smallexample
1153
1154 A class can also be used as a qualifier, although this usually
1155 restricts the output by so much that there is nothing to display.  One
1156 case where it does work however is when one of the classes is
1157 @var{target}.  So for example to display all the target-specific
1158 optimization options the following can be used:
1159
1160 @smallexample
1161 --help=target,optimizers
1162 @end smallexample
1163
1164 The @option{--help=} option can be repeated on the command line.  Each
1165 successive use will display its requested class of options, skipping
1166 those that have already been displayed.
1167
1168 If the @option{-Q} option appears on the command line before the
1169 @option{--help=} option, then the descriptive text displayed by
1170 @option{--help=} is changed.  Instead of describing the displayed
1171 options, an indication is given as to whether the option is enabled,
1172 disabled or set to a specific value (assuming that the compiler
1173 knows this at the point where the @option{--help=} option is used).
1174
1175 Here is a truncated example from the ARM port of @command{gcc}:
1176
1177 @smallexample
1178   % gcc -Q -mabi=2 --help=target -c
1179   The following options are target specific:
1180   -mabi=                                2
1181   -mabort-on-noreturn                   [disabled]
1182   -mapcs                                [disabled]
1183 @end smallexample
1184
1185 The output is sensitive to the effects of previous command line
1186 options, so for example it is possible to find out which optimizations
1187 are enabled at @option{-O2} by using:
1188
1189 @smallexample
1190 -O2 --help=optimizers
1191 @end smallexample
1192
1193 Alternatively you can discover which binary optimizations are enabled
1194 by @option{-O3} by using:
1195
1196 @smallexample
1197 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1198 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1199 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1200 @end smallexample
1201
1202 @item --version
1203 @opindex version
1204 Display the version number and copyrights of the invoked GCC@.
1205
1206 @include @value{srcdir}/../libiberty/at-file.texi
1207 @end table
1208
1209 @node Invoking G++
1210 @section Compiling C++ Programs
1211
1212 @cindex suffixes for C++ source
1213 @cindex C++ source file suffixes
1214 C++ source files conventionally use one of the suffixes @samp{.C},
1215 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1216 @samp{.cxx}; C++ header files often use @samp{.hh} or @samp{.H}; and
1217 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
1218 files with these names and compiles them as C++ programs even if you
1219 call the compiler the same way as for compiling C programs (usually
1220 with the name @command{gcc}).
1221
1222 @findex g++
1223 @findex c++
1224 However, the use of @command{gcc} does not add the C++ library.
1225 @command{g++} is a program that calls GCC and treats @samp{.c},
1226 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1227 files unless @option{-x} is used, and automatically specifies linking
1228 against the C++ library.  This program is also useful when
1229 precompiling a C header file with a @samp{.h} extension for use in C++
1230 compilations.  On many systems, @command{g++} is also installed with
1231 the name @command{c++}.
1232
1233 @cindex invoking @command{g++}
1234 When you compile C++ programs, you may specify many of the same
1235 command-line options that you use for compiling programs in any
1236 language; or command-line options meaningful for C and related
1237 languages; or options that are meaningful only for C++ programs.
1238 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1239 explanations of options for languages related to C@.
1240 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1241 explanations of options that are meaningful only for C++ programs.
1242
1243 @node C Dialect Options
1244 @section Options Controlling C Dialect
1245 @cindex dialect options
1246 @cindex language dialect options
1247 @cindex options, dialect
1248
1249 The following options control the dialect of C (or languages derived
1250 from C, such as C++, Objective-C and Objective-C++) that the compiler
1251 accepts:
1252
1253 @table @gcctabopt
1254 @cindex ANSI support
1255 @cindex ISO support
1256 @item -ansi
1257 @opindex ansi
1258 In C mode, support all ISO C90 programs.  In C++ mode,
1259 remove GNU extensions that conflict with ISO C++.
1260
1261 This turns off certain features of GCC that are incompatible with ISO
1262 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1263 such as the @code{asm} and @code{typeof} keywords, and
1264 predefined macros such as @code{unix} and @code{vax} that identify the
1265 type of system you are using.  It also enables the undesirable and
1266 rarely used ISO trigraph feature.  For the C compiler,
1267 it disables recognition of C++ style @samp{//} comments as well as
1268 the @code{inline} keyword.
1269
1270 The alternate keywords @code{__asm__}, @code{__extension__},
1271 @code{__inline__} and @code{__typeof__} continue to work despite
1272 @option{-ansi}.  You would not want to use them in an ISO C program, of
1273 course, but it is useful to put them in header files that might be included
1274 in compilations done with @option{-ansi}.  Alternate predefined macros
1275 such as @code{__unix__} and @code{__vax__} are also available, with or
1276 without @option{-ansi}.
1277
1278 The @option{-ansi} option does not cause non-ISO programs to be
1279 rejected gratuitously.  For that, @option{-pedantic} is required in
1280 addition to @option{-ansi}.  @xref{Warning Options}.
1281
1282 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1283 option is used.  Some header files may notice this macro and refrain
1284 from declaring certain functions or defining certain macros that the
1285 ISO standard doesn't call for; this is to avoid interfering with any
1286 programs that might use these names for other things.
1287
1288 Functions which would normally be built in but do not have semantics
1289 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1290 functions with @option{-ansi} is used.  @xref{Other Builtins,,Other
1291 built-in functions provided by GCC}, for details of the functions
1292 affected.
1293
1294 @item -std=
1295 @opindex std
1296 Determine the language standard.  This option is currently only
1297 supported when compiling C or C++.  A value for this option must be
1298 provided; possible values are
1299
1300 @table @samp
1301 @item c89
1302 @itemx iso9899:1990
1303 ISO C90 (same as @option{-ansi}).
1304
1305 @item iso9899:199409
1306 ISO C90 as modified in amendment 1.
1307
1308 @item c99
1309 @itemx c9x
1310 @itemx iso9899:1999
1311 @itemx iso9899:199x
1312 ISO C99.  Note that this standard is not yet fully supported; see
1313 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information.  The
1314 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1315
1316 @item gnu89
1317 Default, ISO C90 plus GNU extensions (including some C99 features).
1318
1319 @item gnu99
1320 @itemx gnu9x
1321 ISO C99 plus GNU extensions.  When ISO C99 is fully implemented in GCC,
1322 this will become the default.  The name @samp{gnu9x} is deprecated.
1323
1324 @item c++98
1325 The 1998 ISO C++ standard plus amendments.
1326
1327 @item gnu++98
1328 The same as @option{-std=c++98} plus GNU extensions.  This is the
1329 default for C++ code.
1330
1331 @item c++0x
1332 The working draft of the upcoming ISO C++0x standard. This option
1333 enables experimental features that are likely to be included in
1334 C++0x. The working draft is constantly changing, and any feature that is
1335 enabled by this flag may be removed from future versions of GCC if it is
1336 not part of the C++0x standard.
1337
1338 @item gnu++0x
1339 The same as @option{-std=c++0x} plus GNU extensions. As with
1340 @option{-std=c++0x}, this option enables experimental features that may
1341 be removed in future versions of GCC.
1342 @end table
1343
1344 Even when this option is not specified, you can still use some of the
1345 features of newer standards in so far as they do not conflict with
1346 previous C standards.  For example, you may use @code{__restrict__} even
1347 when @option{-std=c99} is not specified.
1348
1349 The @option{-std} options specifying some version of ISO C have the same
1350 effects as @option{-ansi}, except that features that were not in ISO C90
1351 but are in the specified version (for example, @samp{//} comments and
1352 the @code{inline} keyword in ISO C99) are not disabled.
1353
1354 @xref{Standards,,Language Standards Supported by GCC}, for details of
1355 these standard versions.
1356
1357 @item -fgnu89-inline
1358 @opindex fgnu89-inline
1359 The option @option{-fgnu89-inline} tells GCC to use the traditional
1360 GNU semantics for @code{inline} functions when in C99 mode.
1361 @xref{Inline,,An Inline Function is As Fast As a Macro}.  This option
1362 is accepted and ignored by GCC versions 4.1.3 up to but not including
1363 4.3.  In GCC versions 4.3 and later it changes the behavior of GCC in
1364 C99 mode.  Using this option is roughly equivalent to adding the
1365 @code{gnu_inline} function attribute to all inline functions
1366 (@pxref{Function Attributes}).
1367
1368 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1369 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1370 specifies the default behavior).  This option was first supported in
1371 GCC 4.3.  This option is not supported in C89 or gnu89 mode.
1372
1373 The preprocesor macros @code{__GNUC_GNU_INLINE__} and
1374 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1375 in effect for @code{inline} functions.  @xref{Common Predefined
1376 Macros,,,cpp.info,The C Preprocessor}.
1377
1378 @item -aux-info @var{filename}
1379 @opindex aux-info
1380 Output to the given filename prototyped declarations for all functions
1381 declared and/or defined in a translation unit, including those in header
1382 files.  This option is silently ignored in any language other than C@.
1383
1384 Besides declarations, the file indicates, in comments, the origin of
1385 each declaration (source file and line), whether the declaration was
1386 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1387 @samp{O} for old, respectively, in the first character after the line
1388 number and the colon), and whether it came from a declaration or a
1389 definition (@samp{C} or @samp{F}, respectively, in the following
1390 character).  In the case of function definitions, a K&R-style list of
1391 arguments followed by their declarations is also provided, inside
1392 comments, after the declaration.
1393
1394 @item -fno-asm
1395 @opindex fno-asm
1396 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1397 keyword, so that code can use these words as identifiers.  You can use
1398 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1399 instead.  @option{-ansi} implies @option{-fno-asm}.
1400
1401 In C++, this switch only affects the @code{typeof} keyword, since
1402 @code{asm} and @code{inline} are standard keywords.  You may want to
1403 use the @option{-fno-gnu-keywords} flag instead, which has the same
1404 effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1405 switch only affects the @code{asm} and @code{typeof} keywords, since
1406 @code{inline} is a standard keyword in ISO C99.
1407
1408 @item -fno-builtin
1409 @itemx -fno-builtin-@var{function}
1410 @opindex fno-builtin
1411 @cindex built-in functions
1412 Don't recognize built-in functions that do not begin with
1413 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
1414 functions provided by GCC}, for details of the functions affected,
1415 including those which are not built-in functions when @option{-ansi} or
1416 @option{-std} options for strict ISO C conformance are used because they
1417 do not have an ISO standard meaning.
1418
1419 GCC normally generates special code to handle certain built-in functions
1420 more efficiently; for instance, calls to @code{alloca} may become single
1421 instructions that adjust the stack directly, and calls to @code{memcpy}
1422 may become inline copy loops.  The resulting code is often both smaller
1423 and faster, but since the function calls no longer appear as such, you
1424 cannot set a breakpoint on those calls, nor can you change the behavior
1425 of the functions by linking with a different library.  In addition,
1426 when a function is recognized as a built-in function, GCC may use
1427 information about that function to warn about problems with calls to
1428 that function, or to generate more efficient code, even if the
1429 resulting code still contains calls to that function.  For example,
1430 warnings are given with @option{-Wformat} for bad calls to
1431 @code{printf}, when @code{printf} is built in, and @code{strlen} is
1432 known not to modify global memory.
1433
1434 With the @option{-fno-builtin-@var{function}} option
1435 only the built-in function @var{function} is
1436 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
1437 function is named this is not built-in in this version of GCC, this
1438 option is ignored.  There is no corresponding
1439 @option{-fbuiltin-@var{function}} option; if you wish to enable
1440 built-in functions selectively when using @option{-fno-builtin} or
1441 @option{-ffreestanding}, you may define macros such as:
1442
1443 @smallexample
1444 #define abs(n)          __builtin_abs ((n))
1445 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
1446 @end smallexample
1447
1448 @item -fhosted
1449 @opindex fhosted
1450 @cindex hosted environment
1451
1452 Assert that compilation takes place in a hosted environment.  This implies
1453 @option{-fbuiltin}.  A hosted environment is one in which the
1454 entire standard library is available, and in which @code{main} has a return
1455 type of @code{int}.  Examples are nearly everything except a kernel.
1456 This is equivalent to @option{-fno-freestanding}.
1457
1458 @item -ffreestanding
1459 @opindex ffreestanding
1460 @cindex hosted environment
1461
1462 Assert that compilation takes place in a freestanding environment.  This
1463 implies @option{-fno-builtin}.  A freestanding environment
1464 is one in which the standard library may not exist, and program startup may
1465 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
1466 This is equivalent to @option{-fno-hosted}.
1467
1468 @xref{Standards,,Language Standards Supported by GCC}, for details of
1469 freestanding and hosted environments.
1470
1471 @item -fopenmp
1472 @opindex fopenmp
1473 @cindex openmp parallel
1474 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1475 @code{!$omp} in Fortran.  When @option{-fopenmp} is specified, the
1476 compiler generates parallel code according to the OpenMP Application
1477 Program Interface v2.5 @w{@uref{http://www.openmp.org/}}.
1478
1479 @item -fms-extensions
1480 @opindex fms-extensions
1481 Accept some non-standard constructs used in Microsoft header files.
1482
1483 Some cases of unnamed fields in structures and unions are only
1484 accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
1485 fields within structs/unions}, for details.
1486
1487 @item -trigraphs
1488 @opindex trigraphs
1489 Support ISO C trigraphs.  The @option{-ansi} option (and @option{-std}
1490 options for strict ISO C conformance) implies @option{-trigraphs}.
1491
1492 @item -no-integrated-cpp
1493 @opindex no-integrated-cpp
1494 Performs a compilation in two passes: preprocessing and compiling.  This
1495 option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1496 @option{-B} option.  The user supplied compilation step can then add in
1497 an additional preprocessing step after normal preprocessing but before
1498 compiling.  The default is to use the integrated cpp (internal cpp)
1499
1500 The semantics of this option will change if "cc1", "cc1plus", and
1501 "cc1obj" are merged.
1502
1503 @cindex traditional C language
1504 @cindex C language, traditional
1505 @item -traditional
1506 @itemx -traditional-cpp
1507 @opindex traditional-cpp
1508 @opindex traditional
1509 Formerly, these options caused GCC to attempt to emulate a pre-standard
1510 C compiler.  They are now only supported with the @option{-E} switch.
1511 The preprocessor continues to support a pre-standard mode.  See the GNU
1512 CPP manual for details.
1513
1514 @item -fcond-mismatch
1515 @opindex fcond-mismatch
1516 Allow conditional expressions with mismatched types in the second and
1517 third arguments.  The value of such an expression is void.  This option
1518 is not supported for C++.
1519
1520 @item -flax-vector-conversions
1521 @opindex flax-vector-conversions
1522 Allow implicit conversions between vectors with differing numbers of
1523 elements and/or incompatible element types.  This option should not be
1524 used for new code.
1525
1526 @item -funsigned-char
1527 @opindex funsigned-char
1528 Let the type @code{char} be unsigned, like @code{unsigned char}.
1529
1530 Each kind of machine has a default for what @code{char} should
1531 be.  It is either like @code{unsigned char} by default or like
1532 @code{signed char} by default.
1533
1534 Ideally, a portable program should always use @code{signed char} or
1535 @code{unsigned char} when it depends on the signedness of an object.
1536 But many programs have been written to use plain @code{char} and
1537 expect it to be signed, or expect it to be unsigned, depending on the
1538 machines they were written for.  This option, and its inverse, let you
1539 make such a program work with the opposite default.
1540
1541 The type @code{char} is always a distinct type from each of
1542 @code{signed char} or @code{unsigned char}, even though its behavior
1543 is always just like one of those two.
1544
1545 @item -fsigned-char
1546 @opindex fsigned-char
1547 Let the type @code{char} be signed, like @code{signed char}.
1548
1549 Note that this is equivalent to @option{-fno-unsigned-char}, which is
1550 the negative form of @option{-funsigned-char}.  Likewise, the option
1551 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1552
1553 @item -fsigned-bitfields
1554 @itemx -funsigned-bitfields
1555 @itemx -fno-signed-bitfields
1556 @itemx -fno-unsigned-bitfields
1557 @opindex fsigned-bitfields
1558 @opindex funsigned-bitfields
1559 @opindex fno-signed-bitfields
1560 @opindex fno-unsigned-bitfields
1561 These options control whether a bit-field is signed or unsigned, when the
1562 declaration does not use either @code{signed} or @code{unsigned}.  By
1563 default, such a bit-field is signed, because this is consistent: the
1564 basic integer types such as @code{int} are signed types.
1565 @end table
1566
1567 @node C++ Dialect Options
1568 @section Options Controlling C++ Dialect
1569
1570 @cindex compiler options, C++
1571 @cindex C++ options, command line
1572 @cindex options, C++
1573 This section describes the command-line options that are only meaningful
1574 for C++ programs; but you can also use most of the GNU compiler options
1575 regardless of what language your program is in.  For example, you
1576 might compile a file @code{firstClass.C} like this:
1577
1578 @smallexample
1579 g++ -g -frepo -O -c firstClass.C
1580 @end smallexample
1581
1582 @noindent
1583 In this example, only @option{-frepo} is an option meant
1584 only for C++ programs; you can use the other options with any
1585 language supported by GCC@.
1586
1587 Here is a list of options that are @emph{only} for compiling C++ programs:
1588
1589 @table @gcctabopt
1590
1591 @item -fabi-version=@var{n}
1592 @opindex fabi-version
1593 Use version @var{n} of the C++ ABI@.  Version 2 is the version of the
1594 C++ ABI that first appeared in G++ 3.4.  Version 1 is the version of
1595 the C++ ABI that first appeared in G++ 3.2.  Version 0 will always be
1596 the version that conforms most closely to the C++ ABI specification.
1597 Therefore, the ABI obtained using version 0 will change as ABI bugs
1598 are fixed.
1599
1600 The default is version 2.
1601
1602 @item -fno-access-control
1603 @opindex fno-access-control
1604 Turn off all access checking.  This switch is mainly useful for working
1605 around bugs in the access control code.
1606
1607 @item -fcheck-new
1608 @opindex fcheck-new
1609 Check that the pointer returned by @code{operator new} is non-null
1610 before attempting to modify the storage allocated.  This check is
1611 normally unnecessary because the C++ standard specifies that
1612 @code{operator new} will only return @code{0} if it is declared
1613 @samp{throw()}, in which case the compiler will always check the
1614 return value even without this option.  In all other cases, when
1615 @code{operator new} has a non-empty exception specification, memory
1616 exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
1617 @samp{new (nothrow)}.
1618
1619 @item -fconserve-space
1620 @opindex fconserve-space
1621 Put uninitialized or runtime-initialized global variables into the
1622 common segment, as C does.  This saves space in the executable at the
1623 cost of not diagnosing duplicate definitions.  If you compile with this
1624 flag and your program mysteriously crashes after @code{main()} has
1625 completed, you may have an object that is being destroyed twice because
1626 two definitions were merged.
1627
1628 This option is no longer useful on most targets, now that support has
1629 been added for putting variables into BSS without making them common.
1630
1631 @item -ffriend-injection
1632 @opindex ffriend-injection
1633 Inject friend functions into the enclosing namespace, so that they are
1634 visible outside the scope of the class in which they are declared.
1635 Friend functions were documented to work this way in the old Annotated
1636 C++ Reference Manual, and versions of G++ before 4.1 always worked
1637 that way.  However, in ISO C++ a friend function which is not declared
1638 in an enclosing scope can only be found using argument dependent
1639 lookup.  This option causes friends to be injected as they were in
1640 earlier releases.
1641
1642 This option is for compatibility, and may be removed in a future
1643 release of G++.
1644
1645 @item -fno-elide-constructors
1646 @opindex fno-elide-constructors
1647 The C++ standard allows an implementation to omit creating a temporary
1648 which is only used to initialize another object of the same type.
1649 Specifying this option disables that optimization, and forces G++ to
1650 call the copy constructor in all cases.
1651
1652 @item -fno-enforce-eh-specs
1653 @opindex fno-enforce-eh-specs
1654 Don't generate code to check for violation of exception specifications
1655 at runtime.  This option violates the C++ standard, but may be useful
1656 for reducing code size in production builds, much like defining
1657 @samp{NDEBUG}.  This does not give user code permission to throw
1658 exceptions in violation of the exception specifications; the compiler
1659 will still optimize based on the specifications, so throwing an
1660 unexpected exception will result in undefined behavior.
1661
1662 @item -ffor-scope
1663 @itemx -fno-for-scope
1664 @opindex ffor-scope
1665 @opindex fno-for-scope
1666 If @option{-ffor-scope} is specified, the scope of variables declared in
1667 a @i{for-init-statement} is limited to the @samp{for} loop itself,
1668 as specified by the C++ standard.
1669 If @option{-fno-for-scope} is specified, the scope of variables declared in
1670 a @i{for-init-statement} extends to the end of the enclosing scope,
1671 as was the case in old versions of G++, and other (traditional)
1672 implementations of C++.
1673
1674 The default if neither flag is given to follow the standard,
1675 but to allow and give a warning for old-style code that would
1676 otherwise be invalid, or have different behavior.
1677
1678 @item -fno-gnu-keywords
1679 @opindex fno-gnu-keywords
1680 Do not recognize @code{typeof} as a keyword, so that code can use this
1681 word as an identifier.  You can use the keyword @code{__typeof__} instead.
1682 @option{-ansi} implies @option{-fno-gnu-keywords}.
1683
1684 @item -fno-implicit-templates
1685 @opindex fno-implicit-templates
1686 Never emit code for non-inline templates which are instantiated
1687 implicitly (i.e.@: by use); only emit code for explicit instantiations.
1688 @xref{Template Instantiation}, for more information.
1689
1690 @item -fno-implicit-inline-templates
1691 @opindex fno-implicit-inline-templates
1692 Don't emit code for implicit instantiations of inline templates, either.
1693 The default is to handle inlines differently so that compiles with and
1694 without optimization will need the same set of explicit instantiations.
1695
1696 @item -fno-implement-inlines
1697 @opindex fno-implement-inlines
1698 To save space, do not emit out-of-line copies of inline functions
1699 controlled by @samp{#pragma implementation}.  This will cause linker
1700 errors if these functions are not inlined everywhere they are called.
1701
1702 @item -fms-extensions
1703 @opindex fms-extensions
1704 Disable pedantic warnings about constructs used in MFC, such as implicit
1705 int and getting a pointer to member function via non-standard syntax.
1706
1707 @item -fno-nonansi-builtins
1708 @opindex fno-nonansi-builtins
1709 Disable built-in declarations of functions that are not mandated by
1710 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
1711 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
1712
1713 @item -fno-operator-names
1714 @opindex fno-operator-names
1715 Do not treat the operator name keywords @code{and}, @code{bitand},
1716 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1717 synonyms as keywords.
1718
1719 @item -fno-optional-diags
1720 @opindex fno-optional-diags
1721 Disable diagnostics that the standard says a compiler does not need to
1722 issue.  Currently, the only such diagnostic issued by G++ is the one for
1723 a name having multiple meanings within a class.
1724
1725 @item -fpermissive
1726 @opindex fpermissive
1727 Downgrade some diagnostics about nonconformant code from errors to
1728 warnings.  Thus, using @option{-fpermissive} will allow some
1729 nonconforming code to compile.
1730
1731 @item -frepo
1732 @opindex frepo
1733 Enable automatic template instantiation at link time.  This option also
1734 implies @option{-fno-implicit-templates}.  @xref{Template
1735 Instantiation}, for more information.
1736
1737 @item -fno-rtti
1738 @opindex fno-rtti
1739 Disable generation of information about every class with virtual
1740 functions for use by the C++ runtime type identification features
1741 (@samp{dynamic_cast} and @samp{typeid}).  If you don't use those parts
1742 of the language, you can save some space by using this flag.  Note that
1743 exception handling uses the same information, but it will generate it as
1744 needed. The @samp{dynamic_cast} operator can still be used for casts that
1745 do not require runtime type information, i.e. casts to @code{void *} or to
1746 unambiguous base classes.
1747
1748 @item -fstats
1749 @opindex fstats
1750 Emit statistics about front-end processing at the end of the compilation.
1751 This information is generally only useful to the G++ development team.
1752
1753 @item -ftemplate-depth-@var{n}
1754 @opindex ftemplate-depth
1755 Set the maximum instantiation depth for template classes to @var{n}.
1756 A limit on the template instantiation depth is needed to detect
1757 endless recursions during template class instantiation.  ANSI/ISO C++
1758 conforming programs must not rely on a maximum depth greater than 17.
1759
1760 @item -fno-threadsafe-statics
1761 @opindex fno-threadsafe-statics
1762 Do not emit the extra code to use the routines specified in the C++
1763 ABI for thread-safe initialization of local statics.  You can use this
1764 option to reduce code size slightly in code that doesn't need to be
1765 thread-safe.
1766
1767 @item -fuse-cxa-atexit
1768 @opindex fuse-cxa-atexit
1769 Register destructors for objects with static storage duration with the
1770 @code{__cxa_atexit} function rather than the @code{atexit} function.
1771 This option is required for fully standards-compliant handling of static
1772 destructors, but will only work if your C library supports
1773 @code{__cxa_atexit}.
1774
1775 @item -fno-use-cxa-get-exception-ptr
1776 @opindex fno-use-cxa-get-exception-ptr
1777 Don't use the @code{__cxa_get_exception_ptr} runtime routine.  This
1778 will cause @code{std::uncaught_exception} to be incorrect, but is necessary
1779 if the runtime routine is not available.
1780
1781 @item -fvisibility-inlines-hidden
1782 @opindex fvisibility-inlines-hidden
1783 This switch declares that the user does not attempt to compare
1784 pointers to inline methods where the addresses of the two functions
1785 were taken in different shared objects.
1786
1787 The effect of this is that GCC may, effectively, mark inline methods with
1788 @code{__attribute__ ((visibility ("hidden")))} so that they do not
1789 appear in the export table of a DSO and do not require a PLT indirection
1790 when used within the DSO@.  Enabling this option can have a dramatic effect
1791 on load and link times of a DSO as it massively reduces the size of the
1792 dynamic export table when the library makes heavy use of templates.
1793
1794 The behavior of this switch is not quite the same as marking the
1795 methods as hidden directly, because it does not affect static variables
1796 local to the function or cause the compiler to deduce that
1797 the function is defined in only one shared object.
1798
1799 You may mark a method as having a visibility explicitly to negate the
1800 effect of the switch for that method.  For example, if you do want to
1801 compare pointers to a particular inline method, you might mark it as
1802 having default visibility.  Marking the enclosing class with explicit
1803 visibility will have no effect.
1804
1805 Explicitly instantiated inline methods are unaffected by this option
1806 as their linkage might otherwise cross a shared library boundary.
1807 @xref{Template Instantiation}.
1808
1809 @item -fno-weak
1810 @opindex fno-weak
1811 Do not use weak symbol support, even if it is provided by the linker.
1812 By default, G++ will use weak symbols if they are available.  This
1813 option exists only for testing, and should not be used by end-users;
1814 it will result in inferior code and has no benefits.  This option may
1815 be removed in a future release of G++.
1816
1817 @item -nostdinc++
1818 @opindex nostdinc++
1819 Do not search for header files in the standard directories specific to
1820 C++, but do still search the other standard directories.  (This option
1821 is used when building the C++ library.)
1822 @end table
1823
1824 In addition, these optimization, warning, and code generation options
1825 have meanings only for C++ programs:
1826
1827 @table @gcctabopt
1828 @item -fno-default-inline
1829 @opindex fno-default-inline
1830 Do not assume @samp{inline} for functions defined inside a class scope.
1831 @xref{Optimize Options,,Options That Control Optimization}.  Note that these
1832 functions will have linkage like inline functions; they just won't be
1833 inlined by default.
1834
1835 @item -Wabi @r{(C++ only)}
1836 @opindex Wabi
1837 Warn when G++ generates code that is probably not compatible with the
1838 vendor-neutral C++ ABI@.  Although an effort has been made to warn about
1839 all such cases, there are probably some cases that are not warned about,
1840 even though G++ is generating incompatible code.  There may also be
1841 cases where warnings are emitted even though the code that is generated
1842 will be compatible.
1843
1844 You should rewrite your code to avoid these warnings if you are
1845 concerned about the fact that code generated by G++ may not be binary
1846 compatible with code generated by other compilers.
1847
1848 The known incompatibilities at this point include:
1849
1850 @itemize @bullet
1851
1852 @item
1853 Incorrect handling of tail-padding for bit-fields.  G++ may attempt to
1854 pack data into the same byte as a base class.  For example:
1855
1856 @smallexample
1857 struct A @{ virtual void f(); int f1 : 1; @};
1858 struct B : public A @{ int f2 : 1; @};
1859 @end smallexample
1860
1861 @noindent
1862 In this case, G++ will place @code{B::f2} into the same byte
1863 as@code{A::f1}; other compilers will not.  You can avoid this problem
1864 by explicitly padding @code{A} so that its size is a multiple of the
1865 byte size on your platform; that will cause G++ and other compilers to
1866 layout @code{B} identically.
1867
1868 @item
1869 Incorrect handling of tail-padding for virtual bases.  G++ does not use
1870 tail padding when laying out virtual bases.  For example:
1871
1872 @smallexample
1873 struct A @{ virtual void f(); char c1; @};
1874 struct B @{ B(); char c2; @};
1875 struct C : public A, public virtual B @{@};
1876 @end smallexample
1877
1878 @noindent
1879 In this case, G++ will not place @code{B} into the tail-padding for
1880 @code{A}; other compilers will.  You can avoid this problem by
1881 explicitly padding @code{A} so that its size is a multiple of its
1882 alignment (ignoring virtual base classes); that will cause G++ and other
1883 compilers to layout @code{C} identically.
1884
1885 @item
1886 Incorrect handling of bit-fields with declared widths greater than that
1887 of their underlying types, when the bit-fields appear in a union.  For
1888 example:
1889
1890 @smallexample
1891 union U @{ int i : 4096; @};
1892 @end smallexample
1893
1894 @noindent
1895 Assuming that an @code{int} does not have 4096 bits, G++ will make the
1896 union too small by the number of bits in an @code{int}.
1897
1898 @item
1899 Empty classes can be placed at incorrect offsets.  For example:
1900
1901 @smallexample
1902 struct A @{@};
1903
1904 struct B @{
1905   A a;
1906   virtual void f ();
1907 @};
1908
1909 struct C : public B, public A @{@};
1910 @end smallexample
1911
1912 @noindent
1913 G++ will place the @code{A} base class of @code{C} at a nonzero offset;
1914 it should be placed at offset zero.  G++ mistakenly believes that the
1915 @code{A} data member of @code{B} is already at offset zero.
1916
1917 @item
1918 Names of template functions whose types involve @code{typename} or
1919 template template parameters can be mangled incorrectly.
1920
1921 @smallexample
1922 template <typename Q>
1923 void f(typename Q::X) @{@}
1924
1925 template <template <typename> class Q>
1926 void f(typename Q<int>::X) @{@}
1927 @end smallexample
1928
1929 @noindent
1930 Instantiations of these templates may be mangled incorrectly.
1931
1932 @end itemize
1933
1934 @item -Wctor-dtor-privacy @r{(C++ only)}
1935 @opindex Wctor-dtor-privacy
1936 Warn when a class seems unusable because all the constructors or
1937 destructors in that class are private, and it has neither friends nor
1938 public static member functions.
1939
1940 @item -Wnon-virtual-dtor @r{(C++ only)}
1941 @opindex Wnon-virtual-dtor
1942 Warn when a class appears to be polymorphic, thereby requiring a virtual
1943 destructor, yet it declares a non-virtual one.  This warning is also
1944 enabled if -Weffc++ is specified.
1945
1946 @item -Wreorder @r{(C++ only)}
1947 @opindex Wreorder
1948 @cindex reordering, warning
1949 @cindex warning for reordering of member initializers
1950 Warn when the order of member initializers given in the code does not
1951 match the order in which they must be executed.  For instance:
1952
1953 @smallexample
1954 struct A @{
1955   int i;
1956   int j;
1957   A(): j (0), i (1) @{ @}
1958 @};
1959 @end smallexample
1960
1961 The compiler will rearrange the member initializers for @samp{i}
1962 and @samp{j} to match the declaration order of the members, emitting
1963 a warning to that effect.  This warning is enabled by @option{-Wall}.
1964 @end table
1965
1966 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
1967
1968 @table @gcctabopt
1969 @item -Weffc++ @r{(C++ only)}
1970 @opindex Weffc++
1971 Warn about violations of the following style guidelines from Scott Meyers'
1972 @cite{Effective C++} book:
1973
1974 @itemize @bullet
1975 @item
1976 Item 11:  Define a copy constructor and an assignment operator for classes
1977 with dynamically allocated memory.
1978
1979 @item
1980 Item 12:  Prefer initialization to assignment in constructors.
1981
1982 @item
1983 Item 14:  Make destructors virtual in base classes.
1984
1985 @item
1986 Item 15:  Have @code{operator=} return a reference to @code{*this}.
1987
1988 @item
1989 Item 23:  Don't try to return a reference when you must return an object.
1990
1991 @end itemize
1992
1993 Also warn about violations of the following style guidelines from
1994 Scott Meyers' @cite{More Effective C++} book:
1995
1996 @itemize @bullet
1997 @item
1998 Item 6:  Distinguish between prefix and postfix forms of increment and
1999 decrement operators.
2000
2001 @item
2002 Item 7:  Never overload @code{&&}, @code{||}, or @code{,}.
2003
2004 @end itemize
2005
2006 When selecting this option, be aware that the standard library
2007 headers do not obey all of these guidelines; use @samp{grep -v}
2008 to filter out those warnings.
2009
2010 @item -Wno-deprecated @r{(C++ only)}
2011 @opindex Wno-deprecated
2012 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
2013
2014 @item -Wstrict-null-sentinel @r{(C++ only)}
2015 @opindex Wstrict-null-sentinel
2016 Warn also about the use of an uncasted @code{NULL} as sentinel.  When
2017 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2018 to @code{__null}.  Although it is a null pointer constant not a null pointer,
2019 it is guaranteed to of the same size as a pointer.  But this use is
2020 not portable across different compilers.
2021
2022 @item -Wno-non-template-friend @r{(C++ only)}
2023 @opindex Wno-non-template-friend
2024 Disable warnings when non-templatized friend functions are declared
2025 within a template.  Since the advent of explicit template specification
2026 support in G++, if the name of the friend is an unqualified-id (i.e.,
2027 @samp{friend foo(int)}), the C++ language specification demands that the
2028 friend declare or define an ordinary, nontemplate function.  (Section
2029 14.5.3).  Before G++ implemented explicit specification, unqualified-ids
2030 could be interpreted as a particular specialization of a templatized
2031 function.  Because this non-conforming behavior is no longer the default
2032 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2033 check existing code for potential trouble spots and is on by default.
2034 This new compiler behavior can be turned off with
2035 @option{-Wno-non-template-friend} which keeps the conformant compiler code
2036 but disables the helpful warning.
2037
2038 @item -Wold-style-cast @r{(C++ only)}
2039 @opindex Wold-style-cast
2040 Warn if an old-style (C-style) cast to a non-void type is used within
2041 a C++ program.  The new-style casts (@samp{dynamic_cast},
2042 @samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are
2043 less vulnerable to unintended effects and much easier to search for.
2044
2045 @item -Woverloaded-virtual @r{(C++ only)}
2046 @opindex Woverloaded-virtual
2047 @cindex overloaded virtual fn, warning
2048 @cindex warning for overloaded virtual fn
2049 Warn when a function declaration hides virtual functions from a
2050 base class.  For example, in:
2051
2052 @smallexample
2053 struct A @{
2054   virtual void f();
2055 @};
2056
2057 struct B: public A @{
2058   void f(int);
2059 @};
2060 @end smallexample
2061
2062 the @code{A} class version of @code{f} is hidden in @code{B}, and code
2063 like:
2064
2065 @smallexample
2066 B* b;
2067 b->f();
2068 @end smallexample
2069
2070 will fail to compile.
2071
2072 @item -Wno-pmf-conversions @r{(C++ only)}
2073 @opindex Wno-pmf-conversions
2074 Disable the diagnostic for converting a bound pointer to member function
2075 to a plain pointer.
2076
2077 @item -Wsign-promo @r{(C++ only)}
2078 @opindex Wsign-promo
2079 Warn when overload resolution chooses a promotion from unsigned or
2080 enumerated type to a signed type, over a conversion to an unsigned type of
2081 the same size.  Previous versions of G++ would try to preserve
2082 unsignedness, but the standard mandates the current behavior.
2083
2084 @smallexample
2085 struct A @{
2086   operator int ();
2087   A& operator = (int);
2088 @};
2089
2090 main ()
2091 @{
2092   A a,b;
2093   a = b;
2094 @}
2095 @end smallexample
2096
2097 In this example, G++ will synthesize a default @samp{A& operator =
2098 (const A&);}, while cfront will use the user-defined @samp{operator =}.
2099 @end table
2100
2101 @node Objective-C and Objective-C++ Dialect Options
2102 @section Options Controlling Objective-C and Objective-C++ Dialects
2103
2104 @cindex compiler options, Objective-C and Objective-C++
2105 @cindex Objective-C and Objective-C++ options, command line
2106 @cindex options, Objective-C and Objective-C++
2107 (NOTE: This manual does not describe the Objective-C and Objective-C++
2108 languages themselves.  See @xref{Standards,,Language Standards
2109 Supported by GCC}, for references.)
2110
2111 This section describes the command-line options that are only meaningful
2112 for Objective-C and Objective-C++ programs, but you can also use most of
2113 the language-independent GNU compiler options.
2114 For example, you might compile a file @code{some_class.m} like this:
2115
2116 @smallexample
2117 gcc -g -fgnu-runtime -O -c some_class.m
2118 @end smallexample
2119
2120 @noindent
2121 In this example, @option{-fgnu-runtime} is an option meant only for
2122 Objective-C and Objective-C++ programs; you can use the other options with
2123 any language supported by GCC@.
2124
2125 Note that since Objective-C is an extension of the C language, Objective-C
2126 compilations may also use options specific to the C front-end (e.g.,
2127 @option{-Wtraditional}).  Similarly, Objective-C++ compilations may use
2128 C++-specific options (e.g., @option{-Wabi}).
2129
2130 Here is a list of options that are @emph{only} for compiling Objective-C
2131 and Objective-C++ programs:
2132
2133 @table @gcctabopt
2134 @item -fconstant-string-class=@var{class-name}
2135 @opindex fconstant-string-class
2136 Use @var{class-name} as the name of the class to instantiate for each
2137 literal string specified with the syntax @code{@@"@dots{}"}.  The default
2138 class name is @code{NXConstantString} if the GNU runtime is being used, and
2139 @code{NSConstantString} if the NeXT runtime is being used (see below).  The
2140 @option{-fconstant-cfstrings} option, if also present, will override the
2141 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
2142 to be laid out as constant CoreFoundation strings.
2143
2144 @item -fgnu-runtime
2145 @opindex fgnu-runtime
2146 Generate object code compatible with the standard GNU Objective-C
2147 runtime.  This is the default for most types of systems.
2148
2149 @item -fnext-runtime
2150 @opindex fnext-runtime
2151 Generate output compatible with the NeXT runtime.  This is the default
2152 for NeXT-based systems, including Darwin and Mac OS X@.  The macro
2153 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
2154 used.
2155
2156 @item -fno-nil-receivers
2157 @opindex fno-nil-receivers
2158 Assume that all Objective-C message dispatches (e.g.,
2159 @code{[receiver message:arg]}) in this translation unit ensure that the receiver
2160 is not @code{nil}.  This allows for more efficient entry points in the runtime
2161 to be used.  Currently, this option is only available in conjunction with
2162 the NeXT runtime on Mac OS X 10.3 and later.
2163
2164 @item -fobjc-call-cxx-cdtors
2165 @opindex fobjc-call-cxx-cdtors
2166 For each Objective-C class, check if any of its instance variables is a
2167 C++ object with a non-trivial default constructor.  If so, synthesize a
2168 special @code{- (id) .cxx_construct} instance method that will run
2169 non-trivial default constructors on any such instance variables, in order,
2170 and then return @code{self}.  Similarly, check if any instance variable
2171 is a C++ object with a non-trivial destructor, and if so, synthesize a
2172 special @code{- (void) .cxx_destruct} method that will run
2173 all such default destructors, in reverse order.
2174
2175 The @code{- (id) .cxx_construct} and/or @code{- (void) .cxx_destruct} methods
2176 thusly generated will only operate on instance variables declared in the
2177 current Objective-C class, and not those inherited from superclasses.  It
2178 is the responsibility of the Objective-C runtime to invoke all such methods
2179 in an object's inheritance hierarchy.  The @code{- (id) .cxx_construct} methods
2180 will be invoked by the runtime immediately after a new object
2181 instance is allocated; the @code{- (void) .cxx_destruct} methods will
2182 be invoked immediately before the runtime deallocates an object instance.
2183
2184 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
2185 support for invoking the @code{- (id) .cxx_construct} and
2186 @code{- (void) .cxx_destruct} methods.
2187
2188 @item -fobjc-direct-dispatch
2189 @opindex fobjc-direct-dispatch
2190 Allow fast jumps to the message dispatcher.  On Darwin this is
2191 accomplished via the comm page.
2192
2193 @item -fobjc-exceptions
2194 @opindex fobjc-exceptions
2195 Enable syntactic support for structured exception handling in Objective-C,
2196 similar to what is offered by C++ and Java.  This option is
2197 unavailable in conjunction with the NeXT runtime on Mac OS X 10.2 and
2198 earlier.
2199
2200 @smallexample
2201   @@try @{
2202     @dots{}
2203        @@throw expr;
2204     @dots{}
2205   @}
2206   @@catch (AnObjCClass *exc) @{
2207     @dots{}
2208       @@throw expr;
2209     @dots{}
2210       @@throw;
2211     @dots{}
2212   @}
2213   @@catch (AnotherClass *exc) @{
2214     @dots{}
2215   @}
2216   @@catch (id allOthers) @{
2217     @dots{}
2218   @}
2219   @@finally @{
2220     @dots{}
2221       @@throw expr;
2222     @dots{}
2223   @}
2224 @end smallexample
2225
2226 The @code{@@throw} statement may appear anywhere in an Objective-C or
2227 Objective-C++ program; when used inside of a @code{@@catch} block, the
2228 @code{@@throw} may appear without an argument (as shown above), in which case
2229 the object caught by the @code{@@catch} will be rethrown.
2230
2231 Note that only (pointers to) Objective-C objects may be thrown and
2232 caught using this scheme.  When an object is thrown, it will be caught
2233 by the nearest @code{@@catch} clause capable of handling objects of that type,
2234 analogously to how @code{catch} blocks work in C++ and Java.  A
2235 @code{@@catch(id @dots{})} clause (as shown above) may also be provided to catch
2236 any and all Objective-C exceptions not caught by previous @code{@@catch}
2237 clauses (if any).
2238
2239 The @code{@@finally} clause, if present, will be executed upon exit from the
2240 immediately preceding @code{@@try @dots{} @@catch} section.  This will happen
2241 regardless of whether any exceptions are thrown, caught or rethrown
2242 inside the @code{@@try @dots{} @@catch} section, analogously to the behavior
2243 of the @code{finally} clause in Java.
2244
2245 There are several caveats to using the new exception mechanism:
2246
2247 @itemize @bullet
2248 @item
2249 Although currently designed to be binary compatible with @code{NS_HANDLER}-style
2250 idioms provided by the @code{NSException} class, the new
2251 exceptions can only be used on Mac OS X 10.3 (Panther) and later
2252 systems, due to additional functionality needed in the (NeXT) Objective-C
2253 runtime.
2254
2255 @item
2256 As mentioned above, the new exceptions do not support handling
2257 types other than Objective-C objects.   Furthermore, when used from
2258 Objective-C++, the Objective-C exception model does not interoperate with C++
2259 exceptions at this time.  This means you cannot @code{@@throw} an exception
2260 from Objective-C and @code{catch} it in C++, or vice versa
2261 (i.e., @code{throw @dots{} @@catch}).
2262 @end itemize
2263
2264 The @option{-fobjc-exceptions} switch also enables the use of synchronization
2265 blocks for thread-safe execution:
2266
2267 @smallexample
2268   @@synchronized (ObjCClass *guard) @{
2269     @dots{}
2270   @}
2271 @end smallexample
2272
2273 Upon entering the @code{@@synchronized} block, a thread of execution shall
2274 first check whether a lock has been placed on the corresponding @code{guard}
2275 object by another thread.  If it has, the current thread shall wait until
2276 the other thread relinquishes its lock.  Once @code{guard} becomes available,
2277 the current thread will place its own lock on it, execute the code contained in
2278 the @code{@@synchronized} block, and finally relinquish the lock (thereby
2279 making @code{guard} available to other threads).
2280
2281 Unlike Java, Objective-C does not allow for entire methods to be marked
2282 @code{@@synchronized}.  Note that throwing exceptions out of
2283 @code{@@synchronized} blocks is allowed, and will cause the guarding object
2284 to be unlocked properly.
2285
2286 @item -fobjc-gc
2287 @opindex fobjc-gc
2288 Enable garbage collection (GC) in Objective-C and Objective-C++ programs.
2289
2290 @item -freplace-objc-classes
2291 @opindex freplace-objc-classes
2292 Emit a special marker instructing @command{ld(1)} not to statically link in
2293 the resulting object file, and allow @command{dyld(1)} to load it in at
2294 run time instead.  This is used in conjunction with the Fix-and-Continue
2295 debugging mode, where the object file in question may be recompiled and
2296 dynamically reloaded in the course of program execution, without the need
2297 to restart the program itself.  Currently, Fix-and-Continue functionality
2298 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
2299 and later.
2300
2301 @item -fzero-link
2302 @opindex fzero-link
2303 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
2304 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
2305 compile time) with static class references that get initialized at load time,
2306 which improves run-time performance.  Specifying the @option{-fzero-link} flag
2307 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
2308 to be retained.  This is useful in Zero-Link debugging mode, since it allows
2309 for individual class implementations to be modified during program execution.
2310
2311 @item -gen-decls
2312 @opindex gen-decls
2313 Dump interface declarations for all classes seen in the source file to a
2314 file named @file{@var{sourcename}.decl}.
2315
2316 @item -Wassign-intercept
2317 @opindex Wassign-intercept
2318 Warn whenever an Objective-C assignment is being intercepted by the
2319 garbage collector.
2320
2321 @item -Wno-protocol
2322 @opindex Wno-protocol
2323 If a class is declared to implement a protocol, a warning is issued for
2324 every method in the protocol that is not implemented by the class.  The
2325 default behavior is to issue a warning for every method not explicitly
2326 implemented in the class, even if a method implementation is inherited
2327 from the superclass.  If you use the @option{-Wno-protocol} option, then
2328 methods inherited from the superclass are considered to be implemented,
2329 and no warning is issued for them.
2330
2331 @item -Wselector
2332 @opindex Wselector
2333 Warn if multiple methods of different types for the same selector are
2334 found during compilation.  The check is performed on the list of methods
2335 in the final stage of compilation.  Additionally, a check is performed
2336 for each selector appearing in a @code{@@selector(@dots{})}
2337 expression, and a corresponding method for that selector has been found
2338 during compilation.  Because these checks scan the method table only at
2339 the end of compilation, these warnings are not produced if the final
2340 stage of compilation is not reached, for example because an error is
2341 found during compilation, or because the @option{-fsyntax-only} option is
2342 being used.
2343
2344 @item -Wstrict-selector-match
2345 @opindex Wstrict-selector-match
2346 Warn if multiple methods with differing argument and/or return types are
2347 found for a given selector when attempting to send a message using this
2348 selector to a receiver of type @code{id} or @code{Class}.  When this flag
2349 is off (which is the default behavior), the compiler will omit such warnings
2350 if any differences found are confined to types which share the same size
2351 and alignment.
2352
2353 @item -Wundeclared-selector
2354 @opindex Wundeclared-selector
2355 Warn if a @code{@@selector(@dots{})} expression referring to an
2356 undeclared selector is found.  A selector is considered undeclared if no
2357 method with that name has been declared before the
2358 @code{@@selector(@dots{})} expression, either explicitly in an
2359 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
2360 an @code{@@implementation} section.  This option always performs its
2361 checks as soon as a @code{@@selector(@dots{})} expression is found,
2362 while @option{-Wselector} only performs its checks in the final stage of
2363 compilation.  This also enforces the coding style convention
2364 that methods and selectors must be declared before being used.
2365
2366 @item -print-objc-runtime-info
2367 @opindex print-objc-runtime-info
2368 Generate C header describing the largest structure that is passed by
2369 value, if any.
2370
2371 @end table
2372
2373 @node Language Independent Options
2374 @section Options to Control Diagnostic Messages Formatting
2375 @cindex options to control diagnostics formatting
2376 @cindex diagnostic messages
2377 @cindex message formatting
2378
2379 Traditionally, diagnostic messages have been formatted irrespective of
2380 the output device's aspect (e.g.@: its width, @dots{}).  The options described
2381 below can be used to control the diagnostic messages formatting
2382 algorithm, e.g.@: how many characters per line, how often source location
2383 information should be reported.  Right now, only the C++ front end can
2384 honor these options.  However it is expected, in the near future, that
2385 the remaining front ends would be able to digest them correctly.
2386
2387 @table @gcctabopt
2388 @item -fmessage-length=@var{n}
2389 @opindex fmessage-length
2390 Try to format error messages so that they fit on lines of about @var{n}
2391 characters.  The default is 72 characters for @command{g++} and 0 for the rest of
2392 the front ends supported by GCC@.  If @var{n} is zero, then no
2393 line-wrapping will be done; each error message will appear on a single
2394 line.
2395
2396 @opindex fdiagnostics-show-location
2397 @item -fdiagnostics-show-location=once
2398 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
2399 reporter to emit @emph{once} source location information; that is, in
2400 case the message is too long to fit on a single physical line and has to
2401 be wrapped, the source location won't be emitted (as prefix) again,
2402 over and over, in subsequent continuation lines.  This is the default
2403 behavior.
2404
2405 @item -fdiagnostics-show-location=every-line
2406 Only meaningful in line-wrapping mode.  Instructs the diagnostic
2407 messages reporter to emit the same source location information (as
2408 prefix) for physical lines that result from the process of breaking
2409 a message which is too long to fit on a single line.
2410
2411 @item -fdiagnostics-show-option
2412 @opindex fdiagnostics-show-option
2413 This option instructs the diagnostic machinery to add text to each
2414 diagnostic emitted, which indicates which command line option directly
2415 controls that diagnostic, when such an option is known to the
2416 diagnostic machinery.
2417
2418 @item -Wcoverage-mismatch
2419 @opindex Wcoverage-mismatch
2420 Warn if feedback profiles do not match when using the
2421 @option{-fprofile-use} option.
2422 If a source file was changed between @option{-fprofile-gen} and
2423 @option{-fprofile-use}, the files with the profile feedback can fail
2424 to match the source file and GCC can not use the profile feedback
2425 information.  By default, GCC emits an error message in this case.
2426 The option @option{-Wcoverage-mismatch} emits a warning instead of an
2427 error.  GCC does not use appropriate feedback profiles, so using this
2428 option can result in poorly optimized code.  This option is useful
2429 only in the case of very minor changes such as bug fixes to an
2430 existing code-base.
2431
2432 @end table
2433
2434 @node Warning Options
2435 @section Options to Request or Suppress Warnings
2436 @cindex options to control warnings
2437 @cindex warning messages
2438 @cindex messages, warning
2439 @cindex suppressing warnings
2440
2441 Warnings are diagnostic messages that report constructions which
2442 are not inherently erroneous but which are risky or suggest there
2443 may have been an error.
2444
2445 You can request many specific warnings with options beginning @samp{-W},
2446 for example @option{-Wimplicit} to request warnings on implicit
2447 declarations.  Each of these specific warning options also has a
2448 negative form beginning @samp{-Wno-} to turn off warnings;
2449 for example, @option{-Wno-implicit}.  This manual lists only one of the
2450 two forms, whichever is not the default.
2451
2452 The following options control the amount and kinds of warnings produced
2453 by GCC; for further, language-specific options also refer to
2454 @ref{C++ Dialect Options} and @ref{Objective-C and Objective-C++ Dialect
2455 Options}.
2456
2457 @table @gcctabopt
2458 @cindex syntax checking
2459 @item -fsyntax-only
2460 @opindex fsyntax-only
2461 Check the code for syntax errors, but don't do anything beyond that.
2462
2463 @item -pedantic
2464 @opindex pedantic
2465 Issue all the warnings demanded by strict ISO C and ISO C++;
2466 reject all programs that use forbidden extensions, and some other
2467 programs that do not follow ISO C and ISO C++.  For ISO C, follows the
2468 version of the ISO C standard specified by any @option{-std} option used.
2469
2470 Valid ISO C and ISO C++ programs should compile properly with or without
2471 this option (though a rare few will require @option{-ansi} or a
2472 @option{-std} option specifying the required version of ISO C)@.  However,
2473 without this option, certain GNU extensions and traditional C and C++
2474 features are supported as well.  With this option, they are rejected.
2475
2476 @option{-pedantic} does not cause warning messages for use of the
2477 alternate keywords whose names begin and end with @samp{__}.  Pedantic
2478 warnings are also disabled in the expression that follows
2479 @code{__extension__}.  However, only system header files should use
2480 these escape routes; application programs should avoid them.
2481 @xref{Alternate Keywords}.
2482
2483 Some users try to use @option{-pedantic} to check programs for strict ISO
2484 C conformance.  They soon find that it does not do quite what they want:
2485 it finds some non-ISO practices, but not all---only those for which
2486 ISO C @emph{requires} a diagnostic, and some others for which
2487 diagnostics have been added.
2488
2489 A feature to report any failure to conform to ISO C might be useful in
2490 some instances, but would require considerable additional work and would
2491 be quite different from @option{-pedantic}.  We don't have plans to
2492 support such a feature in the near future.
2493
2494 Where the standard specified with @option{-std} represents a GNU
2495 extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
2496 corresponding @dfn{base standard}, the version of ISO C on which the GNU
2497 extended dialect is based.  Warnings from @option{-pedantic} are given
2498 where they are required by the base standard.  (It would not make sense
2499 for such warnings to be given only for features not in the specified GNU
2500 C dialect, since by definition the GNU dialects of C include all
2501 features the compiler supports with the given option, and there would be
2502 nothing to warn about.)
2503
2504 @item -pedantic-errors
2505 @opindex pedantic-errors
2506 Like @option{-pedantic}, except that errors are produced rather than
2507 warnings.
2508
2509 @item -w
2510 @opindex w
2511 Inhibit all warning messages.
2512
2513 @item -Wno-import
2514 @opindex Wno-import
2515 Inhibit warning messages about the use of @samp{#import}.
2516
2517 @item -Wchar-subscripts
2518 @opindex Wchar-subscripts
2519 Warn if an array subscript has type @code{char}.  This is a common cause
2520 of error, as programmers often forget that this type is signed on some
2521 machines.
2522 This warning is enabled by @option{-Wall}.
2523
2524 @item -Wcomment
2525 @opindex Wcomment
2526 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
2527 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
2528 This warning is enabled by @option{-Wall}.
2529
2530 @item -Wfatal-errors
2531 @opindex Wfatal-errors
2532 This option causes the compiler to abort compilation on the first error
2533 occurred rather than trying to keep going and printing further error
2534 messages.
2535
2536 @item -Wformat
2537 @opindex Wformat
2538 @opindex ffreestanding
2539 @opindex fno-builtin
2540 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
2541 the arguments supplied have types appropriate to the format string
2542 specified, and that the conversions specified in the format string make
2543 sense.  This includes standard functions, and others specified by format
2544 attributes (@pxref{Function Attributes}), in the @code{printf},
2545 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
2546 not in the C standard) families (or other target-specific families).
2547 Which functions are checked without format attributes having been
2548 specified depends on the standard version selected, and such checks of
2549 functions without the attribute specified are disabled by
2550 @option{-ffreestanding} or @option{-fno-builtin}.
2551
2552 The formats are checked against the format features supported by GNU
2553 libc version 2.2.  These include all ISO C90 and C99 features, as well
2554 as features from the Single Unix Specification and some BSD and GNU
2555 extensions.  Other library implementations may not support all these
2556 features; GCC does not support warning about features that go beyond a
2557 particular library's limitations.  However, if @option{-pedantic} is used
2558 with @option{-Wformat}, warnings will be given about format features not
2559 in the selected standard version (but not for @code{strfmon} formats,
2560 since those are not in any version of the C standard).  @xref{C Dialect
2561 Options,,Options Controlling C Dialect}.
2562
2563 Since @option{-Wformat} also checks for null format arguments for
2564 several functions, @option{-Wformat} also implies @option{-Wnonnull}.
2565
2566 @option{-Wformat} is included in @option{-Wall}.  For more control over some
2567 aspects of format checking, the options @option{-Wformat-y2k},
2568 @option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
2569 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
2570 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
2571
2572 @item -Wformat-y2k
2573 @opindex Wformat-y2k
2574 If @option{-Wformat} is specified, also warn about @code{strftime}
2575 formats which may yield only a two-digit year.
2576
2577 @item -Wno-format-extra-args
2578 @opindex Wno-format-extra-args
2579 If @option{-Wformat} is specified, do not warn about excess arguments to a
2580 @code{printf} or @code{scanf} format function.  The C standard specifies
2581 that such arguments are ignored.
2582
2583 Where the unused arguments lie between used arguments that are
2584 specified with @samp{$} operand number specifications, normally
2585 warnings are still given, since the implementation could not know what
2586 type to pass to @code{va_arg} to skip the unused arguments.  However,
2587 in the case of @code{scanf} formats, this option will suppress the
2588 warning if the unused arguments are all pointers, since the Single
2589 Unix Specification says that such unused arguments are allowed.
2590
2591 @item -Wno-format-zero-length
2592 @opindex Wno-format-zero-length
2593 If @option{-Wformat} is specified, do not warn about zero-length formats.
2594 The C standard specifies that zero-length formats are allowed.
2595
2596 @item -Wformat-nonliteral
2597 @opindex Wformat-nonliteral
2598 If @option{-Wformat} is specified, also warn if the format string is not a
2599 string literal and so cannot be checked, unless the format function
2600 takes its format arguments as a @code{va_list}.
2601
2602 @item -Wformat-security
2603 @opindex Wformat-security
2604 If @option{-Wformat} is specified, also warn about uses of format
2605 functions that represent possible security problems.  At present, this
2606 warns about calls to @code{printf} and @code{scanf} functions where the
2607 format string is not a string literal and there are no format arguments,
2608 as in @code{printf (foo);}.  This may be a security hole if the format
2609 string came from untrusted input and contains @samp{%n}.  (This is
2610 currently a subset of what @option{-Wformat-nonliteral} warns about, but
2611 in future warnings may be added to @option{-Wformat-security} that are not
2612 included in @option{-Wformat-nonliteral}.)
2613
2614 @item -Wformat=2
2615 @opindex Wformat=2
2616 Enable @option{-Wformat} plus format checks not included in
2617 @option{-Wformat}.  Currently equivalent to @samp{-Wformat
2618 -Wformat-nonliteral -Wformat-security -Wformat-y2k}.
2619
2620 @item -Wnonnull
2621 @opindex Wnonnull
2622 Warn about passing a null pointer for arguments marked as
2623 requiring a non-null value by the @code{nonnull} function attribute.
2624
2625 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
2626 can be disabled with the @option{-Wno-nonnull} option.
2627
2628 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
2629 @opindex Winit-self
2630 Warn about uninitialized variables which are initialized with themselves.
2631 Note this option can only be used with the @option{-Wuninitialized} option,
2632 which in turn only works with @option{-O1} and above.
2633
2634 For example, GCC will warn about @code{i} being uninitialized in the
2635 following snippet only when @option{-Winit-self} has been specified:
2636 @smallexample
2637 @group
2638 int f()
2639 @{
2640   int i = i;
2641   return i;
2642 @}
2643 @end group
2644 @end smallexample
2645
2646 @item -Wimplicit-int
2647 @opindex Wimplicit-int
2648 Warn when a declaration does not specify a type.
2649 This warning is enabled by @option{-Wall}.
2650
2651 @item -Wimplicit-function-declaration
2652 @opindex Wimplicit-function-declaration
2653 @opindex Wno-implicit-function-declaration
2654 Give a warning whenever a function is used before being declared. In
2655 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
2656 enabled by default and it is made into an error by
2657 @option{-pedantic-errors}. This warning is also enabled by
2658 @option{-Wall}.
2659
2660 @item -Wimplicit
2661 @opindex Wimplicit
2662 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
2663 This warning is enabled by @option{-Wall}.
2664
2665 @item -Wmain
2666 @opindex Wmain
2667 Warn if the type of @samp{main} is suspicious.  @samp{main} should be a
2668 function with external linkage, returning int, taking either zero
2669 arguments, two, or three arguments of appropriate types.
2670 This warning is enabled by @option{-Wall}.
2671
2672 @item -Wmissing-braces
2673 @opindex Wmissing-braces
2674 Warn if an aggregate or union initializer is not fully bracketed.  In
2675 the following example, the initializer for @samp{a} is not fully
2676 bracketed, but that for @samp{b} is fully bracketed.
2677
2678 @smallexample
2679 int a[2][2] = @{ 0, 1, 2, 3 @};
2680 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
2681 @end smallexample
2682
2683 This warning is enabled by @option{-Wall}.
2684
2685 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
2686 @opindex Wmissing-include-dirs
2687 Warn if a user-supplied include directory does not exist.
2688
2689 @item -Wparentheses
2690 @opindex Wparentheses
2691 Warn if parentheses are omitted in certain contexts, such
2692 as when there is an assignment in a context where a truth value
2693 is expected, or when operators are nested whose precedence people
2694 often get confused about.
2695
2696 Also warn if a comparison like @samp{x<=y<=z} appears; this is
2697 equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
2698 interpretation from that of ordinary mathematical notation.
2699
2700 Also warn about constructions where there may be confusion to which
2701 @code{if} statement an @code{else} branch belongs.  Here is an example of
2702 such a case:
2703
2704 @smallexample
2705 @group
2706 @{
2707   if (a)
2708     if (b)
2709       foo ();
2710   else
2711     bar ();
2712 @}
2713 @end group
2714 @end smallexample
2715
2716 In C/C++, every @code{else} branch belongs to the innermost possible
2717 @code{if} statement, which in this example is @code{if (b)}.  This is
2718 often not what the programmer expected, as illustrated in the above
2719 example by indentation the programmer chose.  When there is the
2720 potential for this confusion, GCC will issue a warning when this flag
2721 is specified.  To eliminate the warning, add explicit braces around
2722 the innermost @code{if} statement so there is no way the @code{else}
2723 could belong to the enclosing @code{if}.  The resulting code would
2724 look like this:
2725
2726 @smallexample
2727 @group
2728 @{
2729   if (a)
2730     @{
2731       if (b)
2732         foo ();
2733       else
2734         bar ();
2735     @}
2736 @}
2737 @end group
2738 @end smallexample
2739
2740 This warning is enabled by @option{-Wall}.
2741
2742 @item -Wsequence-point
2743 @opindex Wsequence-point
2744 Warn about code that may have undefined semantics because of violations
2745 of sequence point rules in the C and C++ standards.
2746
2747 The C and C++ standards defines the order in which expressions in a C/C++
2748 program are evaluated in terms of @dfn{sequence points}, which represent
2749 a partial ordering between the execution of parts of the program: those
2750 executed before the sequence point, and those executed after it.  These
2751 occur after the evaluation of a full expression (one which is not part
2752 of a larger expression), after the evaluation of the first operand of a
2753 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
2754 function is called (but after the evaluation of its arguments and the
2755 expression denoting the called function), and in certain other places.
2756 Other than as expressed by the sequence point rules, the order of
2757 evaluation of subexpressions of an expression is not specified.  All
2758 these rules describe only a partial order rather than a total order,
2759 since, for example, if two functions are called within one expression
2760 with no sequence point between them, the order in which the functions
2761 are called is not specified.  However, the standards committee have
2762 ruled that function calls do not overlap.
2763
2764 It is not specified when between sequence points modifications to the
2765 values of objects take effect.  Programs whose behavior depends on this
2766 have undefined behavior; the C and C++ standards specify that ``Between
2767 the previous and next sequence point an object shall have its stored
2768 value modified at most once by the evaluation of an expression.  
2769 Furthermore, the prior value shall be read only to determine the value
2770 to be stored.''.  If a program breaks these rules, the results on any
2771 particular implementation are entirely unpredictable.
2772
2773 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
2774 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
2775 diagnosed by this option, and it may give an occasional false positive
2776 result, but in general it has been found fairly effective at detecting
2777 this sort of problem in programs.
2778
2779 The standard is worded confusingly, therefore there is some debate
2780 over the precise meaning of the sequence point rules in subtle cases.
2781 Links to discussions of the problem, including proposed formal
2782 definitions, may be found on the GCC readings page, at
2783 @w{@uref{http://gcc.gnu.org/readings.html}}.
2784
2785 This warning is enabled by @option{-Wall} for C and C++.
2786
2787 @item -Wreturn-type
2788 @opindex Wreturn-type
2789 Warn whenever a function is defined with a return-type that defaults to
2790 @code{int}.  Also warn about any @code{return} statement with no
2791 return-value in a function whose return-type is not @code{void}.
2792
2793 Also warn if the return type of a function has a type qualifier
2794 such as @code{const}.  For ISO C such a type qualifier has no effect,
2795 since the value returned by a function is not an lvalue.
2796 For C++, the warning is only emitted for scalar types or @code{void}.
2797 ISO C prohibits qualified @code{void} return types on function
2798 definitions, so such return types always receive a warning
2799 even without this option.
2800
2801 For C++, a function without return type always produces a diagnostic
2802 message, even when @option{-Wno-return-type} is specified.  The only
2803 exceptions are @samp{main} and functions defined in system headers.
2804
2805 This warning is enabled by @option{-Wall}.
2806
2807 @item -Wswitch
2808 @opindex Wswitch
2809 Warn whenever a @code{switch} statement has an index of enumerated type
2810 and lacks a @code{case} for one or more of the named codes of that
2811 enumeration.  (The presence of a @code{default} label prevents this
2812 warning.)  @code{case} labels outside the enumeration range also
2813 provoke warnings when this option is used.
2814 This warning is enabled by @option{-Wall}.
2815
2816 @item -Wswitch-default
2817 @opindex Wswitch-switch
2818 Warn whenever a @code{switch} statement does not have a @code{default}
2819 case.
2820
2821 @item -Wswitch-enum
2822 @opindex Wswitch-enum
2823 Warn whenever a @code{switch} statement has an index of enumerated type
2824 and lacks a @code{case} for one or more of the named codes of that
2825 enumeration.  @code{case} labels outside the enumeration range also
2826 provoke warnings when this option is used.
2827
2828 @item -Wtrigraphs
2829 @opindex Wtrigraphs
2830 Warn if any trigraphs are encountered that might change the meaning of
2831 the program (trigraphs within comments are not warned about).
2832 This warning is enabled by @option{-Wall}.
2833
2834 @item -Wunused-function
2835 @opindex Wunused-function
2836 Warn whenever a static function is declared but not defined or a
2837 non-inline static function is unused.
2838 This warning is enabled by @option{-Wall}.
2839
2840 @item -Wunused-label
2841 @opindex Wunused-label
2842 Warn whenever a label is declared but not used.
2843 This warning is enabled by @option{-Wall}.
2844
2845 To suppress this warning use the @samp{unused} attribute
2846 (@pxref{Variable Attributes}).
2847
2848 @item -Wunused-parameter
2849 @opindex Wunused-parameter
2850 Warn whenever a function parameter is unused aside from its declaration.
2851
2852 To suppress this warning use the @samp{unused} attribute
2853 (@pxref{Variable Attributes}).
2854
2855 @item -Wunused-variable
2856 @opindex Wunused-variable
2857 Warn whenever a local variable or non-constant static variable is unused
2858 aside from its declaration.
2859 This warning is enabled by @option{-Wall}.
2860
2861 To suppress this warning use the @samp{unused} attribute
2862 (@pxref{Variable Attributes}).
2863
2864 @item -Wunused-value
2865 @opindex Wunused-value
2866 Warn whenever a statement computes a result that is explicitly not
2867 used. To suppress this warning cast the unused expression to
2868 @samp{void}. This includes an expression-statement or the left-hand
2869 side of a comma expression that contains no side effects. For example,
2870 an expression such as @samp{x[i,j]} will cause a warning, while
2871 @samp{x[(void)i,j]} will not.
2872
2873 This warning is enabled by @option{-Wall}.
2874
2875 @item -Wunused
2876 @opindex Wunused
2877 All the above @option{-Wunused} options combined.
2878
2879 In order to get a warning about an unused function parameter, you must
2880 either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
2881 @samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
2882
2883 @item -Wuninitialized
2884 @opindex Wuninitialized
2885 Warn if an automatic variable is used without first being initialized or
2886 if a variable may be clobbered by a @code{setjmp} call.
2887
2888 These warnings are possible only in optimizing compilation,
2889 because they require data flow information that is computed only
2890 when optimizing.  If you do not specify @option{-O}, you will not get
2891 these warnings. Instead, GCC will issue a warning about @option{-Wuninitialized}
2892 requiring @option{-O}.
2893
2894 If you want to warn about code which uses the uninitialized value of the
2895 variable in its own initializer, use the @option{-Winit-self} option.
2896
2897 These warnings occur for individual uninitialized or clobbered
2898 elements of structure, union or array variables as well as for
2899 variables which are uninitialized or clobbered as a whole.  They do
2900 not occur for variables or elements declared @code{volatile}.  Because
2901 these warnings depend on optimization, the exact variables or elements
2902 for which there are warnings will depend on the precise optimization
2903 options and version of GCC used.
2904
2905 Note that there may be no warning about a variable that is used only
2906 to compute a value that itself is never used, because such
2907 computations may be deleted by data flow analysis before the warnings
2908 are printed.
2909
2910 These warnings are made optional because GCC is not smart
2911 enough to see all the reasons why the code might be correct
2912 despite appearing to have an error.  Here is one example of how
2913 this can happen:
2914
2915 @smallexample
2916 @group
2917 @{
2918   int x;
2919   switch (y)
2920     @{
2921     case 1: x = 1;
2922       break;
2923     case 2: x = 4;
2924       break;
2925     case 3: x = 5;
2926     @}
2927   foo (x);
2928 @}
2929 @end group
2930 @end smallexample
2931
2932 @noindent
2933 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
2934 always initialized, but GCC doesn't know this.  Here is
2935 another common case:
2936
2937 @smallexample
2938 @{
2939   int save_y;
2940   if (change_y) save_y = y, y = new_y;
2941   @dots{}
2942   if (change_y) y = save_y;
2943 @}
2944 @end smallexample
2945
2946 @noindent
2947 This has no bug because @code{save_y} is used only if it is set.
2948
2949 @cindex @code{longjmp} warnings
2950 This option also warns when a non-volatile automatic variable might be
2951 changed by a call to @code{longjmp}.  These warnings as well are possible
2952 only in optimizing compilation.
2953
2954 The compiler sees only the calls to @code{setjmp}.  It cannot know
2955 where @code{longjmp} will be called; in fact, a signal handler could
2956 call it at any point in the code.  As a result, you may get a warning
2957 even when there is in fact no problem because @code{longjmp} cannot
2958 in fact be called at the place which would cause a problem.
2959
2960 Some spurious warnings can be avoided if you declare all the functions
2961 you use that never return as @code{noreturn}.  @xref{Function
2962 Attributes}.
2963
2964 This warning is enabled by @option{-Wall}.
2965
2966 @item -Wunknown-pragmas
2967 @opindex Wunknown-pragmas
2968 @cindex warning for unknown pragmas
2969 @cindex unknown pragmas, warning
2970 @cindex pragmas, warning of unknown
2971 Warn when a #pragma directive is encountered which is not understood by
2972 GCC@.  If this command line option is used, warnings will even be issued
2973 for unknown pragmas in system header files.  This is not the case if
2974 the warnings were only enabled by the @option{-Wall} command line option.
2975
2976 @item -Wno-pragmas
2977 @opindex Wno-pragmas
2978 @opindex Wpragmas
2979 Do not warn about misuses of pragmas, such as incorrect parameters,
2980 invalid syntax, or conflicts between pragmas.  See also
2981 @samp{-Wunknown-pragmas}.
2982
2983 @item -Wstrict-aliasing
2984 @opindex Wstrict-aliasing
2985 This option is only active when @option{-fstrict-aliasing} is active.
2986 It warns about code which might break the strict aliasing rules that the
2987 compiler is using for optimization.  The warning does not catch all
2988 cases, but does attempt to catch the more common pitfalls.  It is
2989 included in @option{-Wall}.
2990
2991 @item -Wstrict-aliasing=2
2992 @opindex Wstrict-aliasing=2
2993 This option is only active when @option{-fstrict-aliasing} is active.
2994 It warns about code which might break the strict aliasing rules that the
2995 compiler is using for optimization.  This warning catches more cases than
2996 @option{-Wstrict-aliasing}, but it will also give a warning for some ambiguous
2997 cases that are safe.
2998
2999 @item -Wstrict-overflow
3000 @item -Wstrict-overflow=@var{n}
3001 @opindex -Wstrict-overflow
3002 This option is only active when @option{-fstrict-overflow} is active.
3003 It warns about cases where the compiler optimizes based on the
3004 assumption that signed overflow does not occur.  Note that it does not
3005 warn about all cases where the code might overflow: it only warns
3006 about cases where the compiler implements some optimization.  Thus
3007 this warning depends on the optimization level.
3008
3009 An optimization which assumes that signed overflow does not occur is
3010 perfectly safe if the values of the variables involved are such that
3011 overflow never does, in fact, occur.  Therefore this warning can
3012 easily give a false positive: a warning about code which is not
3013 actually a problem.  To help focus on important issues, several
3014 warning levels are defined.
3015
3016 @table @option
3017 @item -Wstrict-overflow=1
3018 Warn about cases which are both questionable and easy to avoid.  For
3019 example: @code{x + 1 > x}; with @option{-fstrict-overflow}, the
3020 compiler will simplify this to @code{1}.  @option{-Wstrict-overflow}
3021 (with no level) is the same as @option{-Wstrict-overflow=1}.  This
3022 level of @option{-Wstrict-overflow} is enabled by @option{-Wall};
3023 higher levels are not, and must be explicitly requested.
3024
3025 @item -Wstrict-overflow=2
3026 Also warn about other cases where a comparison is simplified to a
3027 constant.  For example: @code{abs (x) >= 0}.  This can only be
3028 simplified when @option{-fstrict-overflow} is in effect, because
3029 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
3030 zero.
3031
3032 @item -Wstrict-overflow=3
3033 Also warn about other cases where a comparison is simplified.  For
3034 example: @code{x + 1 > 1} will be simplified to @code{x > 0}.
3035
3036 @item -Wstrict-overflow=4
3037 Also warn about other simplifications not covered by the above cases.
3038 For example: @code{(x * 10) / 5} will be simplified to @code{x * 2}.
3039
3040 @item -Wstrict-overflow=5
3041 Also warn about cases where the compiler reduces the magnitude of a
3042 constant involved in a comparison.  For example: @code{x + 2 > y} will
3043 be simplified to @code{x + 1 >= y}.  This is reported only at the
3044 highest warning level because this simplification applies to many
3045 comparisons, so this warning level will give a very large number of
3046 false positives.
3047 @end table
3048
3049 @item -Warray-bounds
3050 @opindex Wno-array-bounds
3051 @opindex Warray-bounds
3052 This option is only active when @option{-ftree-vrp} is active
3053 (default for -O2 and above). It warns about subscripts to arrays
3054 that are always out of bounds. This warning is enabled by @option{-Wall}.
3055
3056 @item -Wall
3057 @opindex Wall
3058 All of the above @samp{-W} options combined.  This enables all the
3059 warnings about constructions that some users consider questionable, and
3060 that are easy to avoid (or modify to prevent the warning), even in
3061 conjunction with macros.  This also enables some language-specific
3062 warnings described in @ref{C++ Dialect Options} and
3063 @ref{Objective-C and Objective-C++ Dialect Options}.
3064 @end table
3065
3066 The following @option{-W@dots{}} options are not implied by @option{-Wall}.
3067 Some of them warn about constructions that users generally do not
3068 consider questionable, but which occasionally you might wish to check
3069 for; others warn about constructions that are necessary or hard to avoid
3070 in some cases, and there is no simple way to modify the code to suppress
3071 the warning.
3072
3073 @table @gcctabopt
3074 @item -Wextra
3075 @opindex W
3076 @opindex Wextra
3077 (This option used to be called @option{-W}.  The older name is still
3078 supported, but the newer name is more descriptive.)  Print extra warning
3079 messages for these events:
3080
3081 @itemize @bullet
3082 @item
3083 A function can return either with or without a value.  (Falling
3084 off the end of the function body is considered returning without
3085 a value.)  For example, this function would evoke such a
3086 warning:
3087
3088 @smallexample
3089 @group
3090 foo (a)
3091 @{
3092   if (a > 0)
3093     return a;
3094 @}
3095 @end group
3096 @end smallexample
3097
3098 @item
3099 An unsigned value is compared against zero with @samp{<} or @samp{>=}.
3100
3101 @item @r{(C only)}
3102 Storage-class specifiers like @code{static} are not the first things
3103 in a declaration.  According to the C Standard, this usage is
3104 obsolescent.  This warning can be independently controlled by
3105 @option{-Wold-style-declaration}.
3106
3107 @item
3108 If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
3109 arguments.
3110
3111 @item
3112 A comparison between signed and unsigned values could produce an
3113 incorrect result when the signed value is converted to unsigned.
3114 (But don't warn if @option{-Wno-sign-compare} is also specified.)
3115
3116 @item
3117 An aggregate has an initializer which does not initialize all members.
3118 This warning can be independently controlled by
3119 @option{-Wmissing-field-initializers}.
3120
3121 @item
3122 An initialized field without side effects is overridden when using
3123 designated initializers (@pxref{Designated Inits, , Designated
3124 Initializers}).  This warning can be independently controlled by
3125 @option{-Woverride-init}.
3126
3127 @item @r{(C only)}
3128 A function parameter is declared without a type specifier in K&R-style
3129 functions.  This warning can be independently controlled by
3130 @option{-Wmissing-parameter-type}.
3131
3132 @item
3133 An empty body occurs in an @samp{if} or @samp{else} statement. This
3134 warning can be independently controlled by @option{-Wempty-body}.
3135
3136 @item
3137 A pointer is compared against integer zero with @samp{<}, @samp{<=},
3138 @samp{>}, or @samp{>=}.
3139
3140 @item
3141 A variable might be changed by @samp{longjmp} or @samp{vfork}.
3142 This warning can be independently controlled by @option{-Wclobbered}.
3143
3144 @item @r{(C++ only)}
3145 An enumerator and a non-enumerator both appear in a conditional expression.
3146
3147 @item @r{(C++ only)}
3148 A non-static reference or non-static @samp{const} member appears in a
3149 class without constructors.
3150
3151 @item @r{(C++ only)}
3152 Ambiguous virtual bases.
3153
3154 @item @r{(C++ only)}
3155 Subscripting an array which has been declared @samp{register}.
3156
3157 @item @r{(C++ only)}
3158 Taking the address of a variable which has been declared @samp{register}.
3159
3160 @item @r{(C++ only)}
3161 A base class is not initialized in a derived class' copy constructor.
3162 @end itemize
3163
3164 @item -Wno-div-by-zero
3165 @opindex Wno-div-by-zero
3166 @opindex Wdiv-by-zero
3167 Do not warn about compile-time integer division by zero.  Floating point
3168 division by zero is not warned about, as it can be a legitimate way of
3169 obtaining infinities and NaNs.
3170
3171 @item -Wsystem-headers
3172 @opindex Wsystem-headers
3173 @cindex warnings from system headers
3174 @cindex system headers, warnings from
3175 Print warning messages for constructs found in system header files.
3176 Warnings from system headers are normally suppressed, on the assumption
3177 that they usually do not indicate real problems and would only make the
3178 compiler output harder to read.  Using this command line option tells
3179 GCC to emit warnings from system headers as if they occurred in user
3180 code.  However, note that using @option{-Wall} in conjunction with this
3181 option will @emph{not} warn about unknown pragmas in system
3182 headers---for that, @option{-Wunknown-pragmas} must also be used.
3183
3184 @item -Wfloat-equal
3185 @opindex Wfloat-equal
3186 Warn if floating point values are used in equality comparisons.
3187
3188 The idea behind this is that sometimes it is convenient (for the
3189 programmer) to consider floating-point values as approximations to
3190 infinitely precise real numbers.  If you are doing this, then you need
3191 to compute (by analyzing the code, or in some other way) the maximum or
3192 likely maximum error that the computation introduces, and allow for it
3193 when performing comparisons (and when producing output, but that's a
3194 different problem).  In particular, instead of testing for equality, you
3195 would check to see whether the two values have ranges that overlap; and
3196 this is done with the relational operators, so equality comparisons are
3197 probably mistaken.
3198
3199 @item -Wtraditional @r{(C only)}
3200 @opindex Wtraditional
3201 Warn about certain constructs that behave differently in traditional and
3202 ISO C@.  Also warn about ISO C constructs that have no traditional C
3203 equivalent, and/or problematic constructs which should be avoided.
3204
3205 @itemize @bullet
3206 @item
3207 Macro parameters that appear within string literals in the macro body.
3208 In traditional C macro replacement takes place within string literals,
3209 but does not in ISO C@.
3210
3211 @item
3212 In traditional C, some preprocessor directives did not exist.
3213 Traditional preprocessors would only consider a line to be a directive
3214 if the @samp{#} appeared in column 1 on the line.  Therefore
3215 @option{-Wtraditional} warns about directives that traditional C
3216 understands but would ignore because the @samp{#} does not appear as the
3217 first character on the line.  It also suggests you hide directives like
3218 @samp{#pragma} not understood by traditional C by indenting them.  Some
3219 traditional implementations would not recognize @samp{#elif}, so it
3220 suggests avoiding it altogether.
3221
3222 @item
3223 A function-like macro that appears without arguments.
3224
3225 @item
3226 The unary plus operator.
3227
3228 @item
3229 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
3230 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
3231 constants.)  Note, these suffixes appear in macros defined in the system
3232 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
3233 Use of these macros in user code might normally lead to spurious
3234 warnings, however GCC's integrated preprocessor has enough context to
3235 avoid warning in these cases.
3236
3237 @item
3238 A function declared external in one block and then used after the end of
3239 the block.
3240
3241 @item
3242 A @code{switch} statement has an operand of type @code{long}.
3243
3244 @item
3245 A non-@code{static} function declaration follows a @code{static} one.
3246 This construct is not accepted by some traditional C compilers.
3247
3248 @item
3249 The ISO type of an integer constant has a different width or
3250 signedness from its traditional type.  This warning is only issued if
3251 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
3252 typically represent bit patterns, are not warned about.
3253
3254 @item
3255 Usage of ISO string concatenation is detected.
3256
3257 @item
3258 Initialization of automatic aggregates.
3259
3260 @item
3261 Identifier conflicts with labels.  Traditional C lacks a separate
3262 namespace for labels.
3263
3264 @item
3265 Initialization of unions.  If the initializer is zero, the warning is
3266 omitted.  This is done under the assumption that the zero initializer in
3267 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
3268 initializer warnings and relies on default initialization to zero in the
3269 traditional C case.
3270
3271 @item
3272 Conversions by prototypes between fixed/floating point values and vice
3273 versa.  The absence of these prototypes when compiling with traditional
3274 C would cause serious problems.  This is a subset of the possible
3275 conversion warnings, for the full set use @option{-Wtraditional-conversion}.
3276
3277 @item
3278 Use of ISO C style function definitions.  This warning intentionally is
3279 @emph{not} issued for prototype declarations or variadic functions
3280 because these ISO C features will appear in your code when using
3281 libiberty's traditional C compatibility macros, @code{PARAMS} and
3282 @code{VPARAMS}.  This warning is also bypassed for nested functions
3283 because that feature is already a GCC extension and thus not relevant to
3284 traditional C compatibility.
3285 @end itemize
3286
3287 @item -Wtraditional-conversion @r{(C only)}
3288 @opindex Wtraditional-conversion
3289 Warn if a prototype causes a type conversion that is different from what
3290 would happen to the same argument in the absence of a prototype.  This
3291 includes conversions of fixed point to floating and vice versa, and
3292 conversions changing the width or signedness of a fixed point argument
3293 except when the same as the default promotion.
3294
3295 @item -Wdeclaration-after-statement @r{(C only)}
3296 @opindex Wdeclaration-after-statement
3297 Warn when a declaration is found after a statement in a block.  This
3298 construct, known from C++, was introduced with ISO C99 and is by default
3299 allowed in GCC@.  It is not supported by ISO C90 and was not supported by
3300 GCC versions before GCC 3.0.  @xref{Mixed Declarations}.
3301
3302 @item -Wundef
3303 @opindex Wundef
3304 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
3305
3306 @item -Wno-endif-labels
3307 @opindex Wno-endif-labels
3308 @opindex Wendif-labels
3309 Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
3310
3311 @item -Wshadow
3312 @opindex Wshadow
3313 Warn whenever a local variable shadows another local variable, parameter or
3314 global variable or whenever a built-in function is shadowed.
3315
3316 @item -Wlarger-than-@var{len}
3317 @opindex Wlarger-than
3318 Warn whenever an object of larger than @var{len} bytes is defined.
3319
3320 @item -Wunsafe-loop-optimizations
3321 @opindex Wunsafe-loop-optimizations
3322 Warn if the loop cannot be optimized because the compiler could not
3323 assume anything on the bounds of the loop indices.  With
3324 @option{-funsafe-loop-optimizations} warn if the compiler made
3325 such assumptions.
3326
3327 @item -Wpointer-arith
3328 @opindex Wpointer-arith
3329 Warn about anything that depends on the ``size of'' a function type or
3330 of @code{void}.  GNU C assigns these types a size of 1, for
3331 convenience in calculations with @code{void *} pointers and pointers
3332 to functions.  In C++, warn also when an arithmetic operation involves
3333 @code{NULL}.  This warning is also enabled by @option{-pedantic}.
3334
3335 @item -Wbad-function-cast @r{(C only)}
3336 @opindex Wbad-function-cast
3337 Warn whenever a function call is cast to a non-matching type.
3338 For example, warn if @code{int malloc()} is cast to @code{anything *}.
3339
3340 @item -Wc++-compat
3341 Warn about ISO C constructs that are outside of the common subset of
3342 ISO C and ISO C++, e.g.@: request for implicit conversion from
3343 @code{void *} to a pointer to non-@code{void} type.
3344
3345 @item -Wc++0x-compat @r{(C++ and Objective-C++ only)}
3346 Warn about C++ constructs whose meaning differs between ISO C++ 1998 and
3347 ISO C++ 200x, e.g., identifiers in ISO C++ 1998 that will become keywords 
3348 in ISO C++ 200x.  This warning is enabled by @option{-Wall}.
3349
3350 @item -Wcast-qual
3351 @opindex Wcast-qual
3352 Warn whenever a pointer is cast so as to remove a type qualifier from
3353 the target type.  For example, warn if a @code{const char *} is cast
3354 to an ordinary @code{char *}.
3355
3356 @item -Wcast-align
3357 @opindex Wcast-align
3358 Warn whenever a pointer is cast such that the required alignment of the
3359 target is increased.  For example, warn if a @code{char *} is cast to
3360 an @code{int *} on machines where integers can only be accessed at
3361 two- or four-byte boundaries.
3362
3363 @item -Wwrite-strings
3364 @opindex Wwrite-strings
3365 When compiling C, give string constants the type @code{const
3366 char[@var{length}]} so that
3367 copying the address of one into a non-@code{const} @code{char *}
3368 pointer will get a warning; when compiling C++, warn about the
3369 deprecated conversion from string literals to @code{char *}.  This
3370 warning, by default, is enabled for C++ programs.
3371 These warnings will help you find at
3372 compile time code that can try to write into a string constant, but
3373 only if you have been very careful about using @code{const} in
3374 declarations and prototypes.  Otherwise, it will just be a nuisance;
3375 this is why we did not make @option{-Wall} request these warnings.
3376
3377 @item -Wclobbered
3378 @opindex Wclobbered
3379 Warn for variables that might be changed by @samp{longjmp} or
3380 @samp{vfork}.  This warning is also enabled by @option{-Wextra}.
3381
3382 @item -Wconversion
3383 @opindex Wconversion
3384 Warn for implicit conversions that may alter a value. This includes
3385 conversions between real and integer, like @code{abs (x)} when
3386 @code{x} is @code{double}; conversions between signed and unsigned,
3387 like @code{unsigned ui = -1}; and conversions to smaller types, like
3388 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
3389 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
3390 changed by the conversion like in @code{abs (2.0)}.
3391
3392 @item -Wempty-body
3393 @opindex Wempty-body
3394 An empty body occurs in an @samp{if} or @samp{else} statement. 
3395 This warning is also enabled by @option{-Wextra}.
3396
3397 @item -Wsign-compare
3398 @opindex Wsign-compare
3399 @cindex warning for comparison of signed and unsigned values
3400 @cindex comparison of signed and unsigned values, warning
3401 @cindex signed and unsigned values, comparison warning
3402 Warn when a comparison between signed and unsigned values could produce
3403 an incorrect result when the signed value is converted to unsigned.
3404 This warning is also enabled by @option{-Wextra}; to get the other warnings
3405 of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
3406
3407 @item -Waddress
3408 @opindex Waddress
3409 @opindex Wno-address
3410 Warn about suspicious uses of memory addresses. These include using
3411 the address of a function in a conditional expression, such as
3412 @code{void func(void); if (func)}, and comparisons against the memory
3413 address of a string literal, such as @code{if (x == "abc")}.  Such
3414 uses typically indicate a programmer error: the address of a function
3415 always evaluates to true, so their use in a conditional usually
3416 indicate that the programmer forgot the parentheses in a function
3417 call; and comparisons against string literals result in unspecified
3418 behavior and are not portable in C, so they usually indicate that the
3419 programmer intended to use @code{strcmp}.  This warning is enabled by
3420 @option{-Wall}.
3421
3422 @item -Waggregate-return
3423 @opindex Waggregate-return
3424 Warn if any functions that return structures or unions are defined or
3425 called.  (In languages where you can return an array, this also elicits
3426 a warning.)
3427
3428 @item -Wno-attributes
3429 @opindex Wno-attributes
3430 @opindex Wattributes
3431 Do not warn if an unexpected @code{__attribute__} is used, such as
3432 unrecognized attributes, function attributes applied to variables,
3433 etc.  This will not stop errors for incorrect use of supported
3434 attributes.
3435
3436 @item -Wstrict-prototypes @r{(C only)}
3437 @opindex Wstrict-prototypes
3438 Warn if a function is declared or defined without specifying the
3439 argument types.  (An old-style function definition is permitted without
3440 a warning if preceded by a declaration which specifies the argument
3441 types.)
3442
3443 @item -Wold-style-declaration @r{(C only)}
3444 @opindex Wold-style-declaration
3445 Warn for obsolescent usages, according to the C Standard, in a
3446 declaration. For example, warn if storage-class specifiers like
3447 @code{static} are not the first things in a declaration.  This warning
3448 is also enabled by @option{-Wextra}.
3449
3450 @item -Wold-style-definition @r{(C only)}
3451 @opindex Wold-style-definition
3452 Warn if an old-style function definition is used.  A warning is given
3453 even if there is a previous prototype.
3454
3455 @item -Wmissing-parameter-type @r{(C only)}
3456 @opindex Wmissing-parameter-type
3457 A function parameter is declared without a type specifier in K&R-style
3458 functions:
3459
3460 @smallexample
3461 void foo(bar) @{ @}
3462 @end smallexample
3463
3464 This warning is also enabled by @option{-Wextra}.
3465
3466 @item -Wmissing-prototypes @r{(C only)}
3467 @opindex Wmissing-prototypes
3468 Warn if a global function is defined without a previous prototype
3469 declaration.  This warning is issued even if the definition itself
3470 provides a prototype.  The aim is to detect global functions that fail
3471 to be declared in header files.
3472
3473 @item -Wmissing-declarations @r{(C and C++ only)}
3474 @opindex Wmissing-declarations
3475 Warn if a global function is defined without a previous declaration.
3476 Do so even if the definition itself provides a prototype.
3477 Use this option to detect global functions that are not declared in
3478 header files.  In C++, no warnings are issued for function templates,
3479 or for inline functions, or for functions in anonymous namespaces.
3480
3481 @item -Wmissing-field-initializers
3482 @opindex Wmissing-field-initializers
3483 @opindex W
3484 @opindex Wextra
3485 Warn if a structure's initializer has some fields missing.  For
3486 example, the following code would cause such a warning, because
3487 @code{x.h} is implicitly zero:
3488
3489 @smallexample
3490 struct s @{ int f, g, h; @};
3491 struct s x = @{ 3, 4 @};
3492 @end smallexample
3493
3494 This option does not warn about designated initializers, so the following
3495 modification would not trigger a warning:
3496
3497 @smallexample
3498 struct s @{ int f, g, h; @};
3499 struct s x = @{ .f = 3, .g = 4 @};
3500 @end smallexample
3501
3502 This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
3503 warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}.
3504
3505 @item -Wmissing-noreturn
3506 @opindex Wmissing-noreturn
3507 Warn about functions which might be candidates for attribute @code{noreturn}.
3508 Note these are only possible candidates, not absolute ones.  Care should
3509 be taken to manually verify functions actually do not ever return before
3510 adding the @code{noreturn} attribute, otherwise subtle code generation
3511 bugs could be introduced.  You will not get a warning for @code{main} in
3512 hosted C environments.
3513
3514 @item -Wmissing-format-attribute
3515 @opindex Wmissing-format-attribute
3516 @opindex Wformat
3517 Warn about function pointers which might be candidates for @code{format}
3518 attributes.  Note these are only possible candidates, not absolute ones.
3519 GCC will guess that function pointers with @code{format} attributes that
3520 are used in assignment, initialization, parameter passing or return
3521 statements should have a corresponding @code{format} attribute in the
3522 resulting type.  I.e.@: the left-hand side of the assignment or
3523 initialization, the type of the parameter variable, or the return type
3524 of the containing function respectively should also have a @code{format}
3525 attribute to avoid the warning.
3526
3527 GCC will also warn about function definitions which might be
3528 candidates for @code{format} attributes.  Again, these are only
3529 possible candidates.  GCC will guess that @code{format} attributes
3530 might be appropriate for any function that calls a function like
3531 @code{vprintf} or @code{vscanf}, but this might not always be the
3532 case, and some functions for which @code{format} attributes are
3533 appropriate may not be detected.
3534
3535 @item -Wno-multichar
3536 @opindex Wno-multichar
3537 @opindex Wmultichar
3538 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
3539 Usually they indicate a typo in the user's code, as they have
3540 implementation-defined values, and should not be used in portable code.
3541
3542 @item -Wnormalized=<none|id|nfc|nfkc>
3543 @opindex Wnormalized
3544 @cindex NFC
3545 @cindex NFKC
3546 @cindex character set, input normalization
3547 In ISO C and ISO C++, two identifiers are different if they are
3548 different sequences of characters.  However, sometimes when characters
3549 outside the basic ASCII character set are used, you can have two
3550 different character sequences that look the same.  To avoid confusion,
3551 the ISO 10646 standard sets out some @dfn{normalization rules} which
3552 when applied ensure that two sequences that look the same are turned into
3553 the same sequence.  GCC can warn you if you are using identifiers which
3554 have not been normalized; this option controls that warning.
3555
3556 There are four levels of warning that GCC supports.  The default is
3557 @option{-Wnormalized=nfc}, which warns about any identifier which is
3558 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
3559 recommended form for most uses.
3560
3561 Unfortunately, there are some characters which ISO C and ISO C++ allow
3562 in identifiers that when turned into NFC aren't allowable as
3563 identifiers.  That is, there's no way to use these symbols in portable
3564 ISO C or C++ and have all your identifiers in NFC.
3565 @option{-Wnormalized=id} suppresses the warning for these characters.
3566 It is hoped that future versions of the standards involved will correct
3567 this, which is why this option is not the default.
3568
3569 You can switch the warning off for all characters by writing
3570 @option{-Wnormalized=none}.  You would only want to do this if you
3571 were using some other normalization scheme (like ``D''), because
3572 otherwise you can easily create bugs that are literally impossible to see.
3573
3574 Some characters in ISO 10646 have distinct meanings but look identical
3575 in some fonts or display methodologies, especially once formatting has
3576 been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
3577 LETTER N'', will display just like a regular @code{n} which has been
3578 placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
3579 normalization scheme to convert all these into a standard form as
3580 well, and GCC will warn if your code is not in NFKC if you use
3581 @option{-Wnormalized=nfkc}.  This warning is comparable to warning
3582 about every identifier that contains the letter O because it might be
3583 confused with the digit 0, and so is not the default, but may be
3584 useful as a local coding convention if the programming environment is
3585 unable to be fixed to display these characters distinctly.
3586
3587 @item -Wno-deprecated-declarations
3588 @opindex Wno-deprecated-declarations
3589 Do not warn about uses of functions (@pxref{Function Attributes}),
3590 variables (@pxref{Variable Attributes}), and types (@pxref{Type
3591 Attributes}) marked as deprecated by using the @code{deprecated}
3592 attribute.
3593
3594 @item -Wno-overflow
3595 @opindex Wno-overflow
3596 Do not warn about compile-time overflow in constant expressions.
3597
3598 @item -Woverride-init
3599 @opindex Woverride-init
3600 @opindex W
3601 @opindex Wextra
3602 Warn if an initialized field without side effects is overridden when
3603 using designated initializers (@pxref{Designated Inits, , Designated
3604 Initializers}).
3605
3606 This warning is included in @option{-Wextra}.  To get other
3607 @option{-Wextra} warnings without this one, use @samp{-Wextra
3608 -Wno-override-init}.
3609
3610 @item -Wpacked
3611 @opindex Wpacked
3612 Warn if a structure is given the packed attribute, but the packed
3613 attribute has no effect on the layout or size of the structure.
3614 Such structures may be mis-aligned for little benefit.  For
3615 instance, in this code, the variable @code{f.x} in @code{struct bar}
3616 will be misaligned even though @code{struct bar} does not itself
3617 have the packed attribute:
3618
3619 @smallexample
3620 @group
3621 struct foo @{
3622   int x;
3623   char a, b, c, d;
3624 @} __attribute__((packed));
3625 struct bar @{
3626   char z;
3627   struct foo f;
3628 @};
3629 @end group
3630 @end smallexample
3631
3632 @item -Wpadded
3633 @opindex Wpadded
3634 Warn if padding is included in a structure, either to align an element
3635 of the structure or to align the whole structure.  Sometimes when this
3636 happens it is possible to rearrange the fields of the structure to
3637 reduce the padding and so make the structure smaller.
3638
3639 @item -Wredundant-decls
3640 @opindex Wredundant-decls
3641 Warn if anything is declared more than once in the same scope, even in
3642 cases where multiple declaration is valid and changes nothing.
3643
3644 @item -Wnested-externs @r{(C only)}
3645 @opindex Wnested-externs
3646 Warn if an @code{extern} declaration is encountered within a function.
3647
3648 @item -Wunreachable-code
3649 @opindex Wunreachable-code
3650 Warn if the compiler detects that code will never be executed.
3651
3652 This option is intended to warn when the compiler detects that at
3653 least a whole line of source code will never be executed, because
3654 some condition is never satisfied or because it is after a
3655 procedure that never returns.
3656
3657 It is possible for this option to produce a warning even though there
3658 are circumstances under which part of the affected line can be executed,
3659 so care should be taken when removing apparently-unreachable code.
3660
3661 For instance, when a function is inlined, a warning may mean that the
3662 line is unreachable in only one inlined copy of the function.
3663
3664 This option is not made part of @option{-Wall} because in a debugging
3665 version of a program there is often substantial code which checks
3666 correct functioning of the program and is, hopefully, unreachable
3667 because the program does work.  Another common use of unreachable
3668 code is to provide behavior which is selectable at compile-time.
3669
3670 @item -Winline
3671 @opindex Winline
3672 Warn if a function can not be inlined and it was declared as inline.
3673 Even with this option, the compiler will not warn about failures to
3674 inline functions declared in system headers.
3675
3676 The compiler uses a variety of heuristics to determine whether or not
3677 to inline a function.  For example, the compiler takes into account
3678 the size of the function being inlined and the amount of inlining
3679 that has already been done in the current function.  Therefore,
3680 seemingly insignificant changes in the source program can cause the
3681 warnings produced by @option{-Winline} to appear or disappear.
3682
3683 @item -Wno-invalid-offsetof @r{(C++ only)}
3684 @opindex Wno-invalid-offsetof
3685 Suppress warnings from applying the @samp{offsetof} macro to a non-POD
3686 type.  According to the 1998 ISO C++ standard, applying @samp{offsetof}
3687 to a non-POD type is undefined.  In existing C++ implementations,
3688 however, @samp{offsetof} typically gives meaningful results even when
3689 applied to certain kinds of non-POD types. (Such as a simple
3690 @samp{struct} that fails to be a POD type only by virtue of having a
3691 constructor.)  This flag is for users who are aware that they are
3692 writing nonportable code and who have deliberately chosen to ignore the
3693 warning about it.
3694
3695 The restrictions on @samp{offsetof} may be relaxed in a future version
3696 of the C++ standard.
3697
3698 @item -Wno-int-to-pointer-cast @r{(C only)}
3699 @opindex Wno-int-to-pointer-cast
3700 Suppress warnings from casts to pointer type of an integer of a
3701 different size.
3702
3703 @item -Wno-pointer-to-int-cast @r{(C only)}
3704 @opindex Wno-pointer-to-int-cast
3705 Suppress warnings from casts from a pointer to an integer type of a
3706 different size.
3707
3708 @item -Winvalid-pch
3709 @opindex Winvalid-pch
3710 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
3711 the search path but can't be used.
3712
3713 @item -Wlong-long
3714 @opindex Wlong-long
3715 @opindex Wno-long-long
3716 Warn if @samp{long long} type is used.  This is default.  To inhibit
3717 the warning messages, use @option{-Wno-long-long}.  Flags
3718 @option{-Wlong-long} and @option{-Wno-long-long} are taken into account
3719 only when @option{-pedantic} flag is used.
3720
3721 @item -Wvariadic-macros
3722 @opindex Wvariadic-macros
3723 @opindex Wno-variadic-macros
3724 Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
3725 alternate syntax when in pedantic ISO C99 mode.  This is default.
3726 To inhibit the warning messages, use @option{-Wno-variadic-macros}.
3727
3728 @item -Wvolatile-register-var
3729 @opindex Wvolatile-register-var
3730 @opindex Wno-volatile-register-var
3731 Warn if a register variable is declared volatile.  The volatile
3732 modifier does not inhibit all optimizations that may eliminate reads
3733 and/or writes to register variables.
3734
3735 @item -Wdisabled-optimization
3736 @opindex Wdisabled-optimization
3737 Warn if a requested optimization pass is disabled.  This warning does
3738 not generally indicate that there is anything wrong with your code; it
3739 merely indicates that GCC's optimizers were unable to handle the code
3740 effectively.  Often, the problem is that your code is too big or too
3741 complex; GCC will refuse to optimize programs when the optimization
3742 itself is likely to take inordinate amounts of time.
3743
3744 @item -Wpointer-sign
3745 @opindex Wpointer-sign
3746 @opindex Wno-pointer-sign
3747 Warn for pointer argument passing or assignment with different signedness.
3748 This option is only supported for C and Objective-C@.  It is implied by
3749 @option{-Wall} and by @option{-pedantic}, which can be disabled with
3750 @option{-Wno-pointer-sign}.
3751
3752 @item -Werror
3753 @opindex Werror
3754 Make all warnings into errors.
3755
3756 @item -Werror=
3757 @opindex Werror=
3758 Make the specified warning into an errors.  The specifier for a
3759 warning is appended, for example @option{-Werror=switch} turns the
3760 warnings controlled by @option{-Wswitch} into errors.  This switch
3761 takes a negative form, to be used to negate @option{-Werror} for
3762 specific warnings, for example @option{-Wno-error=switch} makes
3763 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3764 is in effect.  You can use the @option{-fdiagnostics-show-option}
3765 option to have each controllable warning amended with the option which
3766 controls it, to determine what to use with this option.
3767
3768 Note that specifying @option{-Werror=}@var{foo} automatically implies
3769 @option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
3770 imply anything.
3771
3772 @item -Wstack-protector
3773 @opindex Wstack-protector
3774 This option is only active when @option{-fstack-protector} is active.  It
3775 warns about functions that will not be protected against stack smashing.
3776
3777 @item -Woverlength-strings
3778 @opindex Woverlength-strings
3779 Warn about string constants which are longer than the ``minimum
3780 maximum'' length specified in the C standard.  Modern compilers
3781 generally allow string constants which are much longer than the
3782 standard's minimum limit, but very portable programs should avoid
3783 using longer strings.
3784
3785 The limit applies @emph{after} string constant concatenation, and does
3786 not count the trailing NUL@.  In C89, the limit was 509 characters; in
3787 C99, it was raised to 4095.  C++98 does not specify a normative
3788 minimum maximum, so we do not diagnose overlength strings in C++@.
3789
3790 This option is implied by @option{-pedantic}, and can be disabled with
3791 @option{-Wno-overlength-strings}.
3792 @end table
3793
3794 @node Debugging Options
3795 @section Options for Debugging Your Program or GCC
3796 @cindex options, debugging
3797 @cindex debugging information options
3798
3799 GCC has various special options that are used for debugging
3800 either your program or GCC:
3801
3802 @table @gcctabopt
3803 @item -g
3804 @opindex g
3805 Produce debugging information in the operating system's native format
3806 (stabs, COFF, XCOFF, or DWARF 2)@.  GDB can work with this debugging
3807 information.
3808
3809 On most systems that use stabs format, @option{-g} enables use of extra
3810 debugging information that only GDB can use; this extra information
3811 makes debugging work better in GDB but will probably make other debuggers
3812 crash or
3813 refuse to read the program.  If you want to control for certain whether
3814 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
3815 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
3816
3817 GCC allows you to use @option{-g} with
3818 @option{-O}.  The shortcuts taken by optimized code may occasionally
3819 produce surprising results: some variables you declared may not exist
3820 at all; flow of control may briefly move where you did not expect it;
3821 some statements may not be executed because they compute constant
3822 results or their values were already at hand; some statements may
3823 execute in different places because they were moved out of loops.
3824
3825 Nevertheless it proves possible to debug optimized output.  This makes
3826 it reasonable to use the optimizer for programs that might have bugs.
3827
3828 The following options are useful when GCC is generated with the
3829 capability for more than one debugging format.
3830
3831 @item -ggdb
3832 @opindex ggdb
3833 Produce debugging information for use by GDB@.  This means to use the
3834 most expressive format available (DWARF 2, stabs, or the native format
3835 if neither of those are supported), including GDB extensions if at all
3836 possible.
3837
3838 @item -gstabs
3839 @opindex gstabs
3840 Produce debugging information in stabs format (if that is supported),
3841 without GDB extensions.  This is the format used by DBX on most BSD
3842 systems.  On MIPS, Alpha and System V Release 4 systems this option
3843 produces stabs debugging output which is not understood by DBX or SDB@.
3844 On System V Release 4 systems this option requires the GNU assembler.
3845
3846 @item -feliminate-unused-debug-symbols
3847 @opindex feliminate-unused-debug-symbols
3848 Produce debugging information in stabs format (if that is supported),
3849 for only symbols that are actually used.
3850
3851 @item -femit-class-debug-always
3852 Instead of emitting debugging information for a C++ class in only one
3853 object file, emit it in all object files using the class.  This option
3854 should be used only with debuggers that are unable to handle the way GCC
3855 normally emits debugging information for classes because using this
3856 option will increase the size of debugging information by as much as a
3857 factor of two.
3858
3859 @item -gstabs+
3860 @opindex gstabs+
3861 Produce debugging information in stabs format (if that is supported),
3862 using GNU extensions understood only by the GNU debugger (GDB)@.  The
3863 use of these extensions is likely to make other debuggers crash or
3864 refuse to read the program.
3865
3866 @item -gcoff
3867 @opindex gcoff
3868 Produce debugging information in COFF format (if that is supported).
3869 This is the format used by SDB on most System V systems prior to
3870 System V Release 4.
3871
3872 @item -gxcoff
3873 @opindex gxcoff
3874 Produce debugging information in XCOFF format (if that is supported).
3875 This is the format used by the DBX debugger on IBM RS/6000 systems.
3876
3877 @item -gxcoff+
3878 @opindex gxcoff+
3879 Produce debugging information in XCOFF format (if that is supported),
3880 using GNU extensions understood only by the GNU debugger (GDB)@.  The
3881 use of these extensions is likely to make other debuggers crash or
3882 refuse to read the program, and may cause assemblers other than the GNU
3883 assembler (GAS) to fail with an error.
3884
3885 @item -gdwarf-2
3886 @opindex gdwarf-2
3887 Produce debugging information in DWARF version 2 format (if that is
3888 supported).  This is the format used by DBX on IRIX 6.  With this
3889 option, GCC uses features of DWARF version 3 when they are useful;
3890 version 3 is upward compatible with version 2, but may still cause
3891 problems for older debuggers.
3892
3893 @item -gvms
3894 @opindex gvms
3895 Produce debugging information in VMS debug format (if that is
3896 supported).  This is the format used by DEBUG on VMS systems.
3897
3898 @item -g@var{level}
3899 @itemx -ggdb@var{level}
3900 @itemx -gstabs@var{level}
3901 @itemx -gcoff@var{level}
3902 @itemx -gxcoff@var{level}
3903 @itemx -gvms@var{level}
3904 Request debugging information and also use @var{level} to specify how
3905 much information.  The default level is 2.
3906
3907 Level 0 produces no debug information at all.  Thus, @option{-g0} negates
3908 @option{-g}.
3909
3910 Level 1 produces minimal information, enough for making backtraces in
3911 parts of the program that you don't plan to debug.  This includes
3912 descriptions of functions and external variables, but no information
3913 about local variables and no line numbers.
3914
3915 Level 3 includes extra information, such as all the macro definitions
3916 present in the program.  Some debuggers support macro expansion when
3917 you use @option{-g3}.
3918
3919 @option{-gdwarf-2} does not accept a concatenated debug level, because
3920 GCC used to support an option @option{-gdwarf} that meant to generate
3921 debug information in version 1 of the DWARF format (which is very
3922 different from version 2), and it would have been too confusing.  That
3923 debug format is long obsolete, but the option cannot be changed now.
3924 Instead use an additional @option{-g@var{level}} option to change the
3925 debug level for DWARF2.
3926
3927 @item -feliminate-dwarf2-dups
3928 @opindex feliminate-dwarf2-dups
3929 Compress DWARF2 debugging information by eliminating duplicated
3930 information about each symbol.  This option only makes sense when
3931 generating DWARF2 debugging information with @option{-gdwarf-2}.
3932
3933 @cindex @command{prof}
3934 @item -p
3935 @opindex p
3936 Generate extra code to write profile information suitable for the
3937 analysis program @command{prof}.  You must use this option when compiling
3938 the source files you want data about, and you must also use it when
3939 linking.
3940
3941 @cindex @command{gprof}
3942 @item -pg
3943 @opindex pg
3944 Generate extra code to write profile information suitable for the
3945 analysis program @command{gprof}.  You must use this option when compiling
3946 the source files you want data about, and you must also use it when
3947 linking.
3948
3949 @item -Q
3950 @opindex Q
3951 Makes the compiler print out each function name as it is compiled, and
3952 print some statistics about each pass when it finishes.
3953
3954 @item -ftime-report
3955 @opindex ftime-report
3956 Makes the compiler print some statistics about the time consumed by each
3957 pass when it finishes.
3958
3959 @item -fmem-report
3960 @opindex fmem-report
3961 Makes the compiler print some statistics about permanent memory
3962 allocation when it finishes.
3963
3964 @item -fpre-ipa-mem-report
3965 @opindex fpre-ipa-mem-report
3966 @item -fpost-ipa-mem-report
3967 @opindex fpost-ipa-mem-report
3968 Makes the compiler print some statistics about permanent memory
3969 allocation before or after interprocedural optimization.
3970
3971 @item -fprofile-arcs
3972 @opindex fprofile-arcs
3973 Add code so that program flow @dfn{arcs} are instrumented.  During
3974 execution the program records how many times each branch and call is
3975 executed and how many times it is taken or returns.  When the compiled
3976 program exits it saves this data to a file called
3977 @file{@var{auxname}.gcda} for each source file.  The data may be used for
3978 profile-directed optimizations (@option{-fbranch-probabilities}), or for
3979 test coverage analysis (@option{-ftest-coverage}).  Each object file's
3980 @var{auxname} is generated from the name of the output file, if
3981 explicitly specified and it is not the final executable, otherwise it is
3982 the basename of the source file.  In both cases any suffix is removed
3983 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
3984 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
3985 @xref{Cross-profiling}.
3986
3987 @cindex @command{gcov}
3988 @item --coverage
3989 @opindex coverage
3990
3991 This option is used to compile and link code instrumented for coverage
3992 analysis.  The option is a synonym for @option{-fprofile-arcs}
3993 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
3994 linking).  See the documentation for those options for more details.
3995
3996 @itemize
3997
3998 @item
3999 Compile the source files with @option{-fprofile-arcs} plus optimization
4000 and code generation options.  For test coverage analysis, use the
4001 additional @option{-ftest-coverage} option.  You do not need to profile
4002 every source file in a program.
4003
4004 @item
4005 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
4006 (the latter implies the former).
4007
4008 @item
4009 Run the program on a representative workload to generate the arc profile
4010 information.  This may be repeated any number of times.  You can run
4011 concurrent instances of your program, and provided that the file system
4012 supports locking, the data files will be correctly updated.  Also
4013 @code{fork} calls are detected and correctly handled (double counting
4014 will not happen).
4015
4016 @item
4017 For profile-directed optimizations, compile the source files again with
4018 the same optimization and code generation options plus
4019 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
4020 Control Optimization}).
4021
4022 @item
4023 For test coverage analysis, use @command{gcov} to produce human readable
4024 information from the @file{.gcno} and @file{.gcda} files.  Refer to the
4025 @command{gcov} documentation for further information.
4026
4027 @end itemize
4028
4029 With @option{-fprofile-arcs}, for each function of your program GCC
4030 creates a program flow graph, then finds a spanning tree for the graph.
4031 Only arcs that are not on the spanning tree have to be instrumented: the
4032 compiler adds code to count the number of times that these arcs are
4033 executed.  When an arc is the only exit or only entrance to a block, the
4034 instrumentation code can be added to the block; otherwise, a new basic
4035 block must be created to hold the instrumentation code.
4036
4037 @need 2000
4038 @item -ftest-coverage
4039 @opindex ftest-coverage
4040 Produce a notes file that the @command{gcov} code-coverage utility
4041 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
4042 show program coverage.  Each source file's note file is called
4043 @file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
4044 above for a description of @var{auxname} and instructions on how to
4045 generate test coverage data.  Coverage data will match the source files
4046 more closely, if you do not optimize.
4047
4048 @item -d@var{letters}
4049 @item -fdump-rtl-@var{pass}
4050 @opindex d
4051 Says to make debugging dumps during compilation at times specified by
4052 @var{letters}.    This is used for debugging the RTL-based passes of the
4053 compiler.  The file names for most of the dumps are made by appending a
4054 pass number and a word to the @var{dumpname}.  @var{dumpname} is generated
4055 from the name of the output file, if explicitly specified and it is not
4056 an executable, otherwise it is the basename of the source file.
4057
4058 Most debug dumps can be enabled either passing a letter to the @option{-d}
4059 option, or with a long @option{-fdump-rtl} switch; here are the possible
4060 letters for use in @var{letters} and @var{pass}, and their meanings:
4061
4062 @table @gcctabopt
4063 @item -dA
4064 @opindex dA
4065 Annotate the assembler output with miscellaneous debugging information.
4066
4067 @item -dB
4068 @itemx -fdump-rtl-bbro
4069 @opindex dB
4070 @opindex fdump-rtl-bbro
4071 Dump after block reordering, to @file{@var{file}.148r.bbro}.
4072
4073 @item -dc
4074 @itemx -fdump-rtl-combine
4075 @opindex dc
4076 @opindex fdump-rtl-combine
4077 Dump after the RTL instruction combination pass, to the file
4078 @file{@var{file}.129r.combine}.
4079
4080 @item -dC
4081 @itemx -fdump-rtl-ce1
4082 @itemx -fdump-rtl-ce2
4083 @opindex dC
4084 @opindex fdump-rtl-ce1
4085 @opindex fdump-rtl-ce2
4086 @option{-dC} and @option{-fdump-rtl-ce1} enable dumping after the
4087 first if conversion, to the file @file{@var{file}.117r.ce1}.  @option{-dC}
4088 and @option{-fdump-rtl-ce2} enable dumping after the second if
4089 conversion, to the file @file{@var{file}.130r.ce2}.
4090
4091 @item -dd
4092 @itemx -fdump-rtl-btl
4093 @itemx -fdump-rtl-dbr
4094 @opindex dd
4095 @opindex fdump-rtl-btl
4096 @opindex fdump-rtl-dbr
4097 @option{-dd} and @option{-fdump-rtl-btl} enable dumping after branch
4098 target load optimization, to @file{@var{file}.31.btl}.  @option{-dd}
4099 and @option{-fdump-rtl-dbr} enable dumping after delayed branch
4100 scheduling, to @file{@var{file}.36.dbr}.
4101
4102 @item -dD
4103 @opindex dD
4104 Dump all macro definitions, at the end of preprocessing, in addition to
4105 normal output.
4106
4107 @item -dE
4108 @itemx -fdump-rtl-ce3
4109 @opindex dE
4110 @opindex fdump-rtl-ce3
4111 Dump after the third if conversion, to @file{@var{file}.146r.ce3}.
4112
4113 @item -df
4114 @itemx -fdump-rtl-cfg
4115 @itemx -fdump-rtl-life
4116 @opindex df
4117 @opindex fdump-rtl-cfg
4118 @opindex fdump-rtl-life
4119 @option{-df} and @option{-fdump-rtl-cfg} enable dumping after control
4120 and data flow analysis, to @file{@var{file}.116r.cfg}.  @option{-df}
4121 and @option{-fdump-rtl-cfg} enable dumping dump after life analysis,
4122 to @file{@var{file}.128r.life1} and @file{@var{file}.135r.life2}.
4123
4124 @item -dg
4125 @itemx -fdump-rtl-greg
4126 @opindex dg
4127 @opindex fdump-rtl-greg
4128 Dump after global register allocation, to @file{@var{file}.139r.greg}.
4129
4130 @item -dG
4131 @itemx -fdump-rtl-gcse
4132 @itemx -fdump-rtl-bypass
4133 @opindex dG
4134 @opindex fdump-rtl-gcse
4135 @opindex fdump-rtl-bypass
4136 @option{-dG} and @option{-fdump-rtl-gcse} enable dumping after GCSE, to
4137 @file{@var{file}.114r.gcse}.  @option{-dG} and @option{-fdump-rtl-bypass}
4138 enable dumping after jump bypassing and control flow optimizations, to
4139 @file{@var{file}.115r.bypass}.
4140
4141 @item -dh
4142 @itemx -fdump-rtl-eh
4143 @opindex dh
4144 @opindex fdump-rtl-eh
4145 Dump after finalization of EH handling code, to @file{@var{file}.02.eh}.
4146
4147 @item -di
4148 @itemx -fdump-rtl-sibling
4149 @opindex di
4150 @opindex fdump-rtl-sibling
4151 Dump after sibling call optimizations, to @file{@var{file}.106r.sibling}.
4152
4153 @item -dj
4154 @itemx -fdump-rtl-jump
4155 @opindex dj
4156 @opindex fdump-rtl-jump
4157 Dump after the first jump optimization, to @file{@var{file}.112r.jump}.
4158
4159 @item -dk
4160 @itemx -fdump-rtl-stack
4161 @opindex dk
4162 @opindex fdump-rtl-stack
4163 Dump after conversion from GCC's "flat register file" registers to the
4164 x87's stack-like registers, to @file{@var{file}.152r.stack}.
4165
4166 @item -dl
4167 @itemx -fdump-rtl-lreg
4168 @opindex dl
4169 @opindex fdump-rtl-lreg
4170 Dump after local register allocation, to @file{@var{file}.138r.lreg}.
4171
4172 @item -dL
4173 @itemx -fdump-rtl-loop2
4174 @opindex dL
4175 @opindex fdump-rtl-loop2
4176 @option{-dL} and @option{-fdump-rtl-loop2} enable dumping after the
4177 loop optimization pass, to @file{@var{file}.119r.loop2},
4178 @file{@var{file}.120r.loop2_init},
4179 @file{@var{file}.121r.loop2_invariant}, and
4180 @file{@var{file}.125r.loop2_done}.
4181
4182 @item -dm
4183 @itemx -fdump-rtl-sms
4184 @opindex dm
4185 @opindex fdump-rtl-sms
4186 Dump after modulo scheduling, to @file{@var{file}.136r.sms}.
4187
4188 @item -dM
4189 @itemx -fdump-rtl-mach
4190 @opindex dM
4191 @opindex fdump-rtl-mach
4192 Dump after performing the machine dependent reorganization pass, to
4193 @file{@var{file}.155r.mach}.
4194
4195 @item -dn
4196 @itemx -fdump-rtl-rnreg
4197 @opindex dn
4198 @opindex fdump-rtl-rnreg
4199 Dump after register renumbering, to @file{@var{file}.147r.rnreg}.
4200
4201 @item -dN
4202 @itemx -fdump-rtl-regmove
4203 @opindex dN
4204 @opindex fdump-rtl-regmove
4205 Dump after the register move pass, to @file{@var{file}.132r.regmove}.
4206
4207 @item -do
4208 @itemx -fdump-rtl-postreload
4209 @opindex do
4210 @opindex fdump-rtl-postreload
4211 Dump after post-reload optimizations, to @file{@var{file}.24.postreload}.
4212
4213 @item -dr
4214 @itemx -fdump-rtl-expand
4215 @opindex dr
4216 @opindex fdump-rtl-expand
4217 Dump after RTL generation, to @file{@var{file}.104r.expand}.
4218
4219 @item -dR
4220 @itemx -fdump-rtl-sched2
4221 @opindex dR
4222 @opindex fdump-rtl-sched2
4223 Dump after the second scheduling pass, to @file{@var{file}.149r.sched2}.
4224
4225 @item -ds
4226 @itemx -fdump-rtl-cse
4227 @opindex ds
4228 @opindex fdump-rtl-cse
4229 Dump after CSE (including the jump optimization that sometimes follows
4230 CSE), to @file{@var{file}.113r.cse}.
4231
4232 @item -dS
4233 @itemx -fdump-rtl-sched1
4234 @opindex dS
4235 @opindex fdump-rtl-sched1
4236 Dump after the first scheduling pass, to @file{@var{file}.136r.sched1}.
4237
4238 @item -dt
4239 @itemx -fdump-rtl-cse2
4240 @opindex dt
4241 @opindex fdump-rtl-cse2
4242 Dump after the second CSE pass (including the jump optimization that
4243 sometimes follows CSE), to @file{@var{file}.127r.cse2}.
4244
4245 @item -dT
4246 @itemx -fdump-rtl-tracer
4247 @opindex dT
4248 @opindex fdump-rtl-tracer
4249 Dump after running tracer, to @file{@var{file}.118r.tracer}.
4250
4251 @item -dV
4252 @itemx -fdump-rtl-vpt
4253 @itemx -fdump-rtl-vartrack
4254 @opindex dV
4255 @opindex fdump-rtl-vpt
4256 @opindex fdump-rtl-vartrack
4257 @option{-dV} and @option{-fdump-rtl-vpt} enable dumping after the value
4258 profile transformations, to @file{@var{file}.10.vpt}.  @option{-dV}
4259 and @option{-fdump-rtl-vartrack} enable dumping after variable tracking,
4260 to @file{@var{file}.154r.vartrack}.
4261
4262 @item -dw
4263 @itemx -fdump-rtl-flow2
4264 @opindex dw
4265 @opindex fdump-rtl-flow2
4266 Dump after the second flow pass, to @file{@var{file}.142r.flow2}.
4267
4268 @item -dz
4269 @itemx -fdump-rtl-peephole2
4270 @opindex dz
4271 @opindex fdump-rtl-peephole2
4272 Dump after the peephole pass, to @file{@var{file}.145r.peephole2}.
4273
4274 @item -dZ
4275 @itemx -fdump-rtl-web
4276 @opindex dZ
4277 @opindex fdump-rtl-web
4278 Dump after live range splitting, to @file{@var{file}.126r.web}.
4279
4280 @item -da
4281 @itemx -fdump-rtl-all
4282 @opindex da
4283 @opindex fdump-rtl-all
4284 Produce all the dumps listed above.
4285
4286 @item -dH
4287 @opindex dH
4288 Produce a core dump whenever an error occurs.
4289
4290 @item -dm
4291 @opindex dm
4292 Print statistics on memory usage, at the end of the run, to
4293 standard error.
4294
4295 @item -dp
4296 @opindex dp
4297 Annotate the assembler output with a comment indicating which
4298 pattern and alternative was used.  The length of each instruction is
4299 also printed.
4300
4301 @item -dP
4302 @opindex dP
4303 Dump the RTL in the assembler output as a comment before each instruction.
4304 Also turns on @option{-dp} annotation.
4305
4306 @item -dv
4307 @opindex dv
4308 For each of the other indicated dump files (either with @option{-d} or
4309 @option{-fdump-rtl-@var{pass}}), dump a representation of the control flow
4310 graph suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
4311
4312 @item -dx
4313 @opindex dx
4314 Just generate RTL for a function instead of compiling it.  Usually used
4315 with @samp{r} (@option{-fdump-rtl-expand}).
4316
4317 @item -dy
4318 @opindex dy
4319 Dump debugging information during parsing, to standard error.
4320 @end table
4321
4322 @item -fdump-noaddr
4323 @opindex fdump-noaddr
4324 When doing debugging dumps (see @option{-d} option above), suppress
4325 address output.  This makes it more feasible to use diff on debugging
4326 dumps for compiler invocations with different compiler binaries and/or
4327 different text / bss / data / heap / stack / dso start locations.
4328
4329 @item -fdump-unnumbered
4330 @opindex fdump-unnumbered
4331 When doing debugging dumps (see @option{-d} option above), suppress instruction
4332 numbers, line number note and address output.  This makes it more feasible to
4333 use diff on debugging dumps for compiler invocations with different
4334 options, in particular with and without @option{-g}.
4335
4336 @item -fdump-translation-unit @r{(C++ only)}
4337 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
4338 @opindex fdump-translation-unit
4339 Dump a representation of the tree structure for the entire translation
4340 unit to a file.  The file name is made by appending @file{.tu} to the
4341 source file name.  If the @samp{-@var{options}} form is used, @var{options}
4342 controls the details of the dump as described for the
4343 @option{-fdump-tree} options.
4344
4345 @item -fdump-class-hierarchy @r{(C++ only)}
4346 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
4347 @opindex fdump-class-hierarchy
4348 Dump a representation of each class's hierarchy and virtual function
4349 table layout to a file.  The file name is made by appending @file{.class}
4350 to the source file name.  If the @samp{-@var{options}} form is used,
4351 @var{options} controls the details of the dump as described for the
4352 @option{-fdump-tree} options.
4353
4354 @item -fdump-ipa-@var{switch}
4355 @opindex fdump-ipa
4356 Control the dumping at various stages of inter-procedural analysis
4357 language tree to a file.  The file name is generated by appending a switch
4358 specific suffix to the source file name.  The following dumps are possible:
4359
4360 @table @samp
4361 @item all
4362 Enables all inter-procedural analysis dumps; currently the only produced
4363 dump is the @samp{cgraph} dump.
4364
4365 @item cgraph
4366 Dumps information about call-graph optimization, unused function removal,
4367 and inlining decisions.
4368 @end table
4369
4370 @item -fdump-tree-@var{switch}
4371 @itemx -fdump-tree-@var{switch}-@var{options}
4372 @opindex fdump-tree
4373 Control the dumping at various stages of processing the intermediate
4374 language tree to a file.  The file name is generated by appending a switch
4375 specific suffix to the source file name.  If the @samp{-@var{options}}
4376 form is used, @var{options} is a list of @samp{-} separated options that
4377 control the details of the dump.  Not all options are applicable to all
4378 dumps, those which are not meaningful will be ignored.  The following
4379 options are available
4380
4381 @table @samp
4382 @item address
4383 Print the address of each node.  Usually this is not meaningful as it
4384 changes according to the environment and source file.  Its primary use
4385 is for tying up a dump file with a debug environment.
4386 @item slim
4387 Inhibit dumping of members of a scope or body of a function merely
4388 because that scope has been reached.  Only dump such items when they
4389 are directly reachable by some other path.  When dumping pretty-printed
4390 trees, this option inhibits dumping the bodies of control structures.
4391 @item raw
4392 Print a raw representation of the tree.  By default, trees are
4393 pretty-printed into a C-like representation.
4394 @item details
4395 Enable more detailed dumps (not honored by every dump option).
4396 @item stats
4397 Enable dumping various statistics about the pass (not honored by every dump
4398 option).
4399 @item blocks
4400 Enable showing basic block boundaries (disabled in raw dumps).
4401 @item vops
4402 Enable showing virtual operands for every statement.
4403 @item lineno
4404 Enable showing line numbers for statements.
4405 @item uid
4406 Enable showing the unique ID (@code{DECL_UID}) for each variable.
4407 @item all
4408 Turn on all options, except @option{raw}, @option{slim} and @option{lineno}.
4409 @end table
4410
4411 The following tree dumps are possible:
4412 @table @samp
4413
4414 @item original
4415 Dump before any tree based optimization, to @file{@var{file}.original}.
4416
4417 @item optimized
4418 Dump after all tree based optimization, to @file{@var{file}.optimized}.
4419
4420 @item inlined
4421 Dump after function inlining, to @file{@var{file}.inlined}.
4422
4423 @item gimple
4424 @opindex fdump-tree-gimple
4425 Dump each function before and after the gimplification pass to a file.  The
4426 file name is made by appending @file{.gimple} to the source file name.
4427
4428 @item cfg
4429 @opindex fdump-tree-cfg
4430 Dump the control flow graph of each function to a file.  The file name is
4431 made by appending @file{.cfg} to the source file name.
4432
4433 @item vcg
4434 @opindex fdump-tree-vcg
4435 Dump the control flow graph of each function to a file in VCG format.  The
4436 file name is made by appending @file{.vcg} to the source file name.  Note
4437 that if the file contains more than one function, the generated file cannot
4438 be used directly by VCG@.  You will need to cut and paste each function's
4439 graph into its own separate file first.
4440
4441 @item ch
4442 @opindex fdump-tree-ch
4443 Dump each function after copying loop headers.  The file name is made by
4444 appending @file{.ch} to the source file name.
4445
4446 @item ssa
4447 @opindex fdump-tree-ssa
4448 Dump SSA related information to a file.  The file name is made by appending
4449 @file{.ssa} to the source file name.
4450
4451 @item salias
4452 @opindex fdump-tree-salias
4453 Dump structure aliasing variable information to a file.  This file name
4454 is made by appending @file{.salias} to the source file name.
4455
4456 @item alias
4457 @opindex fdump-tree-alias
4458 Dump aliasing information for each function.  The file name is made by
4459 appending @file{.alias} to the source file name.
4460
4461 @item ccp
4462 @opindex fdump-tree-ccp
4463 Dump each function after CCP@.  The file name is made by appending
4464 @file{.ccp} to the source file name.
4465
4466 @item storeccp
4467 @opindex fdump-tree-storeccp
4468 Dump each function after STORE-CCP.  The file name is made by appending
4469 @file{.storeccp} to the source file name.
4470
4471 @item pre
4472 @opindex fdump-tree-pre
4473 Dump trees after partial redundancy elimination.  The file name is made
4474 by appending @file{.pre} to the source file name.
4475
4476 @item fre
4477 @opindex fdump-tree-fre
4478 Dump trees after full redundancy elimination.  The file name is made
4479 by appending @file{.fre} to the source file name.
4480
4481 @item copyprop
4482 @opindex fdump-tree-copyprop
4483 Dump trees after copy propagation.  The file name is made
4484 by appending @file{.copyprop} to the source file name.
4485
4486 @item store_copyprop
4487 @opindex fdump-tree-store_copyprop
4488 Dump trees after store copy-propagation.  The file name is made
4489 by appending @file{.store_copyprop} to the source file name.
4490
4491 @item dce
4492 @opindex fdump-tree-dce
4493 Dump each function after dead code elimination.  The file name is made by
4494 appending @file{.dce} to the source file name.
4495
4496 @item mudflap
4497 @opindex fdump-tree-mudflap
4498 Dump each function after adding mudflap instrumentation.  The file name is
4499 made by appending @file{.mudflap} to the source file name.
4500
4501 @item sra
4502 @opindex fdump-tree-sra
4503 Dump each function after performing scalar replacement of aggregates.  The
4504 file name is made by appending @file{.sra} to the source file name.
4505
4506 @item sink
4507 @opindex fdump-tree-sink
4508 Dump each function after performing code sinking.  The file name is made
4509 by appending @file{.sink} to the source file name. 
4510
4511 @item dom
4512 @opindex fdump-tree-dom
4513 Dump each function after applying dominator tree optimizations.  The file
4514 name is made by appending @file{.dom} to the source file name.
4515
4516 @item dse
4517 @opindex fdump-tree-dse
4518 Dump each function after applying dead store elimination.  The file
4519 name is made by appending @file{.dse} to the source file name.
4520
4521 @item phiopt
4522 @opindex fdump-tree-phiopt
4523 Dump each function after optimizing PHI nodes into straightline code.  The file
4524 name is made by appending @file{.phiopt} to the source file name.
4525
4526 @item forwprop
4527 @opindex fdump-tree-forwprop
4528 Dump each function after forward propagating single use variables.  The file
4529 name is made by appending @file{.forwprop} to the source file name.
4530
4531 @item copyrename
4532 @opindex fdump-tree-copyrename
4533 Dump each function after applying the copy rename optimization.  The file
4534 name is made by appending @file{.copyrename} to the source file name.
4535
4536 @item nrv
4537 @opindex fdump-tree-nrv
4538 Dump each function after applying the named return value optimization on
4539 generic trees.  The file name is made by appending @file{.nrv} to the source
4540 file name.
4541
4542 @item vect
4543 @opindex fdump-tree-vect
4544 Dump each function after applying vectorization of loops.  The file name is
4545 made by appending @file{.vect} to the source file name.
4546
4547 @item vrp
4548 @opindex fdump-tree-vrp
4549 Dump each function after Value Range Propagation (VRP).  The file name
4550 is made by appending @file{.vrp} to the source file name.
4551
4552 @item all
4553 @opindex fdump-tree-all
4554 Enable all the available tree dumps with the flags provided in this option.
4555 @end table
4556
4557 @item -ftree-vectorizer-verbose=@var{n}
4558 @opindex ftree-vectorizer-verbose
4559 This option controls the amount of debugging output the vectorizer prints.
4560 This information is written to standard error, unless 
4561 @option{-fdump-tree-all} or @option{-fdump-tree-vect} is specified, 
4562 in which case it is output to the usual dump listing file, @file{.vect}.
4563 For @var{n}=0 no diagnostic information is reported.
4564 If @var{n}=1 the vectorizer reports each loop that got vectorized, 
4565 and the total number of loops that got vectorized.
4566 If @var{n}=2 the vectorizer also reports non-vectorized loops that passed 
4567 the first analysis phase (vect_analyze_loop_form) - i.e. countable, 
4568 inner-most, single-bb, single-entry/exit loops.  This is the same verbosity 
4569 level that @option{-fdump-tree-vect-stats} uses.
4570 Higher verbosity levels mean either more information dumped for each 
4571 reported loop, or same amount of information reported for more loops:
4572 If @var{n}=3, alignment related information is added to the reports.
4573 If @var{n}=4, data-references related information (e.g. memory dependences, 
4574 memory access-patterns) is added to the reports.
4575 If @var{n}=5, the vectorizer reports also non-vectorized inner-most loops 
4576 that did not pass the first analysis phase (i.e. may not be countable, or 
4577 may have complicated control-flow).
4578 If @var{n}=6, the vectorizer reports also non-vectorized nested loops.
4579 For @var{n}=7, all the information the vectorizer generates during its 
4580 analysis and transformation is reported.  This is the same verbosity level
4581 that @option{-fdump-tree-vect-details} uses.
4582
4583 @item -frandom-seed=@var{string}
4584 @opindex frandom-string
4585 This option provides a seed that GCC uses when it would otherwise use
4586 random numbers.  It is used to generate certain symbol names
4587 that have to be different in every compiled file.  It is also used to
4588 place unique stamps in coverage data files and the object files that
4589 produce them.  You can use the @option{-frandom-seed} option to produce
4590 reproducibly identical object files.
4591
4592 The @var{string} should be different for every file you compile.
4593
4594 @item -fsched-verbose=@var{n}
4595 @opindex fsched-verbose
4596 On targets that use instruction scheduling, this option controls the
4597 amount of debugging output the scheduler prints.  This information is
4598 written to standard error, unless @option{-dS} or @option{-dR} is
4599 specified, in which case it is output to the usual dump
4600 listing file, @file{.sched} or @file{.sched2} respectively.  However
4601 for @var{n} greater than nine, the output is always printed to standard
4602 error.
4603
4604 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
4605 same information as @option{-dRS}.  For @var{n} greater than one, it
4606 also output basic block probabilities, detailed ready list information
4607 and unit/insn info.  For @var{n} greater than two, it includes RTL
4608 at abort point, control-flow and regions info.  And for @var{n} over
4609 four, @option{-fsched-verbose} also includes dependence info.
4610
4611 @item -save-temps
4612 @opindex save-temps
4613 Store the usual ``temporary'' intermediate files permanently; place them
4614 in the current directory and name them based on the source file.  Thus,
4615 compiling @file{foo.c} with @samp{-c -save-temps} would produce files
4616 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
4617 preprocessed @file{foo.i} output file even though the compiler now
4618 normally uses an integrated preprocessor.
4619
4620 When used in combination with the @option{-x} command line option,
4621 @option{-save-temps} is sensible enough to avoid over writing an
4622 input source file with the same extension as an intermediate file.
4623 The corresponding intermediate file may be obtained by renaming the
4624 source file before using @option{-save-temps}.
4625
4626 @item -time
4627 @opindex time
4628 Report the CPU time taken by each subprocess in the compilation
4629 sequence.  For C source files, this is the compiler proper and assembler
4630 (plus the linker if linking is done).  The output looks like this:
4631
4632 @smallexample
4633 # cc1 0.12 0.01
4634 # as 0.00 0.01
4635 @end smallexample
4636
4637 The first number on each line is the ``user time'', that is time spent
4638 executing the program itself.  The second number is ``system time'',
4639 time spent executing operating system routines on behalf of the program.
4640 Both numbers are in seconds.
4641
4642 @item -fvar-tracking
4643 @opindex fvar-tracking
4644 Run variable tracking pass.  It computes where variables are stored at each
4645 position in code.  Better debugging information is then generated
4646 (if the debugging information format supports this information).
4647
4648 It is enabled by default when compiling with optimization (@option{-Os},
4649 @option{-O}, @option{-O2}, ...), debugging information (@option{-g}) and
4650 the debug info format supports it.
4651
4652 @item -print-file-name=@var{library}
4653 @opindex print-file-name
4654 Print the full absolute name of the library file @var{library} that
4655 would be used when linking---and don't do anything else.  With this
4656 option, GCC does not compile or link anything; it just prints the
4657 file name.
4658
4659 @item -print-multi-directory
4660 @opindex print-multi-directory
4661 Print the directory name corresponding to the multilib selected by any
4662 other switches present in the command line.  This directory is supposed
4663 to exist in @env{GCC_EXEC_PREFIX}.
4664
4665 @item -print-multi-lib
4666 @opindex print-multi-lib
4667 Print the mapping from multilib directory names to compiler switches
4668 that enable them.  The directory name is separated from the switches by
4669 @samp{;}, and each switch starts with an @samp{@@} instead of the
4670 @samp{-}, without spaces between multiple switches.  This is supposed to
4671 ease shell-processing.
4672
4673 @item -print-prog-name=@var{program}
4674 @opindex print-prog-name
4675 Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
4676
4677 @item -print-libgcc-file-name
4678 @opindex print-libgcc-file-name
4679 Same as @option{-print-file-name=libgcc.a}.
4680
4681 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
4682 but you do want to link with @file{libgcc.a}.  You can do
4683
4684 @smallexample
4685 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
4686 @end smallexample
4687
4688 @item -print-search-dirs
4689 @opindex print-search-dirs
4690 Print the name of the configured installation directory and a list of
4691 program and library directories @command{gcc} will search---and don't do anything else.
4692
4693 This is useful when @command{gcc} prints the error message
4694 @samp{installation problem, cannot exec cpp0: No such file or directory}.
4695 To resolve this you either need to put @file{cpp0} and the other compiler
4696 components where @command{gcc} expects to find them, or you can set the environment
4697 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
4698 Don't forget the trailing @samp{/}.
4699 @xref{Environment Variables}.
4700
4701 @item -print-sysroot-headers-suffix
4702 @opindex print-sysroot-headers-suffix
4703 Print the suffix added to the target sysroot when searching for
4704 headers, or give an error if the compiler is not configured with such
4705 a suffix---and don't do anything else.
4706
4707 @item -dumpmachine
4708 @opindex dumpmachine
4709 Print the compiler's target machine (for example,
4710 @samp{i686-pc-linux-gnu})---and don't do anything else.
4711
4712 @item -dumpversion
4713 @opindex dumpversion
4714 Print the compiler version (for example, @samp{3.0})---and don't do
4715 anything else.
4716
4717 @item -dumpspecs
4718 @opindex dumpspecs
4719 Print the compiler's built-in specs---and don't do anything else.  (This
4720 is used when GCC itself is being built.)  @xref{Spec Files}.
4721
4722 @item -feliminate-unused-debug-types
4723 @opindex feliminate-unused-debug-types
4724 Normally, when producing DWARF2 output, GCC will emit debugging
4725 information for all types declared in a compilation
4726 unit, regardless of whether or not they are actually used
4727 in that compilation unit.  Sometimes this is useful, such as
4728 if, in the debugger, you want to cast a value to a type that is
4729 not actually used in your program (but is declared).  More often,
4730 however, this results in a significant amount of wasted space.
4731 With this option, GCC will avoid producing debug symbol output
4732 for types that are nowhere used in the source file being compiled.
4733 @end table
4734
4735 @node Optimize Options
4736 @section Options That Control Optimization
4737 @cindex optimize options
4738 @cindex options, optimization
4739
4740 These options control various sorts of optimizations.
4741
4742 Without any optimization option, the compiler's goal is to reduce the
4743 cost of compilation and to make debugging produce the expected
4744 results.  Statements are independent: if you stop the program with a
4745 breakpoint between statements, you can then assign a new value to any
4746 variable or change the program counter to any other statement in the
4747 function and get exactly the results you would expect from the source
4748 code.
4749
4750 Turning on optimization flags makes the compiler attempt to improve
4751 the performance and/or code size at the expense of compilation time
4752 and possibly the ability to debug the program.
4753
4754 The compiler performs optimization based on the knowledge it has of
4755 the program.  Optimization levels @option{-O} and above, in
4756 particular, enable @emph{unit-at-a-time} mode, which allows the
4757 compiler to consider information gained from later functions in
4758 the file when compiling a function.  Compiling multiple files at
4759 once to a single output file in @emph{unit-at-a-time} mode allows
4760 the compiler to use information gained from all of the files when
4761 compiling each of them.
4762
4763 Not all optimizations are controlled directly by a flag.  Only
4764 optimizations that have a flag are listed.
4765
4766 @table @gcctabopt
4767 @item -O
4768 @itemx -O1
4769 @opindex O
4770 @opindex O1
4771 Optimize.  Optimizing compilation takes somewhat more time, and a lot
4772 more memory for a large function.
4773
4774 With @option{-O}, the compiler tries to reduce code size and execution
4775 time, without performing any optimizations that take a great deal of
4776 compilation time.
4777
4778 @option{-O} turns on the following optimization flags:
4779 @gccoptlist{-fdefer-pop @gol
4780 -fdelayed-branch @gol
4781 -fguess-branch-probability @gol
4782 -fcprop-registers @gol
4783 -fif-conversion @gol
4784 -fif-conversion2 @gol
4785 -fsplit-wide-types @gol
4786 -ftree-ccp @gol
4787 -ftree-dce @gol
4788 -ftree-dominator-opts @gol
4789 -ftree-dse @gol
4790 -ftree-ter @gol
4791 -ftree-sra @gol
4792 -ftree-copyrename @gol
4793 -ftree-fre @gol
4794 -ftree-ch @gol
4795 -funit-at-a-time @gol
4796 -fmerge-constants}
4797
4798 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
4799 where doing so does not interfere with debugging.
4800
4801 @item -O2
4802 @opindex O2
4803 Optimize even more.  GCC performs nearly all supported optimizations
4804 that do not involve a space-speed tradeoff.  The compiler does not
4805 perform loop unrolling or function inlining when you specify @option{-O2}.
4806 As compared to @option{-O}, this option increases both compilation time
4807 and the performance of the generated code.
4808
4809 @option{-O2} turns on all optimization flags specified by @option{-O}.  It
4810 also turns on the following optimization flags:
4811 @gccoptlist{-fthread-jumps @gol
4812 -fcrossjumping @gol
4813 -foptimize-sibling-calls @gol
4814 -fcse-follow-jumps  -fcse-skip-blocks @gol
4815 -fgcse  -fgcse-lm  @gol
4816 -fexpensive-optimizations @gol
4817 -frerun-cse-after-loop  @gol
4818 -fcaller-saves @gol
4819 -fpeephole2 @gol
4820 -fschedule-insns  -fschedule-insns2 @gol
4821 -fsched-interblock  -fsched-spec @gol
4822 -fregmove @gol
4823 -fstrict-aliasing -fstrict-overflow @gol
4824 -fdelete-null-pointer-checks @gol
4825 -freorder-blocks  -freorder-functions @gol
4826 -falign-functions  -falign-jumps @gol
4827 -falign-loops  -falign-labels @gol
4828 -ftree-vrp @gol
4829 -ftree-pre}
4830
4831 Please note the warning under @option{-fgcse} about
4832 invoking @option{-O2} on programs that use computed gotos.
4833
4834 @item -O3
4835 @opindex O3
4836 Optimize yet more.  @option{-O3} turns on all optimizations specified by
4837 @option{-O2} and also turns on the @option{-finline-functions},
4838 @option{-funswitch-loops} and @option{-fgcse-after-reload} options.
4839
4840 @item -O0
4841 @opindex O0
4842 Reduce compilation time and make debugging produce the expected
4843 results.  This is the default.
4844
4845 @item -Os
4846 @opindex Os
4847 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations that
4848 do not typically increase code size.  It also performs further
4849 optimizations designed to reduce code size.
4850
4851 @option{-Os} disables the following optimization flags:
4852 @gccoptlist{-falign-functions  -falign-jumps  -falign-loops @gol
4853 -falign-labels  -freorder-blocks  -freorder-blocks-and-partition @gol
4854 -fprefetch-loop-arrays  -ftree-vect-loop-version}
4855
4856 If you use multiple @option{-O} options, with or without level numbers,
4857 the last such option is the one that is effective.
4858 @end table
4859
4860 Options of the form @option{-f@var{flag}} specify machine-independent
4861 flags.  Most flags have both positive and negative forms; the negative
4862 form of @option{-ffoo} would be @option{-fno-foo}.  In the table
4863 below, only one of the forms is listed---the one you typically will
4864 use.  You can figure out the other form by either removing @samp{no-}
4865 or adding it.
4866
4867 The following options control specific optimizations.  They are either
4868 activated by @option{-O} options or are related to ones that are.  You
4869 can use the following flags in the rare cases when ``fine-tuning'' of
4870 optimizations to be performed is desired.
4871
4872 @table @gcctabopt
4873 @item -fno-default-inline
4874 @opindex fno-default-inline
4875 Do not make member functions inline by default merely because they are
4876 defined inside the class scope (C++ only).  Otherwise, when you specify
4877 @w{@option{-O}}, member functions defined inside class scope are compiled
4878 inline by default; i.e., you don't need to add @samp{inline} in front of
4879 the member function name.
4880
4881 @item -fno-defer-pop
4882 @opindex fno-defer-pop
4883 Always pop the arguments to each function call as soon as that function
4884 returns.  For machines which must pop arguments after a function call,
4885 the compiler normally lets arguments accumulate on the stack for several
4886 function calls and pops them all at once.
4887
4888 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4889
4890 @item -fforce-addr
4891 @opindex fforce-addr
4892 Force memory address constants to be copied into registers before
4893 doing arithmetic on them.
4894
4895 @item -fforward-propagate
4896 @opindex fforward-propagate
4897 Perform a forward propagation pass on RTL.  The pass tries to combine two
4898 instructions and checks if the result can be simplified.  If loop unrolling
4899 is active, two passes are performed and the second is scheduled after
4900 loop unrolling.
4901
4902 This option is enabled by default at optimization levels @option{-O2},
4903 @option{-O3}, @option{-Os}.
4904
4905 @item -fomit-frame-pointer
4906 @opindex fomit-frame-pointer
4907 Don't keep the frame pointer in a register for functions that
4908 don't need one.  This avoids the instructions to save, set up and
4909 restore frame pointers; it also makes an extra register available
4910 in many functions.  @strong{It also makes debugging impossible on
4911 some machines.}
4912
4913 On some machines, such as the VAX, this flag has no effect, because
4914 the standard calling sequence automatically handles the frame pointer
4915 and nothing is saved by pretending it doesn't exist.  The
4916 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
4917 whether a target machine supports this flag.  @xref{Registers,,Register
4918 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
4919
4920 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4921
4922 @item -foptimize-sibling-calls
4923 @opindex foptimize-sibling-calls
4924 Optimize sibling and tail recursive calls.
4925
4926 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4927
4928 @item -fno-inline
4929 @opindex fno-inline
4930 Don't pay attention to the @code{inline} keyword.  Normally this option
4931 is used to keep the compiler from expanding any functions inline.
4932 Note that if you are not optimizing, no functions can be expanded inline.
4933
4934 @item -finline-functions
4935 @opindex finline-functions
4936 Integrate all simple functions into their callers.  The compiler
4937 heuristically decides which functions are simple enough to be worth
4938 integrating in this way.
4939
4940 If all calls to a given function are integrated, and the function is
4941 declared @code{static}, then the function is normally not output as
4942 assembler code in its own right.
4943
4944 Enabled at level @option{-O3}.
4945
4946 @item -finline-functions-called-once
4947 @opindex finline-functions-called-once
4948 Consider all @code{static} functions called once for inlining into their
4949 caller even if they are not marked @code{inline}.  If a call to a given
4950 function is integrated, then the function is not output as assembler code
4951 in its own right.
4952
4953 Enabled if @option{-funit-at-a-time} is enabled.
4954
4955 @item -fearly-inlining
4956 @opindex fearly-inlining
4957 Inline functions marked by @code{always_inline} and functions whose body seems
4958 smaller than the function call overhead early before doing
4959 @option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
4960 makes profiling significantly cheaper and usually inlining faster on programs
4961 having large chains of nested wrapper functions.
4962
4963 Enabled by default.
4964
4965 @item -finline-limit=@var{n}
4966 @opindex finline-limit
4967 By default, GCC limits the size of functions that can be inlined.  This flag
4968 allows the control of this limit for functions that are explicitly marked as
4969 inline (i.e., marked with the inline keyword or defined within the class
4970 definition in c++).  @var{n} is the size of functions that can be inlined in
4971 number of pseudo instructions (not counting parameter handling).  The default
4972 value of @var{n} is 600.
4973 Increasing this value can result in more inlined code at
4974 the cost of compilation time and memory consumption.  Decreasing usually makes
4975 the compilation faster and less code will be inlined (which presumably
4976 means slower programs).  This option is particularly useful for programs that
4977 use inlining heavily such as those based on recursive templates with C++.
4978
4979 Inlining is actually controlled by a number of parameters, which may be
4980 specified individually by using @option{--param @var{name}=@var{value}}.
4981 The @option{-finline-limit=@var{n}} option sets some of these parameters
4982 as follows:
4983
4984 @table @gcctabopt
4985 @item max-inline-insns-single
4986  is set to @var{n}/2.
4987 @item max-inline-insns-auto
4988  is set to @var{n}/2.
4989 @item min-inline-insns
4990  is set to 130 or @var{n}/4, whichever is smaller.
4991 @item max-inline-insns-rtl
4992  is set to @var{n}.
4993 @end table
4994
4995 See below for a documentation of the individual
4996 parameters controlling inlining.
4997
4998 @emph{Note:} pseudo instruction represents, in this particular context, an
4999 abstract measurement of function's size.  In no way does it represent a count
5000 of assembly instructions and as such its exact meaning might change from one
5001 release to an another.
5002
5003 @item -fkeep-inline-functions
5004 @opindex fkeep-inline-functions
5005 In C, emit @code{static} functions that are declared @code{inline}
5006 into the object file, even if the function has been inlined into all
5007 of its callers.  This switch does not affect functions using the
5008 @code{extern inline} extension in GNU C89@.  In C++, emit any and all
5009 inline functions into the object file.
5010
5011 @item -fkeep-static-consts
5012 @opindex fkeep-static-consts
5013 Emit variables declared @code{static const} when optimization isn't turned
5014 on, even if the variables aren't referenced.
5015
5016 GCC enables this option by default.  If you want to force the compiler to
5017 check if the variable was referenced, regardless of whether or not
5018 optimization is turned on, use the @option{-fno-keep-static-consts} option.
5019
5020 @item -fmerge-constants
5021 Attempt to merge identical constants (string constants and floating point
5022 constants) across compilation units.
5023
5024 This option is the default for optimized compilation if the assembler and
5025 linker support it.  Use @option{-fno-merge-constants} to inhibit this
5026 behavior.
5027
5028 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5029
5030 @item -fmerge-all-constants
5031 Attempt to merge identical constants and identical variables.
5032
5033 This option implies @option{-fmerge-constants}.  In addition to
5034 @option{-fmerge-constants} this considers e.g.@: even constant initialized
5035 arrays or initialized constant variables with integral or floating point
5036 types.  Languages like C or C++ require each non-automatic variable to
5037 have distinct location, so using this option will result in non-conforming
5038 behavior.
5039
5040 @item -fmodulo-sched
5041 @opindex fmodulo-sched
5042 Perform swing modulo scheduling immediately before the first scheduling
5043 pass.  This pass looks at innermost loops and reorders their
5044 instructions by overlapping different iterations.
5045
5046 @item -fno-branch-count-reg
5047 @opindex fno-branch-count-reg
5048 Do not use ``decrement and branch'' instructions on a count register,
5049 but instead generate a sequence of instructions that decrement a
5050 register, compare it against zero, then branch based upon the result.
5051 This option is only meaningful on architectures that support such
5052 instructions, which include x86, PowerPC, IA-64 and S/390.
5053
5054 The default is @option{-fbranch-count-reg}.
5055
5056 @item -fno-function-cse
5057 @opindex fno-function-cse
5058 Do not put function addresses in registers; make each instruction that
5059 calls a constant function contain the function's address explicitly.
5060
5061 This option results in less efficient code, but some strange hacks
5062 that alter the assembler output may be confused by the optimizations
5063 performed when this option is not used.
5064
5065 The default is @option{-ffunction-cse}
5066
5067 @item -fno-zero-initialized-in-bss
5068 @opindex fno-zero-initialized-in-bss
5069 If the target supports a BSS section, GCC by default puts variables that
5070 are initialized to zero into BSS@.  This can save space in the resulting
5071 code.
5072
5073 This option turns off this behavior because some programs explicitly
5074 rely on variables going to the data section.  E.g., so that the
5075 resulting executable can find the beginning of that section and/or make
5076 assumptions based on that.
5077
5078 The default is @option{-fzero-initialized-in-bss}.
5079
5080 @item -fbounds-check
5081 @opindex fbounds-check
5082 For front-ends that support it, generate additional code to check that
5083 indices used to access arrays are within the declared range.  This is
5084 currently only supported by the Java and Fortran front-ends, where
5085 this option defaults to true and false respectively.
5086
5087 @item -fmudflap -fmudflapth -fmudflapir
5088 @opindex fmudflap
5089 @opindex fmudflapth
5090 @opindex fmudflapir
5091 @cindex bounds checking
5092 @cindex mudflap
5093 For front-ends that support it (C and C++), instrument all risky
5094 pointer/array dereferencing operations, some standard library
5095 string/heap functions, and some other associated constructs with
5096 range/validity tests.  Modules so instrumented should be immune to
5097 buffer overflows, invalid heap use, and some other classes of C/C++
5098 programming errors.  The instrumentation relies on a separate runtime
5099 library (@file{libmudflap}), which will be linked into a program if
5100 @option{-fmudflap} is given at link time.  Run-time behavior of the
5101 instrumented program is controlled by the @env{MUDFLAP_OPTIONS}
5102 environment variable.  See @code{env MUDFLAP_OPTIONS=-help a.out}
5103 for its options.
5104
5105 Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to
5106 link if your program is multi-threaded.  Use @option{-fmudflapir}, in
5107 addition to @option{-fmudflap} or @option{-fmudflapth}, if
5108 instrumentation should ignore pointer reads.  This produces less
5109 instrumentation (and therefore faster execution) and still provides
5110 some protection against outright memory corrupting writes, but allows
5111 erroneously read data to propagate within a program.
5112
5113 @item -fthread-jumps
5114 @opindex fthread-jumps
5115 Perform optimizations where we check to see if a jump branches to a
5116 location where another comparison subsumed by the first is found.  If
5117 so, the first branch is redirected to either the destination of the
5118 second branch or a point immediately following it, depending on whether
5119 the condition is known to be true or false.
5120
5121 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5122
5123 @item -fsplit-wide-types
5124 @opindex -fsplit-wide-types
5125 When using a type that occupies multiple registers, such as @code{long
5126 long} on a 32-bit system, split the registers apart and allocate them
5127 independently.  This normally generates better code for those types,
5128 but may make debugging more difficult.
5129
5130 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
5131 @option{-Os}.
5132
5133 @item -fcse-follow-jumps
5134 @opindex fcse-follow-jumps
5135 In common subexpression elimination, scan through jump instructions
5136 when the target of the jump is not reached by any other path.  For
5137 example, when CSE encounters an @code{if} statement with an
5138 @code{else} clause, CSE will follow the jump when the condition
5139 tested is false.
5140
5141 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5142
5143 @item -fcse-skip-blocks
5144 @opindex fcse-skip-blocks
5145 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
5146 follow jumps which conditionally skip over blocks.  When CSE
5147 encounters a simple @code{if} statement with no else clause,
5148 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
5149 body of the @code{if}.
5150
5151 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5152
5153 @item -frerun-cse-after-loop
5154 @opindex frerun-cse-after-loop
5155 Re-run common subexpression elimination after loop optimizations has been
5156 performed.
5157
5158 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5159
5160 @item -fgcse
5161 @opindex fgcse
5162 Perform a global common subexpression elimination pass.
5163 This pass also performs global constant and copy propagation.
5164
5165 @emph{Note:} When compiling a program using computed gotos, a GCC
5166 extension, you may get better runtime performance if you disable
5167 the global common subexpression elimination pass by adding
5168 @option{-fno-gcse} to the command line.
5169
5170 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5171
5172 @item -fgcse-lm
5173 @opindex fgcse-lm
5174 When @option{-fgcse-lm} is enabled, global common subexpression elimination will
5175 attempt to move loads which are only killed by stores into themselves.  This
5176 allows a loop containing a load/store sequence to be changed to a load outside
5177 the loop, and a copy/store within the loop.
5178
5179 Enabled by default when gcse is enabled.
5180
5181 @item -fgcse-sm
5182 @opindex fgcse-sm
5183 When @option{-fgcse-sm} is enabled, a store motion pass is run after
5184 global common subexpression elimination.  This pass will attempt to move
5185 stores out of loops.  When used in conjunction with @option{-fgcse-lm},
5186 loops containing a load/store sequence can be changed to a load before
5187 the loop and a store after the loop.
5188
5189 Not enabled at any optimization level.
5190
5191 @item -fgcse-las
5192 @opindex fgcse-las
5193 When @option{-fgcse-las} is enabled, the global common subexpression
5194 elimination pass eliminates redundant loads that come after stores to the
5195 same memory location (both partial and full redundancies).
5196
5197 Not enabled at any optimization level.
5198
5199 @item -fgcse-after-reload
5200 @opindex fgcse-after-reload
5201 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
5202 pass is performed after reload.  The purpose of this pass is to cleanup
5203 redundant spilling.
5204
5205 @item -funsafe-loop-optimizations
5206 @opindex funsafe-loop-optimizations
5207 If given, the loop optimizer will assume that loop indices do not
5208 overflow, and that the loops with nontrivial exit condition are not
5209 infinite.  This enables a wider range of loop optimizations even if
5210 the loop optimizer itself cannot prove that these assumptions are valid.
5211 Using @option{-Wunsafe-loop-optimizations}, the compiler will warn you
5212 if it finds this kind of loop.
5213
5214 @item -fcrossjumping
5215 @opindex crossjumping
5216 Perform cross-jumping transformation.  This transformation unifies equivalent code and save code size.  The
5217 resulting code may or may not perform better than without cross-jumping.
5218
5219 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5220
5221 @item -fif-conversion
5222 @opindex if-conversion
5223 Attempt to transform conditional jumps into branch-less equivalents.  This
5224 include use of conditional moves, min, max, set flags and abs instructions, and
5225 some tricks doable by standard arithmetics.  The use of conditional execution
5226 on chips where it is available is controlled by @code{if-conversion2}.
5227
5228 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5229
5230 @item -fif-conversion2
5231 @opindex if-conversion2
5232 Use conditional execution (where available) to transform conditional jumps into
5233 branch-less equivalents.
5234
5235 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5236
5237 @item -fdelete-null-pointer-checks
5238 @opindex fdelete-null-pointer-checks
5239 Use global dataflow analysis to identify and eliminate useless checks
5240 for null pointers.  The compiler assumes that dereferencing a null
5241 pointer would have halted the program.  If a pointer is checked after
5242 it has already been dereferenced, it cannot be null.
5243
5244 In some environments, this assumption is not true, and programs can
5245 safely dereference null pointers.  Use
5246 @option{-fno-delete-null-pointer-checks} to disable this optimization
5247 for programs which depend on that behavior.
5248
5249 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5250
5251 @item -fexpensive-optimizations
5252 @opindex fexpensive-optimizations
5253 Perform a number of minor optimizations that are relatively expensive.
5254
5255 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5256
5257 @item -foptimize-register-move
5258 @itemx -fregmove
5259 @opindex foptimize-register-move
5260 @opindex fregmove
5261 Attempt to reassign register numbers in move instructions and as
5262 operands of other simple instructions in order to maximize the amount of
5263 register tying.  This is especially helpful on machines with two-operand
5264 instructions.
5265
5266 Note @option{-fregmove} and @option{-foptimize-register-move} are the same
5267 optimization.
5268
5269 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5270
5271 @item -fdelayed-branch
5272 @opindex fdelayed-branch
5273 If supported for the target machine, attempt to reorder instructions
5274 to exploit instruction slots available after delayed branch
5275 instructions.
5276
5277 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5278
5279 @item -fschedule-insns
5280 @opindex fschedule-insns
5281 If supported for the target machine, attempt to reorder instructions to
5282 eliminate execution stalls due to required data being unavailable.  This
5283 helps machines that have slow floating point or memory load instructions
5284 by allowing other instructions to be issued until the result of the load
5285 or floating point instruction is required.
5286
5287 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5288
5289 @item -fschedule-insns2
5290 @opindex fschedule-insns2
5291 Similar to @option{-fschedule-insns}, but requests an additional pass of
5292 instruction scheduling after register allocation has been done.  This is
5293 especially useful on machines with a relatively small number of
5294 registers and where memory load instructions take more than one cycle.
5295
5296 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5297
5298 @item -fno-sched-interblock
5299 @opindex fno-sched-interblock
5300 Don't schedule instructions across basic blocks.  This is normally
5301 enabled by default when scheduling before register allocation, i.e.@:
5302 with @option{-fschedule-insns} or at @option{-O2} or higher.
5303
5304 @item -fno-sched-spec
5305 @opindex fno-sched-spec
5306 Don't allow speculative motion of non-load instructions.  This is normally
5307 enabled by default when scheduling before register allocation, i.e.@:
5308 with @option{-fschedule-insns} or at @option{-O2} or higher.
5309
5310 @item -fsched-spec-load
5311 @opindex fsched-spec-load
5312 Allow speculative motion of some load instructions.  This only makes
5313 sense when scheduling before register allocation, i.e.@: with
5314 @option{-fschedule-insns} or at @option{-O2} or higher.
5315
5316 @item -fsched-spec-load-dangerous
5317 @opindex fsched-spec-load-dangerous
5318 Allow speculative motion of more load instructions.  This only makes
5319 sense when scheduling before register allocation, i.e.@: with
5320 @option{-fschedule-insns} or at @option{-O2} or higher.
5321
5322 @item -fsched-stalled-insns=@var{n}
5323 @opindex fsched-stalled-insns
5324 Define how many insns (if any) can be moved prematurely from the queue
5325 of stalled insns into the ready list, during the second scheduling pass.
5326
5327 @item -fsched-stalled-insns-dep=@var{n}
5328 @opindex fsched-stalled-insns-dep
5329 Define how many insn groups (cycles) will be examined for a dependency
5330 on a stalled insn that is candidate for premature removal from the queue
5331 of stalled insns.  Has an effect only during the second scheduling pass,
5332 and only if @option{-fsched-stalled-insns} is used and its value is not zero.
5333
5334 @item -fsched2-use-superblocks
5335 @opindex fsched2-use-superblocks
5336 When scheduling after register allocation, do use superblock scheduling
5337 algorithm.  Superblock scheduling allows motion across basic block boundaries
5338 resulting on faster schedules.  This option is experimental, as not all machine
5339 descriptions used by GCC model the CPU closely enough to avoid unreliable
5340 results from the algorithm.
5341
5342 This only makes sense when scheduling after register allocation, i.e.@: with
5343 @option{-fschedule-insns2} or at @option{-O2} or higher.
5344
5345 @item -fsched2-use-traces
5346 @opindex fsched2-use-traces
5347 Use @option{-fsched2-use-superblocks} algorithm when scheduling after register
5348 allocation and additionally perform code duplication in order to increase the
5349 size of superblocks using tracer pass.  See @option{-ftracer} for details on
5350 trace formation.
5351
5352 This mode should produce faster but significantly longer programs.  Also
5353 without @option{-fbranch-probabilities} the traces constructed may not
5354 match the reality and hurt the performance.  This only makes
5355 sense when scheduling after register allocation, i.e.@: with
5356 @option{-fschedule-insns2} or at @option{-O2} or higher.
5357
5358 @item -fsee
5359 @opindex fsee
5360 Eliminates redundant extension instructions and move the non redundant
5361 ones to optimal placement using LCM.
5362
5363 @item -freschedule-modulo-scheduled-loops
5364 @opindex fscheduling-in-modulo-scheduled-loops
5365 The modulo scheduling comes before the traditional scheduling, if a loop was modulo scheduled
5366 we may want to prevent the later scheduling passes from changing its schedule, we use this
5367 option to control that.
5368
5369 @item -fcaller-saves
5370 @opindex fcaller-saves
5371 Enable values to be allocated in registers that will be clobbered by
5372 function calls, by emitting extra instructions to save and restore the
5373 registers around such calls.  Such allocation is done only when it
5374 seems to result in better code than would otherwise be produced.
5375
5376 This option is always enabled by default on certain machines, usually
5377 those which have no call-preserved registers to use instead.
5378
5379 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5380
5381 @item -ftree-pre
5382 Perform Partial Redundancy Elimination (PRE) on trees.  This flag is
5383 enabled by default at @option{-O2} and @option{-O3}.
5384
5385 @item -ftree-fre
5386 Perform Full Redundancy Elimination (FRE) on trees.  The difference
5387 between FRE and PRE is that FRE only considers expressions
5388 that are computed on all paths leading to the redundant computation.
5389 This analysis faster than PRE, though it exposes fewer redundancies.
5390 This flag is enabled by default at @option{-O} and higher.
5391
5392 @item -ftree-copy-prop
5393 Perform copy propagation on trees.  This pass eliminates unnecessary
5394 copy operations.  This flag is enabled by default at @option{-O} and
5395 higher.
5396
5397 @item -ftree-store-copy-prop
5398 Perform copy propagation of memory loads and stores.  This pass
5399 eliminates unnecessary copy operations in memory references
5400 (structures, global variables, arrays, etc).  This flag is enabled by
5401 default at @option{-O2} and higher.
5402
5403 @item -ftree-salias
5404 Perform structural alias analysis on trees.  This flag
5405 is enabled by default at @option{-O} and higher.
5406
5407 @item -fipa-pta
5408 Perform interprocedural pointer analysis.
5409
5410 @item -ftree-sink
5411 Perform forward store motion  on trees.  This flag is
5412 enabled by default at @option{-O} and higher.
5413
5414 @item -ftree-ccp
5415 Perform sparse conditional constant propagation (CCP) on trees.  This
5416 pass only operates on local scalar variables and is enabled by default
5417 at @option{-O} and higher.
5418
5419 @item -ftree-store-ccp
5420 Perform sparse conditional constant propagation (CCP) on trees.  This
5421 pass operates on both local scalar variables and memory stores and
5422 loads (global variables, structures, arrays, etc).  This flag is
5423 enabled by default at @option{-O2} and higher.
5424
5425 @item -ftree-dce
5426 Perform dead code elimination (DCE) on trees.  This flag is enabled by
5427 default at @option{-O} and higher.
5428
5429 @item -ftree-dominator-opts
5430 Perform a variety of simple scalar cleanups (constant/copy
5431 propagation, redundancy elimination, range propagation and expression
5432 simplification) based on a dominator tree traversal.  This also
5433 performs jump threading (to reduce jumps to jumps). This flag is
5434 enabled by default at @option{-O} and higher.
5435
5436 @item -ftree-ch
5437 Perform loop header copying on trees.  This is beneficial since it increases
5438 effectiveness of code motion optimizations.  It also saves one jump.  This flag
5439 is enabled by default at @option{-O} and higher.  It is not enabled
5440 for @option{-Os}, since it usually increases code size.
5441
5442 @item -ftree-loop-optimize
5443 Perform loop optimizations on trees.  This flag is enabled by default
5444 at @option{-O} and higher.
5445
5446 @item -ftree-loop-linear
5447 Perform linear loop transformations on tree.  This flag can improve cache
5448 performance and allow further loop optimizations to take place.
5449
5450 @item -ftree-loop-im
5451 Perform loop invariant motion on trees.  This pass moves only invariants that
5452 would be hard to handle at RTL level (function calls, operations that expand to
5453 nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
5454 operands of conditions that are invariant out of the loop, so that we can use
5455 just trivial invariantness analysis in loop unswitching.  The pass also includes
5456 store motion.
5457
5458 @item -ftree-loop-ivcanon
5459 Create a canonical counter for number of iterations in the loop for that
5460 determining number of iterations requires complicated analysis.  Later
5461 optimizations then may determine the number easily.  Useful especially
5462 in connection with unrolling.
5463
5464 @item -fivopts
5465 Perform induction variable optimizations (strength reduction, induction
5466 variable merging and induction variable elimination) on trees.
5467
5468 @item -ftree-sra
5469 Perform scalar replacement of aggregates.  This pass replaces structure
5470 references with scalars to prevent committing structures to memory too
5471 early.  This flag is enabled by default at @option{-O} and higher.
5472
5473 @item -ftree-copyrename
5474 Perform copy renaming on trees.  This pass attempts to rename compiler
5475 temporaries to other variables at copy locations, usually resulting in
5476 variable names which more closely resemble the original variables.  This flag
5477 is enabled by default at @option{-O} and higher.
5478
5479 @item -ftree-ter
5480 Perform temporary expression replacement during the SSA->normal phase.  Single
5481 use/single def temporaries are replaced at their use location with their
5482 defining expression.  This results in non-GIMPLE code, but gives the expanders
5483 much more complex trees to work on resulting in better RTL generation.  This is
5484 enabled by default at @option{-O} and higher.
5485
5486 @item -ftree-vectorize
5487 Perform loop vectorization on trees.
5488
5489 @item -ftree-vect-loop-version
5490 @opindex ftree-vect-loop-version
5491 Perform loop versioning when doing loop vectorization on trees.  When a loop
5492 appears to be vectorizable except that data alignment or data dependence cannot
5493 be determined at compile time then vectorized and non-vectorized versions of
5494 the loop are generated along with runtime checks for alignment or dependence
5495 to control which version is executed.  This option is enabled by default
5496 except at level @option{-Os} where it is disabled.
5497
5498 @item -ftree-vrp
5499 Perform Value Range Propagation on trees.  This is similar to the
5500 constant propagation pass, but instead of values, ranges of values are
5501 propagated.  This allows the optimizers to remove unnecessary range
5502 checks like array bound checks and null pointer checks.  This is
5503 enabled by default at @option{-O2} and higher.  Null pointer check
5504 elimination is only done if @option{-fdelete-null-pointer-checks} is
5505 enabled.
5506
5507 @item -ftracer
5508 @opindex ftracer
5509 Perform tail duplication to enlarge superblock size.  This transformation
5510 simplifies the control flow of the function allowing other optimizations to do
5511 better job.
5512
5513 @item -funroll-loops
5514 @opindex funroll-loops
5515 Unroll loops whose number of iterations can be determined at compile
5516 time or upon entry to the loop.  @option{-funroll-loops} implies
5517 @option{-frerun-cse-after-loop}.  This option makes code larger,
5518 and may or may not make it run faster.
5519
5520 @item -funroll-all-loops
5521 @opindex funroll-all-loops
5522 Unroll all loops, even if their number of iterations is uncertain when
5523 the loop is entered.  This usually makes programs run more slowly.
5524 @option{-funroll-all-loops} implies the same options as
5525 @option{-funroll-loops},
5526
5527 @item -fsplit-ivs-in-unroller
5528 @opindex -fsplit-ivs-in-unroller
5529 Enables expressing of values of induction variables in later iterations
5530 of the unrolled loop using the value in the first iteration.  This breaks
5531 long dependency chains, thus improving efficiency of the scheduling passes.
5532
5533 Combination of @option{-fweb} and CSE is often sufficient to obtain the
5534 same effect.  However in cases the loop body is more complicated than
5535 a single basic block, this is not reliable.  It also does not work at all
5536 on some of the architectures due to restrictions in the CSE pass.
5537
5538 This optimization is enabled by default.
5539
5540 @item -fvariable-expansion-in-unroller
5541 @opindex -fvariable-expansion-in-unroller
5542 With this option, the compiler will create multiple copies of some
5543 local variables when unrolling a loop which can result in superior code.
5544
5545 @item -fprefetch-loop-arrays
5546 @opindex fprefetch-loop-arrays
5547 If supported by the target machine, generate instructions to prefetch
5548 memory to improve the performance of loops that access large arrays.
5549
5550 This option may generate better or worse code; results are highly
5551 dependent on the structure of loops within the source code.
5552
5553 Disabled at level @option{-Os}.
5554
5555 @item -fno-peephole
5556 @itemx -fno-peephole2
5557 @opindex fno-peephole
5558 @opindex fno-peephole2
5559 Disable any machine-specific peephole optimizations.  The difference
5560 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
5561 are implemented in the compiler; some targets use one, some use the
5562 other, a few use both.
5563
5564 @option{-fpeephole} is enabled by default.
5565 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5566
5567 @item -fno-guess-branch-probability
5568 @opindex fno-guess-branch-probability
5569 Do not guess branch probabilities using heuristics.
5570
5571 GCC will use heuristics to guess branch probabilities if they are
5572 not provided by profiling feedback (@option{-fprofile-arcs}).  These
5573 heuristics are based on the control flow graph.  If some branch probabilities
5574 are specified by @samp{__builtin_expect}, then the heuristics will be
5575 used to guess branch probabilities for the rest of the control flow graph,
5576 taking the @samp{__builtin_expect} info into account.  The interactions
5577 between the heuristics and @samp{__builtin_expect} can be complex, and in
5578 some cases, it may be useful to disable the heuristics so that the effects
5579 of @samp{__builtin_expect} are easier to understand.
5580
5581 The default is @option{-fguess-branch-probability} at levels
5582 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5583
5584 @item -freorder-blocks
5585 @opindex freorder-blocks
5586 Reorder basic blocks in the compiled function in order to reduce number of
5587 taken branches and improve code locality.
5588
5589 Enabled at levels @option{-O2}, @option{-O3}.
5590
5591 @item -freorder-blocks-and-partition
5592 @opindex freorder-blocks-and-partition
5593 In addition to reordering basic blocks in the compiled function, in order
5594 to reduce number of taken branches, partitions hot and cold basic blocks
5595 into separate sections of the assembly and .o files, to improve
5596 paging and cache locality performance.
5597
5598 This optimization is automatically turned off in the presence of
5599 exception handling, for linkonce sections, for functions with a user-defined
5600 section attribute and on any architecture that does not support named
5601 sections.
5602
5603 @item -freorder-functions
5604 @opindex freorder-functions
5605 Reorder functions in the object file in order to
5606 improve code locality.  This is implemented by using special
5607 subsections @code{.text.hot} for most frequently executed functions and
5608 @code{.text.unlikely} for unlikely executed functions.  Reordering is done by
5609 the linker so object file format must support named sections and linker must
5610 place them in a reasonable way.
5611
5612 Also profile feedback must be available in to make this option effective.  See
5613 @option{-fprofile-arcs} for details.
5614
5615 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5616
5617 @item -fstrict-aliasing
5618 @opindex fstrict-aliasing
5619 Allows the compiler to assume the strictest aliasing rules applicable to
5620 the language being compiled.  For C (and C++), this activates
5621 optimizations based on the type of expressions.  In particular, an
5622 object of one type is assumed never to reside at the same address as an
5623 object of a different type, unless the types are almost the same.  For
5624 example, an @code{unsigned int} can alias an @code{int}, but not a
5625 @code{void*} or a @code{double}.  A character type may alias any other
5626 type.
5627
5628 Pay special attention to code like this:
5629 @smallexample
5630 union a_union @{
5631   int i;
5632   double d;
5633 @};
5634
5635 int f() @{
5636   a_union t;
5637   t.d = 3.0;
5638   return t.i;
5639 @}
5640 @end smallexample
5641 The practice of reading from a different union member than the one most
5642 recently written to (called ``type-punning'') is common.  Even with
5643 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
5644 is accessed through the union type.  So, the code above will work as
5645 expected.  However, this code might not:
5646 @smallexample
5647 int f() @{
5648   a_union t;
5649   int* ip;
5650   t.d = 3.0;
5651   ip = &t.i;
5652   return *ip;
5653 @}
5654 @end smallexample
5655
5656 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5657
5658 @item -fstrict-overflow
5659 @opindex fstrict-overflow
5660 Allow the compiler to assume strict signed overflow rules, depending
5661 on the language being compiled.  For C (and C++) this means that
5662 overflow when doing arithmetic with signed numbers is undefined, which
5663 means that the compiler may assume that it will not happen.  This
5664 permits various optimizations.  For example, the compiler will assume
5665 that an expression like @code{i + 10 > i} will always be true for
5666 signed @code{i}.  This assumption is only valid if signed overflow is
5667 undefined, as the expression is false if @code{i + 10} overflows when
5668 using twos complement arithmetic.  When this option is in effect any
5669 attempt to determine whether an operation on signed numbers will
5670 overflow must be written carefully to not actually involve overflow.
5671
5672 See also the @option{-fwrapv} option.  Using @option{-fwrapv} means
5673 that signed overflow is fully defined: it wraps.  When
5674 @option{-fwrapv} is used, there is no difference between
5675 @option{-fstrict-overflow} and @option{-fno-strict-overflow}.  With
5676 @option{-fwrapv} certain types of overflow are permitted.  For
5677 example, if the compiler gets an overflow when doing arithmetic on
5678 constants, the overflowed value can still be used with
5679 @option{-fwrapv}, but not otherwise.
5680
5681 The @option{-fstrict-overflow} option is enabled at levels
5682 @option{-O2}, @option{-O3}, @option{-Os}.
5683
5684 @item -falign-functions
5685 @itemx -falign-functions=@var{n}
5686 @opindex falign-functions
5687 Align the start of functions to the next power-of-two greater than
5688 @var{n}, skipping up to @var{n} bytes.  For instance,
5689 @option{-falign-functions=32} aligns functions to the next 32-byte
5690 boundary, but @option{-falign-functions=24} would align to the next
5691 32-byte boundary only if this can be done by skipping 23 bytes or less.
5692
5693 @option{-fno-align-functions} and @option{-falign-functions=1} are
5694 equivalent and mean that functions will not be aligned.
5695
5696 Some assemblers only support this flag when @var{n} is a power of two;
5697 in that case, it is rounded up.
5698
5699 If @var{n} is not specified or is zero, use a machine-dependent default.
5700
5701 Enabled at levels @option{-O2}, @option{-O3}.
5702
5703 @item -falign-labels
5704 @itemx -falign-labels=@var{n}
5705 @opindex falign-labels
5706 Align all branch targets to a power-of-two boundary, skipping up to
5707 @var{n} bytes like @option{-falign-functions}.  This option can easily
5708 make code slower, because it must insert dummy operations for when the
5709 branch target is reached in the usual flow of the code.
5710
5711 @option{-fno-align-labels} and @option{-falign-labels=1} are
5712 equivalent and mean that labels will not be aligned.
5713
5714 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
5715 are greater than this value, then their values are used instead.
5716
5717 If @var{n} is not specified or is zero, use a machine-dependent default
5718 which is very likely to be @samp{1}, meaning no alignment.
5719
5720 Enabled at levels @option{-O2}, @option{-O3}.
5721
5722 @item -falign-loops
5723 @itemx -falign-loops=@var{n}
5724 @opindex falign-loops
5725 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
5726 like @option{-falign-functions}.  The hope is that the loop will be
5727 executed many times, which will make up for any execution of the dummy
5728 operations.
5729
5730 @option{-fno-align-loops} and @option{-falign-loops=1} are
5731 equivalent and mean that loops will not be aligned.
5732
5733 If @var{n} is not specified or is zero, use a machine-dependent default.
5734
5735 Enabled at levels @option{-O2}, @option{-O3}.
5736
5737 @item -falign-jumps
5738 @itemx -falign-jumps=@var{n}
5739 @opindex falign-jumps
5740 Align branch targets to a power-of-two boundary, for branch targets
5741 where the targets can only be reached by jumping, skipping up to @var{n}
5742 bytes like @option{-falign-functions}.  In this case, no dummy operations
5743 need be executed.
5744
5745 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
5746 equivalent and mean that loops will not be aligned.
5747
5748 If @var{n} is not specified or is zero, use a machine-dependent default.
5749
5750 Enabled at levels @option{-O2}, @option{-O3}.
5751
5752 @item -funit-at-a-time
5753 @opindex funit-at-a-time
5754 Parse the whole compilation unit before starting to produce code.
5755 This allows some extra optimizations to take place but consumes
5756 more memory (in general).  There are some compatibility issues
5757 with @emph{unit-at-a-time} mode:
5758 @itemize @bullet
5759 @item
5760 enabling @emph{unit-at-a-time} mode may change the order
5761 in which functions, variables, and top-level @code{asm} statements
5762 are emitted, and will likely break code relying on some particular
5763 ordering.  The majority of such top-level @code{asm} statements,
5764 though, can be replaced by @code{section} attributes.  The
5765 @option{fno-toplevel-reorder} option may be used to keep the ordering
5766 used in the input file, at the cost of some optimizations.
5767
5768 @item
5769 @emph{unit-at-a-time} mode removes unreferenced static variables
5770 and functions.  This may result in undefined references
5771 when an @code{asm} statement refers directly to variables or functions
5772 that are otherwise unused.  In that case either the variable/function
5773 shall be listed as an operand of the @code{asm} statement operand or,
5774 in the case of top-level @code{asm} statements the attribute @code{used}
5775 shall be used on the declaration.
5776
5777 @item
5778 Static functions now can use non-standard passing conventions that
5779 may break @code{asm} statements calling functions directly.  Again,
5780 attribute @code{used} will prevent this behavior.
5781 @end itemize
5782
5783 As a temporary workaround, @option{-fno-unit-at-a-time} can be used,
5784 but this scheme may not be supported by future releases of GCC@.
5785
5786 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5787
5788 @item -fno-toplevel-reorder
5789 Do not reorder top-level functions, variables, and @code{asm}
5790 statements.  Output them in the same order that they appear in the
5791 input file.  When this option is used, unreferenced static variables
5792 will not be removed.  This option is intended to support existing code
5793 which relies on a particular ordering.  For new code, it is better to
5794 use attributes.
5795
5796 @item -fweb
5797 @opindex fweb
5798 Constructs webs as commonly used for register allocation purposes and assign
5799 each web individual pseudo register.  This allows the register allocation pass
5800 to operate on pseudos directly, but also strengthens several other optimization
5801 passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
5802 however, make debugging impossible, since variables will no longer stay in a
5803 ``home register''.
5804
5805 Enabled by default with @option{-funroll-loops}.
5806
5807 @item -fwhole-program
5808 @opindex fwhole-program
5809 Assume that the current compilation unit represents whole program being
5810 compiled.  All public functions and variables with the exception of @code{main}
5811 and those merged by attribute @code{externally_visible} become static functions
5812 and in a affect gets more aggressively optimized by interprocedural optimizers.
5813 While this option is equivalent to proper use of @code{static} keyword for
5814 programs consisting of single file, in combination with option
5815 @option{--combine} this flag can be used to compile most of smaller scale C
5816 programs since the functions and variables become local for the whole combined
5817 compilation unit, not for the single source file itself.
5818
5819
5820 @item -fno-cprop-registers
5821 @opindex fno-cprop-registers
5822 After register allocation and post-register allocation instruction splitting,
5823 we perform a copy-propagation pass to try to reduce scheduling dependencies
5824 and occasionally eliminate the copy.
5825
5826 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5827
5828 @item -fprofile-generate
5829 @opindex fprofile-generate
5830
5831 Enable options usually used for instrumenting application to produce
5832 profile useful for later recompilation with profile feedback based
5833 optimization.  You must use @option{-fprofile-generate} both when
5834 compiling and when linking your program.
5835
5836 The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
5837
5838 @item -fprofile-use
5839 @opindex fprofile-use
5840 Enable profile feedback directed optimizations, and optimizations
5841 generally profitable only with profile feedback available.
5842
5843 The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
5844 @code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}
5845
5846 By default, GCC emits an error message if the feedback profiles do not
5847 match the source code.  This error can be turned into a warning by using
5848 @option{-Wcoverage-mismatch}.  Note this may result in poorly optimized
5849 code.
5850 @end table
5851
5852 The following options control compiler behavior regarding floating
5853 point arithmetic.  These options trade off between speed and
5854 correctness.  All must be specifically enabled.
5855
5856 @table @gcctabopt
5857 @item -ffloat-store
5858 @opindex ffloat-store
5859 Do not store floating point variables in registers, and inhibit other
5860 options that might change whether a floating point value is taken from a
5861 register or memory.
5862
5863 @cindex floating point precision
5864 This option prevents undesirable excess precision on machines such as
5865 the 68000 where the floating registers (of the 68881) keep more
5866 precision than a @code{double} is supposed to have.  Similarly for the
5867 x86 architecture.  For most programs, the excess precision does only
5868 good, but a few programs rely on the precise definition of IEEE floating
5869 point.  Use @option{-ffloat-store} for such programs, after modifying
5870 them to store all pertinent intermediate computations into variables.
5871
5872 @item -ffast-math
5873 @opindex ffast-math
5874 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @*
5875 @option{-fno-trapping-math}, @option{-ffinite-math-only},
5876 @option{-fno-rounding-math}, @option{-fno-signaling-nans},
5877 @option{-fno-signed-zeros} and @option{fcx-limited-range}.
5878
5879 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
5880
5881 This option should never be turned on by any @option{-O} option since
5882 it can result in incorrect output for programs which depend on
5883 an exact implementation of IEEE or ISO rules/specifications for
5884 math functions.
5885
5886 @item -fno-math-errno
5887 @opindex fno-math-errno
5888 Do not set ERRNO after calling math functions that are executed
5889 with a single instruction, e.g., sqrt.  A program that relies on
5890 IEEE exceptions for math error handling may want to use this flag
5891 for speed while maintaining IEEE arithmetic compatibility.
5892
5893 This option should never be turned on by any @option{-O} option since
5894 it can result in incorrect output for programs which depend on
5895 an exact implementation of IEEE or ISO rules/specifications for
5896 math functions.
5897
5898 The default is @option{-fmath-errno}.
5899
5900 On Darwin systems, the math library never sets @code{errno}.  There is
5901 therefore no reason for the compiler to consider the possibility that
5902 it might, and @option{-fno-math-errno} is the default.
5903
5904 @item -funsafe-math-optimizations
5905 @opindex funsafe-math-optimizations
5906 Allow optimizations for floating-point arithmetic that (a) assume
5907 that arguments and results are valid and (b) may violate IEEE or
5908 ANSI standards.  When used at link-time, it may include libraries
5909 or startup files that change the default FPU control word or other
5910 similar optimizations.
5911
5912 This option should never be turned on by any @option{-O} option since
5913 it can result in incorrect output for programs which depend on
5914 an exact implementation of IEEE or ISO rules/specifications for
5915 math functions.
5916
5917 The default is @option{-fno-unsafe-math-optimizations}.
5918
5919 @item -ffinite-math-only
5920 @opindex ffinite-math-only
5921 Allow optimizations for floating-point arithmetic that assume
5922 that arguments and results are not NaNs or +-Infs.
5923
5924 This option should never be turned on by any @option{-O} option since
5925 it can result in incorrect output for programs which depend on
5926 an exact implementation of IEEE or ISO rules/specifications.
5927
5928 The default is @option{-fno-finite-math-only}.
5929
5930 @item -fno-signed-zeros
5931 @opindex fno-signed-zeros
5932 Allow optimizations for floating point arithmetic that ignore the
5933 signedness of zero.  IEEE arithmetic specifies the behavior of
5934 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
5935 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
5936 This option implies that the sign of a zero result isn't significant.
5937
5938 The default is @option{-fsigned-zeros}.
5939
5940 @item -fno-trapping-math
5941 @opindex fno-trapping-math
5942 Compile code assuming that floating-point operations cannot generate
5943 user-visible traps.  These traps include division by zero, overflow,
5944 underflow, inexact result and invalid operation.  This option implies
5945 @option{-fno-signaling-nans}.  Setting this option may allow faster
5946 code if one relies on ``non-stop'' IEEE arithmetic, for example.
5947
5948 This option should never be turned on by any @option{-O} option since
5949 it can result in incorrect output for programs which depend on
5950 an exact implementation of IEEE or ISO rules/specifications for
5951 math functions.
5952
5953 The default is @option{-ftrapping-math}.
5954
5955 @item -frounding-math
5956 @opindex frounding-math
5957 Disable transformations and optimizations that assume default floating
5958 point rounding behavior.  This is round-to-zero for all floating point
5959 to integer conversions, and round-to-nearest for all other arithmetic
5960 truncations.  This option should be specified for programs that change
5961 the FP rounding mode dynamically, or that may be executed with a
5962 non-default rounding mode.  This option disables constant folding of
5963 floating point expressions at compile-time (which may be affected by
5964 rounding mode) and arithmetic transformations that are unsafe in the
5965 presence of sign-dependent rounding modes.
5966
5967 The default is @option{-fno-rounding-math}.
5968
5969 This option is experimental and does not currently guarantee to
5970 disable all GCC optimizations that are affected by rounding mode.
5971 Future versions of GCC may provide finer control of this setting
5972 using C99's @code{FENV_ACCESS} pragma.  This command line option
5973 will be used to specify the default state for @code{FENV_ACCESS}.
5974
5975 @item -frtl-abstract-sequences
5976 @opindex frtl-abstract-sequences
5977 It is a size optimization method. This option is to find identical
5978 sequences of code, which can be turned into pseudo-procedures  and
5979 then  replace  all  occurrences with  calls to  the  newly created
5980 subroutine. It is kind of an opposite of @option{-finline-functions}.
5981 This optimization runs at RTL level.
5982
5983 @item -fsignaling-nans
5984 @opindex fsignaling-nans
5985 Compile code assuming that IEEE signaling NaNs may generate user-visible
5986 traps during floating-point operations.  Setting this option disables
5987 optimizations that may change the number of exceptions visible with
5988 signaling NaNs.  This option implies @option{-ftrapping-math}.
5989
5990 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
5991 be defined.
5992
5993 The default is @option{-fno-signaling-nans}.
5994
5995 This option is experimental and does not currently guarantee to
5996 disable all GCC optimizations that affect signaling NaN behavior.
5997
5998 @item -fsingle-precision-constant
5999 @opindex fsingle-precision-constant
6000 Treat floating point constant as single precision constant instead of
6001 implicitly converting it to double precision constant.
6002
6003 @item -fcx-limited-range
6004 @itemx -fno-cx-limited-range
6005 @opindex fcx-limited-range
6006 @opindex fno-cx-limited-range
6007 When enabled, this option states that a range reduction step is not
6008 needed when performing complex division.  The default is
6009 @option{-fno-cx-limited-range}, but is enabled by @option{-ffast-math}.
6010
6011 This option controls the default setting of the ISO C99 
6012 @code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
6013 all languages.
6014
6015 @end table
6016
6017 The following options control optimizations that may improve
6018 performance, but are not enabled by any @option{-O} options.  This
6019 section includes experimental options that may produce broken code.
6020
6021 @table @gcctabopt
6022 @item -fbranch-probabilities
6023 @opindex fbranch-probabilities
6024 After running a program compiled with @option{-fprofile-arcs}
6025 (@pxref{Debugging Options,, Options for Debugging Your Program or
6026 @command{gcc}}), you can compile it a second time using
6027 @option{-fbranch-probabilities}, to improve optimizations based on
6028 the number of times each branch was taken.  When the program
6029 compiled with @option{-fprofile-arcs} exits it saves arc execution
6030 counts to a file called @file{@var{sourcename}.gcda} for each source
6031 file.  The information in this data file is very dependent on the
6032 structure of the generated code, so you must use the same source code
6033 and the same optimization options for both compilations.
6034
6035 With @option{-fbranch-probabilities}, GCC puts a
6036 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
6037 These can be used to improve optimization.  Currently, they are only
6038 used in one place: in @file{reorg.c}, instead of guessing which path a
6039 branch is mostly to take, the @samp{REG_BR_PROB} values are used to
6040 exactly determine which path is taken more often.
6041
6042 @item -fprofile-values
6043 @opindex fprofile-values
6044 If combined with @option{-fprofile-arcs}, it adds code so that some
6045 data about values of expressions in the program is gathered.
6046
6047 With @option{-fbranch-probabilities}, it reads back the data gathered
6048 from profiling values of expressions and adds @samp{REG_VALUE_PROFILE}
6049 notes to instructions for their later usage in optimizations.
6050
6051 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
6052
6053 @item -fvpt
6054 @opindex fvpt
6055 If combined with @option{-fprofile-arcs}, it instructs the compiler to add
6056 a code to gather information about values of expressions.
6057
6058 With @option{-fbranch-probabilities}, it reads back the data gathered
6059 and actually performs the optimizations based on them.
6060 Currently the optimizations include specialization of division operation
6061 using the knowledge about the value of the denominator.
6062
6063 @item -frename-registers
6064 @opindex frename-registers
6065 Attempt to avoid false dependencies in scheduled code by making use
6066 of registers left over after register allocation.  This optimization
6067 will most benefit processors with lots of registers.  Depending on the
6068 debug information format adopted by the target, however, it can
6069 make debugging impossible, since variables will no longer stay in
6070 a ``home register''.
6071
6072 Enabled by default with @option{-funroll-loops}.
6073
6074 @item -ftracer
6075 @opindex ftracer
6076 Perform tail duplication to enlarge superblock size.  This transformation
6077 simplifies the control flow of the function allowing other optimizations to do
6078 better job.
6079
6080 Enabled with @option{-fprofile-use}.
6081
6082 @item -funroll-loops
6083 @opindex funroll-loops
6084 Unroll loops whose number of iterations can be determined at compile time or
6085 upon entry to the loop.  @option{-funroll-loops} implies
6086 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}. 
6087 It also turns on complete loop peeling (i.e.@: complete removal of loops with
6088 small constant number of iterations).  This option makes code larger, and may
6089 or may not make it run faster.
6090
6091 Enabled with @option{-fprofile-use}.
6092
6093 @item -funroll-all-loops
6094 @opindex funroll-all-loops
6095 Unroll all loops, even if their number of iterations is uncertain when
6096 the loop is entered.  This usually makes programs run more slowly.
6097 @option{-funroll-all-loops} implies the same options as
6098 @option{-funroll-loops}.
6099
6100 @item -fpeel-loops
6101 @opindex fpeel-loops
6102 Peels the loops for that there is enough information that they do not
6103 roll much (from profile feedback).  It also turns on complete loop peeling
6104 (i.e.@: complete removal of loops with small constant number of iterations).
6105
6106 Enabled with @option{-fprofile-use}.
6107
6108 @item -fmove-loop-invariants
6109 @opindex fmove-loop-invariants
6110 Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
6111 at level @option{-O1}
6112
6113 @item -funswitch-loops
6114 @opindex funswitch-loops
6115 Move branches with loop invariant conditions out of the loop, with duplicates
6116 of the loop on both branches (modified according to result of the condition).
6117
6118 @item -ffunction-sections
6119 @itemx -fdata-sections
6120 @opindex ffunction-sections
6121 @opindex fdata-sections
6122 Place each function or data item into its own section in the output
6123 file if the target supports arbitrary sections.  The name of the
6124 function or the name of the data item determines the section's name
6125 in the output file.
6126
6127 Use these options on systems where the linker can perform optimizations
6128 to improve locality of reference in the instruction space.  Most systems
6129 using the ELF object format and SPARC processors running Solaris 2 have
6130 linkers with such optimizations.  AIX may have these optimizations in
6131 the future.
6132
6133 Only use these options when there are significant benefits from doing
6134 so.  When you specify these options, the assembler and linker will
6135 create larger object and executable files and will also be slower.
6136 You will not be able to use @code{gprof} on all systems if you
6137 specify this option and you may have problems with debugging if
6138 you specify both this option and @option{-g}.
6139
6140 @item -fbranch-target-load-optimize
6141 @opindex fbranch-target-load-optimize
6142 Perform branch target register load optimization before prologue / epilogue
6143 threading.
6144 The use of target registers can typically be exposed only during reload,
6145 thus hoisting loads out of loops and doing inter-block scheduling needs
6146 a separate optimization pass.
6147
6148 @item -fbranch-target-load-optimize2
6149 @opindex fbranch-target-load-optimize2
6150 Perform branch target register load optimization after prologue / epilogue
6151 threading.
6152
6153 @item -fbtr-bb-exclusive
6154 @opindex fbtr-bb-exclusive
6155 When performing branch target register load optimization, don't reuse
6156 branch target registers in within any basic block.
6157
6158 @item -fstack-protector
6159 Emit extra code to check for buffer overflows, such as stack smashing
6160 attacks.  This is done by adding a guard variable to functions with
6161 vulnerable objects.  This includes functions that call alloca, and
6162 functions with buffers larger than 8 bytes.  The guards are initialized
6163 when a function is entered and then checked when the function exits.
6164 If a guard check fails, an error message is printed and the program exits.
6165
6166 @item -fstack-protector-all
6167 Like @option{-fstack-protector} except that all functions are protected.
6168
6169 @item -fsection-anchors
6170 @opindex fsection-anchors
6171 Try to reduce the number of symbolic address calculations by using
6172 shared ``anchor'' symbols to address nearby objects.  This transformation
6173 can help to reduce the number of GOT entries and GOT accesses on some
6174 targets.
6175
6176 For example, the implementation of the following function @code{foo}:
6177
6178 @smallexample
6179 static int a, b, c;
6180 int foo (void) @{ return a + b + c; @}
6181 @end smallexample
6182
6183 would usually calculate the addresses of all three variables, but if you
6184 compile it with @option{-fsection-anchors}, it will access the variables
6185 from a common anchor point instead.  The effect is similar to the
6186 following pseudocode (which isn't valid C):
6187
6188 @smallexample
6189 int foo (void)
6190 @{
6191   register int *xr = &x;
6192   return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
6193 @}
6194 @end smallexample
6195
6196 Not all targets support this option.
6197
6198 @item --param @var{name}=@var{value}
6199 @opindex param
6200 In some places, GCC uses various constants to control the amount of
6201 optimization that is done.  For example, GCC will not inline functions
6202 that contain more that a certain number of instructions.  You can
6203 control some of these constants on the command-line using the
6204 @option{--param} option.
6205
6206 The names of specific parameters, and the meaning of the values, are
6207 tied to the internals of the compiler, and are subject to change
6208 without notice in future releases.
6209
6210 In each case, the @var{value} is an integer.  The allowable choices for
6211 @var{name} are given in the following table:
6212
6213 @table @gcctabopt
6214 @item salias-max-implicit-fields
6215 The maximum number of fields in a variable without direct
6216 structure accesses for which structure aliasing will consider trying 
6217 to track each field.  The default is 5
6218
6219 @item salias-max-array-elements
6220 The maximum number of elements an array can have and its elements
6221 still be tracked individually by structure aliasing. The default is 4
6222
6223 @item sra-max-structure-size
6224 The maximum structure size, in bytes, at which the scalar replacement
6225 of aggregates (SRA) optimization will perform block copies.  The
6226 default value, 0, implies that GCC will select the most appropriate
6227 size itself.
6228
6229 @item sra-field-structure-ratio
6230 The threshold ratio (as a percentage) between instantiated fields and
6231 the complete structure size.  We say that if the ratio of the number
6232 of bytes in instantiated fields to the number of bytes in the complete
6233 structure exceeds this parameter, then block copies are not used.  The
6234 default is 75.
6235
6236 @item max-crossjump-edges
6237 The maximum number of incoming edges to consider for crossjumping.
6238 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
6239 the number of edges incoming to each block.  Increasing values mean
6240 more aggressive optimization, making the compile time increase with
6241 probably small improvement in executable size.
6242
6243 @item min-crossjump-insns
6244 The minimum number of instructions which must be matched at the end
6245 of two blocks before crossjumping will be performed on them.  This
6246 value is ignored in the case where all instructions in the block being
6247 crossjumped from are matched.  The default value is 5.
6248
6249 @item max-grow-copy-bb-insns
6250 The maximum code size expansion factor when copying basic blocks
6251 instead of jumping.  The expansion is relative to a jump instruction.
6252 The default value is 8.
6253
6254 @item max-goto-duplication-insns
6255 The maximum number of instructions to duplicate to a block that jumps
6256 to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
6257 passes, GCC factors computed gotos early in the compilation process,
6258 and unfactors them as late as possible.  Only computed jumps at the
6259 end of a basic blocks with no more than max-goto-duplication-insns are
6260 unfactored.  The default value is 8.
6261
6262 @item max-delay-slot-insn-search
6263 The maximum number of instructions to consider when looking for an
6264 instruction to fill a delay slot.  If more than this arbitrary number of
6265 instructions is searched, the time savings from filling the delay slot
6266 will be minimal so stop searching.  Increasing values mean more
6267 aggressive optimization, making the compile time increase with probably
6268 small improvement in executable run time.
6269
6270 @item max-delay-slot-live-search
6271 When trying to fill delay slots, the maximum number of instructions to
6272 consider when searching for a block with valid live register
6273 information.  Increasing this arbitrarily chosen value means more
6274 aggressive optimization, increasing the compile time.  This parameter
6275 should be removed when the delay slot code is rewritten to maintain the
6276 control-flow graph.
6277
6278 @item max-gcse-memory
6279 The approximate maximum amount of memory that will be allocated in
6280 order to perform the global common subexpression elimination
6281 optimization.  If more memory than specified is required, the
6282 optimization will not be done.
6283
6284 @item max-gcse-passes
6285 The maximum number of passes of GCSE to run.  The default is 1.
6286
6287 @item max-pending-list-length
6288 The maximum number of pending dependencies scheduling will allow
6289 before flushing the current state and starting over.  Large functions
6290 with few branches or calls can create excessively large lists which
6291 needlessly consume memory and resources.
6292
6293 @item max-inline-insns-single
6294 Several parameters control the tree inliner used in gcc.
6295 This number sets the maximum number of instructions (counted in GCC's
6296 internal representation) in a single function that the tree inliner
6297 will consider for inlining.  This only affects functions declared
6298 inline and methods implemented in a class declaration (C++).
6299 The default value is 450.
6300
6301 @item max-inline-insns-auto
6302 When you use @option{-finline-functions} (included in @option{-O3}),
6303 a lot of functions that would otherwise not be considered for inlining
6304 by the compiler will be investigated.  To those functions, a different
6305 (more restrictive) limit compared to functions declared inline can
6306 be applied.
6307 The default value is 90.
6308
6309 @item large-function-insns
6310 The limit specifying really large functions.  For functions larger than this
6311 limit after inlining inlining is constrained by
6312 @option{--param large-function-growth}.  This parameter is useful primarily
6313 to avoid extreme compilation time caused by non-linear algorithms used by the
6314 backend.
6315 This parameter is ignored when @option{-funit-at-a-time} is not used.
6316 The default value is 2700.
6317
6318 @item large-function-growth
6319 Specifies maximal growth of large function caused by inlining in percents.
6320 This parameter is ignored when @option{-funit-at-a-time} is not used.
6321 The default value is 100 which limits large function growth to 2.0 times
6322 the original size.
6323
6324 @item large-unit-insns
6325 The limit specifying large translation unit.  Growth caused by inlining of
6326 units larger than this limit is limited by @option{--param inline-unit-growth}.
6327 For small units this might be too tight (consider unit consisting of function A
6328 that is inline and B that just calls A three time.  If B is small relative to
6329 A, the growth of unit is 300\% and yet such inlining is very sane.  For very
6330 large units consisting of small inlininable functions however the overall unit
6331 growth limit is needed to avoid exponential explosion of code size.  Thus for
6332 smaller units, the size is increased to @option{--param large-unit-insns}
6333 before applying @option{--param inline-unit-growth}.  The default is 10000
6334
6335 @item inline-unit-growth
6336 Specifies maximal overall growth of the compilation unit caused by inlining.
6337 This parameter is ignored when @option{-funit-at-a-time} is not used.
6338 The default value is 30 which limits unit growth to 1.3 times the original
6339 size.
6340
6341 @item large-stack-frame
6342 The limit specifying large stack frames.  While inlining the algorithm is trying
6343 to not grow past this limit too much.  Default value is 256 bytes.
6344
6345 @item large-stack-frame-growth
6346 Specifies maximal growth of large stack frames caused by inlining in percents.
6347 The default value is 1000 which limits large stack frame growth to 11 times
6348 the original size.
6349
6350 @item max-inline-insns-recursive
6351 @itemx max-inline-insns-recursive-auto
6352 Specifies maximum number of instructions out-of-line copy of self recursive inline
6353 function can grow into by performing recursive inlining.
6354
6355 For functions declared inline @option{--param max-inline-insns-recursive} is
6356 taken into account.  For function not declared inline, recursive inlining
6357 happens only when @option{-finline-functions} (included in @option{-O3}) is
6358 enabled and @option{--param max-inline-insns-recursive-auto} is used.  The
6359 default value is 450.
6360
6361 @item max-inline-recursive-depth
6362 @itemx max-inline-recursive-depth-auto
6363 Specifies maximum recursion depth used by the recursive inlining.
6364
6365 For functions declared inline @option{--param max-inline-recursive-depth} is
6366 taken into account.  For function not declared inline, recursive inlining
6367 happens only when @option{-finline-functions} (included in @option{-O3}) is
6368 enabled and @option{--param max-inline-recursive-depth-auto} is used.  The
6369 default value is 450.
6370
6371 @item min-inline-recursive-probability
6372 Recursive inlining is profitable only for function having deep recursion
6373 in average and can hurt for function having little recursion depth by
6374 increasing the prologue size or complexity of function body to other
6375 optimizers.
6376
6377 When profile feedback is available (see @option{-fprofile-generate}) the actual
6378 recursion depth can be guessed from probability that function will recurse via
6379 given call expression.  This parameter limits inlining only to call expression
6380 whose probability exceeds given threshold (in percents).  The default value is
6381 10.
6382
6383 @item inline-call-cost
6384 Specify cost of call instruction relative to simple arithmetics operations
6385 (having cost of 1).  Increasing this cost disqualifies inlining of non-leaf
6386 functions and at the same time increases size of leaf function that is believed to
6387 reduce function size by being inlined.  In effect it increases amount of
6388 inlining for code having large abstraction penalty (many functions that just
6389 pass the arguments to other functions) and decrease inlining for code with low
6390 abstraction penalty.  The default value is 16.
6391
6392 @item min-vect-loop-bound
6393 The minimum number of iterations under which a loop will not get vectorized 
6394 when @option{-ftree-vectorize} is used.  The number of iterations after 
6395 vectorization needs to be greater than the value specified by this option
6396 to allow vectorization.  The default value is 0.
6397
6398 @item max-unrolled-insns
6399 The maximum number of instructions that a loop should have if that loop
6400 is unrolled, and if the loop is unrolled, it determines how many times
6401 the loop code is unrolled.
6402
6403 @item max-average-unrolled-insns
6404 The maximum number of instructions biased by probabilities of their execution
6405 that a loop should have if that loop is unrolled, and if the loop is unrolled,
6406 it determines how many times the loop code is unrolled.
6407
6408 @item max-unroll-times
6409 The maximum number of unrollings of a single loop.
6410
6411 @item max-peeled-insns
6412 The maximum number of instructions that a loop should have if that loop
6413 is peeled, and if the loop is peeled, it determines how many times
6414 the loop code is peeled.
6415
6416 @item max-peel-times
6417 The maximum number of peelings of a single loop.
6418
6419 @item max-completely-peeled-insns
6420 The maximum number of insns of a completely peeled loop.
6421
6422 @item max-completely-peel-times
6423 The maximum number of iterations of a loop to be suitable for complete peeling.
6424
6425 @item max-unswitch-insns
6426 The maximum number of insns of an unswitched loop.
6427
6428 @item max-unswitch-level
6429 The maximum number of branches unswitched in a single loop.
6430
6431 @item lim-expensive
6432 The minimum cost of an expensive expression in the loop invariant motion.
6433
6434 @item iv-consider-all-candidates-bound
6435 Bound on number of candidates for induction variables below that
6436 all candidates are considered for each use in induction variable
6437 optimizations.  Only the most relevant candidates are considered
6438 if there are more candidates, to avoid quadratic time complexity.
6439
6440 @item iv-max-considered-uses
6441 The induction variable optimizations give up on loops that contain more
6442 induction variable uses.
6443
6444 @item iv-always-prune-cand-set-bound
6445 If number of candidates in the set is smaller than this value,
6446 we always try to remove unnecessary ivs from the set during its
6447 optimization when a new iv is added to the set.
6448
6449 @item scev-max-expr-size
6450 Bound on size of expressions used in the scalar evolutions analyzer.
6451 Large expressions slow the analyzer.
6452
6453 @item vect-max-version-checks
6454 The maximum number of runtime checks that can be performed when doing
6455 loop versioning in the vectorizer.  See option ftree-vect-loop-version
6456 for more information.
6457
6458 @item max-iterations-to-track
6459
6460 The maximum number of iterations of a loop the brute force algorithm
6461 for analysis of # of iterations of the loop tries to evaluate.
6462
6463 @item hot-bb-count-fraction
6464 Select fraction of the maximal count of repetitions of basic block in program
6465 given basic block needs to have to be considered hot.
6466
6467 @item hot-bb-frequency-fraction
6468 Select fraction of the maximal frequency of executions of basic block in
6469 function given basic block needs to have to be considered hot
6470
6471 @item max-predicted-iterations
6472 The maximum number of loop iterations we predict statically.  This is useful
6473 in cases where function contain single loop with known bound and other loop
6474 with unknown.  We predict the known number of iterations correctly, while
6475 the unknown number of iterations average to roughly 10.  This means that the
6476 loop without bounds would appear artificially cold relative to the other one.
6477
6478 @item tracer-dynamic-coverage
6479 @itemx tracer-dynamic-coverage-feedback
6480
6481 This value is used to limit superblock formation once the given percentage of
6482 executed instructions is covered.  This limits unnecessary code size
6483 expansion.
6484
6485 The @option{tracer-dynamic-coverage-feedback} is used only when profile
6486 feedback is available.  The real profiles (as opposed to statically estimated
6487 ones) are much less balanced allowing the threshold to be larger value.
6488
6489 @item tracer-max-code-growth
6490 Stop tail duplication once code growth has reached given percentage.  This is
6491 rather hokey argument, as most of the duplicates will be eliminated later in
6492 cross jumping, so it may be set to much higher values than is the desired code
6493 growth.
6494
6495 @item tracer-min-branch-ratio
6496
6497 Stop reverse growth when the reverse probability of best edge is less than this
6498 threshold (in percent).
6499
6500 @item tracer-min-branch-ratio
6501 @itemx tracer-min-branch-ratio-feedback
6502
6503 Stop forward growth if the best edge do have probability lower than this
6504 threshold.
6505
6506 Similarly to @option{tracer-dynamic-coverage} two values are present, one for
6507 compilation for profile feedback and one for compilation without.  The value
6508 for compilation with profile feedback needs to be more conservative (higher) in
6509 order to make tracer effective.
6510
6511 @item max-cse-path-length
6512
6513 Maximum number of basic blocks on path that cse considers.  The default is 10.
6514
6515 @item max-cse-insns
6516 The maximum instructions CSE process before flushing. The default is 1000.
6517
6518 @item max-aliased-vops
6519
6520 Maximum number of virtual operands per statement allowed to represent
6521 aliases before triggering the alias grouping heuristic.  Alias
6522 grouping reduces compile times and memory consumption needed for
6523 aliasing at the expense of precision loss in alias information.
6524
6525 @item ggc-min-expand
6526
6527 GCC uses a garbage collector to manage its own memory allocation.  This
6528 parameter specifies the minimum percentage by which the garbage
6529 collector's heap should be allowed to expand between collections.
6530 Tuning this may improve compilation speed; it has no effect on code
6531 generation.
6532
6533 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
6534 RAM >= 1GB@.  If @code{getrlimit} is available, the notion of "RAM" is
6535 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
6536 GCC is not able to calculate RAM on a particular platform, the lower
6537 bound of 30% is used.  Setting this parameter and
6538 @option{ggc-min-heapsize} to zero causes a full collection to occur at
6539 every opportunity.  This is extremely slow, but can be useful for
6540 debugging.
6541
6542 @item ggc-min-heapsize
6543
6544 Minimum size of the garbage collector's heap before it begins bothering
6545 to collect garbage.  The first collection occurs after the heap expands
6546 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
6547 tuning this may improve compilation speed, and has no effect on code
6548 generation.
6549
6550 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit which
6551 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
6552 with a lower bound of 4096 (four megabytes) and an upper bound of
6553 131072 (128 megabytes).  If GCC is not able to calculate RAM on a
6554 particular platform, the lower bound is used.  Setting this parameter
6555 very large effectively disables garbage collection.  Setting this
6556 parameter and @option{ggc-min-expand} to zero causes a full collection
6557 to occur at every opportunity.
6558
6559 @item max-reload-search-insns
6560 The maximum number of instruction reload should look backward for equivalent
6561 register.  Increasing values mean more aggressive optimization, making the
6562 compile time increase with probably slightly better performance.  The default
6563 value is 100.
6564
6565 @item max-cselib-memory-locations
6566 The maximum number of memory locations cselib should take into account.
6567 Increasing values mean more aggressive optimization, making the compile time
6568 increase with probably slightly better performance.  The default value is 500.
6569
6570 @item max-flow-memory-locations
6571 Similar as @option{max-cselib-memory-locations} but for dataflow liveness.
6572 The default value is 100.
6573
6574 @item reorder-blocks-duplicate
6575 @itemx reorder-blocks-duplicate-feedback
6576
6577 Used by basic block reordering pass to decide whether to use unconditional
6578 branch or duplicate the code on its destination.  Code is duplicated when its
6579 estimated size is smaller than this value multiplied by the estimated size of
6580 unconditional jump in the hot spots of the program.
6581
6582 The @option{reorder-block-duplicate-feedback} is used only when profile
6583 feedback is available and may be set to higher values than
6584 @option{reorder-block-duplicate} since information about the hot spots is more
6585 accurate.
6586
6587 @item max-sched-ready-insns
6588 The maximum number of instructions ready to be issued the scheduler should
6589 consider at any given time during the first scheduling pass.  Increasing
6590 values mean more thorough searches, making the compilation time increase
6591 with probably little benefit.  The default value is 100.
6592
6593 @item max-sched-region-blocks
6594 The maximum number of blocks in a region to be considered for
6595 interblock scheduling.  The default value is 10.
6596
6597 @item max-sched-region-insns
6598 The maximum number of insns in a region to be considered for
6599 interblock scheduling.  The default value is 100.
6600
6601 @item min-spec-prob
6602 The minimum probability (in percents) of reaching a source block
6603 for interblock speculative scheduling.  The default value is 40.
6604
6605 @item max-sched-extend-regions-iters
6606 The maximum number of iterations through CFG to extend regions.
6607 0 - disable region extension,
6608 N - do at most N iterations.
6609 The default value is 0.
6610
6611 @item max-sched-insn-conflict-delay
6612 The maximum conflict delay for an insn to be considered for speculative motion.
6613 The default value is 3.
6614
6615 @item sched-spec-prob-cutoff
6616 The minimal probability of speculation success (in percents), so that
6617 speculative insn will be scheduled.
6618 The default value is 40.
6619
6620 @item max-last-value-rtl
6621
6622 The maximum size measured as number of RTLs that can be recorded in an expression
6623 in combiner for a pseudo register as last known value of that register.  The default
6624 is 10000.
6625
6626 @item integer-share-limit
6627 Small integer constants can use a shared data structure, reducing the
6628 compiler's memory usage and increasing its speed.  This sets the maximum
6629 value of a shared integer constant's.  The default value is 256.
6630
6631 @item min-virtual-mappings
6632 Specifies the minimum number of virtual mappings in the incremental
6633 SSA updater that should be registered to trigger the virtual mappings
6634 heuristic defined by virtual-mappings-ratio.  The default value is
6635 100.
6636
6637 @item virtual-mappings-ratio
6638 If the number of virtual mappings is virtual-mappings-ratio bigger
6639 than the number of virtual symbols to be updated, then the incremental
6640 SSA updater switches to a full update for those symbols.  The default
6641 ratio is 3.
6642
6643 @item ssp-buffer-size
6644 The minimum size of buffers (i.e. arrays) that will receive stack smashing
6645 protection when @option{-fstack-protection} is used.
6646
6647 @item max-jump-thread-duplication-stmts
6648 Maximum number of statements allowed in a block that needs to be
6649 duplicated when threading jumps.
6650
6651 @item max-fields-for-field-sensitive
6652 Maximum number of fields in a structure we will treat in
6653 a field sensitive manner during pointer analysis.
6654
6655 @item prefetch-latency
6656 Estimate on average number of instructions that are executed before
6657 prefetch finishes.  The distance we prefetch ahead is proportional
6658 to this constant.  Increasing this number may also lead to less
6659 streams being prefetched (see @option{simultaneous-prefetches}).
6660
6661 @item simultaneous-prefetches
6662 Maximum number of prefetches that can run at the same time.
6663
6664 @item l1-cache-line-size
6665 The size of cache line in L1 cache, in bytes.
6666
6667 @item l1-cache-size
6668 The number of cache lines in L1 cache.
6669
6670 @item verify-canonical-types
6671 Whether the compiler should verify the ``canonical'' types used for
6672 type equality comparisons within the C++ and Objective-C++ front
6673 ends. Set to 1 (the default when GCC is configured with
6674 --enable-checking) to enable verification, 0 to disable verification
6675 (the default when GCC is configured with --disable-checking).
6676
6677 @end table
6678 @end table
6679
6680 @node Preprocessor Options
6681 @section Options Controlling the Preprocessor
6682 @cindex preprocessor options
6683 @cindex options, preprocessor
6684
6685 These options control the C preprocessor, which is run on each C source
6686 file before actual compilation.
6687
6688 If you use the @option{-E} option, nothing is done except preprocessing.
6689 Some of these options make sense only together with @option{-E} because
6690 they cause the preprocessor output to be unsuitable for actual
6691 compilation.
6692
6693 @table @gcctabopt
6694 @opindex Wp
6695 You can use @option{-Wp,@var{option}} to bypass the compiler driver
6696 and pass @var{option} directly through to the preprocessor.  If
6697 @var{option} contains commas, it is split into multiple options at the
6698 commas.  However, many options are modified, translated or interpreted
6699 by the compiler driver before being passed to the preprocessor, and
6700 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
6701 interface is undocumented and subject to change, so whenever possible
6702 you should avoid using @option{-Wp} and let the driver handle the
6703 options instead.
6704
6705 @item -Xpreprocessor @var{option}
6706 @opindex preprocessor
6707 Pass @var{option} as an option to the preprocessor.  You can use this to
6708 supply system-specific preprocessor options which GCC does not know how to
6709 recognize.
6710
6711 If you want to pass an option that takes an argument, you must use
6712 @option{-Xpreprocessor} twice, once for the option and once for the argument.
6713 @end table
6714
6715 @include cppopts.texi
6716
6717 @node Assembler Options
6718 @section Passing Options to the Assembler
6719
6720 @c prevent bad page break with this line
6721 You can pass options to the assembler.
6722
6723 @table @gcctabopt
6724 @item -Wa,@var{option}
6725 @opindex Wa
6726 Pass @var{option} as an option to the assembler.  If @var{option}
6727 contains commas, it is split into multiple options at the commas.
6728
6729 @item -Xassembler @var{option}
6730 @opindex Xassembler
6731 Pass @var{option} as an option to the assembler.  You can use this to
6732 supply system-specific assembler options which GCC does not know how to
6733 recognize.
6734
6735 If you want to pass an option that takes an argument, you must use
6736 @option{-Xassembler} twice, once for the option and once for the argument.
6737
6738 @end table
6739
6740 @node Link Options
6741 @section Options for Linking
6742 @cindex link options
6743 @cindex options, linking
6744
6745 These options come into play when the compiler links object files into
6746 an executable output file.  They are meaningless if the compiler is
6747 not doing a link step.
6748
6749 @table @gcctabopt
6750 @cindex file names
6751 @item @var{object-file-name}
6752 A file name that does not end in a special recognized suffix is
6753 considered to name an object file or library.  (Object files are
6754 distinguished from libraries by the linker according to the file
6755 contents.)  If linking is done, these object files are used as input
6756 to the linker.
6757
6758 @item -c
6759 @itemx -S
6760 @itemx -E
6761 @opindex c
6762 @opindex S
6763 @opindex E
6764 If any of these options is used, then the linker is not run, and
6765 object file names should not be used as arguments.  @xref{Overall
6766 Options}.
6767
6768 @cindex Libraries
6769 @item -l@var{library}
6770 @itemx -l @var{library}
6771 @opindex l
6772 Search the library named @var{library} when linking.  (The second
6773 alternative with the library as a separate argument is only for
6774 POSIX compliance and is not recommended.)
6775
6776 It makes a difference where in the command you write this option; the
6777 linker searches and processes libraries and object files in the order they
6778 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
6779 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
6780 to functions in @samp{z}, those functions may not be loaded.
6781
6782 The linker searches a standard list of directories for the library,
6783 which is actually a file named @file{lib@var{library}.a}.  The linker
6784 then uses this file as if it had been specified precisely by name.
6785
6786 The directories searched include several standard system directories
6787 plus any that you specify with @option{-L}.
6788
6789 Normally the files found this way are library files---archive files
6790 whose members are object files.  The linker handles an archive file by
6791 scanning through it for members which define symbols that have so far
6792 been referenced but not defined.  But if the file that is found is an
6793 ordinary object file, it is linked in the usual fashion.  The only
6794 difference between using an @option{-l} option and specifying a file name
6795 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
6796 and searches several directories.
6797
6798 @item -lobjc
6799 @opindex lobjc
6800 You need this special case of the @option{-l} option in order to
6801 link an Objective-C or Objective-C++ program.
6802
6803 @item -nostartfiles
6804 @opindex nostartfiles
6805 Do not use the standard system startup files when linking.
6806 The standard system libraries are used normally, unless @option{-nostdlib}
6807 or @option{-nodefaultlibs} is used.
6808
6809 @item -nodefaultlibs
6810 @opindex nodefaultlibs
6811 Do not use the standard system libraries when linking.
6812 Only the libraries you specify will be passed to the linker.
6813 The standard startup files are used normally, unless @option{-nostartfiles}
6814 is used.  The compiler may generate calls to @code{memcmp},
6815 @code{memset}, @code{memcpy} and @code{memmove}.
6816 These entries are usually resolved by entries in
6817 libc.  These entry points should be supplied through some other
6818 mechanism when this option is specified.
6819
6820 @item -nostdlib
6821 @opindex nostdlib
6822 Do not use the standard system startup files or libraries when linking.
6823 No startup files and only the libraries you specify will be passed to
6824 the linker.  The compiler may generate calls to @code{memcmp}, @code{memset},
6825 @code{memcpy} and @code{memmove}.
6826 These entries are usually resolved by entries in
6827 libc.  These entry points should be supplied through some other
6828 mechanism when this option is specified.
6829
6830 @cindex @option{-lgcc}, use with @option{-nostdlib}
6831 @cindex @option{-nostdlib} and unresolved references
6832 @cindex unresolved references and @option{-nostdlib}
6833 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
6834 @cindex @option{-nodefaultlibs} and unresolved references
6835 @cindex unresolved references and @option{-nodefaultlibs}
6836 One of the standard libraries bypassed by @option{-nostdlib} and
6837 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
6838 that GCC uses to overcome shortcomings of particular machines, or special
6839 needs for some languages.
6840 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
6841 Collection (GCC) Internals},
6842 for more discussion of @file{libgcc.a}.)
6843 In most cases, you need @file{libgcc.a} even when you want to avoid
6844 other standard libraries.  In other words, when you specify @option{-nostdlib}
6845 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
6846 This ensures that you have no unresolved references to internal GCC
6847 library subroutines.  (For example, @samp{__main}, used to ensure C++
6848 constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
6849 GNU Compiler Collection (GCC) Internals}.)
6850
6851 @item -pie
6852 @opindex pie
6853 Produce a position independent executable on targets which support it.
6854 For predictable results, you must also specify the same set of options
6855 that were used to generate code (@option{-fpie}, @option{-fPIE},
6856 or model suboptions) when you specify this option.
6857
6858 @item -rdynamic
6859 @opindex rdynamic
6860 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
6861 that support it. This instructs the linker to add all symbols, not
6862 only used ones, to the dynamic symbol table. This option is needed
6863 for some uses of @code{dlopen} or to allow obtaining backtraces
6864 from within a program.
6865
6866 @item -s
6867 @opindex s
6868 Remove all symbol table and relocation information from the executable.
6869
6870 @item -static
6871 @opindex static
6872 On systems that support dynamic linking, this prevents linking with the shared
6873 libraries.  On other systems, this option has no effect.
6874
6875 @item -shared
6876 @opindex shared
6877 Produce a shared object which can then be linked with other objects to
6878 form an executable.  Not all systems support this option.  For predictable
6879 results, you must also specify the same set of options that were used to
6880 generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
6881 when you specify this option.@footnote{On some systems, @samp{gcc -shared}
6882 needs to build supplementary stub code for constructors to work.  On
6883 multi-libbed systems, @samp{gcc -shared} must select the correct support
6884 libraries to link against.  Failing to supply the correct flags may lead
6885 to subtle defects.  Supplying them in cases where they are not necessary
6886 is innocuous.}
6887
6888 @item -shared-libgcc
6889 @itemx -static-libgcc
6890 @opindex shared-libgcc
6891 @opindex static-libgcc
6892 On systems that provide @file{libgcc} as a shared library, these options
6893 force the use of either the shared or static version respectively.
6894 If no shared version of @file{libgcc} was built when the compiler was
6895 configured, these options have no effect.
6896
6897 There are several situations in which an application should use the
6898 shared @file{libgcc} instead of the static version.  The most common
6899 of these is when the application wishes to throw and catch exceptions
6900 across different shared libraries.  In that case, each of the libraries
6901 as well as the application itself should use the shared @file{libgcc}.
6902
6903 Therefore, the G++ and GCJ drivers automatically add
6904 @option{-shared-libgcc} whenever you build a shared library or a main
6905 executable, because C++ and Java programs typically use exceptions, so
6906 this is the right thing to do.
6907
6908 If, instead, you use the GCC driver to create shared libraries, you may
6909 find that they will not always be linked with the shared @file{libgcc}.
6910 If GCC finds, at its configuration time, that you have a non-GNU linker
6911 or a GNU linker that does not support option @option{--eh-frame-hdr},
6912 it will link the shared version of @file{libgcc} into shared libraries
6913 by default.  Otherwise, it will take advantage of the linker and optimize
6914 away the linking with the shared version of @file{libgcc}, linking with
6915 the static version of libgcc by default.  This allows exceptions to
6916 propagate through such shared libraries, without incurring relocation
6917 costs at library load time.
6918
6919 However, if a library or main executable is supposed to throw or catch
6920 exceptions, you must link it using the G++ or GCJ driver, as appropriate
6921 for the languages used in the program, or using the option
6922 @option{-shared-libgcc}, such that it is linked with the shared
6923 @file{libgcc}.
6924
6925 @item -symbolic
6926 @opindex symbolic
6927 Bind references to global symbols when building a shared object.  Warn
6928 about any unresolved references (unless overridden by the link editor
6929 option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
6930 this option.
6931
6932 @item -Xlinker @var{option}
6933 @opindex Xlinker
6934 Pass @var{option} as an option to the linker.  You can use this to
6935 supply system-specific linker options which GCC does not know how to
6936 recognize.
6937
6938 If you want to pass an option that takes an argument, you must use
6939 @option{-Xlinker} twice, once for the option and once for the argument.
6940 For example, to pass @option{-assert definitions}, you must write
6941 @samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
6942 @option{-Xlinker "-assert definitions"}, because this passes the entire
6943 string as a single argument, which is not what the linker expects.
6944
6945 @item -Wl,@var{option}
6946 @opindex Wl
6947 Pass @var{option} as an option to the linker.  If @var{option} contains
6948 commas, it is split into multiple options at the commas.
6949
6950 @item -u @var{symbol}
6951 @opindex u
6952 Pretend the symbol @var{symbol} is undefined, to force linking of
6953 library modules to define it.  You can use @option{-u} multiple times with
6954 different symbols to force loading of additional library modules.
6955 @end table
6956
6957 @node Directory Options
6958 @section Options for Directory Search
6959 @cindex directory options
6960 @cindex options, directory search
6961 @cindex search path
6962
6963 These options specify directories to search for header files, for
6964 libraries and for parts of the compiler:
6965
6966 @table @gcctabopt
6967 @item -I@var{dir}
6968 @opindex I
6969 Add the directory @var{dir} to the head of the list of directories to be
6970 searched for header files.  This can be used to override a system header
6971 file, substituting your own version, since these directories are
6972 searched before the system header file directories.  However, you should
6973 not use this option to add directories that contain vendor-supplied
6974 system header files (use @option{-isystem} for that).  If you use more than
6975 one @option{-I} option, the directories are scanned in left-to-right
6976 order; the standard system directories come after.
6977
6978 If a standard system include directory, or a directory specified with
6979 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
6980 option will be ignored.  The directory will still be searched but as a
6981 system directory at its normal position in the system include chain.
6982 This is to ensure that GCC's procedure to fix buggy system headers and
6983 the ordering for the include_next directive are not inadvertently changed.
6984 If you really need to change the search order for system directories,
6985 use the @option{-nostdinc} and/or @option{-isystem} options.
6986
6987 @item -iquote@var{dir}
6988 @opindex iquote
6989 Add the directory @var{dir} to the head of the list of directories to
6990 be searched for header files only for the case of @samp{#include
6991 "@var{file}"}; they are not searched for @samp{#include <@var{file}>},
6992 otherwise just like @option{-I}.
6993
6994 @item -L@var{dir}
6995 @opindex L
6996 Add directory @var{dir} to the list of directories to be searched
6997 for @option{-l}.
6998
6999 @item -B@var{prefix}
7000 @opindex B
7001 This option specifies where to find the executables, libraries,
7002 include files, and data files of the compiler itself.
7003
7004 The compiler driver program runs one or more of the subprograms
7005 @file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
7006 @var{prefix} as a prefix for each program it tries to run, both with and
7007 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
7008
7009 For each subprogram to be run, the compiler driver first tries the
7010 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
7011 was not specified, the driver tries two standard prefixes, which are
7012 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
7013 those results in a file name that is found, the unmodified program
7014 name is searched for using the directories specified in your
7015 @env{PATH} environment variable.
7016
7017 The compiler will check to see if the path provided by the @option{-B}
7018 refers to a directory, and if necessary it will add a directory
7019 separator character at the end of the path.
7020
7021 @option{-B} prefixes that effectively specify directory names also apply
7022 to libraries in the linker, because the compiler translates these
7023 options into @option{-L} options for the linker.  They also apply to
7024 includes files in the preprocessor, because the compiler translates these
7025 options into @option{-isystem} options for the preprocessor.  In this case,
7026 the compiler appends @samp{include} to the prefix.
7027
7028 The run-time support file @file{libgcc.a} can also be searched for using
7029 the @option{-B} prefix, if needed.  If it is not found there, the two
7030 standard prefixes above are tried, and that is all.  The file is left
7031 out of the link if it is not found by those means.
7032
7033 Another way to specify a prefix much like the @option{-B} prefix is to use
7034 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
7035 Variables}.
7036
7037 As a special kludge, if the path provided by @option{-B} is
7038 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
7039 9, then it will be replaced by @file{[dir/]include}.  This is to help
7040 with boot-strapping the compiler.
7041
7042 @item -specs=@var{file}
7043 @opindex specs
7044 Process @var{file} after the compiler reads in the standard @file{specs}
7045 file, in order to override the defaults that the @file{gcc} driver
7046 program uses when determining what switches to pass to @file{cc1},
7047 @file{cc1plus}, @file{as}, @file{ld}, etc.  More than one
7048 @option{-specs=@var{file}} can be specified on the command line, and they
7049 are processed in order, from left to right.
7050
7051 @item --sysroot=@var{dir}
7052 @opindex sysroot
7053 Use @var{dir} as the logical root directory for headers and libraries.
7054 For example, if the compiler would normally search for headers in
7055 @file{/usr/include} and libraries in @file{/usr/lib}, it will instead
7056 search @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.  
7057
7058 If you use both this option and the @option{-isysroot} option, then
7059 the @option{--sysroot} option will apply to libraries, but the
7060 @option{-isysroot} option will apply to header files.
7061
7062 The GNU linker (beginning with version 2.16) has the necessary support
7063 for this option.  If your linker does not support this option, the
7064 header file aspect of @option{--sysroot} will still work, but the
7065 library aspect will not.
7066
7067 @item -I-
7068 @opindex I-
7069 This option has been deprecated.  Please use @option{-iquote} instead for
7070 @option{-I} directories before the @option{-I-} and remove the @option{-I-}.
7071 Any directories you specify with @option{-I} options before the @option{-I-}
7072 option are searched only for the case of @samp{#include "@var{file}"};
7073 they are not searched for @samp{#include <@var{file}>}.
7074
7075 If additional directories are specified with @option{-I} options after
7076 the @option{-I-}, these directories are searched for all @samp{#include}
7077 directives.  (Ordinarily @emph{all} @option{-I} directories are used
7078 this way.)
7079
7080 In addition, the @option{-I-} option inhibits the use of the current
7081 directory (where the current input file came from) as the first search
7082 directory for @samp{#include "@var{file}"}.  There is no way to
7083 override this effect of @option{-I-}.  With @option{-I.} you can specify
7084 searching the directory which was current when the compiler was
7085 invoked.  That is not exactly the same as what the preprocessor does
7086 by default, but it is often satisfactory.
7087
7088 @option{-I-} does not inhibit the use of the standard system directories
7089 for header files.  Thus, @option{-I-} and @option{-nostdinc} are
7090 independent.
7091 @end table
7092
7093 @c man end
7094
7095 @node Spec Files
7096 @section Specifying subprocesses and the switches to pass to them
7097 @cindex Spec Files
7098
7099 @command{gcc} is a driver program.  It performs its job by invoking a
7100 sequence of other programs to do the work of compiling, assembling and
7101 linking.  GCC interprets its command-line parameters and uses these to
7102 deduce which programs it should invoke, and which command-line options
7103 it ought to place on their command lines.  This behavior is controlled
7104 by @dfn{spec strings}.  In most cases there is one spec string for each
7105 program that GCC can invoke, but a few programs have multiple spec
7106 strings to control their behavior.  The spec strings built into GCC can
7107 be overridden by using the @option{-specs=} command-line switch to specify
7108 a spec file.
7109
7110 @dfn{Spec files} are plaintext files that are used to construct spec
7111 strings.  They consist of a sequence of directives separated by blank
7112 lines.  The type of directive is determined by the first non-whitespace
7113 character on the line and it can be one of the following:
7114
7115 @table @code
7116 @item %@var{command}
7117 Issues a @var{command} to the spec file processor.  The commands that can
7118 appear here are:
7119
7120 @table @code
7121 @item %include <@var{file}>
7122 @cindex %include
7123 Search for @var{file} and insert its text at the current point in the
7124 specs file.
7125
7126 @item %include_noerr <@var{file}>
7127 @cindex %include_noerr
7128 Just like @samp{%include}, but do not generate an error message if the include
7129 file cannot be found.
7130
7131 @item %rename @var{old_name} @var{new_name}
7132 @cindex %rename
7133 Rename the spec string @var{old_name} to @var{new_name}.
7134
7135 @end table
7136
7137 @item *[@var{spec_name}]:
7138 This tells the compiler to create, override or delete the named spec
7139 string.  All lines after this directive up to the next directive or
7140 blank line are considered to be the text for the spec string.  If this
7141 results in an empty string then the spec will be deleted.  (Or, if the
7142 spec did not exist, then nothing will happened.)  Otherwise, if the spec
7143 does not currently exist a new spec will be created.  If the spec does
7144 exist then its contents will be overridden by the text of this
7145 directive, unless the first character of that text is the @samp{+}
7146 character, in which case the text will be appended to the spec.
7147
7148 @item [@var{suffix}]:
7149 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
7150 and up to the next directive or blank line are considered to make up the
7151 spec string for the indicated suffix.  When the compiler encounters an
7152 input file with the named suffix, it will processes the spec string in
7153 order to work out how to compile that file.  For example:
7154
7155 @smallexample
7156 .ZZ:
7157 z-compile -input %i
7158 @end smallexample
7159
7160 This says that any input file whose name ends in @samp{.ZZ} should be
7161 passed to the program @samp{z-compile}, which should be invoked with the
7162 command-line switch @option{-input} and with the result of performing the
7163 @samp{%i} substitution.  (See below.)
7164
7165 As an alternative to providing a spec string, the text that follows a
7166 suffix directive can be one of the following:
7167
7168 @table @code
7169 @item @@@var{language}
7170 This says that the suffix is an alias for a known @var{language}.  This is
7171 similar to using the @option{-x} command-line switch to GCC to specify a
7172 language explicitly.  For example:
7173
7174 @smallexample
7175 .ZZ:
7176 @@c++
7177 @end smallexample
7178
7179 Says that .ZZ files are, in fact, C++ source files.
7180
7181 @item #@var{name}
7182 This causes an error messages saying:
7183
7184 @smallexample
7185 @var{name} compiler not installed on this system.
7186 @end smallexample
7187 @end table
7188
7189 GCC already has an extensive list of suffixes built into it.
7190 This directive will add an entry to the end of the list of suffixes, but
7191 since the list is searched from the end backwards, it is effectively
7192 possible to override earlier entries using this technique.
7193
7194 @end table
7195
7196 GCC has the following spec strings built into it.  Spec files can
7197 override these strings or create their own.  Note that individual
7198 targets can also add their own spec strings to this list.
7199
7200 @smallexample
7201 asm          Options to pass to the assembler
7202 asm_final    Options to pass to the assembler post-processor
7203 cpp          Options to pass to the C preprocessor
7204 cc1          Options to pass to the C compiler
7205 cc1plus      Options to pass to the C++ compiler
7206 endfile      Object files to include at the end of the link
7207 link         Options to pass to the linker
7208 lib          Libraries to include on the command line to the linker
7209 libgcc       Decides which GCC support library to pass to the linker
7210 linker       Sets the name of the linker
7211 predefines   Defines to be passed to the C preprocessor
7212 signed_char  Defines to pass to CPP to say whether @code{char} is signed
7213              by default
7214 startfile    Object files to include at the start of the link
7215 @end smallexample
7216
7217 Here is a small example of a spec file:
7218
7219 @smallexample
7220 %rename lib                 old_lib
7221
7222 *lib:
7223 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
7224 @end smallexample
7225
7226 This example renames the spec called @samp{lib} to @samp{old_lib} and
7227 then overrides the previous definition of @samp{lib} with a new one.
7228 The new definition adds in some extra command-line options before
7229 including the text of the old definition.
7230
7231 @dfn{Spec strings} are a list of command-line options to be passed to their
7232 corresponding program.  In addition, the spec strings can contain
7233 @samp{%}-prefixed sequences to substitute variable text or to
7234 conditionally insert text into the command line.  Using these constructs
7235 it is possible to generate quite complex command lines.
7236
7237 Here is a table of all defined @samp{%}-sequences for spec
7238 strings.  Note that spaces are not generated automatically around the
7239 results of expanding these sequences.  Therefore you can concatenate them
7240 together or combine them with constant text in a single argument.
7241
7242 @table @code
7243 @item %%
7244 Substitute one @samp{%} into the program name or argument.
7245
7246 @item %i
7247 Substitute the name of the input file being processed.
7248
7249 @item %b
7250 Substitute the basename of the input file being processed.
7251 This is the substring up to (and not including) the last period
7252 and not including the directory.
7253
7254 @item %B
7255 This is the same as @samp{%b}, but include the file suffix (text after
7256 the last period).
7257
7258 @item %d
7259 Marks the argument containing or following the @samp{%d} as a
7260 temporary file name, so that that file will be deleted if GCC exits
7261 successfully.  Unlike @samp{%g}, this contributes no text to the
7262 argument.
7263
7264 @item %g@var{suffix}
7265 Substitute a file name that has suffix @var{suffix} and is chosen
7266 once per compilation, and mark the argument in the same way as
7267 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
7268 name is now chosen in a way that is hard to predict even when previously
7269 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
7270 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
7271 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
7272 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
7273 was simply substituted with a file name chosen once per compilation,
7274 without regard to any appended suffix (which was therefore treated
7275 just like ordinary text), making such attacks more likely to succeed.
7276
7277 @item %u@var{suffix}
7278 Like @samp{%g}, but generates a new temporary file name even if
7279 @samp{%u@var{suffix}} was already seen.
7280
7281 @item %U@var{suffix}
7282 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
7283 new one if there is no such last file name.  In the absence of any
7284 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
7285 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
7286 would involve the generation of two distinct file names, one
7287 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
7288 simply substituted with a file name chosen for the previous @samp{%u},
7289 without regard to any appended suffix.
7290
7291 @item %j@var{suffix}
7292 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
7293 writable, and if save-temps is off; otherwise, substitute the name
7294 of a temporary file, just like @samp{%u}.  This temporary file is not
7295 meant for communication between processes, but rather as a junk
7296 disposal mechanism.
7297
7298 @item %|@var{suffix}
7299 @itemx %m@var{suffix}
7300 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
7301 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
7302 all.  These are the two most common ways to instruct a program that it
7303 should read from standard input or write to standard output.  If you
7304 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
7305 construct: see for example @file{f/lang-specs.h}.
7306
7307 @item %.@var{SUFFIX}
7308 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
7309 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
7310 terminated by the next space or %.
7311
7312 @item %w
7313 Marks the argument containing or following the @samp{%w} as the
7314 designated output file of this compilation.  This puts the argument
7315 into the sequence of arguments that @samp{%o} will substitute later.
7316
7317 @item %o
7318 Substitutes the names of all the output files, with spaces
7319 automatically placed around them.  You should write spaces
7320 around the @samp{%o} as well or the results are undefined.
7321 @samp{%o} is for use in the specs for running the linker.
7322 Input files whose names have no recognized suffix are not compiled
7323 at all, but they are included among the output files, so they will
7324 be linked.
7325
7326 @item %O
7327 Substitutes the suffix for object files.  Note that this is
7328 handled specially when it immediately follows @samp{%g, %u, or %U},
7329 because of the need for those to form complete file names.  The
7330 handling is such that @samp{%O} is treated exactly as if it had already
7331 been substituted, except that @samp{%g, %u, and %U} do not currently
7332 support additional @var{suffix} characters following @samp{%O} as they would
7333 following, for example, @samp{.o}.
7334
7335 @item %p
7336 Substitutes the standard macro predefinitions for the
7337 current target machine.  Use this when running @code{cpp}.
7338
7339 @item %P
7340 Like @samp{%p}, but puts @samp{__} before and after the name of each
7341 predefined macro, except for macros that start with @samp{__} or with
7342 @samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
7343 C@.
7344
7345 @item %I
7346 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
7347 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
7348 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
7349 and @option{-imultilib} as necessary.
7350
7351 @item %s
7352 Current argument is the name of a library or startup file of some sort.
7353 Search for that file in a standard list of directories and substitute
7354 the full name found.
7355
7356 @item %e@var{str}
7357 Print @var{str} as an error message.  @var{str} is terminated by a newline.
7358 Use this when inconsistent options are detected.
7359
7360 @item %(@var{name})
7361 Substitute the contents of spec string @var{name} at this point.
7362
7363 @item %[@var{name}]
7364 Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
7365
7366 @item %x@{@var{option}@}
7367 Accumulate an option for @samp{%X}.
7368
7369 @item %X
7370 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
7371 spec string.
7372
7373 @item %Y
7374 Output the accumulated assembler options specified by @option{-Wa}.
7375
7376 @item %Z
7377 Output the accumulated preprocessor options specified by @option{-Wp}.
7378
7379 @item %a
7380 Process the @code{asm} spec.  This is used to compute the
7381 switches to be passed to the assembler.
7382
7383 @item %A
7384 Process the @code{asm_final} spec.  This is a spec string for
7385 passing switches to an assembler post-processor, if such a program is
7386 needed.
7387
7388 @item %l
7389 Process the @code{link} spec.  This is the spec for computing the
7390 command line passed to the linker.  Typically it will make use of the
7391 @samp{%L %G %S %D and %E} sequences.
7392
7393 @item %D
7394 Dump out a @option{-L} option for each directory that GCC believes might
7395 contain startup files.  If the target supports multilibs then the
7396 current multilib directory will be prepended to each of these paths.
7397
7398 @item %L
7399 Process the @code{lib} spec.  This is a spec string for deciding which
7400 libraries should be included on the command line to the linker.
7401
7402 @item %G
7403 Process the @code{libgcc} spec.  This is a spec string for deciding
7404 which GCC support library should be included on the command line to the linker.
7405
7406 @item %S
7407 Process the @code{startfile} spec.  This is a spec for deciding which
7408 object files should be the first ones passed to the linker.  Typically
7409 this might be a file named @file{crt0.o}.
7410
7411 @item %E
7412 Process the @code{endfile} spec.  This is a spec string that specifies
7413 the last object files that will be passed to the linker.
7414
7415 @item %C
7416 Process the @code{cpp} spec.  This is used to construct the arguments
7417 to be passed to the C preprocessor.
7418
7419 @item %1
7420 Process the @code{cc1} spec.  This is used to construct the options to be
7421 passed to the actual C compiler (@samp{cc1}).
7422
7423 @item %2
7424 Process the @code{cc1plus} spec.  This is used to construct the options to be
7425 passed to the actual C++ compiler (@samp{cc1plus}).
7426
7427 @item %*
7428 Substitute the variable part of a matched option.  See below.
7429 Note that each comma in the substituted string is replaced by
7430 a single space.
7431
7432 @item %<@code{S}
7433 Remove all occurrences of @code{-S} from the command line.  Note---this
7434 command is position dependent.  @samp{%} commands in the spec string
7435 before this one will see @code{-S}, @samp{%} commands in the spec string
7436 after this one will not.
7437
7438 @item %:@var{function}(@var{args})
7439 Call the named function @var{function}, passing it @var{args}.
7440 @var{args} is first processed as a nested spec string, then split
7441 into an argument vector in the usual fashion.  The function returns
7442 a string which is processed as if it had appeared literally as part
7443 of the current spec.
7444
7445 The following built-in spec functions are provided:
7446
7447 @table @code
7448 @item @code{getenv}
7449 The @code{getenv} spec function takes two arguments: an environment
7450 variable name and a string.  If the environment variable is not
7451 defined, a fatal error is issued.  Otherwise, the return value is the
7452 value of the environment variable concatenated with the string.  For
7453 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
7454
7455 @smallexample
7456 %:getenv(TOPDIR /include)
7457 @end smallexample
7458
7459 expands to @file{/path/to/top/include}.
7460
7461 @item @code{if-exists}
7462 The @code{if-exists} spec function takes one argument, an absolute
7463 pathname to a file.  If the file exists, @code{if-exists} returns the
7464 pathname.  Here is a small example of its usage:
7465
7466 @smallexample
7467 *startfile:
7468 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
7469 @end smallexample
7470
7471 @item @code{if-exists-else}
7472 The @code{if-exists-else} spec function is similar to the @code{if-exists}
7473 spec function, except that it takes two arguments.  The first argument is
7474 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
7475 returns the pathname.  If it does not exist, it returns the second argument.
7476 This way, @code{if-exists-else} can be used to select one file or another,
7477 based on the existence of the first.  Here is a small example of its usage:
7478
7479 @smallexample
7480 *startfile:
7481 crt0%O%s %:if-exists(crti%O%s) \
7482 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
7483 @end smallexample
7484
7485 @item @code{replace-outfile}
7486 The @code{replace-outfile} spec function takes two arguments.  It looks for the
7487 first argument in the outfiles array and replaces it with the second argument.  Here
7488 is a small example of its usage:
7489
7490 @smallexample
7491 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
7492 @end smallexample
7493
7494 @end table
7495
7496 @item %@{@code{S}@}
7497 Substitutes the @code{-S} switch, if that switch was given to GCC@.
7498 If that switch was not specified, this substitutes nothing.  Note that
7499 the leading dash is omitted when specifying this option, and it is
7500 automatically inserted if the substitution is performed.  Thus the spec
7501 string @samp{%@{foo@}} would match the command-line option @option{-foo}
7502 and would output the command line option @option{-foo}.
7503
7504 @item %W@{@code{S}@}
7505 Like %@{@code{S}@} but mark last argument supplied within as a file to be
7506 deleted on failure.
7507
7508 @item %@{@code{S}*@}
7509 Substitutes all the switches specified to GCC whose names start
7510 with @code{-S}, but which also take an argument.  This is used for
7511 switches like @option{-o}, @option{-D}, @option{-I}, etc.
7512 GCC considers @option{-o foo} as being
7513 one switch whose names starts with @samp{o}.  %@{o*@} would substitute this
7514 text, including the space.  Thus two arguments would be generated.
7515
7516 @item %@{@code{S}*&@code{T}*@}
7517 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
7518 (the order of @code{S} and @code{T} in the spec is not significant).
7519 There can be any number of ampersand-separated variables; for each the
7520 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
7521
7522 @item %@{@code{S}:@code{X}@}
7523 Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
7524
7525 @item %@{!@code{S}:@code{X}@}
7526 Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
7527
7528 @item %@{@code{S}*:@code{X}@}
7529 Substitutes @code{X} if one or more switches whose names start with
7530 @code{-S} are specified to GCC@.  Normally @code{X} is substituted only
7531 once, no matter how many such switches appeared.  However, if @code{%*}
7532 appears somewhere in @code{X}, then @code{X} will be substituted once
7533 for each matching switch, with the @code{%*} replaced by the part of
7534 that switch that matched the @code{*}.
7535
7536 @item %@{.@code{S}:@code{X}@}
7537 Substitutes @code{X}, if processing a file with suffix @code{S}.
7538
7539 @item %@{!.@code{S}:@code{X}@}
7540 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
7541
7542 @item %@{@code{S}|@code{P}:@code{X}@}
7543 Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@.
7544 This may be combined with @samp{!}, @samp{.}, and @code{*} sequences as well,
7545 although they have a stronger binding than the @samp{|}.  If @code{%*}
7546 appears in @code{X}, all of the alternatives must be starred, and only
7547 the first matching alternative is substituted.
7548
7549 For example, a spec string like this:
7550
7551 @smallexample
7552 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
7553 @end smallexample
7554
7555 will output the following command-line options from the following input
7556 command-line options:
7557
7558 @smallexample
7559 fred.c        -foo -baz
7560 jim.d         -bar -boggle
7561 -d fred.c     -foo -baz -boggle
7562 -d jim.d      -bar -baz -boggle
7563 @end smallexample
7564
7565 @item %@{S:X; T:Y; :D@}
7566
7567 If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
7568 given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
7569 be as many clauses as you need.  This may be combined with @code{.},
7570 @code{!}, @code{|}, and @code{*} as needed.
7571
7572
7573 @end table
7574
7575 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
7576 construct may contain other nested @samp{%} constructs or spaces, or
7577 even newlines.  They are processed as usual, as described above.
7578 Trailing white space in @code{X} is ignored.  White space may also
7579 appear anywhere on the left side of the colon in these constructs,
7580 except between @code{.} or @code{*} and the corresponding word.
7581
7582 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
7583 handled specifically in these constructs.  If another value of
7584 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
7585 @option{-W} switch is found later in the command line, the earlier
7586 switch value is ignored, except with @{@code{S}*@} where @code{S} is
7587 just one letter, which passes all matching options.
7588
7589 The character @samp{|} at the beginning of the predicate text is used to
7590 indicate that a command should be piped to the following command, but
7591 only if @option{-pipe} is specified.
7592
7593 It is built into GCC which switches take arguments and which do not.
7594 (You might think it would be useful to generalize this to allow each
7595 compiler's spec to say which switches take arguments.  But this cannot
7596 be done in a consistent fashion.  GCC cannot even decide which input
7597 files have been specified without knowing which switches take arguments,
7598 and it must know which input files to compile in order to tell which
7599 compilers to run).
7600
7601 GCC also knows implicitly that arguments starting in @option{-l} are to be
7602 treated as compiler output files, and passed to the linker in their
7603 proper position among the other output files.
7604
7605 @c man begin OPTIONS
7606
7607 @node Target Options
7608 @section Specifying Target Machine and Compiler Version
7609 @cindex target options
7610 @cindex cross compiling
7611 @cindex specifying machine version
7612 @cindex specifying compiler version and target machine
7613 @cindex compiler version, specifying
7614 @cindex target machine, specifying
7615
7616 The usual way to run GCC is to run the executable called @file{gcc}, or
7617 @file{<machine>-gcc} when cross-compiling, or
7618 @file{<machine>-gcc-<version>} to run a version other than the one that
7619 was installed last.  Sometimes this is inconvenient, so GCC provides
7620 options that will switch to another cross-compiler or version.
7621
7622 @table @gcctabopt
7623 @item -b @var{machine}
7624 @opindex b
7625 The argument @var{machine} specifies the target machine for compilation.
7626
7627 The value to use for @var{machine} is the same as was specified as the
7628 machine type when configuring GCC as a cross-compiler.  For
7629 example, if a cross-compiler was configured with @samp{configure
7630 arm-elf}, meaning to compile for an arm processor with elf binaries,
7631 then you would specify @option{-b arm-elf} to run that cross compiler.
7632 Because there are other options beginning with @option{-b}, the
7633 configuration must contain a hyphen. 
7634
7635 @item -V @var{version}
7636 @opindex V
7637 The argument @var{version} specifies which version of GCC to run.
7638 This is useful when multiple versions are installed.  For example,
7639 @var{version} might be @samp{4.0}, meaning to run GCC version 4.0.
7640 @end table
7641
7642 The @option{-V} and @option{-b} options work by running the
7643 @file{<machine>-gcc-<version>} executable, so there's no real reason to
7644 use them if you can just run that directly.
7645
7646 @node Submodel Options
7647 @section Hardware Models and Configurations
7648 @cindex submodel options
7649 @cindex specifying hardware config
7650 @cindex hardware models and configurations, specifying
7651 @cindex machine dependent options
7652
7653 Earlier we discussed the standard option @option{-b} which chooses among
7654 different installed compilers for completely different target
7655 machines, such as VAX vs.@: 68000 vs.@: 80386.
7656
7657 In addition, each of these target machine types can have its own
7658 special options, starting with @samp{-m}, to choose among various
7659 hardware models or configurations---for example, 68010 vs 68020,
7660 floating coprocessor or none.  A single installed version of the
7661 compiler can compile for any model or configuration, according to the
7662 options specified.
7663
7664 Some configurations of the compiler also support additional special
7665 options, usually for compatibility with other compilers on the same
7666 platform.
7667
7668 @c This list is ordered alphanumerically by subsection name.
7669 @c It should be the same order and spelling as these options are listed
7670 @c in Machine Dependent Options
7671
7672 @menu
7673 * ARC Options::
7674 * ARM Options::
7675 * AVR Options::
7676 * Blackfin Options::
7677 * CRIS Options::
7678 * CRX Options::
7679 * Darwin Options::
7680 * DEC Alpha Options::
7681 * DEC Alpha/VMS Options::
7682 * FRV Options::
7683 * GNU/Linux Options::
7684 * H8/300 Options::
7685 * HPPA Options::
7686 * i386 and x86-64 Options::
7687 * IA-64 Options::
7688 * M32C Options::
7689 * M32R/D Options::
7690 * M680x0 Options::
7691 * M68hc1x Options::
7692 * MCore Options::
7693 * MIPS Options::
7694 * MMIX Options::
7695 * MN10300 Options::
7696 * MT Options::
7697 * PDP-11 Options::
7698 * PowerPC Options::
7699 * RS/6000 and PowerPC Options::
7700 * S/390 and zSeries Options::
7701 * Score Options::
7702 * SH Options::
7703 * SPARC Options::
7704 * SPU Options::
7705 * System V Options::
7706 * TMS320C3x/C4x Options::
7707 * V850 Options::
7708 * VAX Options::
7709 * x86-64 Options::
7710 * Xstormy16 Options::
7711 * Xtensa Options::
7712 * zSeries Options::
7713 @end menu
7714
7715 @node ARC Options
7716 @subsection ARC Options
7717 @cindex ARC Options
7718
7719 These options are defined for ARC implementations:
7720
7721 @table @gcctabopt
7722 @item -EL
7723 @opindex EL
7724 Compile code for little endian mode.  This is the default.
7725
7726 @item -EB
7727 @opindex EB
7728 Compile code for big endian mode.
7729
7730 @item -mmangle-cpu
7731 @opindex mmangle-cpu
7732 Prepend the name of the cpu to all public symbol names.
7733 In multiple-processor systems, there are many ARC variants with different
7734 instruction and register set characteristics.  This flag prevents code
7735 compiled for one cpu to be linked with code compiled for another.
7736 No facility exists for handling variants that are ``almost identical''.
7737 This is an all or nothing option.
7738
7739 @item -mcpu=@var{cpu}
7740 @opindex mcpu
7741 Compile code for ARC variant @var{cpu}.
7742 Which variants are supported depend on the configuration.
7743 All variants support @option{-mcpu=base}, this is the default.
7744
7745 @item -mtext=@var{text-section}
7746 @itemx -mdata=@var{data-section}
7747 @itemx -mrodata=@var{readonly-data-section}
7748 @opindex mtext
7749 @opindex mdata
7750 @opindex mrodata
7751 Put functions, data, and readonly data in @var{text-section},
7752 @var{data-section}, and @var{readonly-data-section} respectively
7753 by default.  This can be overridden with the @code{section} attribute.
7754 @xref{Variable Attributes}.
7755
7756 @end table
7757
7758 @node ARM Options
7759 @subsection ARM Options
7760 @cindex ARM options
7761
7762 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
7763 architectures:
7764
7765 @table @gcctabopt
7766 @item -mabi=@var{name}
7767 @opindex mabi
7768 Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
7769 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
7770
7771 @item -mapcs-frame
7772 @opindex mapcs-frame
7773 Generate a stack frame that is compliant with the ARM Procedure Call
7774 Standard for all functions, even if this is not strictly necessary for
7775 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
7776 with this option will cause the stack frames not to be generated for
7777 leaf functions.  The default is @option{-mno-apcs-frame}.
7778
7779 @item -mapcs
7780 @opindex mapcs
7781 This is a synonym for @option{-mapcs-frame}.
7782
7783 @ignore
7784 @c not currently implemented
7785 @item -mapcs-stack-check
7786 @opindex mapcs-stack-check
7787 Generate code to check the amount of stack space available upon entry to
7788 every function (that actually uses some stack space).  If there is
7789 insufficient space available then either the function
7790 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
7791 called, depending upon the amount of stack space required.  The run time
7792 system is required to provide these functions.  The default is
7793 @option{-mno-apcs-stack-check}, since this produces smaller code.
7794
7795 @c not currently implemented
7796 @item -mapcs-float
7797 @opindex mapcs-float
7798 Pass floating point arguments using the float point registers.  This is
7799 one of the variants of the APCS@.  This option is recommended if the
7800 target hardware has a floating point unit or if a lot of floating point
7801 arithmetic is going to be performed by the code.  The default is
7802 @option{-mno-apcs-float}, since integer only code is slightly increased in
7803 size if @option{-mapcs-float} is used.
7804
7805 @c not currently implemented
7806 @item -mapcs-reentrant
7807 @opindex mapcs-reentrant
7808 Generate reentrant, position independent code.  The default is
7809 @option{-mno-apcs-reentrant}.
7810 @end ignore
7811
7812 @item -mthumb-interwork
7813 @opindex mthumb-interwork
7814 Generate code which supports calling between the ARM and Thumb
7815 instruction sets.  Without this option the two instruction sets cannot
7816 be reliably used inside one program.  The default is
7817 @option{-mno-thumb-interwork}, since slightly larger code is generated
7818 when @option{-mthumb-interwork} is specified.
7819
7820 @item -mno-sched-prolog
7821 @opindex mno-sched-prolog
7822 Prevent the reordering of instructions in the function prolog, or the
7823 merging of those instruction with the instructions in the function's
7824 body.  This means that all functions will start with a recognizable set
7825 of instructions (or in fact one of a choice from a small set of
7826 different function prologues), and this information can be used to
7827 locate the start if functions inside an executable piece of code.  The
7828 default is @option{-msched-prolog}.
7829
7830 @item -mhard-float
7831 @opindex mhard-float
7832 Generate output containing floating point instructions.  This is the
7833 default.
7834
7835 @item -msoft-float
7836 @opindex msoft-float
7837 Generate output containing library calls for floating point.
7838 @strong{Warning:} the requisite libraries are not available for all ARM
7839 targets.  Normally the facilities of the machine's usual C compiler are
7840 used, but this cannot be done directly in cross-compilation.  You must make
7841 your own arrangements to provide suitable library functions for
7842 cross-compilation.
7843
7844 @option{-msoft-float} changes the calling convention in the output file;
7845 therefore, it is only useful if you compile @emph{all} of a program with
7846 this option.  In particular, you need to compile @file{libgcc.a}, the
7847 library that comes with GCC, with @option{-msoft-float} in order for
7848 this to work.
7849
7850 @item -mfloat-abi=@var{name}
7851 @opindex mfloat-abi
7852 Specifies which ABI to use for floating point values.  Permissible values
7853 are: @samp{soft}, @samp{softfp} and @samp{hard}.
7854
7855 @samp{soft} and @samp{hard} are equivalent to @option{-msoft-float}
7856 and @option{-mhard-float} respectively.  @samp{softfp} allows the generation
7857 of floating point instructions, but still uses the soft-float calling
7858 conventions.
7859
7860 @item -mlittle-endian
7861 @opindex mlittle-endian
7862 Generate code for a processor running in little-endian mode.  This is
7863 the default for all standard configurations.
7864
7865 @item -mbig-endian
7866 @opindex mbig-endian
7867 Generate code for a processor running in big-endian mode; the default is
7868 to compile code for a little-endian processor.
7869
7870 @item -mwords-little-endian
7871 @opindex mwords-little-endian
7872 This option only applies when generating code for big-endian processors.
7873 Generate code for a little-endian word order but a big-endian byte
7874 order.  That is, a byte order of the form @samp{32107654}.  Note: this
7875 option should only be used if you require compatibility with code for
7876 big-endian ARM processors generated by versions of the compiler prior to
7877 2.8.
7878
7879 @item -mcpu=@var{name}
7880 @opindex mcpu
7881 This specifies the name of the target ARM processor.  GCC uses this name
7882 to determine what kind of instructions it can emit when generating
7883 assembly code.  Permissible names are: @samp{arm2}, @samp{arm250},
7884 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
7885 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
7886 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
7887 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
7888 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
7889 @samp{arm8}, @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
7890 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
7891 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
7892 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
7893 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
7894 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
7895 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
7896 @samp{arm1156t2-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
7897 @samp{cortex-a8}, @samp{cortex-r4}, @samp{cortex-m3},
7898 @samp{xscale}, @samp{iwmmxt}, @samp{ep9312}.
7899
7900 @itemx -mtune=@var{name}
7901 @opindex mtune
7902 This option is very similar to the @option{-mcpu=} option, except that
7903 instead of specifying the actual target processor type, and hence
7904 restricting which instructions can be used, it specifies that GCC should
7905 tune the performance of the code as if the target were of the type
7906 specified in this option, but still choosing the instructions that it
7907 will generate based on the cpu specified by a @option{-mcpu=} option.
7908 For some ARM implementations better performance can be obtained by using
7909 this option.
7910
7911 @item -march=@var{name}
7912 @opindex march
7913 This specifies the name of the target ARM architecture.  GCC uses this
7914 name to determine what kind of instructions it can emit when generating
7915 assembly code.  This option can be used in conjunction with or instead
7916 of the @option{-mcpu=} option.  Permissible names are: @samp{armv2},
7917 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
7918 @samp{armv5}, @samp{armv5t}, @samp{armv5te}, @samp{armv6}, @samp{armv6j},
7919 @samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv7}, @samp{armv7-a},
7920 @samp{armv7-r}, @samp{armv7-m}, @samp{iwmmxt}, @samp{ep9312}.
7921
7922 @item -mfpu=@var{name}
7923 @itemx -mfpe=@var{number}
7924 @itemx -mfp=@var{number}
7925 @opindex mfpu
7926 @opindex mfpe
7927 @opindex mfp
7928 This specifies what floating point hardware (or hardware emulation) is
7929 available on the target.  Permissible names are: @samp{fpa}, @samp{fpe2},
7930 @samp{fpe3}, @samp{maverick}, @samp{vfp}.  @option{-mfp} and @option{-mfpe}
7931 are synonyms for @option{-mfpu}=@samp{fpe}@var{number}, for compatibility
7932 with older versions of GCC@.
7933
7934 If @option{-msoft-float} is specified this specifies the format of
7935 floating point values.
7936
7937 @item -mstructure-size-boundary=@var{n}
7938 @opindex mstructure-size-boundary
7939 The size of all structures and unions will be rounded up to a multiple
7940 of the number of bits set by this option.  Permissible values are 8, 32
7941 and 64.  The default value varies for different toolchains.  For the COFF
7942 targeted toolchain the default value is 8.  A value of 64 is only allowed
7943 if the underlying ABI supports it.
7944
7945 Specifying the larger number can produce faster, more efficient code, but
7946 can also increase the size of the program.  Different values are potentially
7947 incompatible.  Code compiled with one value cannot necessarily expect to
7948 work with code or libraries compiled with another value, if they exchange
7949 information using structures or unions.
7950
7951 @item -mabort-on-noreturn
7952 @opindex mabort-on-noreturn
7953 Generate a call to the function @code{abort} at the end of a
7954 @code{noreturn} function.  It will be executed if the function tries to
7955 return.
7956
7957 @item -mlong-calls
7958 @itemx -mno-long-calls
7959 @opindex mlong-calls
7960 @opindex mno-long-calls
7961 Tells the compiler to perform function calls by first loading the
7962 address of the function into a register and then performing a subroutine
7963 call on this register.  This switch is needed if the target function
7964 will lie outside of the 64 megabyte addressing range of the offset based
7965 version of subroutine call instruction.
7966
7967 Even if this switch is enabled, not all function calls will be turned
7968 into long calls.  The heuristic is that static functions, functions
7969 which have the @samp{short-call} attribute, functions that are inside
7970 the scope of a @samp{#pragma no_long_calls} directive and functions whose
7971 definitions have already been compiled within the current compilation
7972 unit, will not be turned into long calls.  The exception to this rule is
7973 that weak function definitions, functions with the @samp{long-call}
7974 attribute or the @samp{section} attribute, and functions that are within
7975 the scope of a @samp{#pragma long_calls} directive, will always be
7976 turned into long calls.
7977
7978 This feature is not enabled by default.  Specifying
7979 @option{-mno-long-calls} will restore the default behavior, as will
7980 placing the function calls within the scope of a @samp{#pragma
7981 long_calls_off} directive.  Note these switches have no effect on how
7982 the compiler generates code to handle function calls via function
7983 pointers.
7984
7985 @item -mnop-fun-dllimport
7986 @opindex mnop-fun-dllimport
7987 Disable support for the @code{dllimport} attribute.
7988
7989 @item -msingle-pic-base
7990 @opindex msingle-pic-base
7991 Treat the register used for PIC addressing as read-only, rather than
7992 loading it in the prologue for each function.  The run-time system is
7993 responsible for initializing this register with an appropriate value
7994 before execution begins.
7995
7996 @item -mpic-register=@var{reg}
7997 @opindex mpic-register
7998 Specify the register to be used for PIC addressing.  The default is R10
7999 unless stack-checking is enabled, when R9 is used.
8000
8001 @item -mcirrus-fix-invalid-insns
8002 @opindex mcirrus-fix-invalid-insns
8003 @opindex mno-cirrus-fix-invalid-insns
8004 Insert NOPs into the instruction stream to in order to work around
8005 problems with invalid Maverick instruction combinations.  This option
8006 is only valid if the @option{-mcpu=ep9312} option has been used to
8007 enable generation of instructions for the Cirrus Maverick floating
8008 point co-processor.  This option is not enabled by default, since the
8009 problem is only present in older Maverick implementations.  The default
8010 can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
8011 switch.
8012
8013 @item -mpoke-function-name
8014 @opindex mpoke-function-name
8015 Write the name of each function into the text section, directly
8016 preceding the function prologue.  The generated code is similar to this:
8017
8018 @smallexample
8019      t0
8020          .ascii "arm_poke_function_name", 0
8021          .align
8022      t1
8023          .word 0xff000000 + (t1 - t0)
8024      arm_poke_function_name
8025          mov     ip, sp
8026          stmfd   sp!, @{fp, ip, lr, pc@}
8027          sub     fp, ip, #4
8028 @end smallexample
8029
8030 When performing a stack backtrace, code can inspect the value of
8031 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
8032 location @code{pc - 12} and the top 8 bits are set, then we know that
8033 there is a function name embedded immediately preceding this location
8034 and has length @code{((pc[-3]) & 0xff000000)}.
8035
8036 @item -mthumb
8037 @opindex mthumb
8038 Generate code for the Thumb instruction set.  The default is to
8039 use the 32-bit ARM instruction set.
8040 This option automatically enables either 16-bit Thumb-1 or
8041 mixed 16/32-bit Thumb-2 instructions based on the @option{-mcpu=@var{name}}
8042 and @option{-march=@var{name}} options.
8043
8044 @item -mtpcs-frame
8045 @opindex mtpcs-frame
8046 Generate a stack frame that is compliant with the Thumb Procedure Call
8047 Standard for all non-leaf functions.  (A leaf function is one that does
8048 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
8049
8050 @item -mtpcs-leaf-frame
8051 @opindex mtpcs-leaf-frame
8052 Generate a stack frame that is compliant with the Thumb Procedure Call
8053 Standard for all leaf functions.  (A leaf function is one that does
8054 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
8055
8056 @item -mcallee-super-interworking
8057 @opindex mcallee-super-interworking
8058 Gives all externally visible functions in the file being compiled an ARM
8059 instruction set header which switches to Thumb mode before executing the
8060 rest of the function.  This allows these functions to be called from
8061 non-interworking code.
8062
8063 @item -mcaller-super-interworking
8064 @opindex mcaller-super-interworking
8065 Allows calls via function pointers (including virtual functions) to
8066 execute correctly regardless of whether the target code has been
8067 compiled for interworking or not.  There is a small overhead in the cost
8068 of executing a function pointer if this option is enabled.
8069
8070 @item -mtp=@var{name}
8071 @opindex mtp
8072 Specify the access model for the thread local storage pointer.  The valid
8073 models are @option{soft}, which generates calls to @code{__aeabi_read_tp},
8074 @option{cp15}, which fetches the thread pointer from @code{cp15} directly
8075 (supported in the arm6k architecture), and @option{auto}, which uses the
8076 best available method for the selected processor.  The default setting is
8077 @option{auto}.
8078
8079 @end table
8080
8081 @node AVR Options
8082 @subsection AVR Options
8083 @cindex AVR Options
8084
8085 These options are defined for AVR implementations:
8086
8087 @table @gcctabopt
8088 @item -mmcu=@var{mcu}
8089 @opindex mmcu
8090 Specify ATMEL AVR instruction set or MCU type.
8091
8092 Instruction set avr1 is for the minimal AVR core, not supported by the C
8093 compiler, only for assembler programs (MCU types: at90s1200, attiny10,
8094 attiny11, attiny12, attiny15, attiny28).
8095
8096 Instruction set avr2 (default) is for the classic AVR core with up to
8097 8K program memory space (MCU types: at90s2313, at90s2323, attiny22,
8098 at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
8099 at90c8534, at90s8535).
8100
8101 Instruction set avr3 is for the classic AVR core with up to 128K program
8102 memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
8103
8104 Instruction set avr4 is for the enhanced AVR core with up to 8K program
8105 memory space (MCU types: atmega8, atmega83, atmega85).
8106
8107 Instruction set avr5 is for the enhanced AVR core with up to 128K program
8108 memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
8109 atmega64, atmega128, at43usb355, at94k).
8110
8111 @item -msize
8112 @opindex msize
8113 Output instruction sizes to the asm file.
8114
8115 @item -minit-stack=@var{N}
8116 @opindex minit-stack
8117 Specify the initial stack address, which may be a symbol or numeric value,
8118 @samp{__stack} is the default.
8119
8120 @item -mno-interrupts
8121 @opindex mno-interrupts
8122 Generated code is not compatible with hardware interrupts.
8123 Code size will be smaller.
8124
8125 @item -mcall-prologues
8126 @opindex mcall-prologues
8127 Functions prologues/epilogues expanded as call to appropriate
8128 subroutines.  Code size will be smaller.
8129
8130 @item -mno-tablejump
8131 @opindex mno-tablejump
8132 Do not generate tablejump insns which sometimes increase code size.
8133
8134 @item -mtiny-stack
8135 @opindex mtiny-stack
8136 Change only the low 8 bits of the stack pointer.
8137
8138 @item -mint8
8139 @opindex mint8
8140 Assume int to be 8 bit integer.  This affects the sizes of all types: A
8141 char will be 1 byte, an int will be 1 byte, an long will be 2 bytes
8142 and long long will be 4 bytes.  Please note that this option does not
8143 comply to the C standards, but it will provide you with smaller code
8144 size.
8145 @end table
8146
8147 @node Blackfin Options
8148 @subsection Blackfin Options
8149 @cindex Blackfin Options
8150
8151 @table @gcctabopt
8152 @item -momit-leaf-frame-pointer
8153 @opindex momit-leaf-frame-pointer
8154 Don't keep the frame pointer in a register for leaf functions.  This
8155 avoids the instructions to save, set up and restore frame pointers and
8156 makes an extra register available in leaf functions.  The option
8157 @option{-fomit-frame-pointer} removes the frame pointer for all functions
8158 which might make debugging harder.
8159
8160 @item -mspecld-anomaly
8161 @opindex mspecld-anomaly
8162 When enabled, the compiler will ensure that the generated code does not
8163 contain speculative loads after jump instructions.  This option is enabled
8164 by default.
8165
8166 @item -mno-specld-anomaly
8167 @opindex mno-specld-anomaly
8168 Don't generate extra code to prevent speculative loads from occurring.
8169
8170 @item -mcsync-anomaly
8171 @opindex mcsync-anomaly
8172 When enabled, the compiler will ensure that the generated code does not
8173 contain CSYNC or SSYNC instructions too soon after conditional branches.
8174 This option is enabled by default.
8175
8176 @item -mno-csync-anomaly
8177 @opindex mno-csync-anomaly
8178 Don't generate extra code to prevent CSYNC or SSYNC instructions from
8179 occurring too soon after a conditional branch.
8180
8181 @item -mlow-64k
8182 @opindex mlow-64k
8183 When enabled, the compiler is free to take advantage of the knowledge that
8184 the entire program fits into the low 64k of memory.
8185
8186 @item -mno-low-64k
8187 @opindex mno-low-64k
8188 Assume that the program is arbitrarily large.  This is the default.
8189
8190 @item -mstack-check-l1
8191 @opindex mstack-check-l1
8192 Do stack checking using information placed into L1 scratchpad memory by the
8193 uClinux kernel.
8194
8195 @item -mid-shared-library
8196 @opindex mid-shared-library
8197 Generate code that supports shared libraries via the library ID method.
8198 This allows for execute in place and shared libraries in an environment
8199 without virtual memory management.  This option implies @option{-fPIC}.
8200
8201 @item -mno-id-shared-library
8202 @opindex mno-id-shared-library
8203 Generate code that doesn't assume ID based shared libraries are being used.
8204 This is the default.
8205
8206 @item -mleaf-id-shared-library
8207 @opindex mleaf-id-shared-library
8208 Generate code that supports shared libraries via the library ID method,
8209 but assumes that this library or executable won't link against any other
8210 ID shared libraries.  That allows the compiler to use faster code for jumps
8211 and calls.
8212
8213 @item -mno-leaf-id-shared-library
8214 @opindex mno-leaf-id-shared-library
8215 Do not assume that the code being compiled won't link against any ID shared
8216 libraries.  Slower code will be generated for jump and call insns.
8217
8218 @item -mshared-library-id=n
8219 @opindex mshared-library-id
8220 Specified the identification number of the ID based shared library being
8221 compiled.  Specifying a value of 0 will generate more compact code, specifying
8222 other values will force the allocation of that number to the current
8223 library but is no more space or time efficient than omitting this option.
8224
8225 @item -msep-data
8226 @opindex msep-data
8227 Generate code that allows the data segment to be located in a different
8228 area of memory from the text segment.  This allows for execute in place in
8229 an environment without virtual memory management by eliminating relocations
8230 against the text section.
8231
8232 @item -mno-sep-data
8233 @opindex mno-sep-data
8234 Generate code that assumes that the data segment follows the text segment.
8235 This is the default.
8236
8237 @item -mlong-calls
8238 @itemx -mno-long-calls
8239 @opindex mlong-calls
8240 @opindex mno-long-calls
8241 Tells the compiler to perform function calls by first loading the
8242 address of the function into a register and then performing a subroutine
8243 call on this register.  This switch is needed if the target function
8244 will lie outside of the 24 bit addressing range of the offset based
8245 version of subroutine call instruction.
8246
8247 This feature is not enabled by default.  Specifying
8248 @option{-mno-long-calls} will restore the default behavior.  Note these
8249 switches have no effect on how the compiler generates code to handle
8250 function calls via function pointers.
8251 @end table
8252
8253 @node CRIS Options
8254 @subsection CRIS Options
8255 @cindex CRIS Options
8256
8257 These options are defined specifically for the CRIS ports.
8258
8259 @table @gcctabopt
8260 @item -march=@var{architecture-type}
8261 @itemx -mcpu=@var{architecture-type}
8262 @opindex march
8263 @opindex mcpu
8264 Generate code for the specified architecture.  The choices for
8265 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
8266 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
8267 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
8268 @samp{v10}.
8269
8270 @item -mtune=@var{architecture-type}
8271 @opindex mtune
8272 Tune to @var{architecture-type} everything applicable about the generated
8273 code, except for the ABI and the set of available instructions.  The
8274 choices for @var{architecture-type} are the same as for
8275 @option{-march=@var{architecture-type}}.
8276
8277 @item -mmax-stack-frame=@var{n}
8278 @opindex mmax-stack-frame
8279 Warn when the stack frame of a function exceeds @var{n} bytes.
8280
8281 @item -melinux-stacksize=@var{n}
8282 @opindex melinux-stacksize
8283 Only available with the @samp{cris-axis-aout} target.  Arranges for
8284 indications in the program to the kernel loader that the stack of the
8285 program should be set to @var{n} bytes.
8286
8287 @item -metrax4
8288 @itemx -metrax100
8289 @opindex metrax4
8290 @opindex metrax100
8291 The options @option{-metrax4} and @option{-metrax100} are synonyms for
8292 @option{-march=v3} and @option{-march=v8} respectively.
8293
8294 @item -mmul-bug-workaround
8295 @itemx -mno-mul-bug-workaround
8296 @opindex mmul-bug-workaround
8297 @opindex mno-mul-bug-workaround
8298 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
8299 models where it applies.  This option is active by default.
8300
8301 @item -mpdebug
8302 @opindex mpdebug
8303 Enable CRIS-specific verbose debug-related information in the assembly
8304 code.  This option also has the effect to turn off the @samp{#NO_APP}
8305 formatted-code indicator to the assembler at the beginning of the
8306 assembly file.
8307
8308 @item -mcc-init
8309 @opindex mcc-init
8310 Do not use condition-code results from previous instruction; always emit
8311 compare and test instructions before use of condition codes.
8312
8313 @item -mno-side-effects
8314 @opindex mno-side-effects
8315 Do not emit instructions with side-effects in addressing modes other than
8316 post-increment.
8317
8318 @item -mstack-align
8319 @itemx -mno-stack-align
8320 @itemx -mdata-align
8321 @itemx -mno-data-align
8322 @itemx -mconst-align
8323 @itemx -mno-const-align
8324 @opindex mstack-align
8325 @opindex mno-stack-align
8326 @opindex mdata-align
8327 @opindex mno-data-align
8328 @opindex mconst-align
8329 @opindex mno-const-align
8330 These options (no-options) arranges (eliminate arrangements) for the
8331 stack-frame, individual data and constants to be aligned for the maximum
8332 single data access size for the chosen CPU model.  The default is to
8333 arrange for 32-bit alignment.  ABI details such as structure layout are
8334 not affected by these options.
8335
8336 @item -m32-bit
8337 @itemx -m16-bit
8338 @itemx -m8-bit
8339 @opindex m32-bit
8340 @opindex m16-bit
8341 @opindex m8-bit
8342 Similar to the stack- data- and const-align options above, these options
8343 arrange for stack-frame, writable data and constants to all be 32-bit,
8344 16-bit or 8-bit aligned.  The default is 32-bit alignment.
8345
8346 @item -mno-prologue-epilogue
8347 @itemx -mprologue-epilogue
8348 @opindex mno-prologue-epilogue
8349 @opindex mprologue-epilogue
8350 With @option{-mno-prologue-epilogue}, the normal function prologue and
8351 epilogue that sets up the stack-frame are omitted and no return
8352 instructions or return sequences are generated in the code.  Use this
8353 option only together with visual inspection of the compiled code: no
8354 warnings or errors are generated when call-saved registers must be saved,
8355 or storage for local variable needs to be allocated.
8356
8357 @item -mno-gotplt
8358 @itemx -mgotplt
8359 @opindex mno-gotplt
8360 @opindex mgotplt
8361 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
8362 instruction sequences that load addresses for functions from the PLT part
8363 of the GOT rather than (traditional on other architectures) calls to the
8364 PLT@.  The default is @option{-mgotplt}.
8365
8366 @item -maout
8367 @opindex maout
8368 Legacy no-op option only recognized with the cris-axis-aout target.
8369
8370 @item -melf
8371 @opindex melf
8372 Legacy no-op option only recognized with the cris-axis-elf and
8373 cris-axis-linux-gnu targets.
8374
8375 @item -melinux
8376 @opindex melinux
8377 Only recognized with the cris-axis-aout target, where it selects a
8378 GNU/linux-like multilib, include files and instruction set for
8379 @option{-march=v8}.
8380
8381 @item -mlinux
8382 @opindex mlinux
8383 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
8384
8385 @item -sim
8386 @opindex sim
8387 This option, recognized for the cris-axis-aout and cris-axis-elf arranges
8388 to link with input-output functions from a simulator library.  Code,
8389 initialized data and zero-initialized data are allocated consecutively.
8390
8391 @item -sim2
8392 @opindex sim2
8393 Like @option{-sim}, but pass linker options to locate initialized data at
8394 0x40000000 and zero-initialized data at 0x80000000.
8395 @end table
8396
8397 @node CRX Options
8398 @subsection CRX Options
8399 @cindex CRX Options
8400
8401 These options are defined specifically for the CRX ports.
8402
8403 @table @gcctabopt
8404
8405 @item -mmac
8406 @opindex mmac
8407 Enable the use of multiply-accumulate instructions. Disabled by default.
8408
8409 @item -mpush-args
8410 @opindex mpush-args
8411 Push instructions will be used to pass outgoing arguments when functions
8412 are called. Enabled by default.
8413 @end table
8414
8415 @node Darwin Options
8416 @subsection Darwin Options
8417 @cindex Darwin options
8418
8419 These options are defined for all architectures running the Darwin operating
8420 system.
8421
8422 FSF GCC on Darwin does not create ``fat'' object files; it will create
8423 an object file for the single architecture that it was built to
8424 target.  Apple's GCC on Darwin does create ``fat'' files if multiple
8425 @option{-arch} options are used; it does so by running the compiler or
8426 linker multiple times and joining the results together with
8427 @file{lipo}.
8428
8429 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
8430 @samp{i686}) is determined by the flags that specify the ISA
8431 that GCC is targetting, like @option{-mcpu} or @option{-march}.  The
8432 @option{-force_cpusubtype_ALL} option can be used to override this.
8433
8434 The Darwin tools vary in their behavior when presented with an ISA
8435 mismatch.  The assembler, @file{as}, will only permit instructions to
8436 be used that are valid for the subtype of the file it is generating,
8437 so you cannot put 64-bit instructions in an @samp{ppc750} object file.
8438 The linker for shared libraries, @file{/usr/bin/libtool}, will fail
8439 and print an error if asked to create a shared library with a less
8440 restrictive subtype than its input files (for instance, trying to put
8441 a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
8442 for executables, @file{ld}, will quietly give the executable the most
8443 restrictive subtype of any of its input files.
8444
8445 @table @gcctabopt
8446 @item -F@var{dir}
8447 @opindex F
8448 Add the framework directory @var{dir} to the head of the list of
8449 directories to be searched for header files.  These directories are
8450 interleaved with those specified by @option{-I} options and are
8451 scanned in a left-to-right order.
8452
8453 A framework directory is a directory with frameworks in it.  A
8454 framework is a directory with a @samp{"Headers"} and/or
8455 @samp{"PrivateHeaders"} directory contained directly in it that ends
8456 in @samp{".framework"}.  The name of a framework is the name of this
8457 directory excluding the @samp{".framework"}.  Headers associated with
8458 the framework are found in one of those two directories, with
8459 @samp{"Headers"} being searched first.  A subframework is a framework
8460 directory that is in a framework's @samp{"Frameworks"} directory.
8461 Includes of subframework headers can only appear in a header of a
8462 framework that contains the subframework, or in a sibling subframework
8463 header.  Two subframeworks are siblings if they occur in the same
8464 framework.  A subframework should not have the same name as a
8465 framework, a warning will be issued if this is violated.  Currently a
8466 subframework cannot have subframeworks, in the future, the mechanism
8467 may be extended to support this.  The standard frameworks can be found
8468 in @samp{"/System/Library/Frameworks"} and
8469 @samp{"/Library/Frameworks"}.  An example include looks like
8470 @code{#include <Framework/header.h>}, where @samp{Framework} denotes
8471 the name of the framework and header.h is found in the
8472 @samp{"PrivateHeaders"} or @samp{"Headers"} directory.
8473
8474 @item -iframework@var{dir}
8475 @opindex iframework
8476 Like @option{-F} except the directory is a treated as a system
8477 directory.  The main difference between this @option{-iframework} and
8478 @option{-F} is that with @option{-iframework} the compiler does not
8479 warn about constructs contained within header files found via
8480 @var{dir}.  This option is valid only for the C family of languages.
8481
8482 @item -gused
8483 @opindex -gused
8484 Emit debugging information for symbols that are used.  For STABS
8485 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
8486 This is by default ON@.
8487
8488 @item -gfull
8489 @opindex -gfull
8490 Emit debugging information for all symbols and types.
8491
8492 @item -mmacosx-version-min=@var{version}
8493 The earliest version of MacOS X that this executable will run on
8494 is @var{version}.  Typical values of @var{version} include @code{10.1},
8495 @code{10.2}, and @code{10.3.9}.
8496
8497 The default for this option is to make choices that seem to be most
8498 useful.  
8499
8500 @item -mkernel
8501 @opindex mkernel
8502 Enable kernel development mode.  The @option{-mkernel} option sets
8503 @option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit},
8504 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
8505 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
8506 applicable.  This mode also sets @option{-mno-altivec},
8507 @option{-msoft-float}, @option{-fno-builtin} and
8508 @option{-mlong-branch} for PowerPC targets.
8509
8510 @item -mone-byte-bool
8511 @opindex -mone-byte-bool
8512 Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}.
8513 By default @samp{sizeof(bool)} is @samp{4} when compiling for
8514 Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this
8515 option has no effect on x86.
8516
8517 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
8518 to generate code that is not binary compatible with code generated
8519 without that switch.  Using this switch may require recompiling all
8520 other modules in a program, including system libraries.  Use this
8521 switch to conform to a non-default data model.
8522
8523 @item -mfix-and-continue
8524 @itemx -ffix-and-continue
8525 @itemx -findirect-data
8526 @opindex mfix-and-continue
8527 @opindex ffix-and-continue
8528 @opindex findirect-data
8529 Generate code suitable for fast turn around development.  Needed to
8530 enable gdb to dynamically load @code{.o} files into already running
8531 programs.  @option{-findirect-data} and @option{-ffix-and-continue}
8532 are provided for backwards compatibility.
8533
8534 @item -all_load
8535 @opindex all_load
8536 Loads all members of static archive libraries.
8537 See man ld(1) for more information.
8538
8539 @item -arch_errors_fatal
8540 @opindex arch_errors_fatal
8541 Cause the errors having to do with files that have the wrong architecture
8542 to be fatal.
8543
8544 @item -bind_at_load
8545 @opindex bind_at_load
8546 Causes the output file to be marked such that the dynamic linker will
8547 bind all undefined references when the file is loaded or launched.
8548
8549 @item -bundle
8550 @opindex bundle
8551 Produce a Mach-o bundle format file.
8552 See man ld(1) for more information.
8553
8554 @item -bundle_loader @var{executable}
8555 @opindex bundle_loader
8556 This option specifies the @var{executable} that will be loading the build
8557 output file being linked.  See man ld(1) for more information.
8558
8559 @item -dynamiclib
8560 @opindex -dynamiclib
8561 When passed this option, GCC will produce a dynamic library instead of
8562 an executable when linking, using the Darwin @file{libtool} command.
8563
8564 @item -force_cpusubtype_ALL
8565 @opindex -force_cpusubtype_ALL
8566 This causes GCC's output file to have the @var{ALL} subtype, instead of
8567 one controlled by the @option{-mcpu} or @option{-march} option.
8568
8569 @item -allowable_client  @var{client_name}
8570 @itemx -client_name
8571 @itemx -compatibility_version
8572 @itemx -current_version
8573 @itemx -dead_strip
8574 @itemx -dependency-file
8575 @itemx -dylib_file
8576 @itemx -dylinker_install_name
8577 @itemx -dynamic
8578 @itemx -exported_symbols_list
8579 @itemx -filelist
8580 @itemx -flat_namespace
8581 @itemx -force_flat_namespace
8582 @itemx -headerpad_max_install_names
8583 @itemx -image_base
8584 @itemx -init
8585 @itemx -install_name
8586 @itemx -keep_private_externs
8587 @itemx -multi_module
8588 @itemx -multiply_defined
8589 @itemx -multiply_defined_unused
8590 @itemx -noall_load
8591 @itemx -no_dead_strip_inits_and_terms
8592 @itemx -nofixprebinding
8593 @itemx -nomultidefs
8594 @itemx -noprebind
8595 @itemx -noseglinkedit
8596 @itemx -pagezero_size
8597 @itemx -prebind
8598 @itemx -prebind_all_twolevel_modules
8599 @itemx -private_bundle
8600 @itemx -read_only_relocs
8601 @itemx -sectalign
8602 @itemx -sectobjectsymbols
8603 @itemx -whyload
8604 @itemx -seg1addr
8605 @itemx -sectcreate
8606 @itemx -sectobjectsymbols
8607 @itemx -sectorder
8608 @itemx -segaddr
8609 @itemx -segs_read_only_addr
8610 @itemx -segs_read_write_addr
8611 @itemx -seg_addr_table
8612 @itemx -seg_addr_table_filename
8613 @itemx -seglinkedit
8614 @itemx -segprot
8615 @itemx -segs_read_only_addr
8616 @itemx -segs_read_write_addr
8617 @itemx -single_module
8618 @itemx -static
8619 @itemx -sub_library
8620 @itemx -sub_umbrella
8621 @itemx -twolevel_namespace
8622 @itemx -umbrella
8623 @itemx -undefined
8624 @itemx -unexported_symbols_list
8625 @itemx -weak_reference_mismatches
8626 @itemx -whatsloaded
8627
8628 @opindex allowable_client
8629 @opindex client_name
8630 @opindex compatibility_version
8631 @opindex current_version
8632 @opindex dead_strip
8633 @opindex dependency-file
8634 @opindex dylib_file
8635 @opindex dylinker_install_name
8636 @opindex dynamic
8637 @opindex exported_symbols_list
8638 @opindex filelist
8639 @opindex flat_namespace
8640 @opindex force_flat_namespace
8641 @opindex headerpad_max_install_names
8642 @opindex image_base
8643 @opindex init
8644 @opindex install_name
8645 @opindex keep_private_externs
8646 @opindex multi_module
8647 @opindex multiply_defined
8648 @opindex multiply_defined_unused
8649 @opindex noall_load
8650 @opindex no_dead_strip_inits_and_terms
8651 @opindex nofixprebinding
8652 @opindex nomultidefs
8653 @opindex noprebind
8654 @opindex noseglinkedit
8655 @opindex pagezero_size
8656 @opindex prebind
8657 @opindex prebind_all_twolevel_modules
8658 @opindex private_bundle
8659 @opindex read_only_relocs
8660 @opindex sectalign
8661 @opindex sectobjectsymbols
8662 @opindex whyload
8663 @opindex seg1addr
8664 @opindex sectcreate
8665 @opindex sectobjectsymbols
8666 @opindex sectorder
8667 @opindex segaddr
8668 @opindex segs_read_only_addr
8669 @opindex segs_read_write_addr
8670 @opindex seg_addr_table
8671 @opindex seg_addr_table_filename
8672 @opindex seglinkedit
8673 @opindex segprot
8674 @opindex segs_read_only_addr
8675 @opindex segs_read_write_addr
8676 @opindex single_module
8677 @opindex static
8678 @opindex sub_library
8679 @opindex sub_umbrella
8680 @opindex twolevel_namespace
8681 @opindex umbrella
8682 @opindex undefined
8683 @opindex unexported_symbols_list
8684 @opindex weak_reference_mismatches
8685 @opindex whatsloaded
8686
8687 These options are passed to the Darwin linker.  The Darwin linker man page
8688 describes them in detail.
8689 @end table
8690
8691 @node DEC Alpha Options
8692 @subsection DEC Alpha Options
8693
8694 These @samp{-m} options are defined for the DEC Alpha implementations:
8695
8696 @table @gcctabopt
8697 @item -mno-soft-float
8698 @itemx -msoft-float
8699 @opindex mno-soft-float
8700 @opindex msoft-float
8701 Use (do not use) the hardware floating-point instructions for
8702 floating-point operations.  When @option{-msoft-float} is specified,
8703 functions in @file{libgcc.a} will be used to perform floating-point
8704 operations.  Unless they are replaced by routines that emulate the
8705 floating-point operations, or compiled in such a way as to call such
8706 emulations routines, these routines will issue floating-point
8707 operations.   If you are compiling for an Alpha without floating-point
8708 operations, you must ensure that the library is built so as not to call
8709 them.
8710
8711 Note that Alpha implementations without floating-point operations are
8712 required to have floating-point registers.
8713
8714 @item -mfp-reg
8715 @itemx -mno-fp-regs
8716 @opindex mfp-reg
8717 @opindex mno-fp-regs
8718 Generate code that uses (does not use) the floating-point register set.
8719 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
8720 register set is not used, floating point operands are passed in integer
8721 registers as if they were integers and floating-point results are passed
8722 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
8723 so any function with a floating-point argument or return value called by code
8724 compiled with @option{-mno-fp-regs} must also be compiled with that
8725 option.
8726
8727 A typical use of this option is building a kernel that does not use,
8728 and hence need not save and restore, any floating-point registers.
8729
8730 @item -mieee
8731 @opindex mieee
8732 The Alpha architecture implements floating-point hardware optimized for
8733 maximum performance.  It is mostly compliant with the IEEE floating
8734 point standard.  However, for full compliance, software assistance is
8735 required.  This option generates code fully IEEE compliant code
8736 @emph{except} that the @var{inexact-flag} is not maintained (see below).
8737 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
8738 defined during compilation.  The resulting code is less efficient but is
8739 able to correctly support denormalized numbers and exceptional IEEE
8740 values such as not-a-number and plus/minus infinity.  Other Alpha
8741 compilers call this option @option{-ieee_with_no_inexact}.
8742
8743 @item -mieee-with-inexact
8744 @opindex mieee-with-inexact
8745 This is like @option{-mieee} except the generated code also maintains
8746 the IEEE @var{inexact-flag}.  Turning on this option causes the
8747 generated code to implement fully-compliant IEEE math.  In addition to
8748 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
8749 macro.  On some Alpha implementations the resulting code may execute
8750 significantly slower than the code generated by default.  Since there is
8751 very little code that depends on the @var{inexact-flag}, you should
8752 normally not specify this option.  Other Alpha compilers call this
8753 option @option{-ieee_with_inexact}.
8754
8755 @item -mfp-trap-mode=@var{trap-mode}
8756 @opindex mfp-trap-mode
8757 This option controls what floating-point related traps are enabled.
8758 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
8759 The trap mode can be set to one of four values:
8760
8761 @table @samp
8762 @item n
8763 This is the default (normal) setting.  The only traps that are enabled
8764 are the ones that cannot be disabled in software (e.g., division by zero
8765 trap).
8766
8767 @item u
8768 In addition to the traps enabled by @samp{n}, underflow traps are enabled
8769 as well.
8770
8771 @item su
8772 Like @samp{u}, but the instructions are marked to be safe for software
8773 completion (see Alpha architecture manual for details).
8774
8775 @item sui
8776 Like @samp{su}, but inexact traps are enabled as well.
8777 @end table
8778
8779 @item -mfp-rounding-mode=@var{rounding-mode}
8780 @opindex mfp-rounding-mode
8781 Selects the IEEE rounding mode.  Other Alpha compilers call this option
8782 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
8783 of:
8784
8785 @table @samp
8786 @item n
8787 Normal IEEE rounding mode.  Floating point numbers are rounded towards
8788 the nearest machine number or towards the even machine number in case
8789 of a tie.
8790
8791 @item m
8792 Round towards minus infinity.
8793
8794 @item c
8795 Chopped rounding mode.  Floating point numbers are rounded towards zero.
8796
8797 @item d
8798 Dynamic rounding mode.  A field in the floating point control register
8799 (@var{fpcr}, see Alpha architecture reference manual) controls the
8800 rounding mode in effect.  The C library initializes this register for
8801 rounding towards plus infinity.  Thus, unless your program modifies the
8802 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
8803 @end table
8804
8805 @item -mtrap-precision=@var{trap-precision}
8806 @opindex mtrap-precision
8807 In the Alpha architecture, floating point traps are imprecise.  This
8808 means without software assistance it is impossible to recover from a
8809 floating trap and program execution normally needs to be terminated.
8810 GCC can generate code that can assist operating system trap handlers
8811 in determining the exact location that caused a floating point trap.
8812 Depending on the requirements of an application, different levels of
8813 precisions can be selected:
8814
8815 @table @samp
8816 @item p
8817 Program precision.  This option is the default and means a trap handler
8818 can only identify which program caused a floating point exception.
8819
8820 @item f
8821 Function precision.  The trap handler can determine the function that
8822 caused a floating point exception.
8823
8824 @item i
8825 Instruction precision.  The trap handler can determine the exact
8826 instruction that caused a floating point exception.
8827 @end table
8828
8829 Other Alpha compilers provide the equivalent options called
8830 @option{-scope_safe} and @option{-resumption_safe}.
8831
8832 @item -mieee-conformant
8833 @opindex mieee-conformant
8834 This option marks the generated code as IEEE conformant.  You must not
8835 use this option unless you also specify @option{-mtrap-precision=i} and either
8836 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
8837 is to emit the line @samp{.eflag 48} in the function prologue of the
8838 generated assembly file.  Under DEC Unix, this has the effect that
8839 IEEE-conformant math library routines will be linked in.
8840
8841 @item -mbuild-constants
8842 @opindex mbuild-constants
8843 Normally GCC examines a 32- or 64-bit integer constant to
8844 see if it can construct it from smaller constants in two or three
8845 instructions.  If it cannot, it will output the constant as a literal and
8846 generate code to load it from the data segment at runtime.
8847
8848 Use this option to require GCC to construct @emph{all} integer constants
8849 using code, even if it takes more instructions (the maximum is six).
8850
8851 You would typically use this option to build a shared library dynamic
8852 loader.  Itself a shared library, it must relocate itself in memory
8853 before it can find the variables and constants in its own data segment.
8854
8855 @item -malpha-as
8856 @itemx -mgas
8857 @opindex malpha-as
8858 @opindex mgas
8859 Select whether to generate code to be assembled by the vendor-supplied
8860 assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
8861
8862 @item -mbwx
8863 @itemx -mno-bwx
8864 @itemx -mcix
8865 @itemx -mno-cix
8866 @itemx -mfix
8867 @itemx -mno-fix
8868 @itemx -mmax
8869 @itemx -mno-max
8870 @opindex mbwx
8871 @opindex mno-bwx
8872 @opindex mcix
8873 @opindex mno-cix
8874 @opindex mfix
8875 @opindex mno-fix
8876 @opindex mmax
8877 @opindex mno-max
8878 Indicate whether GCC should generate code to use the optional BWX,
8879 CIX, FIX and MAX instruction sets.  The default is to use the instruction
8880 sets supported by the CPU type specified via @option{-mcpu=} option or that
8881 of the CPU on which GCC was built if none was specified.
8882
8883 @item -mfloat-vax
8884 @itemx -mfloat-ieee
8885 @opindex mfloat-vax
8886 @opindex mfloat-ieee
8887 Generate code that uses (does not use) VAX F and G floating point
8888 arithmetic instead of IEEE single and double precision.
8889
8890 @item -mexplicit-relocs
8891 @itemx -mno-explicit-relocs
8892 @opindex mexplicit-relocs
8893 @opindex mno-explicit-relocs
8894 Older Alpha assemblers provided no way to generate symbol relocations
8895 except via assembler macros.  Use of these macros does not allow
8896 optimal instruction scheduling.  GNU binutils as of version 2.12
8897 supports a new syntax that allows the compiler to explicitly mark
8898 which relocations should apply to which instructions.  This option
8899 is mostly useful for debugging, as GCC detects the capabilities of
8900 the assembler when it is built and sets the default accordingly.
8901
8902 @item -msmall-data
8903 @itemx -mlarge-data
8904 @opindex msmall-data
8905 @opindex mlarge-data
8906 When @option{-mexplicit-relocs} is in effect, static data is
8907 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
8908 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
8909 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
8910 16-bit relocations off of the @code{$gp} register.  This limits the
8911 size of the small data area to 64KB, but allows the variables to be
8912 directly accessed via a single instruction.
8913
8914 The default is @option{-mlarge-data}.  With this option the data area
8915 is limited to just below 2GB@.  Programs that require more than 2GB of
8916 data must use @code{malloc} or @code{mmap} to allocate the data in the
8917 heap instead of in the program's data segment.
8918
8919 When generating code for shared libraries, @option{-fpic} implies
8920 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
8921
8922 @item -msmall-text
8923 @itemx -mlarge-text
8924 @opindex msmall-text
8925 @opindex mlarge-text
8926 When @option{-msmall-text} is used, the compiler assumes that the
8927 code of the entire program (or shared library) fits in 4MB, and is
8928 thus reachable with a branch instruction.  When @option{-msmall-data}
8929 is used, the compiler can assume that all local symbols share the
8930 same @code{$gp} value, and thus reduce the number of instructions
8931 required for a function call from 4 to 1.
8932
8933 The default is @option{-mlarge-text}.
8934
8935 @item -mcpu=@var{cpu_type}
8936 @opindex mcpu
8937 Set the instruction set and instruction scheduling parameters for
8938 machine type @var{cpu_type}.  You can specify either the @samp{EV}
8939 style name or the corresponding chip number.  GCC supports scheduling
8940 parameters for the EV4, EV5 and EV6 family of processors and will
8941 choose the default values for the instruction set from the processor
8942 you specify.  If you do not specify a processor type, GCC will default
8943 to the processor on which the compiler was built.
8944
8945 Supported values for @var{cpu_type} are
8946
8947 @table @samp
8948 @item ev4
8949 @itemx ev45
8950 @itemx 21064
8951 Schedules as an EV4 and has no instruction set extensions.
8952
8953 @item ev5
8954 @itemx 21164
8955 Schedules as an EV5 and has no instruction set extensions.
8956
8957 @item ev56
8958 @itemx 21164a
8959 Schedules as an EV5 and supports the BWX extension.
8960
8961 @item pca56
8962 @itemx 21164pc
8963 @itemx 21164PC
8964 Schedules as an EV5 and supports the BWX and MAX extensions.
8965
8966 @item ev6
8967 @itemx 21264
8968 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
8969
8970 @item ev67
8971 @itemx 21264a
8972 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
8973 @end table
8974
8975 @item -mtune=@var{cpu_type}
8976 @opindex mtune
8977 Set only the instruction scheduling parameters for machine type
8978 @var{cpu_type}.  The instruction set is not changed.
8979
8980 @item -mmemory-latency=@var{time}
8981 @opindex mmemory-latency
8982 Sets the latency the scheduler should assume for typical memory
8983 references as seen by the application.  This number is highly
8984 dependent on the memory access patterns used by the application
8985 and the size of the external cache on the machine.
8986
8987 Valid options for @var{time} are
8988
8989 @table @samp
8990 @item @var{number}
8991 A decimal number representing clock cycles.
8992
8993 @item L1
8994 @itemx L2
8995 @itemx L3
8996 @itemx main
8997 The compiler contains estimates of the number of clock cycles for
8998 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
8999 (also called Dcache, Scache, and Bcache), as well as to main memory.
9000 Note that L3 is only valid for EV5.
9001
9002 @end table
9003 @end table
9004
9005 @node DEC Alpha/VMS Options
9006 @subsection DEC Alpha/VMS Options
9007
9008 These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
9009
9010 @table @gcctabopt
9011 @item -mvms-return-codes
9012 @opindex mvms-return-codes
9013 Return VMS condition codes from main.  The default is to return POSIX
9014 style condition (e.g.@ error) codes.
9015 @end table
9016
9017 @node FRV Options
9018 @subsection FRV Options
9019 @cindex FRV Options
9020
9021 @table @gcctabopt
9022 @item -mgpr-32
9023 @opindex mgpr-32
9024
9025 Only use the first 32 general purpose registers.
9026
9027 @item -mgpr-64
9028 @opindex mgpr-64
9029
9030 Use all 64 general purpose registers.
9031
9032 @item -mfpr-32
9033 @opindex mfpr-32
9034
9035 Use only the first 32 floating point registers.
9036
9037 @item -mfpr-64
9038 @opindex mfpr-64
9039
9040 Use all 64 floating point registers
9041
9042 @item -mhard-float
9043 @opindex mhard-float
9044
9045 Use hardware instructions for floating point operations.
9046
9047 @item -msoft-float
9048 @opindex msoft-float
9049
9050 Use library routines for floating point operations.
9051
9052 @item -malloc-cc
9053 @opindex malloc-cc
9054
9055 Dynamically allocate condition code registers.
9056
9057 @item -mfixed-cc
9058 @opindex mfixed-cc
9059
9060 Do not try to dynamically allocate condition code registers, only
9061 use @code{icc0} and @code{fcc0}.
9062
9063 @item -mdword
9064 @opindex mdword
9065
9066 Change ABI to use double word insns.
9067
9068 @item -mno-dword
9069 @opindex mno-dword
9070
9071 Do not use double word instructions.
9072
9073 @item -mdouble
9074 @opindex mdouble
9075
9076 Use floating point double instructions.
9077
9078 @item -mno-double
9079 @opindex mno-double
9080
9081 Do not use floating point double instructions.
9082
9083 @item -mmedia
9084 @opindex mmedia
9085
9086 Use media instructions.
9087
9088 @item -mno-media
9089 @opindex mno-media
9090
9091 Do not use media instructions.
9092
9093 @item -mmuladd
9094 @opindex mmuladd
9095
9096 Use multiply and add/subtract instructions.
9097
9098 @item -mno-muladd
9099 @opindex mno-muladd
9100
9101 Do not use multiply and add/subtract instructions.
9102
9103 @item -mfdpic
9104 @opindex mfdpic
9105
9106 Select the FDPIC ABI, that uses function descriptors to represent
9107 pointers to functions.  Without any PIC/PIE-related options, it
9108 implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
9109 assumes GOT entries and small data are within a 12-bit range from the
9110 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
9111 are computed with 32 bits.
9112
9113 @item -minline-plt
9114 @opindex minline-plt
9115
9116 Enable inlining of PLT entries in function calls to functions that are
9117 not known to bind locally.  It has no effect without @option{-mfdpic}.
9118 It's enabled by default if optimizing for speed and compiling for
9119 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
9120 optimization option such as @option{-O3} or above is present in the
9121 command line.
9122
9123 @item -mTLS
9124 @opindex TLS
9125
9126 Assume a large TLS segment when generating thread-local code.
9127
9128 @item -mtls
9129 @opindex tls
9130
9131 Do not assume a large TLS segment when generating thread-local code.
9132
9133 @item -mgprel-ro
9134 @opindex mgprel-ro
9135
9136 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
9137 that is known to be in read-only sections.  It's enabled by default,
9138 except for @option{-fpic} or @option{-fpie}: even though it may help
9139 make the global offset table smaller, it trades 1 instruction for 4.
9140 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
9141 one of which may be shared by multiple symbols, and it avoids the need
9142 for a GOT entry for the referenced symbol, so it's more likely to be a
9143 win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
9144
9145 @item -multilib-library-pic
9146 @opindex multilib-library-pic
9147
9148 Link with the (library, not FD) pic libraries.  It's implied by
9149 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
9150 @option{-fpic} without @option{-mfdpic}.  You should never have to use
9151 it explicitly.
9152
9153 @item -mlinked-fp
9154 @opindex mlinked-fp
9155
9156 Follow the EABI requirement of always creating a frame pointer whenever
9157 a stack frame is allocated.  This option is enabled by default and can
9158 be disabled with @option{-mno-linked-fp}.
9159
9160 @item -mlong-calls
9161 @opindex mlong-calls
9162
9163 Use indirect addressing to call functions outside the current
9164 compilation unit.  This allows the functions to be placed anywhere
9165 within the 32-bit address space.
9166
9167 @item -malign-labels
9168 @opindex malign-labels
9169
9170 Try to align labels to an 8-byte boundary by inserting nops into the
9171 previous packet.  This option only has an effect when VLIW packing
9172 is enabled.  It doesn't create new packets; it merely adds nops to
9173 existing ones.
9174
9175 @item -mlibrary-pic
9176 @opindex mlibrary-pic
9177
9178 Generate position-independent EABI code.
9179
9180 @item -macc-4
9181 @opindex macc-4
9182
9183 Use only the first four media accumulator registers.
9184
9185 @item -macc-8
9186 @opindex macc-8
9187
9188 Use all eight media accumulator registers.
9189
9190 @item -mpack
9191 @opindex mpack
9192
9193 Pack VLIW instructions.
9194
9195 @item -mno-pack
9196 @opindex mno-pack
9197
9198 Do not pack VLIW instructions.
9199
9200 @item -mno-eflags
9201 @opindex mno-eflags
9202
9203 Do not mark ABI switches in e_flags.
9204
9205 @item -mcond-move
9206 @opindex mcond-move
9207
9208 Enable the use of conditional-move instructions (default).
9209
9210 This switch is mainly for debugging the compiler and will likely be removed
9211 in a future version.
9212
9213 @item -mno-cond-move
9214 @opindex mno-cond-move
9215
9216 Disable the use of conditional-move instructions.
9217
9218 This switch is mainly for debugging the compiler and will likely be removed
9219 in a future version.
9220
9221 @item -mscc
9222 @opindex mscc
9223
9224 Enable the use of conditional set instructions (default).
9225
9226 This switch is mainly for debugging the compiler and will likely be removed
9227 in a future version.
9228
9229 @item -mno-scc
9230 @opindex mno-scc
9231
9232 Disable the use of conditional set instructions.
9233
9234 This switch is mainly for debugging the compiler and will likely be removed
9235 in a future version.
9236
9237 @item -mcond-exec
9238 @opindex mcond-exec
9239
9240 Enable the use of conditional execution (default).
9241
9242 This switch is mainly for debugging the compiler and will likely be removed
9243 in a future version.
9244
9245 @item -mno-cond-exec
9246 @opindex mno-cond-exec
9247
9248 Disable the use of conditional execution.
9249
9250 This switch is mainly for debugging the compiler and will likely be removed
9251 in a future version.
9252
9253 @item -mvliw-branch
9254 @opindex mvliw-branch
9255
9256 Run a pass to pack branches into VLIW instructions (default).
9257
9258 This switch is mainly for debugging the compiler and will likely be removed
9259 in a future version.
9260
9261 @item -mno-vliw-branch
9262 @opindex mno-vliw-branch
9263
9264 Do not run a pass to pack branches into VLIW instructions.
9265
9266 This switch is mainly for debugging the compiler and will likely be removed
9267 in a future version.
9268
9269 @item -mmulti-cond-exec
9270 @opindex mmulti-cond-exec
9271
9272 Enable optimization of @code{&&} and @code{||} in conditional execution
9273 (default).
9274
9275 This switch is mainly for debugging the compiler and will likely be removed
9276 in a future version.
9277
9278 @item -mno-multi-cond-exec
9279 @opindex mno-multi-cond-exec
9280
9281 Disable optimization of @code{&&} and @code{||} in conditional execution.
9282
9283 This switch is mainly for debugging the compiler and will likely be removed
9284 in a future version.
9285
9286 @item -mnested-cond-exec
9287 @opindex mnested-cond-exec
9288
9289 Enable nested conditional execution optimizations (default).
9290
9291 This switch is mainly for debugging the compiler and will likely be removed
9292 in a future version.
9293
9294 @item -mno-nested-cond-exec
9295 @opindex mno-nested-cond-exec
9296
9297 Disable nested conditional execution optimizations.
9298
9299 This switch is mainly for debugging the compiler and will likely be removed
9300 in a future version.
9301
9302 @item -moptimize-membar
9303 @opindex moptimize-membar
9304
9305 This switch removes redundant @code{membar} instructions from the
9306 compiler generated code.  It is enabled by default.
9307
9308 @item -mno-optimize-membar
9309 @opindex mno-optimize-membar
9310
9311 This switch disables the automatic removal of redundant @code{membar}
9312 instructions from the generated code.
9313
9314 @item -mtomcat-stats
9315 @opindex mtomcat-stats
9316
9317 Cause gas to print out tomcat statistics.
9318
9319 @item -mcpu=@var{cpu}
9320 @opindex mcpu
9321
9322 Select the processor type for which to generate code.  Possible values are
9323 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
9324 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
9325
9326 @end table
9327
9328 @node GNU/Linux Options
9329 @subsection GNU/Linux Options
9330
9331 These @samp{-m} options are defined for GNU/Linux targets:
9332
9333 @table @gcctabopt
9334 @item -mglibc
9335 @opindex mglibc
9336 Use the GNU C library instead of uClibc.  This is the default except
9337 on @samp{*-*-linux-*uclibc*} targets.
9338
9339 @item -muclibc
9340 @opindex muclibc
9341 Use uClibc instead of the GNU C library.  This is the default on
9342 @samp{*-*-linux-*uclibc*} targets.
9343 @end table
9344
9345 @node H8/300 Options
9346 @subsection H8/300 Options
9347
9348 These @samp{-m} options are defined for the H8/300 implementations:
9349
9350 @table @gcctabopt
9351 @item -mrelax
9352 @opindex mrelax
9353 Shorten some address references at link time, when possible; uses the
9354 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
9355 ld, Using ld}, for a fuller description.
9356
9357 @item -mh
9358 @opindex mh
9359 Generate code for the H8/300H@.
9360
9361 @item -ms
9362 @opindex ms
9363 Generate code for the H8S@.
9364
9365 @item -mn
9366 @opindex mn
9367 Generate code for the H8S and H8/300H in the normal mode.  This switch
9368 must be used either with @option{-mh} or @option{-ms}.
9369
9370 @item -ms2600
9371 @opindex ms2600
9372 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
9373
9374 @item -mint32
9375 @opindex mint32
9376 Make @code{int} data 32 bits by default.
9377
9378 @item -malign-300
9379 @opindex malign-300
9380 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
9381 The default for the H8/300H and H8S is to align longs and floats on 4
9382 byte boundaries.
9383 @option{-malign-300} causes them to be aligned on 2 byte boundaries.
9384 This option has no effect on the H8/300.
9385 @end table
9386
9387 @node HPPA Options
9388 @subsection HPPA Options
9389 @cindex HPPA Options
9390
9391 These @samp{-m} options are defined for the HPPA family of computers:
9392
9393 @table @gcctabopt
9394 @item -march=@var{architecture-type}
9395 @opindex march
9396 Generate code for the specified architecture.  The choices for
9397 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
9398 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
9399 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
9400 architecture option for your machine.  Code compiled for lower numbered
9401 architectures will run on higher numbered architectures, but not the
9402 other way around.
9403
9404 @item -mpa-risc-1-0
9405 @itemx -mpa-risc-1-1
9406 @itemx -mpa-risc-2-0
9407 @opindex mpa-risc-1-0
9408 @opindex mpa-risc-1-1
9409 @opindex mpa-risc-2-0
9410 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
9411
9412 @item -mbig-switch
9413 @opindex mbig-switch
9414 Generate code suitable for big switch tables.  Use this option only if
9415 the assembler/linker complain about out of range branches within a switch
9416 table.
9417
9418 @item -mjump-in-delay
9419 @opindex mjump-in-delay
9420 Fill delay slots of function calls with unconditional jump instructions
9421 by modifying the return pointer for the function call to be the target
9422 of the conditional jump.
9423
9424 @item -mdisable-fpregs
9425 @opindex mdisable-fpregs
9426 Prevent floating point registers from being used in any manner.  This is
9427 necessary for compiling kernels which perform lazy context switching of
9428 floating point registers.  If you use this option and attempt to perform
9429 floating point operations, the compiler will abort.
9430
9431 @item -mdisable-indexing
9432 @opindex mdisable-indexing
9433 Prevent the compiler from using indexing address modes.  This avoids some
9434 rather obscure problems when compiling MIG generated code under MACH@.
9435
9436 @item -mno-space-regs
9437 @opindex mno-space-regs
9438 Generate code that assumes the target has no space registers.  This allows
9439 GCC to generate faster indirect calls and use unscaled index address modes.
9440
9441 Such code is suitable for level 0 PA systems and kernels.
9442
9443 @item -mfast-indirect-calls
9444 @opindex mfast-indirect-calls
9445 Generate code that assumes calls never cross space boundaries.  This
9446 allows GCC to emit code which performs faster indirect calls.
9447
9448 This option will not work in the presence of shared libraries or nested
9449 functions.
9450
9451 @item -mfixed-range=@var{register-range}
9452 @opindex mfixed-range
9453 Generate code treating the given register range as fixed registers.
9454 A fixed register is one that the register allocator can not use.  This is
9455 useful when compiling kernel code.  A register range is specified as
9456 two registers separated by a dash.  Multiple register ranges can be
9457 specified separated by a comma.
9458
9459 @item -mlong-load-store
9460 @opindex mlong-load-store
9461 Generate 3-instruction load and store sequences as sometimes required by
9462 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
9463 the HP compilers.
9464
9465 @item -mportable-runtime
9466 @opindex mportable-runtime
9467 Use the portable calling conventions proposed by HP for ELF systems.
9468
9469 @item -mgas
9470 @opindex mgas
9471 Enable the use of assembler directives only GAS understands.
9472
9473 @item -mschedule=@var{cpu-type}
9474 @opindex mschedule
9475 Schedule code according to the constraints for the machine type
9476 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
9477 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
9478 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
9479 proper scheduling option for your machine.  The default scheduling is
9480 @samp{8000}.
9481
9482 @item -mlinker-opt
9483 @opindex mlinker-opt
9484 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
9485 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
9486 linkers in which they give bogus error messages when linking some programs.
9487
9488 @item -msoft-float
9489 @opindex msoft-float
9490 Generate output containing library calls for floating point.
9491 @strong{Warning:} the requisite libraries are not available for all HPPA
9492 targets.  Normally the facilities of the machine's usual C compiler are
9493 used, but this cannot be done directly in cross-compilation.  You must make
9494 your own arrangements to provide suitable library functions for
9495 cross-compilation.  The embedded target @samp{hppa1.1-*-pro}
9496 does provide software floating point support.
9497
9498 @option{-msoft-float} changes the calling convention in the output file;
9499 therefore, it is only useful if you compile @emph{all} of a program with
9500 this option.  In particular, you need to compile @file{libgcc.a}, the
9501 library that comes with GCC, with @option{-msoft-float} in order for
9502 this to work.
9503
9504 @item -msio
9505 @opindex msio
9506 Generate the predefine, @code{_SIO}, for server IO@.  The default is
9507 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
9508 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
9509 options are available under HP-UX and HI-UX@.
9510
9511 @item -mgnu-ld
9512 @opindex gnu-ld
9513 Use GNU ld specific options.  This passes @option{-shared} to ld when
9514 building a shared library.  It is the default when GCC is configured,
9515 explicitly or implicitly, with the GNU linker.  This option does not
9516 have any affect on which ld is called, it only changes what parameters
9517 are passed to that ld.  The ld that is called is determined by the
9518 @option{--with-ld} configure option, GCC's program search path, and
9519 finally by the user's @env{PATH}.  The linker used by GCC can be printed
9520 using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
9521 on the 64 bit HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}.
9522
9523 @item -mhp-ld
9524 @opindex hp-ld
9525 Use HP ld specific options.  This passes @option{-b} to ld when building
9526 a shared library and passes @option{+Accept TypeMismatch} to ld on all
9527 links.  It is the default when GCC is configured, explicitly or
9528 implicitly, with the HP linker.  This option does not have any affect on
9529 which ld is called, it only changes what parameters are passed to that
9530 ld.  The ld that is called is determined by the @option{--with-ld}
9531 configure option, GCC's program search path, and finally by the user's
9532 @env{PATH}.  The linker used by GCC can be printed using @samp{which
9533 `gcc -print-prog-name=ld`}.  This option is only available on the 64 bit
9534 HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}.
9535
9536 @item -mlong-calls
9537 @opindex mno-long-calls
9538 Generate code that uses long call sequences.  This ensures that a call
9539 is always able to reach linker generated stubs.  The default is to generate
9540 long calls only when the distance from the call site to the beginning
9541 of the function or translation unit, as the case may be, exceeds a
9542 predefined limit set by the branch type being used.  The limits for
9543 normal calls are 7,600,000 and 240,000 bytes, respectively for the
9544 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
9545 240,000 bytes.
9546
9547 Distances are measured from the beginning of functions when using the
9548 @option{-ffunction-sections} option, or when using the @option{-mgas}
9549 and @option{-mno-portable-runtime} options together under HP-UX with
9550 the SOM linker.
9551
9552 It is normally not desirable to use this option as it will degrade
9553 performance.  However, it may be useful in large applications,
9554 particularly when partial linking is used to build the application.
9555
9556 The types of long calls used depends on the capabilities of the
9557 assembler and linker, and the type of code being generated.  The
9558 impact on systems that support long absolute calls, and long pic
9559 symbol-difference or pc-relative calls should be relatively small.
9560 However, an indirect call is used on 32-bit ELF systems in pic code
9561 and it is quite long.
9562
9563 @item -munix=@var{unix-std}
9564 @opindex march
9565 Generate compiler predefines and select a startfile for the specified
9566 UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
9567 and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
9568 is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
9569 11.11 and later.  The default values are @samp{93} for HP-UX 10.00,
9570 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
9571 and later.
9572
9573 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
9574 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
9575 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
9576 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
9577 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
9578 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
9579
9580 It is @emph{important} to note that this option changes the interfaces
9581 for various library routines.  It also affects the operational behavior
9582 of the C library.  Thus, @emph{extreme} care is needed in using this
9583 option.
9584
9585 Library code that is intended to operate with more than one UNIX
9586 standard must test, set and restore the variable @var{__xpg4_extended_mask}
9587 as appropriate.  Most GNU software doesn't provide this capability.
9588
9589 @item -nolibdld
9590 @opindex nolibdld
9591 Suppress the generation of link options to search libdld.sl when the
9592 @option{-static} option is specified on HP-UX 10 and later.
9593
9594 @item -static
9595 @opindex static
9596 The HP-UX implementation of setlocale in libc has a dependency on
9597 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
9598 when the @option{-static} option is specified, special link options
9599 are needed to resolve this dependency.
9600
9601 On HP-UX 10 and later, the GCC driver adds the necessary options to
9602 link with libdld.sl when the @option{-static} option is specified.
9603 This causes the resulting binary to be dynamic.  On the 64-bit port,
9604 the linkers generate dynamic binaries by default in any case.  The
9605 @option{-nolibdld} option can be used to prevent the GCC driver from
9606 adding these link options.
9607
9608 @item -threads
9609 @opindex threads
9610 Add support for multithreading with the @dfn{dce thread} library
9611 under HP-UX@.  This option sets flags for both the preprocessor and
9612 linker.
9613 @end table
9614
9615 @node i386 and x86-64 Options
9616 @subsection Intel 386 and AMD x86-64 Options
9617 @cindex i386 Options
9618 @cindex x86-64 Options
9619 @cindex Intel 386 Options
9620 @cindex AMD x86-64 Options
9621
9622 These @samp{-m} options are defined for the i386 and x86-64 family of
9623 computers:
9624
9625 @table @gcctabopt
9626 @item -mtune=@var{cpu-type}
9627 @opindex mtune
9628 Tune to @var{cpu-type} everything applicable about the generated code, except
9629 for the ABI and the set of available instructions.  The choices for
9630 @var{cpu-type} are:
9631 @table @emph
9632 @item generic
9633 Produce code optimized for the most common IA32/AMD64/EM64T processors.
9634 If you know the CPU on which your code will run, then you should use
9635 the corresponding @option{-mtune} option instead of
9636 @option{-mtune=generic}.  But, if you do not know exactly what CPU users
9637 of your application will have, then you should use this option.
9638
9639 As new processors are deployed in the marketplace, the behavior of this
9640 option will change.  Therefore, if you upgrade to a newer version of
9641 GCC, the code generated option will change to reflect the processors
9642 that were most common when that version of GCC was released.
9643
9644 There is no @option{-march=generic} option because @option{-march}
9645 indicates the instruction set the compiler can use, and there is no
9646 generic instruction set applicable to all processors.  In contrast,
9647 @option{-mtune} indicates the processor (or, in this case, collection of
9648 processors) for which the code is optimized.
9649 @item native
9650 This selects the CPU to tune for at compilation time by determining
9651 the processor type of the compiling machine.  Using @option{-mtune=native}
9652 will produce code optimized for the local machine under the constraints
9653 of the selected instruction set.  Using @option{-march=native} will
9654 enable all instruction subsets supported by the local machine (hence
9655 the result might not run on different machines).
9656 @item i386
9657 Original Intel's i386 CPU@.
9658 @item i486
9659 Intel's i486 CPU@.  (No scheduling is implemented for this chip.)
9660 @item i586, pentium
9661 Intel Pentium CPU with no MMX support.
9662 @item pentium-mmx
9663 Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
9664 @item pentiumpro
9665 Intel PentiumPro CPU@.
9666 @item i686
9667 Same as @code{generic}, but when used as @code{march} option, PentiumPro
9668 instruction set will be used, so the code will run on all i686 family chips.
9669 @item pentium2
9670 Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
9671 @item pentium3, pentium3m
9672 Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
9673 support.
9674 @item pentium-m
9675 Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set
9676 support.  Used by Centrino notebooks.
9677 @item pentium4, pentium4m
9678 Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
9679 @item prescott
9680 Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction
9681 set support.
9682 @item nocona
9683 Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE,
9684 SSE2 and SSE3 instruction set support.
9685 @item core2
9686 Intel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
9687 instruction set support.
9688 @item k6
9689 AMD K6 CPU with MMX instruction set support.
9690 @item k6-2, k6-3
9691 Improved versions of AMD K6 CPU with MMX and 3dNOW! instruction set support.
9692 @item athlon, athlon-tbird
9693 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE prefetch instructions
9694 support.
9695 @item athlon-4, athlon-xp, athlon-mp
9696 Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and full SSE
9697 instruction set support.
9698 @item k8, opteron, athlon64, athlon-fx
9699 AMD K8 core based CPUs with x86-64 instruction set support.  (This supersets
9700 MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.)
9701 @item amdfam10
9702 AMD Family 10 core based CPUs with x86-64 instruction set support.  (This
9703 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3dNOW!, enhanced 3dNOW!, ABM and 64-bit
9704 instruction set extensions.)
9705 @item winchip-c6
9706 IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
9707 set support.
9708 @item winchip2
9709 IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW!
9710 instruction set support.
9711 @item c3
9712 Via C3 CPU with MMX and 3dNOW! instruction set support.  (No scheduling is
9713 implemented for this chip.)
9714 @item c3-2
9715 Via C3-2 CPU with MMX and SSE instruction set support.  (No scheduling is
9716 implemented for this chip.)
9717 @item geode
9718 Embedded AMD CPU with MMX and 3dNOW! instruction set support.
9719 @end table
9720
9721 While picking a specific @var{cpu-type} will schedule things appropriately
9722 for that particular chip, the compiler will not generate any code that
9723 does not run on the i386 without the @option{-march=@var{cpu-type}} option
9724 being used.
9725
9726 @item -march=@var{cpu-type}
9727 @opindex march
9728 Generate instructions for the machine type @var{cpu-type}.  The choices
9729 for @var{cpu-type} are the same as for @option{-mtune}.  Moreover,
9730 specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
9731
9732 @item -mcpu=@var{cpu-type}
9733 @opindex mcpu
9734 A deprecated synonym for @option{-mtune}.
9735
9736 @item -m386
9737 @itemx -m486
9738 @itemx -mpentium
9739 @itemx -mpentiumpro
9740 @opindex m386
9741 @opindex m486
9742 @opindex mpentium
9743 @opindex mpentiumpro
9744 These options are synonyms for @option{-mtune=i386}, @option{-mtune=i486},
9745 @option{-mtune=pentium}, and @option{-mtune=pentiumpro} respectively.
9746 These synonyms are deprecated.
9747
9748 @item -mfpmath=@var{unit}
9749 @opindex march
9750 Generate floating point arithmetics for selected unit @var{unit}.  The choices
9751 for @var{unit} are:
9752
9753 @table @samp
9754 @item 387
9755 Use the standard 387 floating point coprocessor present majority of chips and
9756 emulated otherwise.  Code compiled with this option will run almost everywhere.
9757 The temporary results are computed in 80bit precision instead of precision
9758 specified by the type resulting in slightly different results compared to most
9759 of other chips.  See @option{-ffloat-store} for more detailed description.
9760
9761 This is the default choice for i386 compiler.
9762
9763 @item sse
9764 Use scalar floating point instructions present in the SSE instruction set.
9765 This instruction set is supported by Pentium3 and newer chips, in the AMD line
9766 by Athlon-4, Athlon-xp and Athlon-mp chips.  The earlier version of SSE
9767 instruction set supports only single precision arithmetics, thus the double and
9768 extended precision arithmetics is still done using 387.  Later version, present
9769 only in Pentium4 and the future AMD x86-64 chips supports double precision
9770 arithmetics too.
9771
9772 For the i386 compiler, you need to use @option{-march=@var{cpu-type}}, @option{-msse}
9773 or @option{-msse2} switches to enable SSE extensions and make this option
9774 effective.  For the x86-64 compiler, these extensions are enabled by default.
9775
9776 The resulting code should be considerably faster in the majority of cases and avoid
9777 the numerical instability problems of 387 code, but may break some existing
9778 code that expects temporaries to be 80bit.
9779
9780 This is the default choice for the x86-64 compiler.
9781
9782 @item sse,387
9783 Attempt to utilize both instruction sets at once.  This effectively double the
9784 amount of available registers and on chips with separate execution units for
9785 387 and SSE the execution resources too.  Use this option with care, as it is
9786 still experimental, because the GCC register allocator does not model separate
9787 functional units well resulting in instable performance.
9788 @end table
9789
9790 @item -masm=@var{dialect}
9791 @opindex masm=@var{dialect}
9792 Output asm instructions using selected @var{dialect}.  Supported
9793 choices are @samp{intel} or @samp{att} (the default one).  Darwin does
9794 not support @samp{intel}.
9795
9796 @item -mieee-fp
9797 @itemx -mno-ieee-fp
9798 @opindex mieee-fp
9799 @opindex mno-ieee-fp
9800 Control whether or not the compiler uses IEEE floating point
9801 comparisons.  These handle correctly the case where the result of a
9802 comparison is unordered.
9803
9804 @item -msoft-float
9805 @opindex msoft-float
9806 Generate output containing library calls for floating point.
9807 @strong{Warning:} the requisite libraries are not part of GCC@.
9808 Normally the facilities of the machine's usual C compiler are used, but
9809 this can't be done directly in cross-compilation.  You must make your
9810 own arrangements to provide suitable library functions for
9811 cross-compilation.
9812
9813 On machines where a function returns floating point results in the 80387
9814 register stack, some floating point opcodes may be emitted even if
9815 @option{-msoft-float} is used.
9816
9817 @item -mno-fp-ret-in-387
9818 @opindex mno-fp-ret-in-387
9819 Do not use the FPU registers for return values of functions.
9820
9821 The usual calling convention has functions return values of types
9822 @code{float} and @code{double} in an FPU register, even if there
9823 is no FPU@.  The idea is that the operating system should emulate
9824 an FPU@.
9825
9826 The option @option{-mno-fp-ret-in-387} causes such values to be returned
9827 in ordinary CPU registers instead.
9828
9829 @item -mno-fancy-math-387
9830 @opindex mno-fancy-math-387
9831 Some 387 emulators do not support the @code{sin}, @code{cos} and
9832 @code{sqrt} instructions for the 387.  Specify this option to avoid
9833 generating those instructions.  This option is the default on FreeBSD,
9834 OpenBSD and NetBSD@.  This option is overridden when @option{-march}
9835 indicates that the target cpu will always have an FPU and so the
9836 instruction will not need emulation.  As of revision 2.6.1, these
9837 instructions are not generated unless you also use the
9838 @option{-funsafe-math-optimizations} switch.
9839
9840 @item -malign-double
9841 @itemx -mno-align-double
9842 @opindex malign-double
9843 @opindex mno-align-double
9844 Control whether GCC aligns @code{double}, @code{long double}, and
9845 @code{long long} variables on a two word boundary or a one word
9846 boundary.  Aligning @code{double} variables on a two word boundary will
9847 produce code that runs somewhat faster on a @samp{Pentium} at the
9848 expense of more memory.
9849
9850 On x86-64, @option{-malign-double} is enabled by default.
9851
9852 @strong{Warning:} if you use the @option{-malign-double} switch,
9853 structures containing the above types will be aligned differently than
9854 the published application binary interface specifications for the 386
9855 and will not be binary compatible with structures in code compiled
9856 without that switch.
9857
9858 @item -m96bit-long-double
9859 @itemx -m128bit-long-double
9860 @opindex m96bit-long-double
9861 @opindex m128bit-long-double
9862 These switches control the size of @code{long double} type.  The i386
9863 application binary interface specifies the size to be 96 bits,
9864 so @option{-m96bit-long-double} is the default in 32 bit mode.
9865
9866 Modern architectures (Pentium and newer) would prefer @code{long double}
9867 to be aligned to an 8 or 16 byte boundary.  In arrays or structures
9868 conforming to the ABI, this would not be possible.  So specifying a
9869 @option{-m128bit-long-double} will align @code{long double}
9870 to a 16 byte boundary by padding the @code{long double} with an additional
9871 32 bit zero.
9872
9873 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
9874 its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
9875
9876 Notice that neither of these options enable any extra precision over the x87
9877 standard of 80 bits for a @code{long double}.
9878
9879 @strong{Warning:} if you override the default value for your target ABI, the
9880 structures and arrays containing @code{long double} variables will change
9881 their size as well as function calling convention for function taking
9882 @code{long double} will be modified.  Hence they will not be binary
9883 compatible with arrays or structures in code compiled without that switch.
9884
9885 @item -mmlarge-data-threshold=@var{number}
9886 @opindex mlarge-data-threshold=@var{number}
9887 When @option{-mcmodel=medium} is specified, the data greater than
9888 @var{threshold} are placed in large data section.  This value must be the
9889 same across all object linked into the binary and defaults to 65535.
9890
9891 @item -msvr3-shlib
9892 @itemx -mno-svr3-shlib
9893 @opindex msvr3-shlib
9894 @opindex mno-svr3-shlib
9895 Control whether GCC places uninitialized local variables into the
9896 @code{bss} or @code{data} segments.  @option{-msvr3-shlib} places them
9897 into @code{bss}.  These options are meaningful only on System V Release 3.
9898
9899 @item -mrtd
9900 @opindex mrtd
9901 Use a different function-calling convention, in which functions that
9902 take a fixed number of arguments return with the @code{ret} @var{num}
9903 instruction, which pops their arguments while returning.  This saves one
9904 instruction in the caller since there is no need to pop the arguments
9905 there.
9906
9907 You can specify that an individual function is called with this calling
9908 sequence with the function attribute @samp{stdcall}.  You can also
9909 override the @option{-mrtd} option by using the function attribute
9910 @samp{cdecl}.  @xref{Function Attributes}.
9911
9912 @strong{Warning:} this calling convention is incompatible with the one
9913 normally used on Unix, so you cannot use it if you need to call
9914 libraries compiled with the Unix compiler.
9915
9916 Also, you must provide function prototypes for all functions that
9917 take variable numbers of arguments (including @code{printf});
9918 otherwise incorrect code will be generated for calls to those
9919 functions.
9920
9921 In addition, seriously incorrect code will result if you call a
9922 function with too many arguments.  (Normally, extra arguments are
9923 harmlessly ignored.)
9924
9925 @item -mregparm=@var{num}
9926 @opindex mregparm
9927 Control how many registers are used to pass integer arguments.  By
9928 default, no registers are used to pass arguments, and at most 3
9929 registers can be used.  You can control this behavior for a specific
9930 function by using the function attribute @samp{regparm}.
9931 @xref{Function Attributes}.
9932
9933 @strong{Warning:} if you use this switch, and
9934 @var{num} is nonzero, then you must build all modules with the same
9935 value, including any libraries.  This includes the system libraries and
9936 startup modules.
9937
9938 @item -msseregparm
9939 @opindex msseregparm
9940 Use SSE register passing conventions for float and double arguments
9941 and return values.  You can control this behavior for a specific
9942 function by using the function attribute @samp{sseregparm}.
9943 @xref{Function Attributes}.
9944
9945 @strong{Warning:} if you use this switch then you must build all
9946 modules with the same value, including any libraries.  This includes
9947 the system libraries and startup modules.
9948
9949 @item -mstackrealign
9950 @opindex mstackrealign
9951 Realign the stack at entry.  On the Intel x86, the
9952 @option{-mstackrealign} option will generate an alternate prologue and
9953 epilogue that realigns the runtime stack.  This supports mixing legacy
9954 codes that keep a 4-byte aligned stack with modern codes that keep a
9955 16-byte stack for SSE compatibility.  The alternate prologue and
9956 epilogue are slower and bigger than the regular ones, and the
9957 alternate prologue requires an extra scratch register; this lowers the
9958 number of registers available if used in conjunction with the
9959 @code{regparm} attribute.  The @option{-mstackrealign} option is
9960 incompatible with the nested function prologue; this is considered a
9961 hard error.  See also the attribute @code{force_align_arg_pointer},
9962 applicable to individual functions.
9963
9964 @item -mpreferred-stack-boundary=@var{num}
9965 @opindex mpreferred-stack-boundary
9966 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
9967 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
9968 the default is 4 (16 bytes or 128 bits).
9969
9970 On Pentium and PentiumPro, @code{double} and @code{long double} values
9971 should be aligned to an 8 byte boundary (see @option{-malign-double}) or
9972 suffer significant run time performance penalties.  On Pentium III, the
9973 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
9974 properly if it is not 16 byte aligned.
9975
9976 To ensure proper alignment of this values on the stack, the stack boundary
9977 must be as aligned as that required by any value stored on the stack.
9978 Further, every function must be generated such that it keeps the stack
9979 aligned.  Thus calling a function compiled with a higher preferred
9980 stack boundary from a function compiled with a lower preferred stack
9981 boundary will most likely misalign the stack.  It is recommended that
9982 libraries that use callbacks always use the default setting.
9983
9984 This extra alignment does consume extra stack space, and generally
9985 increases code size.  Code that is sensitive to stack space usage, such
9986 as embedded systems and operating system kernels, may want to reduce the
9987 preferred alignment to @option{-mpreferred-stack-boundary=2}.
9988
9989 @item -mmmx
9990 @itemx -mno-mmx
9991 @item -msse
9992 @itemx -mno-sse
9993 @item -msse2
9994 @itemx -mno-sse2
9995 @item -msse3
9996 @itemx -mno-sse3
9997 @item -mssse3
9998 @itemx -mno-ssse3
9999 @item -msse4a
10000 @item -mno-sse4a
10001 @item -m3dnow
10002 @itemx -mno-3dnow
10003 @item -mpopcnt
10004 @itemx -mno-popcnt
10005 @item -mabm
10006 @itemx -mno-abm
10007 @opindex mmmx
10008 @opindex mno-mmx
10009 @opindex msse
10010 @opindex mno-sse
10011 @opindex m3dnow
10012 @opindex mno-3dnow
10013 These switches enable or disable the use of instructions in the MMX,
10014 SSE, SSE2, SSE3, SSSE3, SSE4A, ABM or 3DNow! extended instruction sets.
10015 These extensions are also available as built-in functions: see
10016 @ref{X86 Built-in Functions}, for details of the functions enabled and
10017 disabled by these switches.
10018
10019 To have SSE/SSE2 instructions generated automatically from floating-point
10020 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
10021
10022 These options will enable GCC to use these extended instructions in
10023 generated code, even without @option{-mfpmath=sse}.  Applications which
10024 perform runtime CPU detection must compile separate files for each
10025 supported architecture, using the appropriate flags.  In particular,
10026 the file containing the CPU detection code should be compiled without
10027 these options.
10028
10029 @item -mpush-args
10030 @itemx -mno-push-args
10031 @opindex mpush-args
10032 @opindex mno-push-args
10033 Use PUSH operations to store outgoing parameters.  This method is shorter
10034 and usually equally fast as method using SUB/MOV operations and is enabled
10035 by default.  In some cases disabling it may improve performance because of
10036 improved scheduling and reduced dependencies.
10037
10038 @item -maccumulate-outgoing-args
10039 @opindex maccumulate-outgoing-args
10040 If enabled, the maximum amount of space required for outgoing arguments will be
10041 computed in the function prologue.  This is faster on most modern CPUs
10042 because of reduced dependencies, improved scheduling and reduced stack usage
10043 when preferred stack boundary is not equal to 2.  The drawback is a notable
10044 increase in code size.  This switch implies @option{-mno-push-args}.
10045
10046 @item -mthreads
10047 @opindex mthreads
10048 Support thread-safe exception handling on @samp{Mingw32}.  Code that relies
10049 on thread-safe exception handling must compile and link all code with the
10050 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
10051 @option{-D_MT}; when linking, it links in a special thread helper library
10052 @option{-lmingwthrd} which cleans up per thread exception handling data.
10053
10054 @item -mno-align-stringops
10055 @opindex mno-align-stringops
10056 Do not align destination of inlined string operations.  This switch reduces
10057 code size and improves performance in case the destination is already aligned,
10058 but GCC doesn't know about it.
10059
10060 @item -minline-all-stringops
10061 @opindex minline-all-stringops
10062 By default GCC inlines string operations only when destination is known to be
10063 aligned at least to 4 byte boundary.  This enables more inlining, increase code
10064 size, but may improve performance of code that depends on fast memcpy, strlen
10065 and memset for short lengths.
10066
10067 @item -minline-stringops-dynamically
10068 @opindex minline-stringops-dynamically
10069 For string operation of unknown size, inline runtime checks so for small
10070 blocks inline code is used, while for large blocks library call is used.
10071
10072 @item -mstringop-strategy=@var{alg}
10073 @opindex mstringop-strategy=@var{alg}
10074 Overwrite internal decision heuristic about particular algorithm to inline
10075 string operation with.  The allowed values are @code{rep_byte},
10076 @code{rep_4byte}, @code{rep_8byte} for expanding using i386 @code{rep} prefix
10077 of specified size, @code{byte_loop}, @code{loop}, @code{unrolled_loop} for
10078 expanding inline loop, @code{libcall} for always expanding library call.
10079
10080 @item -momit-leaf-frame-pointer
10081 @opindex momit-leaf-frame-pointer
10082 Don't keep the frame pointer in a register for leaf functions.  This
10083 avoids the instructions to save, set up and restore frame pointers and
10084 makes an extra register available in leaf functions.  The option
10085 @option{-fomit-frame-pointer} removes the frame pointer for all functions
10086 which might make debugging harder.
10087
10088 @item -mtls-direct-seg-refs
10089 @itemx -mno-tls-direct-seg-refs
10090 @opindex mtls-direct-seg-refs
10091 Controls whether TLS variables may be accessed with offsets from the
10092 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
10093 or whether the thread base pointer must be added.  Whether or not this
10094 is legal depends on the operating system, and whether it maps the
10095 segment to cover the entire TLS area.
10096
10097 For systems that use GNU libc, the default is on.
10098 @end table
10099
10100 These @samp{-m} switches are supported in addition to the above
10101 on AMD x86-64 processors in 64-bit environments.
10102
10103 @table @gcctabopt
10104 @item -m32
10105 @itemx -m64
10106 @opindex m32
10107 @opindex m64
10108 Generate code for a 32-bit or 64-bit environment.
10109 The 32-bit environment sets int, long and pointer to 32 bits and
10110 generates code that runs on any i386 system.
10111 The 64-bit environment sets int to 32 bits and long and pointer
10112 to 64 bits and generates code for AMD's x86-64 architecture.
10113
10114 @item -mno-red-zone
10115 @opindex no-red-zone
10116 Do not use a so called red zone for x86-64 code.  The red zone is mandated
10117 by the x86-64 ABI, it is a 128-byte area beyond the location of the
10118 stack pointer that will not be modified by signal or interrupt handlers
10119 and therefore can be used for temporary data without adjusting the stack
10120 pointer.  The flag @option{-mno-red-zone} disables this red zone.
10121
10122 @item -mcmodel=small
10123 @opindex mcmodel=small
10124 Generate code for the small code model: the program and its symbols must
10125 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
10126 Programs can be statically or dynamically linked.  This is the default
10127 code model.
10128
10129 @item -mcmodel=kernel
10130 @opindex mcmodel=kernel
10131 Generate code for the kernel code model.  The kernel runs in the
10132 negative 2 GB of the address space.
10133 This model has to be used for Linux kernel code.
10134
10135 @item -mcmodel=medium
10136 @opindex mcmodel=medium
10137 Generate code for the medium model: The program is linked in the lower 2
10138 GB of the address space but symbols can be located anywhere in the
10139 address space.  Programs can be statically or dynamically linked, but
10140 building of shared libraries are not supported with the medium model.
10141
10142 @item -mcmodel=large
10143 @opindex mcmodel=large
10144 Generate code for the large model: This model makes no assumptions
10145 about addresses and sizes of sections.  Currently GCC does not implement
10146 this model.
10147 @end table
10148
10149 @node IA-64 Options
10150 @subsection IA-64 Options
10151 @cindex IA-64 Options
10152
10153 These are the @samp{-m} options defined for the Intel IA-64 architecture.
10154
10155 @table @gcctabopt
10156 @item -mbig-endian
10157 @opindex mbig-endian
10158 Generate code for a big endian target.  This is the default for HP-UX@.
10159
10160 @item -mlittle-endian
10161 @opindex mlittle-endian
10162 Generate code for a little endian target.  This is the default for AIX5
10163 and GNU/Linux.
10164
10165 @item -mgnu-as
10166 @itemx -mno-gnu-as
10167 @opindex mgnu-as
10168 @opindex mno-gnu-as
10169 Generate (or don't) code for the GNU assembler.  This is the default.
10170 @c Also, this is the default if the configure option @option{--with-gnu-as}
10171 @c is used.
10172
10173 @item -mgnu-ld
10174 @itemx -mno-gnu-ld
10175 @opindex mgnu-ld
10176 @opindex mno-gnu-ld
10177 Generate (or don't) code for the GNU linker.  This is the default.
10178 @c Also, this is the default if the configure option @option{--with-gnu-ld}
10179 @c is used.
10180
10181 @item -mno-pic
10182 @opindex mno-pic
10183 Generate code that does not use a global pointer register.  The result
10184 is not position independent code, and violates the IA-64 ABI@.
10185
10186 @item -mvolatile-asm-stop
10187 @itemx -mno-volatile-asm-stop
10188 @opindex mvolatile-asm-stop
10189 @opindex mno-volatile-asm-stop
10190 Generate (or don't) a stop bit immediately before and after volatile asm
10191 statements.
10192
10193 @item -mregister-names
10194 @itemx -mno-register-names
10195 @opindex mregister-names
10196 @opindex mno-register-names
10197 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
10198 the stacked registers.  This may make assembler output more readable.
10199
10200 @item -mno-sdata
10201 @itemx -msdata
10202 @opindex mno-sdata
10203 @opindex msdata
10204 Disable (or enable) optimizations that use the small data section.  This may
10205 be useful for working around optimizer bugs.
10206
10207 @item -mconstant-gp
10208 @opindex mconstant-gp
10209 Generate code that uses a single constant global pointer value.  This is
10210 useful when compiling kernel code.
10211
10212 @item -mauto-pic
10213 @opindex mauto-pic
10214 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
10215 This is useful when compiling firmware code.
10216
10217 @item -minline-float-divide-min-latency
10218 @opindex minline-float-divide-min-latency
10219 Generate code for inline divides of floating point values
10220 using the minimum latency algorithm.
10221
10222 @item -minline-float-divide-max-throughput
10223 @opindex minline-float-divide-max-throughput
10224 Generate code for inline divides of floating point values
10225 using the maximum throughput algorithm.
10226
10227 @item -minline-int-divide-min-latency
10228 @opindex minline-int-divide-min-latency
10229 Generate code for inline divides of integer values
10230 using the minimum latency algorithm.
10231
10232 @item -minline-int-divide-max-throughput
10233 @opindex minline-int-divide-max-throughput
10234 Generate code for inline divides of integer values
10235 using the maximum throughput algorithm.
10236
10237 @item -minline-sqrt-min-latency
10238 @opindex minline-sqrt-min-latency
10239 Generate code for inline square roots
10240 using the minimum latency algorithm.
10241
10242 @item -minline-sqrt-max-throughput
10243 @opindex minline-sqrt-max-throughput
10244 Generate code for inline square roots
10245 using the maximum throughput algorithm.
10246
10247 @item -mno-dwarf2-asm
10248 @itemx -mdwarf2-asm
10249 @opindex mno-dwarf2-asm
10250 @opindex mdwarf2-asm
10251 Don't (or do) generate assembler code for the DWARF2 line number debugging
10252 info.  This may be useful when not using the GNU assembler.
10253
10254 @item -mearly-stop-bits
10255 @itemx -mno-early-stop-bits
10256 @opindex mearly-stop-bits
10257 @opindex mno-early-stop-bits
10258 Allow stop bits to be placed earlier than immediately preceding the
10259 instruction that triggered the stop bit.  This can improve instruction
10260 scheduling, but does not always do so.
10261
10262 @item -mfixed-range=@var{register-range}
10263 @opindex mfixed-range
10264 Generate code treating the given register range as fixed registers.
10265 A fixed register is one that the register allocator can not use.  This is
10266 useful when compiling kernel code.  A register range is specified as
10267 two registers separated by a dash.  Multiple register ranges can be
10268 specified separated by a comma.
10269
10270 @item -mtls-size=@var{tls-size}
10271 @opindex mtls-size
10272 Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
10273 64.
10274
10275 @item -mtune=@var{cpu-type}
10276 @opindex mtune
10277 Tune the instruction scheduling for a particular CPU, Valid values are
10278 itanium, itanium1, merced, itanium2, and mckinley.
10279
10280 @item -mt
10281 @itemx -pthread
10282 @opindex mt
10283 @opindex pthread
10284 Add support for multithreading using the POSIX threads library.  This
10285 option sets flags for both the preprocessor and linker.  It does
10286 not affect the thread safety of object code produced by the compiler or
10287 that of libraries supplied with it.  These are HP-UX specific flags.
10288
10289 @item -milp32
10290 @itemx -mlp64
10291 @opindex milp32
10292 @opindex mlp64
10293 Generate code for a 32-bit or 64-bit environment.
10294 The 32-bit environment sets int, long and pointer to 32 bits.
10295 The 64-bit environment sets int to 32 bits and long and pointer
10296 to 64 bits.  These are HP-UX specific flags.
10297
10298 @item -mno-sched-br-data-spec
10299 @itemx -msched-br-data-spec
10300 @opindex -mno-sched-br-data-spec
10301 @opindex -msched-br-data-spec
10302 (Dis/En)able data speculative scheduling before reload.
10303 This will result in generation of the ld.a instructions and
10304 the corresponding check instructions (ld.c / chk.a).
10305 The default is 'disable'.
10306
10307 @item -msched-ar-data-spec
10308 @itemx -mno-sched-ar-data-spec
10309 @opindex -msched-ar-data-spec
10310 @opindex -mno-sched-ar-data-spec
10311 (En/Dis)able data speculative scheduling after reload.
10312 This will result in generation of the ld.a instructions and
10313 the corresponding check instructions (ld.c / chk.a).
10314 The default is 'enable'.
10315
10316 @item -mno-sched-control-spec
10317 @itemx -msched-control-spec
10318 @opindex -mno-sched-control-spec
10319 @opindex -msched-control-spec
10320 (Dis/En)able control speculative scheduling.  This feature is
10321 available only during region scheduling (i.e. before reload).
10322 This will result in generation of the ld.s instructions and
10323 the corresponding check instructions chk.s .
10324 The default is 'disable'.
10325
10326 @item -msched-br-in-data-spec
10327 @itemx -mno-sched-br-in-data-spec
10328 @opindex -msched-br-in-data-spec
10329 @opindex -mno-sched-br-in-data-spec
10330 (En/Dis)able speculative scheduling of the instructions that
10331 are dependent on the data speculative loads before reload.
10332 This is effective only with @option{-msched-br-data-spec} enabled.
10333 The default is 'enable'.
10334
10335 @item -msched-ar-in-data-spec
10336 @itemx -mno-sched-ar-in-data-spec
10337 @opindex -msched-ar-in-data-spec
10338 @opindex -mno-sched-ar-in-data-spec
10339 (En/Dis)able speculative scheduling of the instructions that
10340 are dependent on the data speculative loads after reload.
10341 This is effective only with @option{-msched-ar-data-spec} enabled.
10342 The default is 'enable'.
10343
10344 @item -msched-in-control-spec
10345 @itemx -mno-sched-in-control-spec
10346 @opindex -msched-in-control-spec
10347 @opindex -mno-sched-in-control-spec
10348 (En/Dis)able speculative scheduling of the instructions that
10349 are dependent on the control speculative loads.
10350 This is effective only with @option{-msched-control-spec} enabled.
10351 The default is 'enable'.
10352
10353 @item -msched-ldc
10354 @itemx -mno-sched-ldc
10355 @opindex -msched-ldc
10356 @opindex -mno-sched-ldc
10357 (En/Dis)able use of simple data speculation checks ld.c .
10358 If disabled, only chk.a instructions will be emitted to check
10359 data speculative loads.
10360 The default is 'enable'.
10361
10362 @item -mno-sched-control-ldc
10363 @itemx -msched-control-ldc
10364 @opindex -mno-sched-control-ldc
10365 @opindex -msched-control-ldc 
10366 (Dis/En)able use of ld.c instructions to check control speculative loads.
10367 If enabled, in case of control speculative load with no speculatively
10368 scheduled dependent instructions this load will be emitted as ld.sa and
10369 ld.c will be used to check it.
10370 The default is 'disable'.
10371
10372 @item -mno-sched-spec-verbose
10373 @itemx -msched-spec-verbose
10374 @opindex -mno-sched-spec-verbose
10375 @opindex -msched-spec-verbose
10376 (Dis/En)able printing of the information about speculative motions.
10377
10378 @item -mno-sched-prefer-non-data-spec-insns
10379 @itemx -msched-prefer-non-data-spec-insns
10380 @opindex -mno-sched-prefer-non-data-spec-insns
10381 @opindex -msched-prefer-non-data-spec-insns
10382 If enabled, data speculative instructions will be chosen for schedule
10383 only if there are no other choices at the moment.  This will make
10384 the use of the data speculation much more conservative.
10385 The default is 'disable'.
10386
10387 @item -mno-sched-prefer-non-control-spec-insns
10388 @itemx -msched-prefer-non-control-spec-insns
10389 @opindex -mno-sched-prefer-non-control-spec-insns
10390 @opindex -msched-prefer-non-control-spec-insns
10391 If enabled, control speculative instructions will be chosen for schedule
10392 only if there are no other choices at the moment.  This will make
10393 the use of the control speculation much more conservative.
10394 The default is 'disable'.
10395
10396 @item -mno-sched-count-spec-in-critical-path
10397 @itemx -msched-count-spec-in-critical-path
10398 @opindex -mno-sched-count-spec-in-critical-path
10399 @opindex -msched-count-spec-in-critical-path
10400 If enabled, speculative dependencies will be considered during
10401 computation of the instructions priorities.  This will make the use of the
10402 speculation a bit more conservative.
10403 The default is 'disable'.
10404
10405 @end table
10406
10407 @node M32C Options
10408 @subsection M32C Options
10409 @cindex M32C options
10410
10411 @table @gcctabopt
10412 @item -mcpu=@var{name}
10413 @opindex mcpu=
10414 Select the CPU for which code is generated.  @var{name} may be one of
10415 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
10416 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
10417 the M32C/80 series.
10418
10419 @item -msim
10420 @opindex msim
10421 Specifies that the program will be run on the simulator.  This causes
10422 an alternate runtime library to be linked in which supports, for
10423 example, file I/O.  You must not use this option when generating
10424 programs that will run on real hardware; you must provide your own
10425 runtime library for whatever I/O functions are needed.
10426
10427 @item -memregs=@var{number}
10428 @opindex memregs=
10429 Specifies the number of memory-based pseudo-registers GCC will use
10430 during code generation.  These pseudo-registers will be used like real
10431 registers, so there is a tradeoff between GCC's ability to fit the
10432 code into available registers, and the performance penalty of using
10433 memory instead of registers.  Note that all modules in a program must
10434 be compiled with the same value for this option.  Because of that, you
10435 must not use this option with the default runtime libraries gcc
10436 builds.
10437
10438 @end table
10439
10440 @node M32R/D Options
10441 @subsection M32R/D Options
10442 @cindex M32R/D options
10443
10444 These @option{-m} options are defined for Renesas M32R/D architectures:
10445
10446 @table @gcctabopt
10447 @item -m32r2
10448 @opindex m32r2
10449 Generate code for the M32R/2@.
10450
10451 @item -m32rx
10452 @opindex m32rx
10453 Generate code for the M32R/X@.
10454
10455 @item -m32r
10456 @opindex m32r
10457 Generate code for the M32R@.  This is the default.
10458
10459 @item -mmodel=small
10460 @opindex mmodel=small
10461 Assume all objects live in the lower 16MB of memory (so that their addresses
10462 can be loaded with the @code{ld24} instruction), and assume all subroutines
10463 are reachable with the @code{bl} instruction.
10464 This is the default.
10465
10466 The addressability of a particular object can be set with the
10467 @code{model} attribute.
10468
10469 @item -mmodel=medium
10470 @opindex mmodel=medium
10471 Assume objects may be anywhere in the 32-bit address space (the compiler
10472 will generate @code{seth/add3} instructions to load their addresses), and
10473 assume all subroutines are reachable with the @code{bl} instruction.
10474
10475 @item -mmodel=large
10476 @opindex mmodel=large
10477 Assume objects may be anywhere in the 32-bit address space (the compiler
10478 will generate @code{seth/add3} instructions to load their addresses), and
10479 assume subroutines may not be reachable with the @code{bl} instruction
10480 (the compiler will generate the much slower @code{seth/add3/jl}
10481 instruction sequence).
10482
10483 @item -msdata=none
10484 @opindex msdata=none
10485 Disable use of the small data area.  Variables will be put into
10486 one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
10487 @code{section} attribute has been specified).
10488 This is the default.
10489
10490 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
10491 Objects may be explicitly put in the small data area with the
10492 @code{section} attribute using one of these sections.
10493
10494 @item -msdata=sdata
10495 @opindex msdata=sdata
10496 Put small global and static data in the small data area, but do not
10497 generate special code to reference them.
10498
10499 @item -msdata=use
10500 @opindex msdata=use
10501 Put small global and static data in the small data area, and generate
10502 special instructions to reference them.
10503
10504 @item -G @var{num}
10505 @opindex G
10506 @cindex smaller data references
10507 Put global and static objects less than or equal to @var{num} bytes
10508 into the small data or bss sections instead of the normal data or bss
10509 sections.  The default value of @var{num} is 8.
10510 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
10511 for this option to have any effect.
10512
10513 All modules should be compiled with the same @option{-G @var{num}} value.
10514 Compiling with different values of @var{num} may or may not work; if it
10515 doesn't the linker will give an error message---incorrect code will not be
10516 generated.
10517
10518 @item -mdebug
10519 @opindex mdebug
10520 Makes the M32R specific code in the compiler display some statistics
10521 that might help in debugging programs.
10522
10523 @item -malign-loops
10524 @opindex malign-loops
10525 Align all loops to a 32-byte boundary.
10526
10527 @item -mno-align-loops
10528 @opindex mno-align-loops
10529 Do not enforce a 32-byte alignment for loops.  This is the default.
10530
10531 @item -missue-rate=@var{number}
10532 @opindex missue-rate=@var{number}
10533 Issue @var{number} instructions per cycle.  @var{number} can only be 1
10534 or 2.
10535
10536 @item -mbranch-cost=@var{number}
10537 @opindex mbranch-cost=@var{number}
10538 @var{number} can only be 1 or 2.  If it is 1 then branches will be
10539 preferred over conditional code, if it is 2, then the opposite will
10540 apply.
10541
10542 @item -mflush-trap=@var{number}
10543 @opindex mflush-trap=@var{number}
10544 Specifies the trap number to use to flush the cache.  The default is
10545 12.  Valid numbers are between 0 and 15 inclusive.
10546
10547 @item -mno-flush-trap
10548 @opindex mno-flush-trap
10549 Specifies that the cache cannot be flushed by using a trap.
10550
10551 @item -mflush-func=@var{name}
10552 @opindex mflush-func=@var{name}
10553 Specifies the name of the operating system function to call to flush
10554 the cache.  The default is @emph{_flush_cache}, but a function call
10555 will only be used if a trap is not available.
10556
10557 @item -mno-flush-func
10558 @opindex mno-flush-func
10559 Indicates that there is no OS function for flushing the cache.
10560
10561 @end table
10562
10563 @node M680x0 Options
10564 @subsection M680x0 Options
10565 @cindex M680x0 options
10566
10567 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
10568 The default settings depend on which architecture was selected when
10569 the compiler was configured; the defaults for the most common choices
10570 are given below.
10571
10572 @table @gcctabopt
10573 @item -march=@var{arch}
10574 @opindex march
10575 Generate code for a specific M680x0 or ColdFire instruction set
10576 architecture.  Permissible values of @var{arch} for M680x0
10577 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
10578 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}.  ColdFire
10579 architectures are selected according to Freescale's ISA classification
10580 and the permissible values are: @samp{isaa}, @samp{isaaplus},
10581 @samp{isab} and @samp{isac}.
10582
10583 gcc defines a macro @samp{__mcf@var{arch}__} whenever it is generating
10584 code for a ColdFire target.  The @var{arch} in this macro is one of the
10585 @option{-march} arguments given above.
10586
10587 When used together, @option{-march} and @option{-mtune} select code
10588 that runs on a family of similar processors but that is optimized
10589 for a particular microarchitecture.
10590
10591 @item -mcpu=@var{cpu}
10592 @opindex mcpu
10593 Generate code for a specific M680x0 or ColdFire processor.
10594 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
10595 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
10596 and @samp{cpu32}.  The ColdFire @var{cpu}s are given by the table
10597 below, which also classifies the CPUs into families:
10598
10599 @multitable @columnfractions 0.20 0.80
10600 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
10601 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
10602 @item @samp{5206e} @tab @samp{5206e}
10603 @item @samp{5208} @tab @samp{5207} @samp{5208}
10604 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
10605 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
10606 @item @samp{5216} @tab @samp{5214} @samp{5216}
10607 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
10608 @item @samp{5225} @tab @samp{5224} @samp{5225}
10609 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
10610 @item @samp{5249} @tab @samp{5249}
10611 @item @samp{5250} @tab @samp{5250}
10612 @item @samp{5271} @tab @samp{5270} @samp{5271}
10613 @item @samp{5272} @tab @samp{5272}
10614 @item @samp{5275} @tab @samp{5274} @samp{5275}
10615 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
10616 @item @samp{5307} @tab @samp{5307}
10617 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
10618 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
10619 @item @samp{5407} @tab @samp{5407}
10620 @item @samp{5475} @tab @samp{5470} @samp{5471} @samp{5472} @samp{5473} @samp{5474} @samp{5475} @samp{547x} @samp{5480} @samp{5481} @samp{5482} @samp{5483} @samp{5484} @samp{5485}
10621 @end multitable
10622
10623 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
10624 @var{arch} is compatible with @var{cpu}.  Other combinations of
10625 @option{-mcpu} and @option{-march} are rejected.
10626
10627 gcc defines the macro @samp{__mcf_cpu_@var{cpu}} when ColdFire target
10628 @var{cpu} is selected.  It also defines @samp{__mcf_family_@var{family}},
10629 where the value of @var{family} is given by the table above.
10630
10631 @item -mtune=@var{tune}
10632 @opindex mtune
10633 Tune the code for a particular microarchitecture, within the
10634 constraints set by @option{-march} and @option{-mcpu}.
10635 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
10636 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
10637 and @samp{cpu32}.  The ColdFire microarchitectures
10638 are: @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
10639
10640 You can also use @option{-mtune=68020-40} for code that needs
10641 to run relatively well on 68020, 68030 and 68040 targets.
10642 @option{-mtune=68020-60} is similar but includes 68060 targets
10643 as well.  These two options select the same tuning decisions as
10644 @option{-m68020-40} and @option{-m68020-60} respectively.
10645
10646 gcc defines the macros @samp{__mc@var{arch}} and @samp{__mc@var{arch}__}
10647 when tuning for 680x0 architecture @var{arch}.  It also defines
10648 @samp{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
10649 option is used.  If gcc is tuning for a range of architectures,
10650 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
10651 it defines the macros for every architecture in the range.
10652
10653 gcc also defines the macro @samp{__m@var{uarch}__} when tuning for
10654 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
10655 of the arguments given above.
10656
10657 @item -m68000
10658 @itemx -mc68000
10659 @opindex m68000
10660 @opindex mc68000
10661 Generate output for a 68000.  This is the default
10662 when the compiler is configured for 68000-based systems.
10663 It is equivalent to @option{-march=68000}.
10664
10665 Use this option for microcontrollers with a 68000 or EC000 core,
10666 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
10667
10668 @item -m68010
10669 @opindex m68010
10670 Generate output for a 68010.  This is the default
10671 when the compiler is configured for 68010-based systems.
10672 It is equivalent to @option{-march=68010}.
10673
10674 @item -m68020
10675 @itemx -mc68020
10676 @opindex m68020
10677 @opindex mc68020
10678 Generate output for a 68020.  This is the default
10679 when the compiler is configured for 68020-based systems.
10680 It is equivalent to @option{-march=68020}.
10681
10682 @item -m68030
10683 @opindex m68030
10684 Generate output for a 68030.  This is the default when the compiler is
10685 configured for 68030-based systems.  It is equivalent to
10686 @option{-march=68030}.
10687
10688 @item -m68040
10689 @opindex m68040
10690 Generate output for a 68040.  This is the default when the compiler is
10691 configured for 68040-based systems.  It is equivalent to
10692 @option{-march=68040}.
10693
10694 This option inhibits the use of 68881/68882 instructions that have to be
10695 emulated by software on the 68040.  Use this option if your 68040 does not
10696 have code to emulate those instructions.
10697
10698 @item -m68060
10699 @opindex m68060
10700 Generate output for a 68060.  This is the default when the compiler is
10701 configured for 68060-based systems.  It is equivalent to
10702 @option{-march=68060}.
10703
10704 This option inhibits the use of 68020 and 68881/68882 instructions that
10705 have to be emulated by software on the 68060.  Use this option if your 68060
10706 does not have code to emulate those instructions.
10707
10708 @item -mcpu32
10709 @opindex mcpu32
10710 Generate output for a CPU32.  This is the default
10711 when the compiler is configured for CPU32-based systems.
10712 It is equivalent to @option{-march=cpu32}.
10713
10714 Use this option for microcontrollers with a
10715 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
10716 68336, 68340, 68341, 68349 and 68360.
10717
10718 @item -m5200
10719 @opindex m5200
10720 Generate output for a 520X ColdFire CPU.  This is the default
10721 when the compiler is configured for 520X-based systems.
10722 It is equivalent to @option{-mcpu=5206}, and is now deprecated
10723 in favor of that option.
10724
10725 Use this option for microcontroller with a 5200 core, including
10726 the MCF5202, MCF5203, MCF5204 and MCF5206.
10727
10728 @item -m5206e
10729 @opindex m5206e
10730 Generate output for a 5206e ColdFire CPU.  The option is now
10731 deprecated in favor of the equivalent @option{-mcpu=5206e}.
10732
10733 @item -m528x
10734 @opindex m528x
10735 Generate output for a member of the ColdFire 528X family.
10736 The option is now deprecated in favor of the equivalent
10737 @option{-mcpu=528x}.
10738
10739 @item -m5307
10740 @opindex m5307
10741 Generate output for a ColdFire 5307 CPU.  The option is now deprecated
10742 in favor of the equivalent @option{-mcpu=5307}.
10743
10744 @item -m5407
10745 @opindex m5407
10746 Generate output for a ColdFire 5407 CPU.  The option is now deprecated
10747 in favor of the equivalent @option{-mcpu=5407}.
10748
10749 @item -mcfv4e
10750 @opindex mcfv4e
10751 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
10752 This includes use of hardware floating point instructions.
10753 The option is equivalent to @option{-mcpu=547x}, and is now
10754 deprecated in favor of that option.
10755
10756 @item -m68020-40
10757 @opindex m68020-40
10758 Generate output for a 68040, without using any of the new instructions.
10759 This results in code which can run relatively efficiently on either a
10760 68020/68881 or a 68030 or a 68040.  The generated code does use the
10761 68881 instructions that are emulated on the 68040.
10762
10763 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
10764
10765 @item -m68020-60
10766 @opindex m68020-60
10767 Generate output for a 68060, without using any of the new instructions.
10768 This results in code which can run relatively efficiently on either a
10769 68020/68881 or a 68030 or a 68040.  The generated code does use the
10770 68881 instructions that are emulated on the 68060.
10771
10772 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
10773
10774 @item -mhard-float
10775 @itemx -m68881
10776 @opindex mhard-float
10777 @opindex m68881
10778 Generate floating-point instructions.  This is the default for 68020
10779 and above, and for ColdFire devices that have an FPU.  It defines the
10780 macro @samp{__HAVE_68881__} on M680x0 targets and @samp{__mcffpu__}
10781 on ColdFire targets.
10782
10783 @item -msoft-float
10784 @opindex msoft-float
10785 Do not generate floating-point instructions; use library calls instead.
10786 This is the default for 68000, 68010, and 68832 targets.  It is also
10787 the default for ColdFire devices that have no FPU.
10788
10789 @item -mdiv
10790 @itemx -mno-div
10791 @opindex mdiv
10792 @opindex mno-div
10793 Generate (do not generate) ColdFire hardware divide and remainder
10794 instructions.  If @option{-march} is used without @option{-mcpu},
10795 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
10796 architectures.  Otherwise, the default is taken from the target CPU
10797 (either the default CPU, or the one specified by @option{-mcpu}).  For
10798 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
10799 @option{-mcpu=5206e}.
10800
10801 gcc defines the macro @samp{__mcfhwdiv__} when this option is enabled.
10802
10803 @item -mshort
10804 @opindex mshort
10805 Consider type @code{int} to be 16 bits wide, like @code{short int}.
10806 Additionally, parameters passed on the stack are also aligned to a
10807 16-bit boundary even on targets whose API mandates promotion to 32-bit.
10808
10809 @item -mno-short
10810 @opindex -mno-short
10811 Do not consider type @code{int} to be 16 bits wide.  This is the default.
10812
10813 @item -mnobitfield
10814 @itemx -mno-bitfield
10815 @opindex mnobitfield
10816 @opindex mno-bitfield
10817 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
10818 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
10819
10820 @item -mbitfield
10821 @opindex mbitfield
10822 Do use the bit-field instructions.  The @option{-m68020} option implies
10823 @option{-mbitfield}.  This is the default if you use a configuration
10824 designed for a 68020.
10825
10826 @item -mrtd
10827 @opindex mrtd
10828 Use a different function-calling convention, in which functions
10829 that take a fixed number of arguments return with the @code{rtd}
10830 instruction, which pops their arguments while returning.  This
10831 saves one instruction in the caller since there is no need to pop
10832 the arguments there.
10833
10834 This calling convention is incompatible with the one normally
10835 used on Unix, so you cannot use it if you need to call libraries
10836 compiled with the Unix compiler.
10837
10838 Also, you must provide function prototypes for all functions that
10839 take variable numbers of arguments (including @code{printf});
10840 otherwise incorrect code will be generated for calls to those
10841 functions.
10842
10843 In addition, seriously incorrect code will result if you call a
10844 function with too many arguments.  (Normally, extra arguments are
10845 harmlessly ignored.)
10846
10847 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
10848 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
10849
10850 @item -mno-rtd
10851 @opindex mno-rtd
10852 Do not use the calling conventions selected by @option{-mrtd}.
10853 This is the default.
10854
10855 @item -malign-int
10856 @itemx -mno-align-int
10857 @opindex malign-int
10858 @opindex mno-align-int
10859 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
10860 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
10861 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
10862 Aligning variables on 32-bit boundaries produces code that runs somewhat
10863 faster on processors with 32-bit busses at the expense of more memory.
10864
10865 @strong{Warning:} if you use the @option{-malign-int} switch, GCC will
10866 align structures containing the above types  differently than
10867 most published application binary interface specifications for the m68k.
10868
10869 @item -mpcrel
10870 @opindex mpcrel
10871 Use the pc-relative addressing mode of the 68000 directly, instead of
10872 using a global offset table.  At present, this option implies @option{-fpic},
10873 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
10874 not presently supported with @option{-mpcrel}, though this could be supported for
10875 68020 and higher processors.
10876
10877 @item -mno-strict-align
10878 @itemx -mstrict-align
10879 @opindex mno-strict-align
10880 @opindex mstrict-align
10881 Do not (do) assume that unaligned memory references will be handled by
10882 the system.
10883
10884 @item -msep-data
10885 Generate code that allows the data segment to be located in a different
10886 area of memory from the text segment.  This allows for execute in place in
10887 an environment without virtual memory management.  This option implies
10888 @option{-fPIC}.
10889
10890 @item -mno-sep-data
10891 Generate code that assumes that the data segment follows the text segment.
10892 This is the default.
10893
10894 @item -mid-shared-library
10895 Generate code that supports shared libraries via the library ID method.
10896 This allows for execute in place and shared libraries in an environment
10897 without virtual memory management.  This option implies @option{-fPIC}.
10898
10899 @item -mno-id-shared-library
10900 Generate code that doesn't assume ID based shared libraries are being used.
10901 This is the default.
10902
10903 @item -mshared-library-id=n
10904 Specified the identification number of the ID based shared library being
10905 compiled.  Specifying a value of 0 will generate more compact code, specifying
10906 other values will force the allocation of that number to the current
10907 library but is no more space or time efficient than omitting this option.
10908
10909 @end table
10910
10911 @node M68hc1x Options
10912 @subsection M68hc1x Options
10913 @cindex M68hc1x options
10914
10915 These are the @samp{-m} options defined for the 68hc11 and 68hc12
10916 microcontrollers.  The default values for these options depends on
10917 which style of microcontroller was selected when the compiler was configured;
10918 the defaults for the most common choices are given below.
10919
10920 @table @gcctabopt
10921 @item -m6811
10922 @itemx -m68hc11
10923 @opindex m6811
10924 @opindex m68hc11
10925 Generate output for a 68HC11.  This is the default
10926 when the compiler is configured for 68HC11-based systems.
10927
10928 @item -m6812
10929 @itemx -m68hc12
10930 @opindex m6812
10931 @opindex m68hc12
10932 Generate output for a 68HC12.  This is the default
10933 when the compiler is configured for 68HC12-based systems.
10934
10935 @item -m68S12
10936 @itemx -m68hcs12
10937 @opindex m68S12
10938 @opindex m68hcs12
10939 Generate output for a 68HCS12.
10940
10941 @item -mauto-incdec
10942 @opindex mauto-incdec
10943 Enable the use of 68HC12 pre and post auto-increment and auto-decrement
10944 addressing modes.
10945
10946 @item -minmax
10947 @itemx -nominmax
10948 @opindex minmax
10949 @opindex mnominmax
10950 Enable the use of 68HC12 min and max instructions.
10951
10952 @item -mlong-calls
10953 @itemx -mno-long-calls
10954 @opindex mlong-calls
10955 @opindex mno-long-calls
10956 Treat all calls as being far away (near).  If calls are assumed to be
10957 far away, the compiler will use the @code{call} instruction to
10958 call a function and the @code{rtc} instruction for returning.
10959
10960 @item -mshort
10961 @opindex mshort
10962 Consider type @code{int} to be 16 bits wide, like @code{short int}.
10963
10964 @item -msoft-reg-count=@var{count}
10965 @opindex msoft-reg-count
10966 Specify the number of pseudo-soft registers which are used for the
10967 code generation.  The maximum number is 32.  Using more pseudo-soft
10968 register may or may not result in better code depending on the program.
10969 The default is 4 for 68HC11 and 2 for 68HC12.
10970
10971 @end table
10972
10973 @node MCore Options
10974 @subsection MCore Options
10975 @cindex MCore options
10976
10977 These are the @samp{-m} options defined for the Motorola M*Core
10978 processors.
10979
10980 @table @gcctabopt
10981
10982 @item -mhardlit
10983 @itemx -mno-hardlit
10984 @opindex mhardlit
10985 @opindex mno-hardlit
10986 Inline constants into the code stream if it can be done in two
10987 instructions or less.
10988
10989 @item -mdiv
10990 @itemx -mno-div
10991 @opindex mdiv
10992 @opindex mno-div
10993 Use the divide instruction.  (Enabled by default).
10994
10995 @item -mrelax-immediate
10996 @itemx -mno-relax-immediate
10997 @opindex mrelax-immediate
10998 @opindex mno-relax-immediate
10999 Allow arbitrary sized immediates in bit operations.
11000
11001 @item -mwide-bitfields
11002 @itemx -mno-wide-bitfields
11003 @opindex mwide-bitfields
11004 @opindex mno-wide-bitfields
11005 Always treat bit-fields as int-sized.
11006
11007 @item -m4byte-functions
11008 @itemx -mno-4byte-functions
11009 @opindex m4byte-functions
11010 @opindex mno-4byte-functions
11011 Force all functions to be aligned to a four byte boundary.
11012
11013 @item -mcallgraph-data
11014 @itemx -mno-callgraph-data
11015 @opindex mcallgraph-data
11016 @opindex mno-callgraph-data
11017 Emit callgraph information.
11018
11019 @item -mslow-bytes
11020 @itemx -mno-slow-bytes
11021 @opindex mslow-bytes
11022 @opindex mno-slow-bytes
11023 Prefer word access when reading byte quantities.
11024
11025 @item -mlittle-endian
11026 @itemx -mbig-endian
11027 @opindex mlittle-endian
11028 @opindex mbig-endian
11029 Generate code for a little endian target.
11030
11031 @item -m210
11032 @itemx -m340
11033 @opindex m210
11034 @opindex m340
11035 Generate code for the 210 processor.
11036 @end table
11037
11038 @node MIPS Options
11039 @subsection MIPS Options
11040 @cindex MIPS options
11041
11042 @table @gcctabopt
11043
11044 @item -EB
11045 @opindex EB
11046 Generate big-endian code.
11047
11048 @item -EL
11049 @opindex EL
11050 Generate little-endian code.  This is the default for @samp{mips*el-*-*}
11051 configurations.
11052
11053 @item -march=@var{arch}
11054 @opindex march
11055 Generate code that will run on @var{arch}, which can be the name of a
11056 generic MIPS ISA, or the name of a particular processor.
11057 The ISA names are:
11058 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
11059 @samp{mips32}, @samp{mips32r2}, and @samp{mips64}.
11060 The processor names are:
11061 @samp{4kc}, @samp{4km}, @samp{4kp},
11062 @samp{4kec}, @samp{4kem}, @samp{4kep},
11063 @samp{5kc}, @samp{5kf},
11064 @samp{20kc},
11065 @samp{24kc}, @samp{24kf}, @samp{24kx},
11066 @samp{24kec}, @samp{24kef}, @samp{24kex},
11067 @samp{34kc}, @samp{34kf}, @samp{34kx},
11068 @samp{m4k},
11069 @samp{orion},
11070 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
11071 @samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000},
11072 @samp{rm7000}, @samp{rm9000},
11073 @samp{sb1},
11074 @samp{sr71000},
11075 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
11076 @samp{vr5000}, @samp{vr5400} and @samp{vr5500}.
11077 The special value @samp{from-abi} selects the
11078 most compatible architecture for the selected ABI (that is,
11079 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
11080
11081 In processor names, a final @samp{000} can be abbreviated as @samp{k}
11082 (for example, @samp{-march=r2k}).  Prefixes are optional, and
11083 @samp{vr} may be written @samp{r}.
11084
11085 GCC defines two macros based on the value of this option.  The first
11086 is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
11087 a string.  The second has the form @samp{_MIPS_ARCH_@var{foo}},
11088 where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
11089 For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
11090 to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
11091
11092 Note that the @samp{_MIPS_ARCH} macro uses the processor names given
11093 above.  In other words, it will have the full prefix and will not
11094 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
11095 the macro names the resolved architecture (either @samp{"mips1"} or
11096 @samp{"mips3"}).  It names the default architecture when no
11097 @option{-march} option is given.
11098
11099 @item -mtune=@var{arch}
11100 @opindex mtune
11101 Optimize for @var{arch}.  Among other things, this option controls
11102 the way instructions are scheduled, and the perceived cost of arithmetic
11103 operations.  The list of @var{arch} values is the same as for
11104 @option{-march}.
11105
11106 When this option is not used, GCC will optimize for the processor
11107 specified by @option{-march}.  By using @option{-march} and
11108 @option{-mtune} together, it is possible to generate code that will
11109 run on a family of processors, but optimize the code for one
11110 particular member of that family.
11111
11112 @samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
11113 @samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
11114 @samp{-march} ones described above.
11115
11116 @item -mips1
11117 @opindex mips1
11118 Equivalent to @samp{-march=mips1}.
11119
11120 @item -mips2
11121 @opindex mips2
11122 Equivalent to @samp{-march=mips2}.
11123
11124 @item -mips3
11125 @opindex mips3
11126 Equivalent to @samp{-march=mips3}.
11127
11128 @item -mips4
11129 @opindex mips4
11130 Equivalent to @samp{-march=mips4}.
11131
11132 @item -mips32
11133 @opindex mips32
11134 Equivalent to @samp{-march=mips32}.
11135
11136 @item -mips32r2
11137 @opindex mips32r2
11138 Equivalent to @samp{-march=mips32r2}.
11139
11140 @item -mips64
11141 @opindex mips64
11142 Equivalent to @samp{-march=mips64}.
11143
11144 @item -mips16
11145 @itemx -mno-mips16
11146 @opindex mips16
11147 @opindex mno-mips16
11148 Generate (do not generate) MIPS16 code.  If GCC is targetting a
11149 MIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE@.
11150
11151 @item -mabi=32
11152 @itemx -mabi=o64
11153 @itemx -mabi=n32
11154 @itemx -mabi=64
11155 @itemx -mabi=eabi
11156 @opindex mabi=32
11157 @opindex mabi=o64
11158 @opindex mabi=n32
11159 @opindex mabi=64
11160 @opindex mabi=eabi
11161 Generate code for the given ABI@.
11162
11163 Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
11164 generates 64-bit code when you select a 64-bit architecture, but you
11165 can use @option{-mgp32} to get 32-bit code instead.
11166
11167 For information about the O64 ABI, see
11168 @w{@uref{http://gcc.gnu.org/projects/mipso64-abi.html}}.
11169
11170 GCC supports a variant of the o32 ABI in which floating-point registers
11171 are 64 rather than 32 bits wide.  You can select this combination with
11172 @option{-mabi=32} @option{-mfp64}.  This ABI relies on the @samp{mthc1}
11173 and @samp{mfhc1} instructions and is therefore only supported for
11174 MIPS32R2 processors.
11175
11176 The register assignments for arguments and return values remain the
11177 same, but each scalar value is passed in a single 64-bit register
11178 rather than a pair of 32-bit registers.  For example, scalar
11179 floating-point values are returned in @samp{$f0} only, not a
11180 @samp{$f0}/@samp{$f1} pair.  The set of call-saved registers also
11181 remains the same, but all 64 bits are saved.
11182
11183 @item -mabicalls
11184 @itemx -mno-abicalls
11185 @opindex mabicalls
11186 @opindex mno-abicalls
11187 Generate (do not generate) code that is suitable for SVR4-style
11188 dynamic objects.  @option{-mabicalls} is the default for SVR4-based
11189 systems.
11190
11191 @item -mshared
11192 @itemx -mno-shared
11193 Generate (do not generate) code that is fully position-independent,
11194 and that can therefore be linked into shared libraries.  This option
11195 only affects @option{-mabicalls}.
11196
11197 All @option{-mabicalls} code has traditionally been position-independent,
11198 regardless of options like @option{-fPIC} and @option{-fpic}.  However,
11199 as an extension, the GNU toolchain allows executables to use absolute
11200 accesses for locally-binding symbols.  It can also use shorter GP
11201 initialization sequences and generate direct calls to locally-defined
11202 functions.  This mode is selected by @option{-mno-shared}.
11203
11204 @option{-mno-shared} depends on binutils 2.16 or higher and generates
11205 objects that can only be linked by the GNU linker.  However, the option
11206 does not affect the ABI of the final executable; it only affects the ABI
11207 of relocatable objects.  Using @option{-mno-shared} will generally make
11208 executables both smaller and quicker.
11209
11210 @option{-mshared} is the default.
11211
11212 @item -mxgot
11213 @itemx -mno-xgot
11214 @opindex mxgot
11215 @opindex mno-xgot
11216 Lift (do not lift) the usual restrictions on the size of the global
11217 offset table.
11218
11219 GCC normally uses a single instruction to load values from the GOT@.
11220 While this is relatively efficient, it will only work if the GOT
11221 is smaller than about 64k.  Anything larger will cause the linker
11222 to report an error such as:
11223
11224 @cindex relocation truncated to fit (MIPS)
11225 @smallexample
11226 relocation truncated to fit: R_MIPS_GOT16 foobar
11227 @end smallexample
11228
11229 If this happens, you should recompile your code with @option{-mxgot}.
11230 It should then work with very large GOTs, although it will also be
11231 less efficient, since it will take three instructions to fetch the
11232 value of a global symbol.
11233
11234 Note that some linkers can create multiple GOTs.  If you have such a
11235 linker, you should only need to use @option{-mxgot} when a single object
11236 file accesses more than 64k's worth of GOT entries.  Very few do.
11237
11238 These options have no effect unless GCC is generating position
11239 independent code.
11240
11241 @item -mgp32
11242 @opindex mgp32
11243 Assume that general-purpose registers are 32 bits wide.
11244
11245 @item -mgp64
11246 @opindex mgp64
11247 Assume that general-purpose registers are 64 bits wide.
11248
11249 @item -mfp32
11250 @opindex mfp32
11251 Assume that floating-point registers are 32 bits wide.
11252
11253 @item -mfp64
11254 @opindex mfp64
11255 Assume that floating-point registers are 64 bits wide.
11256
11257 @item -mhard-float
11258 @opindex mhard-float
11259 Use floating-point coprocessor instructions.
11260
11261 @item -msoft-float
11262 @opindex msoft-float
11263 Do not use floating-point coprocessor instructions.  Implement
11264 floating-point calculations using library calls instead.
11265
11266 @item -msingle-float
11267 @opindex msingle-float
11268 Assume that the floating-point coprocessor only supports single-precision
11269 operations.
11270
11271 @itemx -mdouble-float
11272 @opindex mdouble-float
11273 Assume that the floating-point coprocessor supports double-precision
11274 operations.  This is the default.
11275
11276 @itemx -mdsp
11277 @itemx -mno-dsp
11278 @opindex mdsp
11279 @opindex mno-dsp
11280 Use (do not use) the MIPS DSP ASE.  @xref{MIPS DSP Built-in Functions}.
11281
11282 @itemx -mpaired-single
11283 @itemx -mno-paired-single
11284 @opindex mpaired-single
11285 @opindex mno-paired-single
11286 Use (do not use) paired-single floating-point instructions.
11287 @xref{MIPS Paired-Single Support}.  This option can only be used
11288 when generating 64-bit code and requires hardware floating-point
11289 support to be enabled.
11290
11291 @itemx -mips3d
11292 @itemx -mno-mips3d
11293 @opindex mips3d
11294 @opindex mno-mips3d
11295 Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
11296 The option @option{-mips3d} implies @option{-mpaired-single}.
11297
11298 @item -mlong64
11299 @opindex mlong64
11300 Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
11301 an explanation of the default and the way that the pointer size is
11302 determined.
11303
11304 @item -mlong32
11305 @opindex mlong32
11306 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
11307
11308 The default size of @code{int}s, @code{long}s and pointers depends on
11309 the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
11310 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
11311 32-bit @code{long}s.  Pointers are the same size as @code{long}s,
11312 or the same size as integer registers, whichever is smaller.
11313
11314 @item -msym32
11315 @itemx -mno-sym32
11316 @opindex msym32
11317 @opindex mno-sym32
11318 Assume (do not assume) that all symbols have 32-bit values, regardless
11319 of the selected ABI@.  This option is useful in combination with
11320 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
11321 to generate shorter and faster references to symbolic addresses.
11322
11323 @item -G @var{num}
11324 @opindex G
11325 @cindex smaller data references (MIPS)
11326 @cindex gp-relative references (MIPS)
11327 Put global and static items less than or equal to @var{num} bytes into
11328 the small data or bss section instead of the normal data or bss section.
11329 This allows the data to be accessed using a single instruction.
11330
11331 All modules should be compiled with the same @option{-G @var{num}}
11332 value.
11333
11334 @item -membedded-data
11335 @itemx -mno-embedded-data
11336 @opindex membedded-data
11337 @opindex mno-embedded-data
11338 Allocate variables to the read-only data section first if possible, then
11339 next in the small data section if possible, otherwise in data.  This gives
11340 slightly slower code than the default, but reduces the amount of RAM required
11341 when executing, and thus may be preferred for some embedded systems.
11342
11343 @item -muninit-const-in-rodata
11344 @itemx -mno-uninit-const-in-rodata
11345 @opindex muninit-const-in-rodata
11346 @opindex mno-uninit-const-in-rodata
11347 Put uninitialized @code{const} variables in the read-only data section.
11348 This option is only meaningful in conjunction with @option{-membedded-data}.
11349
11350 @item -msplit-addresses
11351 @itemx -mno-split-addresses
11352 @opindex msplit-addresses
11353 @opindex mno-split-addresses
11354 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
11355 relocation operators.  This option has been superseded by
11356 @option{-mexplicit-relocs} but is retained for backwards compatibility.
11357
11358 @item -mexplicit-relocs
11359 @itemx -mno-explicit-relocs
11360 @opindex mexplicit-relocs
11361 @opindex mno-explicit-relocs
11362 Use (do not use) assembler relocation operators when dealing with symbolic
11363 addresses.  The alternative, selected by @option{-mno-explicit-relocs},
11364 is to use assembler macros instead.
11365
11366 @option{-mexplicit-relocs} is the default if GCC was configured
11367 to use an assembler that supports relocation operators.
11368
11369 @item -mcheck-zero-division
11370 @itemx -mno-check-zero-division
11371 @opindex mcheck-zero-division
11372 @opindex mno-check-zero-division
11373 Trap (do not trap) on integer division by zero.
11374
11375 The default is @option{-mcheck-zero-division}.
11376
11377 @item -mdivide-traps
11378 @itemx -mdivide-breaks
11379 @opindex mdivide-traps
11380 @opindex mdivide-breaks
11381 MIPS systems check for division by zero by generating either a
11382 conditional trap or a break instruction.  Using traps results in
11383 smaller code, but is only supported on MIPS II and later.  Also, some
11384 versions of the Linux kernel have a bug that prevents trap from
11385 generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
11386 allow conditional traps on architectures that support them and
11387 @option{-mdivide-breaks} to force the use of breaks.
11388
11389 The default is usually @option{-mdivide-traps}, but this can be
11390 overridden at configure time using @option{--with-divide=breaks}.
11391 Divide-by-zero checks can be completely disabled using
11392 @option{-mno-check-zero-division}.
11393
11394 @item -mmemcpy
11395 @itemx -mno-memcpy
11396 @opindex mmemcpy
11397 @opindex mno-memcpy
11398 Force (do not force) the use of @code{memcpy()} for non-trivial block
11399 moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
11400 most constant-sized copies.
11401
11402 @item -mlong-calls
11403 @itemx -mno-long-calls
11404 @opindex mlong-calls
11405 @opindex mno-long-calls
11406 Disable (do not disable) use of the @code{jal} instruction.  Calling
11407 functions using @code{jal} is more efficient but requires the caller
11408 and callee to be in the same 256 megabyte segment.
11409
11410 This option has no effect on abicalls code.  The default is
11411 @option{-mno-long-calls}.
11412
11413 @item -mmad
11414 @itemx -mno-mad
11415 @opindex mmad
11416 @opindex mno-mad
11417 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
11418 instructions, as provided by the R4650 ISA@.
11419
11420 @item -mfused-madd
11421 @itemx -mno-fused-madd
11422 @opindex mfused-madd
11423 @opindex mno-fused-madd
11424 Enable (disable) use of the floating point multiply-accumulate
11425 instructions, when they are available.  The default is
11426 @option{-mfused-madd}.
11427
11428 When multiply-accumulate instructions are used, the intermediate
11429 product is calculated to infinite precision and is not subject to
11430 the FCSR Flush to Zero bit.  This may be undesirable in some
11431 circumstances.
11432
11433 @item -nocpp
11434 @opindex nocpp
11435 Tell the MIPS assembler to not run its preprocessor over user
11436 assembler files (with a @samp{.s} suffix) when assembling them.
11437
11438 @item -mfix-r4000
11439 @itemx -mno-fix-r4000
11440 @opindex mfix-r4000
11441 @opindex mno-fix-r4000
11442 Work around certain R4000 CPU errata:
11443 @itemize @minus
11444 @item
11445 A double-word or a variable shift may give an incorrect result if executed
11446 immediately after starting an integer division.
11447 @item
11448 A double-word or a variable shift may give an incorrect result if executed
11449 while an integer multiplication is in progress.
11450 @item
11451 An integer division may give an incorrect result if started in a delay slot
11452 of a taken branch or a jump.
11453 @end itemize
11454
11455 @item -mfix-r4400
11456 @itemx -mno-fix-r4400
11457 @opindex mfix-r4400
11458 @opindex mno-fix-r4400
11459 Work around certain R4400 CPU errata:
11460 @itemize @minus
11461 @item
11462 A double-word or a variable shift may give an incorrect result if executed
11463 immediately after starting an integer division.
11464 @end itemize
11465
11466 @item -mfix-vr4120
11467 @itemx -mno-fix-vr4120
11468 @opindex mfix-vr4120
11469 Work around certain VR4120 errata:
11470 @itemize @minus
11471 @item
11472 @code{dmultu} does not always produce the correct result.
11473 @item
11474 @code{div} and @code{ddiv} do not always produce the correct result if one
11475 of the operands is negative.
11476 @end itemize
11477 The workarounds for the division errata rely on special functions in
11478 @file{libgcc.a}.  At present, these functions are only provided by
11479 the @code{mips64vr*-elf} configurations.
11480
11481 Other VR4120 errata require a nop to be inserted between certain pairs of
11482 instructions.  These errata are handled by the assembler, not by GCC itself.
11483
11484 @item -mfix-vr4130
11485 @opindex mfix-vr4130
11486 Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
11487 workarounds are implemented by the assembler rather than by GCC,
11488 although GCC will avoid using @code{mflo} and @code{mfhi} if the
11489 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
11490 instructions are available instead.
11491
11492 @item -mfix-sb1
11493 @itemx -mno-fix-sb1
11494 @opindex mfix-sb1
11495 Work around certain SB-1 CPU core errata.
11496 (This flag currently works around the SB-1 revision 2
11497 ``F1'' and ``F2'' floating point errata.)
11498
11499 @item -mflush-func=@var{func}
11500 @itemx -mno-flush-func
11501 @opindex mflush-func
11502 Specifies the function to call to flush the I and D caches, or to not
11503 call any such function.  If called, the function must take the same
11504 arguments as the common @code{_flush_func()}, that is, the address of the
11505 memory range for which the cache is being flushed, the size of the
11506 memory range, and the number 3 (to flush both caches).  The default
11507 depends on the target GCC was configured for, but commonly is either
11508 @samp{_flush_func} or @samp{__cpu_flush}.
11509
11510 @item -mbranch-likely
11511 @itemx -mno-branch-likely
11512 @opindex mbranch-likely
11513 @opindex mno-branch-likely
11514 Enable or disable use of Branch Likely instructions, regardless of the
11515 default for the selected architecture.  By default, Branch Likely
11516 instructions may be generated if they are supported by the selected
11517 architecture.  An exception is for the MIPS32 and MIPS64 architectures
11518 and processors which implement those architectures; for those, Branch
11519 Likely instructions will not be generated by default because the MIPS32
11520 and MIPS64 architectures specifically deprecate their use.
11521
11522 @item -mfp-exceptions
11523 @itemx -mno-fp-exceptions
11524 @opindex mfp-exceptions
11525 Specifies whether FP exceptions are enabled.  This affects how we schedule
11526 FP instructions for some processors.  The default is that FP exceptions are
11527 enabled.
11528
11529 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
11530 64-bit code, then we can use both FP pipes.  Otherwise, we can only use one
11531 FP pipe.
11532
11533 @item -mvr4130-align
11534 @itemx -mno-vr4130-align
11535 @opindex mvr4130-align
11536 The VR4130 pipeline is two-way superscalar, but can only issue two
11537 instructions together if the first one is 8-byte aligned.  When this
11538 option is enabled, GCC will align pairs of instructions that it
11539 thinks should execute in parallel.
11540
11541 This option only has an effect when optimizing for the VR4130.
11542 It normally makes code faster, but at the expense of making it bigger.
11543 It is enabled by default at optimization level @option{-O3}.
11544 @end table
11545
11546 @node MMIX Options
11547 @subsection MMIX Options
11548 @cindex MMIX Options
11549
11550 These options are defined for the MMIX:
11551
11552 @table @gcctabopt
11553 @item -mlibfuncs
11554 @itemx -mno-libfuncs
11555 @opindex mlibfuncs
11556 @opindex mno-libfuncs
11557 Specify that intrinsic library functions are being compiled, passing all
11558 values in registers, no matter the size.
11559
11560 @item -mepsilon
11561 @itemx -mno-epsilon
11562 @opindex mepsilon
11563 @opindex mno-epsilon
11564 Generate floating-point comparison instructions that compare with respect
11565 to the @code{rE} epsilon register.
11566
11567 @item -mabi=mmixware
11568 @itemx -mabi=gnu
11569 @opindex mabi-mmixware
11570 @opindex mabi=gnu
11571 Generate code that passes function parameters and return values that (in
11572 the called function) are seen as registers @code{$0} and up, as opposed to
11573 the GNU ABI which uses global registers @code{$231} and up.
11574
11575 @item -mzero-extend
11576 @itemx -mno-zero-extend
11577 @opindex mzero-extend
11578 @opindex mno-zero-extend
11579 When reading data from memory in sizes shorter than 64 bits, use (do not
11580 use) zero-extending load instructions by default, rather than
11581 sign-extending ones.
11582
11583 @item -mknuthdiv
11584 @itemx -mno-knuthdiv
11585 @opindex mknuthdiv
11586 @opindex mno-knuthdiv
11587 Make the result of a division yielding a remainder have the same sign as
11588 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
11589 remainder follows the sign of the dividend.  Both methods are
11590 arithmetically valid, the latter being almost exclusively used.
11591
11592 @item -mtoplevel-symbols
11593 @itemx -mno-toplevel-symbols
11594 @opindex mtoplevel-symbols
11595 @opindex mno-toplevel-symbols
11596 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
11597 code can be used with the @code{PREFIX} assembly directive.
11598
11599 @item -melf
11600 @opindex melf
11601 Generate an executable in the ELF format, rather than the default
11602 @samp{mmo} format used by the @command{mmix} simulator.
11603
11604 @item -mbranch-predict
11605 @itemx -mno-branch-predict
11606 @opindex mbranch-predict
11607 @opindex mno-branch-predict
11608 Use (do not use) the probable-branch instructions, when static branch
11609 prediction indicates a probable branch.
11610
11611 @item -mbase-addresses
11612 @itemx -mno-base-addresses
11613 @opindex mbase-addresses
11614 @opindex mno-base-addresses
11615 Generate (do not generate) code that uses @emph{base addresses}.  Using a
11616 base address automatically generates a request (handled by the assembler
11617 and the linker) for a constant to be set up in a global register.  The
11618 register is used for one or more base address requests within the range 0
11619 to 255 from the value held in the register.  The generally leads to short
11620 and fast code, but the number of different data items that can be
11621 addressed is limited.  This means that a program that uses lots of static
11622 data may require @option{-mno-base-addresses}.
11623
11624 @item -msingle-exit
11625 @itemx -mno-single-exit
11626 @opindex msingle-exit
11627 @opindex mno-single-exit
11628 Force (do not force) generated code to have a single exit point in each
11629 function.
11630 @end table
11631
11632 @node MN10300 Options
11633 @subsection MN10300 Options
11634 @cindex MN10300 options
11635
11636 These @option{-m} options are defined for Matsushita MN10300 architectures:
11637
11638 @table @gcctabopt
11639 @item -mmult-bug
11640 @opindex mmult-bug
11641 Generate code to avoid bugs in the multiply instructions for the MN10300
11642 processors.  This is the default.
11643
11644 @item -mno-mult-bug
11645 @opindex mno-mult-bug
11646 Do not generate code to avoid bugs in the multiply instructions for the
11647 MN10300 processors.
11648
11649 @item -mam33
11650 @opindex mam33
11651 Generate code which uses features specific to the AM33 processor.
11652
11653 @item -mno-am33
11654 @opindex mno-am33
11655 Do not generate code which uses features specific to the AM33 processor.  This
11656 is the default.
11657
11658 @item -mreturn-pointer-on-d0
11659 @opindex mreturn-pointer-on-d0
11660 When generating a function which returns a pointer, return the pointer
11661 in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
11662 only in a0, and attempts to call such functions without a prototype
11663 would result in errors.  Note that this option is on by default; use
11664 @option{-mno-return-pointer-on-d0} to disable it.
11665
11666 @item -mno-crt0
11667 @opindex mno-crt0
11668 Do not link in the C run-time initialization object file.
11669
11670 @item -mrelax
11671 @opindex mrelax
11672 Indicate to the linker that it should perform a relaxation optimization pass
11673 to shorten branches, calls and absolute memory addresses.  This option only
11674 has an effect when used on the command line for the final link step.
11675
11676 This option makes symbolic debugging impossible.
11677 @end table
11678
11679 @node MT Options
11680 @subsection MT Options
11681 @cindex MT options
11682
11683 These @option{-m} options are defined for Morpho MT architectures:
11684
11685 @table @gcctabopt
11686
11687 @item -march=@var{cpu-type}
11688 @opindex march
11689 Generate code that will run on @var{cpu-type}, which is the name of a system
11690 representing a certain processor type.  Possible values for
11691 @var{cpu-type} are @samp{ms1-64-001}, @samp{ms1-16-002},
11692 @samp{ms1-16-003} and @samp{ms2}.
11693
11694 When this option is not used, the default is @option{-march=ms1-16-002}.
11695
11696 @item -mbacc
11697 @opindex mbacc
11698 Use byte loads and stores when generating code.
11699
11700 @item -mno-bacc
11701 @opindex mno-bacc
11702 Do not use byte loads and stores when generating code.
11703
11704 @item -msim
11705 @opindex msim
11706 Use simulator runtime
11707
11708 @item -mno-crt0
11709 @opindex mno-crt0
11710 Do not link in the C run-time initialization object file
11711 @file{crti.o}.  Other run-time initialization and termination files
11712 such as @file{startup.o} and @file{exit.o} are still included on the
11713 linker command line.
11714
11715 @end table
11716
11717 @node PDP-11 Options
11718 @subsection PDP-11 Options
11719 @cindex PDP-11 Options
11720
11721 These options are defined for the PDP-11:
11722
11723 @table @gcctabopt
11724 @item -mfpu
11725 @opindex mfpu
11726 Use hardware FPP floating point.  This is the default.  (FIS floating
11727 point on the PDP-11/40 is not supported.)
11728
11729 @item -msoft-float
11730 @opindex msoft-float
11731 Do not use hardware floating point.
11732
11733 @item -mac0
11734 @opindex mac0
11735 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
11736
11737 @item -mno-ac0
11738 @opindex mno-ac0
11739 Return floating-point results in memory.  This is the default.
11740
11741 @item -m40
11742 @opindex m40
11743 Generate code for a PDP-11/40.
11744
11745 @item -m45
11746 @opindex m45
11747 Generate code for a PDP-11/45.  This is the default.
11748
11749 @item -m10
11750 @opindex m10
11751 Generate code for a PDP-11/10.
11752
11753 @item -mbcopy-builtin
11754 @opindex bcopy-builtin
11755 Use inline @code{movmemhi} patterns for copying memory.  This is the
11756 default.
11757
11758 @item -mbcopy
11759 @opindex mbcopy
11760 Do not use inline @code{movmemhi} patterns for copying memory.
11761
11762 @item -mint16
11763 @itemx -mno-int32
11764 @opindex mint16
11765 @opindex mno-int32
11766 Use 16-bit @code{int}.  This is the default.
11767
11768 @item -mint32
11769 @itemx -mno-int16
11770 @opindex mint32
11771 @opindex mno-int16
11772 Use 32-bit @code{int}.
11773
11774 @item -mfloat64
11775 @itemx -mno-float32
11776 @opindex mfloat64
11777 @opindex mno-float32
11778 Use 64-bit @code{float}.  This is the default.
11779
11780 @item -mfloat32
11781 @itemx -mno-float64
11782 @opindex mfloat32
11783 @opindex mno-float64
11784 Use 32-bit @code{float}.
11785
11786 @item -mabshi
11787 @opindex mabshi
11788 Use @code{abshi2} pattern.  This is the default.
11789
11790 @item -mno-abshi
11791 @opindex mno-abshi
11792 Do not use @code{abshi2} pattern.
11793
11794 @item -mbranch-expensive
11795 @opindex mbranch-expensive
11796 Pretend that branches are expensive.  This is for experimenting with
11797 code generation only.
11798
11799 @item -mbranch-cheap
11800 @opindex mbranch-cheap
11801 Do not pretend that branches are expensive.  This is the default.
11802
11803 @item -msplit
11804 @opindex msplit
11805 Generate code for a system with split I&D@.
11806
11807 @item -mno-split
11808 @opindex mno-split
11809 Generate code for a system without split I&D@.  This is the default.
11810
11811 @item -munix-asm
11812 @opindex munix-asm
11813 Use Unix assembler syntax.  This is the default when configured for
11814 @samp{pdp11-*-bsd}.
11815
11816 @item -mdec-asm
11817 @opindex mdec-asm
11818 Use DEC assembler syntax.  This is the default when configured for any
11819 PDP-11 target other than @samp{pdp11-*-bsd}.
11820 @end table
11821
11822 @node PowerPC Options
11823 @subsection PowerPC Options
11824 @cindex PowerPC options
11825
11826 These are listed under @xref{RS/6000 and PowerPC Options}.
11827
11828 @node RS/6000 and PowerPC Options
11829 @subsection IBM RS/6000 and PowerPC Options
11830 @cindex RS/6000 and PowerPC Options
11831 @cindex IBM RS/6000 and PowerPC Options
11832
11833 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
11834 @table @gcctabopt
11835 @item -mpower
11836 @itemx -mno-power
11837 @itemx -mpower2
11838 @itemx -mno-power2
11839 @itemx -mpowerpc
11840 @itemx -mno-powerpc
11841 @itemx -mpowerpc-gpopt
11842 @itemx -mno-powerpc-gpopt
11843 @itemx -mpowerpc-gfxopt
11844 @itemx -mno-powerpc-gfxopt
11845 @itemx -mpowerpc64
11846 @itemx -mno-powerpc64
11847 @itemx -mmfcrf
11848 @itemx -mno-mfcrf
11849 @itemx -mpopcntb
11850 @itemx -mno-popcntb
11851 @itemx -mfprnd
11852 @itemx -mno-fprnd
11853 @itemx -mcmpb
11854 @itemx -mno-cmpb
11855 @itemx -mmfpgpr
11856 @itemx -mno-mfpgpr
11857 @itemx -mdfp
11858 @itemx -mno-dfp
11859 @opindex mpower
11860 @opindex mno-power
11861 @opindex mpower2
11862 @opindex mno-power2
11863 @opindex mpowerpc
11864 @opindex mno-powerpc
11865 @opindex mpowerpc-gpopt
11866 @opindex mno-powerpc-gpopt
11867 @opindex mpowerpc-gfxopt
11868 @opindex mno-powerpc-gfxopt
11869 @opindex mpowerpc64
11870 @opindex mno-powerpc64
11871 @opindex mmfcrf
11872 @opindex mno-mfcrf
11873 @opindex mpopcntb
11874 @opindex mno-popcntb
11875 @opindex mfprnd
11876 @opindex mno-fprnd
11877 @opindex mcmpb
11878 @opindex mno-cmpb
11879 @opindex mmfpgpr
11880 @opindex mno-mfpgpr
11881 @opindex mdfp
11882 @opindex mno-dfp
11883 GCC supports two related instruction set architectures for the
11884 RS/6000 and PowerPC@.  The @dfn{POWER} instruction set are those
11885 instructions supported by the @samp{rios} chip set used in the original
11886 RS/6000 systems and the @dfn{PowerPC} instruction set is the
11887 architecture of the Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and
11888 the IBM 4xx, 6xx, and follow-on microprocessors.
11889
11890 Neither architecture is a subset of the other.  However there is a
11891 large common subset of instructions supported by both.  An MQ
11892 register is included in processors supporting the POWER architecture.
11893
11894 You use these options to specify which instructions are available on the
11895 processor you are using.  The default value of these options is
11896 determined when configuring GCC@.  Specifying the
11897 @option{-mcpu=@var{cpu_type}} overrides the specification of these
11898 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
11899 rather than the options listed above.
11900
11901 The @option{-mpower} option allows GCC to generate instructions that
11902 are found only in the POWER architecture and to use the MQ register.
11903 Specifying @option{-mpower2} implies @option{-power} and also allows GCC
11904 to generate instructions that are present in the POWER2 architecture but
11905 not the original POWER architecture.
11906
11907 The @option{-mpowerpc} option allows GCC to generate instructions that
11908 are found only in the 32-bit subset of the PowerPC architecture.
11909 Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
11910 GCC to use the optional PowerPC architecture instructions in the
11911 General Purpose group, including floating-point square root.  Specifying
11912 @option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
11913 use the optional PowerPC architecture instructions in the Graphics
11914 group, including floating-point select.
11915
11916 The @option{-mmfcrf} option allows GCC to generate the move from
11917 condition register field instruction implemented on the POWER4
11918 processor and other processors that support the PowerPC V2.01
11919 architecture.
11920 The @option{-mpopcntb} option allows GCC to generate the popcount and
11921 double precision FP reciprocal estimate instruction implemented on the
11922 POWER5 processor and other processors that support the PowerPC V2.02
11923 architecture.
11924 The @option{-mfprnd} option allows GCC to generate the FP round to
11925 integer instructions implemented on the POWER5+ processor and other
11926 processors that support the PowerPC V2.03 architecture.
11927 The @option{-mcmpb} option allows GCC to generate the compare bytes
11928 instruction implemented on the POWER6 processor and other processors
11929 that support the PowerPC V2.05 architecture.
11930 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
11931 general purpose register instructions implemented on the POWER6X
11932 processor and other processors that support the extended PowerPC V2.05
11933 architecture.
11934 The @option{-mdfp} option allows GCC to generate the decimal floating
11935 point instructions implemented on some POWER processors.
11936
11937 The @option{-mpowerpc64} option allows GCC to generate the additional
11938 64-bit instructions that are found in the full PowerPC64 architecture
11939 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
11940 @option{-mno-powerpc64}.
11941
11942 If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
11943 will use only the instructions in the common subset of both
11944 architectures plus some special AIX common-mode calls, and will not use
11945 the MQ register.  Specifying both @option{-mpower} and @option{-mpowerpc}
11946 permits GCC to use any instruction from either architecture and to
11947 allow use of the MQ register; specify this for the Motorola MPC601.
11948
11949 @item -mnew-mnemonics
11950 @itemx -mold-mnemonics
11951 @opindex mnew-mnemonics
11952 @opindex mold-mnemonics
11953 Select which mnemonics to use in the generated assembler code.  With
11954 @option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
11955 the PowerPC architecture.  With @option{-mold-mnemonics} it uses the
11956 assembler mnemonics defined for the POWER architecture.  Instructions
11957 defined in only one architecture have only one mnemonic; GCC uses that
11958 mnemonic irrespective of which of these options is specified.
11959
11960 GCC defaults to the mnemonics appropriate for the architecture in
11961 use.  Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
11962 value of these option.  Unless you are building a cross-compiler, you
11963 should normally not specify either @option{-mnew-mnemonics} or
11964 @option{-mold-mnemonics}, but should instead accept the default.
11965
11966 @item -mcpu=@var{cpu_type}
11967 @opindex mcpu
11968 Set architecture type, register usage, choice of mnemonics, and
11969 instruction scheduling parameters for machine type @var{cpu_type}.
11970 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
11971 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{505},
11972 @samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604},
11973 @samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400},
11974 @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
11975 @samp{860}, @samp{970}, @samp{8540}, @samp{ec603e}, @samp{G3},
11976 @samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3},
11977 @samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6},
11978 @samp{power6x}, @samp{common}, @samp{powerpc}, @samp{powerpc64},
11979 @samp{rios}, @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}.
11980
11981 @option{-mcpu=common} selects a completely generic processor.  Code
11982 generated under this option will run on any POWER or PowerPC processor.
11983 GCC will use only the instructions in the common subset of both
11984 architectures, and will not use the MQ register.  GCC assumes a generic
11985 processor model for scheduling purposes.
11986
11987 @option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
11988 @option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
11989 PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
11990 types, with an appropriate, generic processor model assumed for
11991 scheduling purposes.
11992
11993 The other options specify a specific processor.  Code generated under
11994 those options will run best on that processor, and may not run at all on
11995 others.
11996
11997 The @option{-mcpu} options automatically enable or disable the
11998 following options:
11999
12000 @gccoptlist{-maltivec  -mfprnd  -mhard-float  -mmfcrf  -mmultiple @gol
12001 -mnew-mnemonics  -mpopcntb  -mpower  -mpower2  -mpowerpc64 @gol
12002 -mpowerpc-gpopt  -mpowerpc-gfxopt  -mstring  -mmulhw  -mdlmzb  -mmfpgpr}
12003
12004 The particular options set for any particular CPU will vary between
12005 compiler versions, depending on what setting seems to produce optimal
12006 code for that CPU; it doesn't necessarily reflect the actual hardware's
12007 capabilities.  If you wish to set an individual option to a particular
12008 value, you may specify it after the @option{-mcpu} option, like
12009 @samp{-mcpu=970 -mno-altivec}.
12010
12011 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
12012 not enabled or disabled by the @option{-mcpu} option at present because
12013 AIX does not have full support for these options.  You may still
12014 enable or disable them individually if you're sure it'll work in your
12015 environment.
12016
12017 @item -mtune=@var{cpu_type}
12018 @opindex mtune
12019 Set the instruction scheduling parameters for machine type
12020 @var{cpu_type}, but do not set the architecture type, register usage, or
12021 choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would.  The same
12022 values for @var{cpu_type} are used for @option{-mtune} as for
12023 @option{-mcpu}.  If both are specified, the code generated will use the
12024 architecture, registers, and mnemonics set by @option{-mcpu}, but the
12025 scheduling parameters set by @option{-mtune}.
12026
12027 @item -mswdiv
12028 @itemx -mno-swdiv
12029 @opindex mswdiv
12030 @opindex mno-swdiv
12031 Generate code to compute division as reciprocal estimate and iterative
12032 refinement, creating opportunities for increased throughput.  This
12033 feature requires: optional PowerPC Graphics instruction set for single
12034 precision and FRE instruction for double precision, assuming divides
12035 cannot generate user-visible traps, and the domain values not include
12036 Infinities, denormals or zero denominator.
12037
12038 @item -maltivec
12039 @itemx -mno-altivec
12040 @opindex maltivec
12041 @opindex mno-altivec
12042 Generate code that uses (does not use) AltiVec instructions, and also
12043 enable the use of built-in functions that allow more direct access to
12044 the AltiVec instruction set.  You may also need to set
12045 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
12046 enhancements.
12047
12048 @item -mvrsave
12049 @item -mno-vrsave
12050 @opindex mvrsave
12051 @opindex mno-vrsave
12052 Generate VRSAVE instructions when generating AltiVec code.
12053
12054 @item -msecure-plt
12055 @opindex msecure-plt
12056 Generate code that allows ld and ld.so to build executables and shared
12057 libraries with non-exec .plt and .got sections.  This is a PowerPC
12058 32-bit SYSV ABI option.
12059
12060 @item -mbss-plt
12061 @opindex mbss-plt
12062 Generate code that uses a BSS .plt section that ld.so fills in, and
12063 requires .plt and .got sections that are both writable and executable.
12064 This is a PowerPC 32-bit SYSV ABI option.
12065
12066 @item -misel
12067 @itemx -mno-isel
12068 @opindex misel
12069 @opindex mno-isel
12070 This switch enables or disables the generation of ISEL instructions.
12071
12072 @item -misel=@var{yes/no}
12073 This switch has been deprecated.  Use @option{-misel} and
12074 @option{-mno-isel} instead.
12075
12076 @item -mspe
12077 @itemx -mno-spe
12078 @opindex mspe
12079 @opindex mno-spe
12080 This switch enables or disables the generation of SPE simd
12081 instructions.
12082
12083 @item -mspe=@var{yes/no}
12084 This option has been deprecated.  Use @option{-mspe} and
12085 @option{-mno-spe} instead.
12086
12087 @item -mfloat-gprs=@var{yes/single/double/no}
12088 @itemx -mfloat-gprs
12089 @opindex mfloat-gprs
12090 This switch enables or disables the generation of floating point
12091 operations on the general purpose registers for architectures that
12092 support it.
12093
12094 The argument @var{yes} or @var{single} enables the use of
12095 single-precision floating point operations.
12096
12097 The argument @var{double} enables the use of single and
12098 double-precision floating point operations.
12099
12100 The argument @var{no} disables floating point operations on the
12101 general purpose registers.
12102
12103 This option is currently only available on the MPC854x.
12104
12105 @item -m32
12106 @itemx -m64
12107 @opindex m32
12108 @opindex m64
12109 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
12110 targets (including GNU/Linux).  The 32-bit environment sets int, long
12111 and pointer to 32 bits and generates code that runs on any PowerPC
12112 variant.  The 64-bit environment sets int to 32 bits and long and
12113 pointer to 64 bits, and generates code for PowerPC64, as for
12114 @option{-mpowerpc64}.
12115
12116 @item -mfull-toc
12117 @itemx -mno-fp-in-toc
12118 @itemx -mno-sum-in-toc
12119 @itemx -mminimal-toc
12120 @opindex mfull-toc
12121 @opindex mno-fp-in-toc
12122 @opindex mno-sum-in-toc
12123 @opindex mminimal-toc
12124 Modify generation of the TOC (Table Of Contents), which is created for
12125 every executable file.  The @option{-mfull-toc} option is selected by
12126 default.  In that case, GCC will allocate at least one TOC entry for
12127 each unique non-automatic variable reference in your program.  GCC
12128 will also place floating-point constants in the TOC@.  However, only
12129 16,384 entries are available in the TOC@.
12130
12131 If you receive a linker error message that saying you have overflowed
12132 the available TOC space, you can reduce the amount of TOC space used
12133 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
12134 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
12135 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
12136 generate code to calculate the sum of an address and a constant at
12137 run-time instead of putting that sum into the TOC@.  You may specify one
12138 or both of these options.  Each causes GCC to produce very slightly
12139 slower and larger code at the expense of conserving TOC space.
12140
12141 If you still run out of space in the TOC even when you specify both of
12142 these options, specify @option{-mminimal-toc} instead.  This option causes
12143 GCC to make only one TOC entry for every file.  When you specify this
12144 option, GCC will produce code that is slower and larger but which
12145 uses extremely little TOC space.  You may wish to use this option
12146 only on files that contain less frequently executed code.
12147
12148 @item -maix64
12149 @itemx -maix32
12150 @opindex maix64
12151 @opindex maix32
12152 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
12153 @code{long} type, and the infrastructure needed to support them.
12154 Specifying @option{-maix64} implies @option{-mpowerpc64} and
12155 @option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
12156 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
12157
12158 @item -mxl-compat
12159 @itemx -mno-xl-compat
12160 @opindex mxl-compat
12161 @opindex mno-xl-compat
12162 Produce code that conforms more closely to IBM XL compiler semantics
12163 when using AIX-compatible ABI.  Pass floating-point arguments to
12164 prototyped functions beyond the register save area (RSA) on the stack
12165 in addition to argument FPRs.  Do not assume that most significant
12166 double in 128-bit long double value is properly rounded when comparing
12167 values and converting to double.  Use XL symbol names for long double
12168 support routines.
12169
12170 The AIX calling convention was extended but not initially documented to
12171 handle an obscure K&R C case of calling a function that takes the
12172 address of its arguments with fewer arguments than declared.  IBM XL
12173 compilers access floating point arguments which do not fit in the
12174 RSA from the stack when a subroutine is compiled without
12175 optimization.  Because always storing floating-point arguments on the
12176 stack is inefficient and rarely needed, this option is not enabled by
12177 default and only is necessary when calling subroutines compiled by IBM
12178 XL compilers without optimization.
12179
12180 @item -mpe
12181 @opindex mpe
12182 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
12183 application written to use message passing with special startup code to
12184 enable the application to run.  The system must have PE installed in the
12185 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
12186 must be overridden with the @option{-specs=} option to specify the
12187 appropriate directory location.  The Parallel Environment does not
12188 support threads, so the @option{-mpe} option and the @option{-pthread}
12189 option are incompatible.
12190
12191 @item -malign-natural
12192 @itemx -malign-power
12193 @opindex malign-natural
12194 @opindex malign-power
12195 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
12196 @option{-malign-natural} overrides the ABI-defined alignment of larger
12197 types, such as floating-point doubles, on their natural size-based boundary.
12198 The option @option{-malign-power} instructs GCC to follow the ABI-specified
12199 alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
12200
12201 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
12202 is not supported.
12203
12204 @item -msoft-float
12205 @itemx -mhard-float
12206 @opindex msoft-float
12207 @opindex mhard-float
12208 Generate code that does not use (uses) the floating-point register set.
12209 Software floating point emulation is provided if you use the
12210 @option{-msoft-float} option, and pass the option to GCC when linking.
12211
12212 @item -mmultiple
12213 @itemx -mno-multiple
12214 @opindex mmultiple
12215 @opindex mno-multiple
12216 Generate code that uses (does not use) the load multiple word
12217 instructions and the store multiple word instructions.  These
12218 instructions are generated by default on POWER systems, and not
12219 generated on PowerPC systems.  Do not use @option{-mmultiple} on little
12220 endian PowerPC systems, since those instructions do not work when the
12221 processor is in little endian mode.  The exceptions are PPC740 and
12222 PPC750 which permit the instructions usage in little endian mode.
12223
12224 @item -mstring
12225 @itemx -mno-string
12226 @opindex mstring
12227 @opindex mno-string
12228 Generate code that uses (does not use) the load string instructions
12229 and the store string word instructions to save multiple registers and
12230 do small block moves.  These instructions are generated by default on
12231 POWER systems, and not generated on PowerPC systems.  Do not use
12232 @option{-mstring} on little endian PowerPC systems, since those
12233 instructions do not work when the processor is in little endian mode.
12234 The exceptions are PPC740 and PPC750 which permit the instructions
12235 usage in little endian mode.
12236
12237 @item -mupdate
12238 @itemx -mno-update
12239 @opindex mupdate
12240 @opindex mno-update
12241 Generate code that uses (does not use) the load or store instructions
12242 that update the base register to the address of the calculated memory
12243 location.  These instructions are generated by default.  If you use
12244 @option{-mno-update}, there is a small window between the time that the
12245 stack pointer is updated and the address of the previous frame is
12246 stored, which means code that walks the stack frame across interrupts or
12247 signals may get corrupted data.
12248
12249 @item -mfused-madd
12250 @itemx -mno-fused-madd
12251 @opindex mfused-madd
12252 @opindex mno-fused-madd
12253 Generate code that uses (does not use) the floating point multiply and
12254 accumulate instructions.  These instructions are generated by default if
12255 hardware floating is used.
12256
12257 @item -mmulhw
12258 @itemx -mno-mulhw
12259 @opindex mmulhw
12260 @opindex mno-mulhw
12261 Generate code that uses (does not use) the half-word multiply and
12262 multiply-accumulate instructions on the IBM 405 and 440 processors.
12263 These instructions are generated by default when targetting those
12264 processors.
12265
12266 @item -mdlmzb
12267 @itemx -mno-dlmzb
12268 @opindex mdlmzb
12269 @opindex mno-dlmzb
12270 Generate code that uses (does not use) the string-search @samp{dlmzb}
12271 instruction on the IBM 405 and 440 processors.  This instruction is
12272 generated by default when targetting those processors.
12273
12274 @item -mno-bit-align
12275 @itemx -mbit-align
12276 @opindex mno-bit-align
12277 @opindex mbit-align
12278 On System V.4 and embedded PowerPC systems do not (do) force structures
12279 and unions that contain bit-fields to be aligned to the base type of the
12280 bit-field.
12281
12282 For example, by default a structure containing nothing but 8
12283 @code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
12284 boundary and have a size of 4 bytes.  By using @option{-mno-bit-align},
12285 the structure would be aligned to a 1 byte boundary and be one byte in
12286 size.
12287
12288 @item -mno-strict-align
12289 @itemx -mstrict-align
12290 @opindex mno-strict-align
12291 @opindex mstrict-align
12292 On System V.4 and embedded PowerPC systems do not (do) assume that
12293 unaligned memory references will be handled by the system.
12294
12295 @item -mrelocatable
12296 @itemx -mno-relocatable
12297 @opindex mrelocatable
12298 @opindex mno-relocatable
12299 On embedded PowerPC systems generate code that allows (does not allow)
12300 the program to be relocated to a different address at runtime.  If you
12301 use @option{-mrelocatable} on any module, all objects linked together must
12302 be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
12303
12304 @item -mrelocatable-lib
12305 @itemx -mno-relocatable-lib
12306 @opindex mrelocatable-lib
12307 @opindex mno-relocatable-lib
12308 On embedded PowerPC systems generate code that allows (does not allow)
12309 the program to be relocated to a different address at runtime.  Modules
12310 compiled with @option{-mrelocatable-lib} can be linked with either modules
12311 compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
12312 with modules compiled with the @option{-mrelocatable} options.
12313
12314 @item -mno-toc
12315 @itemx -mtoc
12316 @opindex mno-toc
12317 @opindex mtoc
12318 On System V.4 and embedded PowerPC systems do not (do) assume that
12319 register 2 contains a pointer to a global area pointing to the addresses
12320 used in the program.
12321
12322 @item -mlittle
12323 @itemx -mlittle-endian
12324 @opindex mlittle
12325 @opindex mlittle-endian
12326 On System V.4 and embedded PowerPC systems compile code for the
12327 processor in little endian mode.  The @option{-mlittle-endian} option is
12328 the same as @option{-mlittle}.
12329
12330 @item -mbig
12331 @itemx -mbig-endian
12332 @opindex mbig
12333 @opindex mbig-endian
12334 On System V.4 and embedded PowerPC systems compile code for the
12335 processor in big endian mode.  The @option{-mbig-endian} option is
12336 the same as @option{-mbig}.
12337
12338 @item -mdynamic-no-pic
12339 @opindex mdynamic-no-pic
12340 On Darwin and Mac OS X systems, compile code so that it is not
12341 relocatable, but that its external references are relocatable.  The
12342 resulting code is suitable for applications, but not shared
12343 libraries.
12344
12345 @item -mprioritize-restricted-insns=@var{priority}
12346 @opindex mprioritize-restricted-insns
12347 This option controls the priority that is assigned to
12348 dispatch-slot restricted instructions during the second scheduling
12349 pass.  The argument @var{priority} takes the value @var{0/1/2} to assign
12350 @var{no/highest/second-highest} priority to dispatch slot restricted
12351 instructions.
12352
12353 @item -msched-costly-dep=@var{dependence_type}
12354 @opindex msched-costly-dep
12355 This option controls which dependences are considered costly
12356 by the target during instruction scheduling.  The argument
12357 @var{dependence_type} takes one of the following values:
12358 @var{no}: no dependence is costly,
12359 @var{all}: all dependences are costly,
12360 @var{true_store_to_load}: a true dependence from store to load is costly,
12361 @var{store_to_load}: any dependence from store to load is costly,
12362 @var{number}: any dependence which latency >= @var{number} is costly.
12363
12364 @item -minsert-sched-nops=@var{scheme}
12365 @opindex minsert-sched-nops
12366 This option controls which nop insertion scheme will be used during
12367 the second scheduling pass.  The argument @var{scheme} takes one of the
12368 following values:
12369 @var{no}: Don't insert nops.
12370 @var{pad}: Pad with nops any dispatch group which has vacant issue slots,
12371 according to the scheduler's grouping.
12372 @var{regroup_exact}: Insert nops to force costly dependent insns into
12373 separate groups.  Insert exactly as many nops as needed to force an insn
12374 to a new group, according to the estimated processor grouping.
12375 @var{number}: Insert nops to force costly dependent insns into
12376 separate groups.  Insert @var{number} nops to force an insn to a new group.
12377
12378 @item -mcall-sysv
12379 @opindex mcall-sysv
12380 On System V.4 and embedded PowerPC systems compile code using calling
12381 conventions that adheres to the March 1995 draft of the System V
12382 Application Binary Interface, PowerPC processor supplement.  This is the
12383 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
12384
12385 @item -mcall-sysv-eabi
12386 @opindex mcall-sysv-eabi
12387 Specify both @option{-mcall-sysv} and @option{-meabi} options.
12388
12389 @item -mcall-sysv-noeabi
12390 @opindex mcall-sysv-noeabi
12391 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
12392
12393 @item -mcall-solaris
12394 @opindex mcall-solaris
12395 On System V.4 and embedded PowerPC systems compile code for the Solaris
12396 operating system.
12397
12398 @item -mcall-linux
12399 @opindex mcall-linux
12400 On System V.4 and embedded PowerPC systems compile code for the
12401 Linux-based GNU system.
12402
12403 @item -mcall-gnu
12404 @opindex mcall-gnu
12405 On System V.4 and embedded PowerPC systems compile code for the
12406 Hurd-based GNU system.
12407
12408 @item -mcall-netbsd
12409 @opindex mcall-netbsd
12410 On System V.4 and embedded PowerPC systems compile code for the
12411 NetBSD operating system.
12412
12413 @item -maix-struct-return
12414 @opindex maix-struct-return
12415 Return all structures in memory (as specified by the AIX ABI)@.
12416
12417 @item -msvr4-struct-return
12418 @opindex msvr4-struct-return
12419 Return structures smaller than 8 bytes in registers (as specified by the
12420 SVR4 ABI)@.
12421
12422 @item -mabi=@var{abi-type}
12423 @opindex mabi
12424 Extend the current ABI with a particular extension, or remove such extension.
12425 Valid values are @var{altivec}, @var{no-altivec}, @var{spe},
12426 @var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@.
12427
12428 @item -mabi=spe
12429 @opindex mabi=spe
12430 Extend the current ABI with SPE ABI extensions.  This does not change
12431 the default ABI, instead it adds the SPE ABI extensions to the current
12432 ABI@.
12433
12434 @item -mabi=no-spe
12435 @opindex mabi=no-spe
12436 Disable Booke SPE ABI extensions for the current ABI@.
12437
12438 @item -mabi=ibmlongdouble
12439 @opindex mabi=ibmlongdouble
12440 Change the current ABI to use IBM extended precision long double.
12441 This is a PowerPC 32-bit SYSV ABI option.
12442
12443 @item -mabi=ieeelongdouble
12444 @opindex mabi=ieeelongdouble
12445 Change the current ABI to use IEEE extended precision long double.
12446 This is a PowerPC 32-bit Linux ABI option.
12447
12448 @item -mprototype
12449 @itemx -mno-prototype
12450 @opindex mprototype
12451 @opindex mno-prototype
12452 On System V.4 and embedded PowerPC systems assume that all calls to
12453 variable argument functions are properly prototyped.  Otherwise, the
12454 compiler must insert an instruction before every non prototyped call to
12455 set or clear bit 6 of the condition code register (@var{CR}) to
12456 indicate whether floating point values were passed in the floating point
12457 registers in case the function takes a variable arguments.  With
12458 @option{-mprototype}, only calls to prototyped variable argument functions
12459 will set or clear the bit.
12460
12461 @item -msim
12462 @opindex msim
12463 On embedded PowerPC systems, assume that the startup module is called
12464 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
12465 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}.
12466 configurations.
12467
12468 @item -mmvme
12469 @opindex mmvme
12470 On embedded PowerPC systems, assume that the startup module is called
12471 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
12472 @file{libc.a}.
12473
12474 @item -mads
12475 @opindex mads
12476 On embedded PowerPC systems, assume that the startup module is called
12477 @file{crt0.o} and the standard C libraries are @file{libads.a} and
12478 @file{libc.a}.
12479
12480 @item -myellowknife
12481 @opindex myellowknife
12482 On embedded PowerPC systems, assume that the startup module is called
12483 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
12484 @file{libc.a}.
12485
12486 @item -mvxworks
12487 @opindex mvxworks
12488 On System V.4 and embedded PowerPC systems, specify that you are
12489 compiling for a VxWorks system.
12490
12491 @item -mwindiss
12492 @opindex mwindiss
12493 Specify that you are compiling for the WindISS simulation environment.
12494
12495 @item -memb
12496 @opindex memb
12497 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
12498 header to indicate that @samp{eabi} extended relocations are used.
12499
12500 @item -meabi
12501 @itemx -mno-eabi
12502 @opindex meabi
12503 @opindex mno-eabi
12504 On System V.4 and embedded PowerPC systems do (do not) adhere to the
12505 Embedded Applications Binary Interface (eabi) which is a set of
12506 modifications to the System V.4 specifications.  Selecting @option{-meabi}
12507 means that the stack is aligned to an 8 byte boundary, a function
12508 @code{__eabi} is called to from @code{main} to set up the eabi
12509 environment, and the @option{-msdata} option can use both @code{r2} and
12510 @code{r13} to point to two separate small data areas.  Selecting
12511 @option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
12512 do not call an initialization function from @code{main}, and the
12513 @option{-msdata} option will only use @code{r13} to point to a single
12514 small data area.  The @option{-meabi} option is on by default if you
12515 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
12516
12517 @item -msdata=eabi
12518 @opindex msdata=eabi
12519 On System V.4 and embedded PowerPC systems, put small initialized
12520 @code{const} global and static data in the @samp{.sdata2} section, which
12521 is pointed to by register @code{r2}.  Put small initialized
12522 non-@code{const} global and static data in the @samp{.sdata} section,
12523 which is pointed to by register @code{r13}.  Put small uninitialized
12524 global and static data in the @samp{.sbss} section, which is adjacent to
12525 the @samp{.sdata} section.  The @option{-msdata=eabi} option is
12526 incompatible with the @option{-mrelocatable} option.  The
12527 @option{-msdata=eabi} option also sets the @option{-memb} option.
12528
12529 @item -msdata=sysv
12530 @opindex msdata=sysv
12531 On System V.4 and embedded PowerPC systems, put small global and static
12532 data in the @samp{.sdata} section, which is pointed to by register
12533 @code{r13}.  Put small uninitialized global and static data in the
12534 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
12535 The @option{-msdata=sysv} option is incompatible with the
12536 @option{-mrelocatable} option.
12537
12538 @item -msdata=default
12539 @itemx -msdata
12540 @opindex msdata=default
12541 @opindex msdata
12542 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
12543 compile code the same as @option{-msdata=eabi}, otherwise compile code the
12544 same as @option{-msdata=sysv}.
12545
12546 @item -msdata-data
12547 @opindex msdata-data
12548 On System V.4 and embedded PowerPC systems, put small global
12549 data in the @samp{.sdata} section.  Put small uninitialized global
12550 data in the @samp{.sbss} section.  Do not use register @code{r13}
12551 to address small data however.  This is the default behavior unless
12552 other @option{-msdata} options are used.
12553
12554 @item -msdata=none
12555 @itemx -mno-sdata
12556 @opindex msdata=none
12557 @opindex mno-sdata
12558 On embedded PowerPC systems, put all initialized global and static data
12559 in the @samp{.data} section, and all uninitialized data in the
12560 @samp{.bss} section.
12561
12562 @item -G @var{num}
12563 @opindex G
12564 @cindex smaller data references (PowerPC)
12565 @cindex .sdata/.sdata2 references (PowerPC)
12566 On embedded PowerPC systems, put global and static items less than or
12567 equal to @var{num} bytes into the small data or bss sections instead of
12568 the normal data or bss section.  By default, @var{num} is 8.  The
12569 @option{-G @var{num}} switch is also passed to the linker.
12570 All modules should be compiled with the same @option{-G @var{num}} value.
12571
12572 @item -mregnames
12573 @itemx -mno-regnames
12574 @opindex mregnames
12575 @opindex mno-regnames
12576 On System V.4 and embedded PowerPC systems do (do not) emit register
12577 names in the assembly language output using symbolic forms.
12578
12579 @item -mlongcall
12580 @itemx -mno-longcall
12581 @opindex mlongcall
12582 @opindex mno-longcall
12583 By default assume that all calls are far away so that a longer more
12584 expensive calling sequence is required.  This is required for calls
12585 further than 32 megabytes (33,554,432 bytes) from the current location.
12586 A short call will be generated if the compiler knows
12587 the call cannot be that far away.  This setting can be overridden by
12588 the @code{shortcall} function attribute, or by @code{#pragma
12589 longcall(0)}.
12590
12591 Some linkers are capable of detecting out-of-range calls and generating
12592 glue code on the fly.  On these systems, long calls are unnecessary and
12593 generate slower code.  As of this writing, the AIX linker can do this,
12594 as can the GNU linker for PowerPC/64.  It is planned to add this feature
12595 to the GNU linker for 32-bit PowerPC systems as well.
12596
12597 On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr
12598 callee, L42'', plus a ``branch island'' (glue code).  The two target
12599 addresses represent the callee and the ``branch island''.  The
12600 Darwin/PPC linker will prefer the first address and generate a ``bl
12601 callee'' if the PPC ``bl'' instruction will reach the callee directly;
12602 otherwise, the linker will generate ``bl L42'' to call the ``branch
12603 island''.  The ``branch island'' is appended to the body of the
12604 calling function; it computes the full 32-bit address of the callee
12605 and jumps to it.
12606
12607 On Mach-O (Darwin) systems, this option directs the compiler emit to
12608 the glue for every direct call, and the Darwin linker decides whether
12609 to use or discard it.
12610
12611 In the future, we may cause GCC to ignore all longcall specifications
12612 when the linker is known to generate glue.
12613
12614 @item -pthread
12615 @opindex pthread
12616 Adds support for multithreading with the @dfn{pthreads} library.
12617 This option sets flags for both the preprocessor and linker.
12618
12619 @end table
12620
12621 @node S/390 and zSeries Options
12622 @subsection S/390 and zSeries Options
12623 @cindex S/390 and zSeries Options
12624
12625 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
12626
12627 @table @gcctabopt
12628 @item -mhard-float
12629 @itemx -msoft-float
12630 @opindex mhard-float
12631 @opindex msoft-float
12632 Use (do not use) the hardware floating-point instructions and registers
12633 for floating-point operations.  When @option{-msoft-float} is specified,
12634 functions in @file{libgcc.a} will be used to perform floating-point
12635 operations.  When @option{-mhard-float} is specified, the compiler
12636 generates IEEE floating-point instructions.  This is the default.
12637
12638 @item -mlong-double-64
12639 @itemx -mlong-double-128
12640 @opindex mlong-double-64
12641 @opindex mlong-double-128
12642 These switches control the size of @code{long double} type. A size
12643 of 64bit makes the @code{long double} type equivalent to the @code{double}
12644 type. This is the default.
12645
12646 @item -mbackchain
12647 @itemx -mno-backchain
12648 @opindex mbackchain
12649 @opindex mno-backchain
12650 Store (do not store) the address of the caller's frame as backchain pointer
12651 into the callee's stack frame.
12652 A backchain may be needed to allow debugging using tools that do not understand
12653 DWARF-2 call frame information.
12654 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
12655 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
12656 the backchain is placed into the topmost word of the 96/160 byte register
12657 save area.
12658
12659 In general, code compiled with @option{-mbackchain} is call-compatible with
12660 code compiled with @option{-mmo-backchain}; however, use of the backchain
12661 for debugging purposes usually requires that the whole binary is built with
12662 @option{-mbackchain}.  Note that the combination of @option{-mbackchain},
12663 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
12664 to build a linux kernel use @option{-msoft-float}.
12665
12666 The default is to not maintain the backchain.
12667
12668 @item -mpacked-stack
12669 @item -mno-packed-stack
12670 @opindex mpacked-stack
12671 @opindex mno-packed-stack
12672 Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
12673 specified, the compiler uses the all fields of the 96/160 byte register save
12674 area only for their default purpose; unused fields still take up stack space.
12675 When @option{-mpacked-stack} is specified, register save slots are densely
12676 packed at the top of the register save area; unused space is reused for other
12677 purposes, allowing for more efficient use of the available stack space.
12678 However, when @option{-mbackchain} is also in effect, the topmost word of
12679 the save area is always used to store the backchain, and the return address
12680 register is always saved two words below the backchain.
12681
12682 As long as the stack frame backchain is not used, code generated with
12683 @option{-mpacked-stack} is call-compatible with code generated with
12684 @option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
12685 S/390 or zSeries generated code that uses the stack frame backchain at run
12686 time, not just for debugging purposes.  Such code is not call-compatible
12687 with code compiled with @option{-mpacked-stack}.  Also, note that the
12688 combination of @option{-mbackchain},
12689 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
12690 to build a linux kernel use @option{-msoft-float}.
12691
12692 The default is to not use the packed stack layout.
12693
12694 @item -msmall-exec
12695 @itemx -mno-small-exec
12696 @opindex msmall-exec
12697 @opindex mno-small-exec
12698 Generate (or do not generate) code using the @code{bras} instruction
12699 to do subroutine calls.
12700 This only works reliably if the total executable size does not
12701 exceed 64k.  The default is to use the @code{basr} instruction instead,
12702 which does not have this limitation.
12703
12704 @item -m64
12705 @itemx -m31
12706 @opindex m64
12707 @opindex m31
12708 When @option{-m31} is specified, generate code compliant to the
12709 GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
12710 code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
12711 particular to generate 64-bit instructions.  For the @samp{s390}
12712 targets, the default is @option{-m31}, while the @samp{s390x}
12713 targets default to @option{-m64}.
12714
12715 @item -mzarch
12716 @itemx -mesa
12717 @opindex mzarch
12718 @opindex mesa
12719 When @option{-mzarch} is specified, generate code using the
12720 instructions available on z/Architecture.
12721 When @option{-mesa} is specified, generate code using the
12722 instructions available on ESA/390.  Note that @option{-mesa} is
12723 not possible with @option{-m64}.
12724 When generating code compliant to the GNU/Linux for S/390 ABI,
12725 the default is @option{-mesa}.  When generating code compliant
12726 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
12727
12728 @item -mmvcle
12729 @itemx -mno-mvcle
12730 @opindex mmvcle
12731 @opindex mno-mvcle
12732 Generate (or do not generate) code using the @code{mvcle} instruction
12733 to perform block moves.  When @option{-mno-mvcle} is specified,
12734 use a @code{mvc} loop instead.  This is the default unless optimizing for
12735 size.
12736
12737 @item -mdebug
12738 @itemx -mno-debug
12739 @opindex mdebug
12740 @opindex mno-debug
12741 Print (or do not print) additional debug information when compiling.
12742 The default is to not print debug information.
12743
12744 @item -march=@var{cpu-type}
12745 @opindex march
12746 Generate code that will run on @var{cpu-type}, which is the name of a system
12747 representing a certain processor type.  Possible values for
12748 @var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}.
12749 When generating code using the instructions available on z/Architecture,
12750 the default is @option{-march=z900}.  Otherwise, the default is
12751 @option{-march=g5}.
12752
12753 @item -mtune=@var{cpu-type}
12754 @opindex mtune
12755 Tune to @var{cpu-type} everything applicable about the generated code,
12756 except for the ABI and the set of available instructions.
12757 The list of @var{cpu-type} values is the same as for @option{-march}.
12758 The default is the value used for @option{-march}.
12759
12760 @item -mtpf-trace
12761 @itemx -mno-tpf-trace
12762 @opindex mtpf-trace
12763 @opindex mno-tpf-trace
12764 Generate code that adds (does not add) in TPF OS specific branches to trace
12765 routines in the operating system.  This option is off by default, even
12766 when compiling for the TPF OS@.
12767
12768 @item -mfused-madd
12769 @itemx -mno-fused-madd
12770 @opindex mfused-madd
12771 @opindex mno-fused-madd
12772 Generate code that uses (does not use) the floating point multiply and
12773 accumulate instructions.  These instructions are generated by default if
12774 hardware floating point is used.
12775
12776 @item -mwarn-framesize=@var{framesize}
12777 @opindex mwarn-framesize
12778 Emit a warning if the current function exceeds the given frame size.  Because
12779 this is a compile time check it doesn't need to be a real problem when the program
12780 runs.  It is intended to identify functions which most probably cause
12781 a stack overflow.  It is useful to be used in an environment with limited stack
12782 size e.g.@: the linux kernel.
12783
12784 @item -mwarn-dynamicstack
12785 @opindex mwarn-dynamicstack
12786 Emit a warning if the function calls alloca or uses dynamically
12787 sized arrays.  This is generally a bad idea with a limited stack size.
12788
12789 @item -mstack-guard=@var{stack-guard}
12790 @item -mstack-size=@var{stack-size}
12791 @opindex mstack-guard
12792 @opindex mstack-size
12793 These arguments always have to be used in conjunction.  If they are present the s390
12794 back end emits additional instructions in the function prologue which trigger a trap
12795 if the stack size is @var{stack-guard} bytes above the @var{stack-size}
12796 (remember that the stack on s390 grows downward).  These options are intended to
12797 be used to help debugging stack overflow problems.  The additionally emitted code
12798 causes only little overhead and hence can also be used in production like systems
12799 without greater performance degradation.  The given values have to be exact
12800 powers of 2 and @var{stack-size} has to be greater than @var{stack-guard} without
12801 exceeding 64k.
12802 In order to be efficient the extra code makes the assumption that the stack starts
12803 at an address aligned to the value given by @var{stack-size}.
12804 @end table
12805
12806 @node Score Options
12807 @subsection Score Options
12808 @cindex Score Options
12809
12810 These options are defined for Score implementations:
12811
12812 @table @gcctabopt
12813 @item -mel
12814 @opindex -mel
12815 Compile code for little endian mode. 
12816
12817 @item -meb
12818 @opindex meb
12819 Compile code for big endian mode.  This is the default.
12820
12821 @item -mmac
12822 @opindex mmac
12823 Enable the use of multiply-accumulate instructions. Disabled by default. 
12824
12825 @item -mscore5u
12826 @opindex mscore5u
12827 Specify the SCORE5U of the target architecture.
12828
12829 @item -mscore7
12830 @opindex mscore7
12831 Specify the SCORE7 of the target architecture. This is the default.
12832 @end table
12833
12834 @node SH Options
12835 @subsection SH Options
12836
12837 These @samp{-m} options are defined for the SH implementations:
12838
12839 @table @gcctabopt
12840 @item -m1
12841 @opindex m1
12842 Generate code for the SH1.
12843
12844 @item -m2
12845 @opindex m2
12846 Generate code for the SH2.
12847
12848 @item -m2e
12849 Generate code for the SH2e.
12850
12851 @item -m3
12852 @opindex m3
12853 Generate code for the SH3.
12854
12855 @item -m3e
12856 @opindex m3e
12857 Generate code for the SH3e.
12858
12859 @item -m4-nofpu
12860 @opindex m4-nofpu
12861 Generate code for the SH4 without a floating-point unit.
12862
12863 @item -m4-single-only
12864 @opindex m4-single-only
12865 Generate code for the SH4 with a floating-point unit that only
12866 supports single-precision arithmetic.
12867
12868 @item -m4-single
12869 @opindex m4-single
12870 Generate code for the SH4 assuming the floating-point unit is in
12871 single-precision mode by default.
12872
12873 @item -m4
12874 @opindex m4
12875 Generate code for the SH4.
12876
12877 @item -m4a-nofpu
12878 @opindex m4a-nofpu
12879 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
12880 floating-point unit is not used.
12881
12882 @item -m4a-single-only
12883 @opindex m4a-single-only
12884 Generate code for the SH4a, in such a way that no double-precision
12885 floating point operations are used.
12886
12887 @item -m4a-single
12888 @opindex m4a-single
12889 Generate code for the SH4a assuming the floating-point unit is in
12890 single-precision mode by default.
12891
12892 @item -m4a
12893 @opindex m4a
12894 Generate code for the SH4a.
12895
12896 @item -m4al
12897 @opindex m4al
12898 Same as @option{-m4a-nofpu}, except that it implicitly passes
12899 @option{-dsp} to the assembler.  GCC doesn't generate any DSP
12900 instructions at the moment.
12901
12902 @item -mb
12903 @opindex mb
12904 Compile code for the processor in big endian mode.
12905
12906 @item -ml
12907 @opindex ml
12908 Compile code for the processor in little endian mode.
12909
12910 @item -mdalign
12911 @opindex mdalign
12912 Align doubles at 64-bit boundaries.  Note that this changes the calling
12913 conventions, and thus some functions from the standard C library will
12914 not work unless you recompile it first with @option{-mdalign}.
12915
12916 @item -mrelax
12917 @opindex mrelax
12918 Shorten some address references at link time, when possible; uses the
12919 linker option @option{-relax}.
12920
12921 @item -mbigtable
12922 @opindex mbigtable
12923 Use 32-bit offsets in @code{switch} tables.  The default is to use
12924 16-bit offsets.
12925
12926 @item -mfmovd
12927 @opindex mfmovd
12928 Enable the use of the instruction @code{fmovd}.
12929
12930 @item -mhitachi
12931 @opindex mhitachi
12932 Comply with the calling conventions defined by Renesas.
12933
12934 @item -mrenesas
12935 @opindex mhitachi
12936 Comply with the calling conventions defined by Renesas.
12937
12938 @item -mno-renesas
12939 @opindex mhitachi
12940 Comply with the calling conventions defined for GCC before the Renesas
12941 conventions were available.  This option is the default for all
12942 targets of the SH toolchain except for @samp{sh-symbianelf}.
12943
12944 @item -mnomacsave
12945 @opindex mnomacsave
12946 Mark the @code{MAC} register as call-clobbered, even if
12947 @option{-mhitachi} is given.
12948
12949 @item -mieee
12950 @opindex mieee
12951 Increase IEEE-compliance of floating-point code.
12952 At the moment, this is equivalent to @option{-fno-finite-math-only}.
12953 When generating 16 bit SH opcodes, getting IEEE-conforming results for
12954 comparisons of NANs / infinities incurs extra overhead in every
12955 floating point comparison, therefore the default is set to
12956 @option{-ffinite-math-only}.
12957
12958 @item -minline-ic_invalidate
12959 @opindex minline-ic_invalidate
12960 Inline code to invalidate instruction cache entries after setting up
12961 nested function trampolines.
12962 This option has no effect if -musermode is in effect and the selected
12963 code generation option (e.g. -m4) does not allow the use of the icbi
12964 instruction.
12965 If the selected code generation option does not allow the use of the icbi
12966 instruction, and -musermode is not in effect, the inlined code will
12967 manipulate the instruction cache address array directly with an associative
12968 write.  This not only requires privileged mode, but it will also
12969 fail if the cache line had been mapped via the TLB and has become unmapped.
12970
12971 @item -misize
12972 @opindex misize
12973 Dump instruction size and location in the assembly code.
12974
12975 @item -mpadstruct
12976 @opindex mpadstruct
12977 This option is deprecated.  It pads structures to multiple of 4 bytes,
12978 which is incompatible with the SH ABI@.
12979
12980 @item -mspace
12981 @opindex mspace
12982 Optimize for space instead of speed.  Implied by @option{-Os}.
12983
12984 @item -mprefergot
12985 @opindex mprefergot
12986 When generating position-independent code, emit function calls using
12987 the Global Offset Table instead of the Procedure Linkage Table.
12988
12989 @item -musermode
12990 @opindex musermode
12991 Don't generate privileged mode only code; implies -mno-inline-ic_invalidate
12992 if the inlined code would not work in user mode.
12993 This is the default when the target is @code{sh-*-linux*}.
12994
12995 @item -multcost=@var{number}
12996 @opindex multcost=@var{number}
12997 Set the cost to assume for a multiply insn.
12998
12999 @item -mdiv=@var{strategy}
13000 @opindex mdiv=@var{strategy}
13001 Set the division strategy to use for SHmedia code.  @var{strategy} must be
13002 one of: call, call2, fp, inv, inv:minlat, inv20u, inv20l, inv:call,
13003 inv:call2, inv:fp .
13004 "fp" performs the operation in floating point.  This has a very high latency,
13005 but needs only a few instructions, so it might be a good choice if
13006 your code has enough easily exploitable ILP to allow the compiler to
13007 schedule the floating point instructions together with other instructions.
13008 Division by zero causes a floating point exception.
13009 "inv" uses integer operations to calculate the inverse of the divisor,
13010 and then multiplies the dividend with the inverse.  This strategy allows
13011 cse and hoisting of the inverse calculation.  Division by zero calculates
13012 an unspecified result, but does not trap.
13013 "inv:minlat" is a variant of "inv" where if no cse / hoisting opportunities
13014 have been found, or if the entire operation has been hoisted to the same
13015 place, the last stages of the inverse calculation are intertwined with the
13016 final multiply to reduce the overall latency, at the expense of using a few
13017 more instructions, and thus offering fewer scheduling opportunities with
13018 other code.
13019 "call" calls a library function that usually implements the inv:minlat
13020 strategy.
13021 This gives high code density for m5-*media-nofpu compilations.
13022 "call2" uses a different entry point of the same library function, where it
13023 assumes that a pointer to a lookup table has already been set up, which
13024 exposes the pointer load to cse / code hoisting optimizations.
13025 "inv:call", "inv:call2" and "inv:fp" all use the "inv" algorithm for initial
13026 code generation, but if the code stays unoptimized, revert to the "call",
13027 "call2", or "fp" strategies, respectively.  Note that the
13028 potentially-trapping side effect of division by zero is carried by a
13029 separate instruction, so it is possible that all the integer instructions
13030 are hoisted out, but the marker for the side effect stays where it is.
13031 A recombination to fp operations or a call is not possible in that case.
13032 "inv20u" and "inv20l" are variants of the "inv:minlat" strategy.  In the case
13033 that the inverse calculation was nor separated from the multiply, they speed
13034 up division where the dividend fits into 20 bits (plus sign where applicable),
13035 by inserting a test to skip a number of operations in this case; this test
13036 slows down the case of larger dividends.  inv20u assumes the case of a such
13037 a small dividend to be unlikely, and inv20l assumes it to be likely.
13038
13039 @item -mdivsi3_libfunc=@var{name}
13040 @opindex mdivsi3_libfunc=@var{name}
13041 Set the name of the library function used for 32 bit signed division to
13042 @var{name}.  This only affect the name used in the call and inv:call
13043 division strategies, and the compiler will still expect the same
13044 sets of input/output/clobbered registers as if this option was not present.
13045
13046 @item -madjust-unroll
13047 @opindex madjust-unroll
13048 Throttle unrolling to avoid thrashing target registers.
13049 This option only has an effect if the gcc code base supports the
13050 TARGET_ADJUST_UNROLL_MAX target hook.
13051
13052 @item -mindexed-addressing
13053 @opindex mindexed-addressing
13054 Enable the use of the indexed addressing mode for SHmedia32/SHcompact.
13055 This is only safe if the hardware and/or OS implement 32 bit wrap-around
13056 semantics for the indexed addressing mode.  The architecture allows the
13057 implementation of processors with 64 bit MMU, which the OS could use to
13058 get 32 bit addressing, but since no current hardware implementation supports
13059 this or any other way to make the indexed addressing mode safe to use in
13060 the 32 bit ABI, the default is -mno-indexed-addressing.
13061
13062 @item -mgettrcost=@var{number}
13063 @opindex mgettrcost=@var{number}
13064 Set the cost assumed for the gettr instruction to @var{number}.
13065 The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise.
13066
13067 @item -mpt-fixed
13068 @opindex mpt-fixed
13069 Assume pt* instructions won't trap.  This will generally generate better
13070 scheduled code, but is unsafe on current hardware.  The current architecture
13071 definition says that ptabs and ptrel trap when the target anded with 3 is 3.
13072 This has the unintentional effect of making it unsafe to schedule ptabs /
13073 ptrel before a branch, or hoist it out of a loop.  For example,
13074 __do_global_ctors, a part of libgcc that runs constructors at program
13075 startup, calls functions in a list which is delimited by @minus{}1.  With the
13076 -mpt-fixed option, the ptabs will be done before testing against @minus{}1.
13077 That means that all the constructors will be run a bit quicker, but when
13078 the loop comes to the end of the list, the program crashes because ptabs
13079 loads @minus{}1 into a target register.  Since this option is unsafe for any
13080 hardware implementing the current architecture specification, the default
13081 is -mno-pt-fixed.  Unless the user specifies a specific cost with
13082 @option{-mgettrcost}, -mno-pt-fixed also implies @option{-mgettrcost=100};
13083 this deters register allocation using target registers for storing
13084 ordinary integers.
13085
13086 @item -minvalid-symbols
13087 @opindex minvalid-symbols
13088 Assume symbols might be invalid.  Ordinary function symbols generated by
13089 the compiler will always be valid to load with movi/shori/ptabs or
13090 movi/shori/ptrel, but with assembler and/or linker tricks it is possible
13091 to generate symbols that will cause ptabs / ptrel to trap.
13092 This option is only meaningful when @option{-mno-pt-fixed} is in effect.
13093 It will then prevent cross-basic-block cse, hoisting and most scheduling
13094 of symbol loads.  The default is @option{-mno-invalid-symbols}.
13095 @end table
13096
13097 @node SPARC Options
13098 @subsection SPARC Options
13099 @cindex SPARC options
13100
13101 These @samp{-m} options are supported on the SPARC:
13102
13103 @table @gcctabopt
13104 @item -mno-app-regs
13105 @itemx -mapp-regs
13106 @opindex mno-app-regs
13107 @opindex mapp-regs
13108 Specify @option{-mapp-regs} to generate output using the global registers
13109 2 through 4, which the SPARC SVR4 ABI reserves for applications.  This
13110 is the default.
13111
13112 To be fully SVR4 ABI compliant at the cost of some performance loss,
13113 specify @option{-mno-app-regs}.  You should compile libraries and system
13114 software with this option.
13115
13116 @item -mfpu
13117 @itemx -mhard-float
13118 @opindex mfpu
13119 @opindex mhard-float
13120 Generate output containing floating point instructions.  This is the
13121 default.
13122
13123 @item -mno-fpu
13124 @itemx -msoft-float
13125 @opindex mno-fpu
13126 @opindex msoft-float
13127 Generate output containing library calls for floating point.
13128 @strong{Warning:} the requisite libraries are not available for all SPARC
13129 targets.  Normally the facilities of the machine's usual C compiler are
13130 used, but this cannot be done directly in cross-compilation.  You must make
13131 your own arrangements to provide suitable library functions for
13132 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
13133 @samp{sparclite-*-*} do provide software floating point support.
13134
13135 @option{-msoft-float} changes the calling convention in the output file;
13136 therefore, it is only useful if you compile @emph{all} of a program with
13137 this option.  In particular, you need to compile @file{libgcc.a}, the
13138 library that comes with GCC, with @option{-msoft-float} in order for
13139 this to work.
13140
13141 @item -mhard-quad-float
13142 @opindex mhard-quad-float
13143 Generate output containing quad-word (long double) floating point
13144 instructions.
13145
13146 @item -msoft-quad-float
13147 @opindex msoft-quad-float
13148 Generate output containing library calls for quad-word (long double)
13149 floating point instructions.  The functions called are those specified
13150 in the SPARC ABI@.  This is the default.
13151
13152 As of this writing, there are no SPARC implementations that have hardware
13153 support for the quad-word floating point instructions.  They all invoke
13154 a trap handler for one of these instructions, and then the trap handler
13155 emulates the effect of the instruction.  Because of the trap handler overhead,
13156 this is much slower than calling the ABI library routines.  Thus the
13157 @option{-msoft-quad-float} option is the default.
13158
13159 @item -mno-unaligned-doubles
13160 @itemx -munaligned-doubles
13161 @opindex mno-unaligned-doubles
13162 @opindex munaligned-doubles
13163 Assume that doubles have 8 byte alignment.  This is the default.
13164
13165 With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
13166 alignment only if they are contained in another type, or if they have an
13167 absolute address.  Otherwise, it assumes they have 4 byte alignment.
13168 Specifying this option avoids some rare compatibility problems with code
13169 generated by other compilers.  It is not the default because it results
13170 in a performance loss, especially for floating point code.
13171
13172 @item -mno-faster-structs
13173 @itemx -mfaster-structs
13174 @opindex mno-faster-structs
13175 @opindex mfaster-structs
13176 With @option{-mfaster-structs}, the compiler assumes that structures
13177 should have 8 byte alignment.  This enables the use of pairs of
13178 @code{ldd} and @code{std} instructions for copies in structure
13179 assignment, in place of twice as many @code{ld} and @code{st} pairs.
13180 However, the use of this changed alignment directly violates the SPARC
13181 ABI@.  Thus, it's intended only for use on targets where the developer
13182 acknowledges that their resulting code will not be directly in line with
13183 the rules of the ABI@.
13184
13185 @item -mimpure-text
13186 @opindex mimpure-text
13187 @option{-mimpure-text}, used in addition to @option{-shared}, tells
13188 the compiler to not pass @option{-z text} to the linker when linking a
13189 shared object.  Using this option, you can link position-dependent
13190 code into a shared object.
13191
13192 @option{-mimpure-text} suppresses the ``relocations remain against
13193 allocatable but non-writable sections'' linker error message.
13194 However, the necessary relocations will trigger copy-on-write, and the
13195 shared object is not actually shared across processes.  Instead of
13196 using @option{-mimpure-text}, you should compile all source code with
13197 @option{-fpic} or @option{-fPIC}.
13198
13199 This option is only available on SunOS and Solaris.
13200
13201 @item -mcpu=@var{cpu_type}
13202 @opindex mcpu
13203 Set the instruction set, register set, and instruction scheduling parameters
13204 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
13205 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
13206 @samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x},
13207 @samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc},
13208 @samp{ultrasparc3}, and @samp{niagara}.
13209
13210 Default instruction scheduling parameters are used for values that select
13211 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
13212 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
13213
13214 Here is a list of each supported architecture and their supported
13215 implementations.
13216
13217 @smallexample
13218     v7:             cypress
13219     v8:             supersparc, hypersparc
13220     sparclite:      f930, f934, sparclite86x
13221     sparclet:       tsc701
13222     v9:             ultrasparc, ultrasparc3, niagara
13223 @end smallexample
13224
13225 By default (unless configured otherwise), GCC generates code for the V7
13226 variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
13227 additionally optimizes it for the Cypress CY7C602 chip, as used in the
13228 SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
13229 SPARCStation 1, 2, IPX etc.
13230
13231 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
13232 architecture.  The only difference from V7 code is that the compiler emits
13233 the integer multiply and integer divide instructions which exist in SPARC-V8
13234 but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
13235 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
13236 2000 series.
13237
13238 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
13239 the SPARC architecture.  This adds the integer multiply, integer divide step
13240 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
13241 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
13242 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
13243 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
13244 MB86934 chip, which is the more recent SPARClite with FPU@.
13245
13246 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
13247 the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
13248 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
13249 but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
13250 optimizes it for the TEMIC SPARClet chip.
13251
13252 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
13253 architecture.  This adds 64-bit integer and floating-point move instructions,
13254 3 additional floating-point condition code registers and conditional move
13255 instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
13256 optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
13257 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
13258 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
13259 @option{-mcpu=niagara}, the compiler additionally optimizes it for
13260 Sun UltraSPARC T1 chips.
13261
13262 @item -mtune=@var{cpu_type}
13263 @opindex mtune
13264 Set the instruction scheduling parameters for machine type
13265 @var{cpu_type}, but do not set the instruction set or register set that the
13266 option @option{-mcpu=@var{cpu_type}} would.
13267
13268 The same values for @option{-mcpu=@var{cpu_type}} can be used for
13269 @option{-mtune=@var{cpu_type}}, but the only useful values are those
13270 that select a particular cpu implementation.  Those are @samp{cypress},
13271 @samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
13272 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
13273 @samp{ultrasparc3}, and @samp{niagara}.
13274
13275 @item -mv8plus
13276 @itemx -mno-v8plus
13277 @opindex mv8plus
13278 @opindex mno-v8plus
13279 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
13280 difference from the V8 ABI is that the global and out registers are
13281 considered 64-bit wide.  This is enabled by default on Solaris in 32-bit
13282 mode for all SPARC-V9 processors.
13283
13284 @item -mvis
13285 @itemx -mno-vis
13286 @opindex mvis
13287 @opindex mno-vis
13288 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
13289 Visual Instruction Set extensions.  The default is @option{-mno-vis}.
13290 @end table
13291
13292 These @samp{-m} options are supported in addition to the above
13293 on SPARC-V9 processors in 64-bit environments:
13294
13295 @table @gcctabopt
13296 @item -mlittle-endian
13297 @opindex mlittle-endian
13298 Generate code for a processor running in little-endian mode.  It is only
13299 available for a few configurations and most notably not on Solaris and Linux.
13300
13301 @item -m32
13302 @itemx -m64
13303 @opindex m32
13304 @opindex m64
13305 Generate code for a 32-bit or 64-bit environment.
13306 The 32-bit environment sets int, long and pointer to 32 bits.
13307 The 64-bit environment sets int to 32 bits and long and pointer
13308 to 64 bits.
13309
13310 @item -mcmodel=medlow
13311 @opindex mcmodel=medlow
13312 Generate code for the Medium/Low code model: 64-bit addresses, programs
13313 must be linked in the low 32 bits of memory.  Programs can be statically
13314 or dynamically linked.
13315
13316 @item -mcmodel=medmid
13317 @opindex mcmodel=medmid
13318 Generate code for the Medium/Middle code model: 64-bit addresses, programs
13319 must be linked in the low 44 bits of memory, the text and data segments must
13320 be less than 2GB in size and the data segment must be located within 2GB of
13321 the text segment.
13322
13323 @item -mcmodel=medany
13324 @opindex mcmodel=medany
13325 Generate code for the Medium/Anywhere code model: 64-bit addresses, programs
13326 may be linked anywhere in memory, the text and data segments must be less
13327 than 2GB in size and the data segment must be located within 2GB of the
13328 text segment.
13329
13330 @item -mcmodel=embmedany
13331 @opindex mcmodel=embmedany
13332 Generate code for the Medium/Anywhere code model for embedded systems:
13333 64-bit addresses, the text and data segments must be less than 2GB in
13334 size, both starting anywhere in memory (determined at link time).  The
13335 global register %g4 points to the base of the data segment.  Programs
13336 are statically linked and PIC is not supported.
13337
13338 @item -mstack-bias
13339 @itemx -mno-stack-bias
13340 @opindex mstack-bias
13341 @opindex mno-stack-bias
13342 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
13343 frame pointer if present, are offset by @minus{}2047 which must be added back
13344 when making stack frame references.  This is the default in 64-bit mode.
13345 Otherwise, assume no such offset is present.
13346 @end table
13347
13348 These switches are supported in addition to the above on Solaris:
13349
13350 @table @gcctabopt
13351 @item -threads
13352 @opindex threads
13353 Add support for multithreading using the Solaris threads library.  This
13354 option sets flags for both the preprocessor and linker.  This option does
13355 not affect the thread safety of object code produced by the compiler or
13356 that of libraries supplied with it.
13357
13358 @item -pthreads
13359 @opindex pthreads
13360 Add support for multithreading using the POSIX threads library.  This
13361 option sets flags for both the preprocessor and linker.  This option does
13362 not affect the thread safety of object code produced  by the compiler or
13363 that of libraries supplied with it.
13364
13365 @item -pthread
13366 @opindex pthread
13367 This is a synonym for @option{-pthreads}.
13368 @end table
13369
13370 @node SPU Options
13371 @subsection SPU Options
13372 @cindex SPU options
13373
13374 These @samp{-m} options are supported on the SPU:
13375
13376 @table @gcctabopt
13377 @item -mwarn-reloc
13378 @itemx -merror-reloc
13379 @opindex mwarn-reloc
13380 @opindex merror-reloc
13381
13382 The loader for SPU does not handle dynamic relocations.  By default, GCC
13383 will give an error when it generates code that requires a dynamic
13384 relocation.  @option{-mno-error-reloc} disables the error,
13385 @option{-mwarn-reloc} will generate a warning instead.
13386
13387 @item -msafe-dma
13388 @itemx -munsafe-dma
13389 @opindex msafe-dma
13390 @opindex munsafe-dma
13391
13392 Instructions which initiate or test completion of DMA must not be
13393 reordered with respect to loads and stores of the memory which is being
13394 accessed.  Users typically address this problem using the volatile
13395 keyword, but that can lead to inefficient code in places where the
13396 memory is known to not change.  Rather than mark the memory as volatile
13397 we treat the DMA instructions as potentially effecting all memory.  With
13398 @option{-munsafe-dma} users must use the volatile keyword to protect
13399 memory accesses.
13400
13401 @item -mbranch-hints
13402 @opindex mbranch-hints
13403
13404 By default, GCC will generate a branch hint instruction to avoid
13405 pipeline stalls for always taken or probably taken branches.  A hint
13406 will not be generated closer than 8 instructions away from its branch.
13407 There is little reason to disable them, except for debugging purposes,
13408 or to make an object a little bit smaller.
13409
13410 @item -msmall-mem
13411 @itemx -mlarge-mem
13412 @opindex msmall-mem
13413 @opindex mlarge-mem
13414
13415 By default, GCC generates code assuming that addresses are never larger
13416 than 18 bits.  With @option{-mlarge-mem} code is generated that assumes
13417 a full 32 bit address.
13418
13419 @item -mstdmain
13420 @opindex mstdmain
13421
13422 By default, GCC links against startup code that assumes the SPU-style
13423 main function interface (which has an unconventional parameter list).
13424 With @option{-mstdmain}, GCC will link your program against startup
13425 code that assumes a C99-style interface to @code{main}, including a
13426 local copy of @code{argv} strings.
13427
13428 @item -mfixed-range=@var{register-range}
13429 @opindex mfixed-range
13430 Generate code treating the given register range as fixed registers.
13431 A fixed register is one that the register allocator can not use.  This is
13432 useful when compiling kernel code.  A register range is specified as
13433 two registers separated by a dash.  Multiple register ranges can be
13434 specified separated by a comma.
13435
13436 @end table
13437
13438 @node System V Options
13439 @subsection Options for System V
13440
13441 These additional options are available on System V Release 4 for
13442 compatibility with other compilers on those systems:
13443
13444 @table @gcctabopt
13445 @item -G
13446 @opindex G
13447 Create a shared object.
13448 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
13449
13450 @item -Qy
13451 @opindex Qy
13452 Identify the versions of each tool used by the compiler, in a
13453 @code{.ident} assembler directive in the output.
13454
13455 @item -Qn
13456 @opindex Qn
13457 Refrain from adding @code{.ident} directives to the output file (this is
13458 the default).
13459
13460 @item -YP,@var{dirs}
13461 @opindex YP
13462 Search the directories @var{dirs}, and no others, for libraries
13463 specified with @option{-l}.
13464
13465 @item -Ym,@var{dir}
13466 @opindex Ym
13467 Look in the directory @var{dir} to find the M4 preprocessor.
13468 The assembler uses this option.
13469 @c This is supposed to go with a -Yd for predefined M4 macro files, but
13470 @c the generic assembler that comes with Solaris takes just -Ym.
13471 @end table
13472
13473 @node TMS320C3x/C4x Options
13474 @subsection TMS320C3x/C4x Options
13475 @cindex TMS320C3x/C4x Options
13476
13477 These @samp{-m} options are defined for TMS320C3x/C4x implementations:
13478
13479 @table @gcctabopt
13480
13481 @item -mcpu=@var{cpu_type}
13482 @opindex mcpu
13483 Set the instruction set, register set, and instruction scheduling
13484 parameters for machine type @var{cpu_type}.  Supported values for
13485 @var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
13486 @samp{c44}.  The default is @samp{c40} to generate code for the
13487 TMS320C40.
13488
13489 @item -mbig-memory
13490 @itemx -mbig
13491 @itemx -msmall-memory
13492 @itemx -msmall
13493 @opindex mbig-memory
13494 @opindex mbig
13495 @opindex msmall-memory
13496 @opindex msmall
13497 Generates code for the big or small memory model.  The small memory
13498 model assumed that all data fits into one 64K word page.  At run-time
13499 the data page (DP) register must be set to point to the 64K page
13500 containing the .bss and .data program sections.  The big memory model is
13501 the default and requires reloading of the DP register for every direct
13502 memory access.
13503
13504 @item -mbk
13505 @itemx -mno-bk
13506 @opindex mbk
13507 @opindex mno-bk
13508 Allow (disallow) allocation of general integer operands into the block
13509 count register BK@.
13510
13511 @item -mdb
13512 @itemx -mno-db
13513 @opindex mdb
13514 @opindex mno-db
13515 Enable (disable) generation of code using decrement and branch,
13516 DBcond(D), instructions.  This is enabled by default for the C4x.  To be
13517 on the safe side, this is disabled for the C3x, since the maximum
13518 iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than
13519 @math{2^{23}} times on the C3x?).  Note that GCC will try to reverse a loop so
13520 that it can utilize the decrement and branch instruction, but will give
13521 up if there is more than one memory reference in the loop.  Thus a loop
13522 where the loop counter is decremented can generate slightly more
13523 efficient code, in cases where the RPTB instruction cannot be utilized.
13524
13525 @item -mdp-isr-reload
13526 @itemx -mparanoid
13527 @opindex mdp-isr-reload
13528 @opindex mparanoid
13529 Force the DP register to be saved on entry to an interrupt service
13530 routine (ISR), reloaded to point to the data section, and restored on
13531 exit from the ISR@.  This should not be required unless someone has
13532 violated the small memory model by modifying the DP register, say within
13533 an object library.
13534
13535 @item -mmpyi
13536 @itemx -mno-mpyi
13537 @opindex mmpyi
13538 @opindex mno-mpyi
13539 For the C3x use the 24-bit MPYI instruction for integer multiplies
13540 instead of a library call to guarantee 32-bit results.  Note that if one
13541 of the operands is a constant, then the multiplication will be performed
13542 using shifts and adds.  If the @option{-mmpyi} option is not specified for the C3x,
13543 then squaring operations are performed inline instead of a library call.
13544
13545 @item -mfast-fix
13546 @itemx -mno-fast-fix
13547 @opindex mfast-fix
13548 @opindex mno-fast-fix
13549 The C3x/C4x FIX instruction to convert a floating point value to an
13550 integer value chooses the nearest integer less than or equal to the
13551 floating point value rather than to the nearest integer.  Thus if the
13552 floating point number is negative, the result will be incorrectly
13553 truncated an additional code is necessary to detect and correct this
13554 case.  This option can be used to disable generation of the additional
13555 code required to correct the result.
13556
13557 @item -mrptb
13558 @itemx -mno-rptb
13559 @opindex mrptb
13560 @opindex mno-rptb
13561 Enable (disable) generation of repeat block sequences using the RPTB
13562 instruction for zero overhead looping.  The RPTB construct is only used
13563 for innermost loops that do not call functions or jump across the loop
13564 boundaries.  There is no advantage having nested RPTB loops due to the
13565 overhead required to save and restore the RC, RS, and RE registers.
13566 This is enabled by default with @option{-O2}.
13567
13568 @item -mrpts=@var{count}
13569 @itemx -mno-rpts
13570 @opindex mrpts
13571 @opindex mno-rpts
13572 Enable (disable) the use of the single instruction repeat instruction
13573 RPTS@.  If a repeat block contains a single instruction, and the loop
13574 count can be guaranteed to be less than the value @var{count}, GCC will
13575 emit a RPTS instruction instead of a RPTB@.  If no value is specified,
13576 then a RPTS will be emitted even if the loop count cannot be determined
13577 at compile time.  Note that the repeated instruction following RPTS does
13578 not have to be reloaded from memory each iteration, thus freeing up the
13579 CPU buses for operands.  However, since interrupts are blocked by this
13580 instruction, it is disabled by default.
13581
13582 @item -mloop-unsigned
13583 @itemx -mno-loop-unsigned
13584 @opindex mloop-unsigned
13585 @opindex mno-loop-unsigned
13586 The maximum iteration count when using RPTS and RPTB (and DB on the C40)
13587 is @math{2^{31} + 1} since these instructions test if the iteration count is
13588 negative to terminate the loop.  If the iteration count is unsigned
13589 there is a possibility than the @math{2^{31} + 1} maximum iteration count may be
13590 exceeded.  This switch allows an unsigned iteration count.
13591
13592 @item -mti
13593 @opindex mti
13594 Try to emit an assembler syntax that the TI assembler (asm30) is happy
13595 with.  This also enforces compatibility with the API employed by the TI
13596 C3x C compiler.  For example, long doubles are passed as structures
13597 rather than in floating point registers.
13598
13599 @item -mregparm
13600 @itemx -mmemparm
13601 @opindex mregparm
13602 @opindex mmemparm
13603 Generate code that uses registers (stack) for passing arguments to functions.
13604 By default, arguments are passed in registers where possible rather
13605 than by pushing arguments on to the stack.
13606
13607 @item -mparallel-insns
13608 @itemx -mno-parallel-insns
13609 @opindex mparallel-insns
13610 @opindex mno-parallel-insns
13611 Allow the generation of parallel instructions.  This is enabled by
13612 default with @option{-O2}.
13613
13614 @item -mparallel-mpy
13615 @itemx -mno-parallel-mpy
13616 @opindex mparallel-mpy
13617 @opindex mno-parallel-mpy
13618 Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
13619 provided @option{-mparallel-insns} is also specified.  These instructions have
13620 tight register constraints which can pessimize the code generation
13621 of large functions.
13622
13623 @end table
13624
13625 @node V850 Options
13626 @subsection V850 Options
13627 @cindex V850 Options
13628
13629 These @samp{-m} options are defined for V850 implementations:
13630
13631 @table @gcctabopt
13632 @item -mlong-calls
13633 @itemx -mno-long-calls
13634 @opindex mlong-calls
13635 @opindex mno-long-calls
13636 Treat all calls as being far away (near).  If calls are assumed to be
13637 far away, the compiler will always load the functions address up into a
13638 register, and call indirect through the pointer.
13639
13640 @item -mno-ep
13641 @itemx -mep
13642 @opindex mno-ep
13643 @opindex mep
13644 Do not optimize (do optimize) basic blocks that use the same index
13645 pointer 4 or more times to copy pointer into the @code{ep} register, and
13646 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
13647 option is on by default if you optimize.
13648
13649 @item -mno-prolog-function
13650 @itemx -mprolog-function
13651 @opindex mno-prolog-function
13652 @opindex mprolog-function
13653 Do not use (do use) external functions to save and restore registers
13654 at the prologue and epilogue of a function.  The external functions
13655 are slower, but use less code space if more than one function saves
13656 the same number of registers.  The @option{-mprolog-function} option
13657 is on by default if you optimize.
13658
13659 @item -mspace
13660 @opindex mspace
13661 Try to make the code as small as possible.  At present, this just turns
13662 on the @option{-mep} and @option{-mprolog-function} options.
13663
13664 @item -mtda=@var{n}
13665 @opindex mtda
13666 Put static or global variables whose size is @var{n} bytes or less into
13667 the tiny data area that register @code{ep} points to.  The tiny data
13668 area can hold up to 256 bytes in total (128 bytes for byte references).
13669
13670 @item -msda=@var{n}
13671 @opindex msda
13672 Put static or global variables whose size is @var{n} bytes or less into
13673 the small data area that register @code{gp} points to.  The small data
13674 area can hold up to 64 kilobytes.
13675
13676 @item -mzda=@var{n}
13677 @opindex mzda
13678 Put static or global variables whose size is @var{n} bytes or less into
13679 the first 32 kilobytes of memory.
13680
13681 @item -mv850
13682 @opindex mv850
13683 Specify that the target processor is the V850.
13684
13685 @item -mbig-switch
13686 @opindex mbig-switch
13687 Generate code suitable for big switch tables.  Use this option only if
13688 the assembler/linker complain about out of range branches within a switch
13689 table.
13690
13691 @item -mapp-regs
13692 @opindex mapp-regs
13693 This option will cause r2 and r5 to be used in the code generated by
13694 the compiler.  This setting is the default.
13695
13696 @item -mno-app-regs
13697 @opindex mno-app-regs
13698 This option will cause r2 and r5 to be treated as fixed registers.
13699
13700 @item -mv850e1
13701 @opindex mv850e1
13702 Specify that the target processor is the V850E1.  The preprocessor
13703 constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
13704 this option is used.
13705
13706 @item -mv850e
13707 @opindex mv850e
13708 Specify that the target processor is the V850E@.  The preprocessor
13709 constant @samp{__v850e__} will be defined if this option is used.
13710
13711 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
13712 are defined then a default target processor will be chosen and the
13713 relevant @samp{__v850*__} preprocessor constant will be defined.
13714
13715 The preprocessor constants @samp{__v850} and @samp{__v851__} are always
13716 defined, regardless of which processor variant is the target.
13717
13718 @item -mdisable-callt
13719 @opindex mdisable-callt
13720 This option will suppress generation of the CALLT instruction for the
13721 v850e and v850e1 flavors of the v850 architecture.  The default is
13722 @option{-mno-disable-callt} which allows the CALLT instruction to be used.
13723
13724 @end table
13725
13726 @node VAX Options
13727 @subsection VAX Options
13728 @cindex VAX options
13729
13730 These @samp{-m} options are defined for the VAX:
13731
13732 @table @gcctabopt
13733 @item -munix
13734 @opindex munix
13735 Do not output certain jump instructions (@code{aobleq} and so on)
13736 that the Unix assembler for the VAX cannot handle across long
13737 ranges.
13738
13739 @item -mgnu
13740 @opindex mgnu
13741 Do output those jump instructions, on the assumption that you
13742 will assemble with the GNU assembler.
13743
13744 @item -mg
13745 @opindex mg
13746 Output code for g-format floating point numbers instead of d-format.
13747 @end table
13748
13749 @node x86-64 Options
13750 @subsection x86-64 Options
13751 @cindex x86-64 options
13752
13753 These are listed under @xref{i386 and x86-64 Options}.
13754
13755 @node Xstormy16 Options
13756 @subsection Xstormy16 Options
13757 @cindex Xstormy16 Options
13758
13759 These options are defined for Xstormy16:
13760
13761 @table @gcctabopt
13762 @item -msim
13763 @opindex msim
13764 Choose startup files and linker script suitable for the simulator.
13765 @end table
13766
13767 @node Xtensa Options
13768 @subsection Xtensa Options
13769 @cindex Xtensa Options
13770
13771 These options are supported for Xtensa targets:
13772
13773 @table @gcctabopt
13774 @item -mconst16
13775 @itemx -mno-const16
13776 @opindex mconst16
13777 @opindex mno-const16
13778 Enable or disable use of @code{CONST16} instructions for loading
13779 constant values.  The @code{CONST16} instruction is currently not a
13780 standard option from Tensilica.  When enabled, @code{CONST16}
13781 instructions are always used in place of the standard @code{L32R}
13782 instructions.  The use of @code{CONST16} is enabled by default only if
13783 the @code{L32R} instruction is not available.
13784
13785 @item -mfused-madd
13786 @itemx -mno-fused-madd
13787 @opindex mfused-madd
13788 @opindex mno-fused-madd
13789 Enable or disable use of fused multiply/add and multiply/subtract
13790 instructions in the floating-point option.  This has no effect if the
13791 floating-point option is not also enabled.  Disabling fused multiply/add
13792 and multiply/subtract instructions forces the compiler to use separate
13793 instructions for the multiply and add/subtract operations.  This may be
13794 desirable in some cases where strict IEEE 754-compliant results are
13795 required: the fused multiply add/subtract instructions do not round the
13796 intermediate result, thereby producing results with @emph{more} bits of
13797 precision than specified by the IEEE standard.  Disabling fused multiply
13798 add/subtract instructions also ensures that the program output is not
13799 sensitive to the compiler's ability to combine multiply and add/subtract
13800 operations.
13801
13802 @item -mtext-section-literals
13803 @itemx -mno-text-section-literals
13804 @opindex mtext-section-literals
13805 @opindex mno-text-section-literals
13806 Control the treatment of literal pools.  The default is
13807 @option{-mno-text-section-literals}, which places literals in a separate
13808 section in the output file.  This allows the literal pool to be placed
13809 in a data RAM/ROM, and it also allows the linker to combine literal
13810 pools from separate object files to remove redundant literals and
13811 improve code size.  With @option{-mtext-section-literals}, the literals
13812 are interspersed in the text section in order to keep them as close as
13813 possible to their references.  This may be necessary for large assembly
13814 files.
13815
13816 @item -mtarget-align
13817 @itemx -mno-target-align
13818 @opindex mtarget-align
13819 @opindex mno-target-align
13820 When this option is enabled, GCC instructs the assembler to
13821 automatically align instructions to reduce branch penalties at the
13822 expense of some code density.  The assembler attempts to widen density
13823 instructions to align branch targets and the instructions following call
13824 instructions.  If there are not enough preceding safe density
13825 instructions to align a target, no widening will be performed.  The
13826 default is @option{-mtarget-align}.  These options do not affect the
13827 treatment of auto-aligned instructions like @code{LOOP}, which the
13828 assembler will always align, either by widening density instructions or
13829 by inserting no-op instructions.
13830
13831 @item -mlongcalls
13832 @itemx -mno-longcalls
13833 @opindex mlongcalls
13834 @opindex mno-longcalls
13835 When this option is enabled, GCC instructs the assembler to translate
13836 direct calls to indirect calls unless it can determine that the target
13837 of a direct call is in the range allowed by the call instruction.  This
13838 translation typically occurs for calls to functions in other source
13839 files.  Specifically, the assembler translates a direct @code{CALL}
13840 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
13841 The default is @option{-mno-longcalls}.  This option should be used in
13842 programs where the call target can potentially be out of range.  This
13843 option is implemented in the assembler, not the compiler, so the
13844 assembly code generated by GCC will still show direct call
13845 instructions---look at the disassembled object code to see the actual
13846 instructions.  Note that the assembler will use an indirect call for
13847 every cross-file call, not just those that really will be out of range.
13848 @end table
13849
13850 @node zSeries Options
13851 @subsection zSeries Options
13852 @cindex zSeries options
13853
13854 These are listed under @xref{S/390 and zSeries Options}.
13855
13856 @node Code Gen Options
13857 @section Options for Code Generation Conventions
13858 @cindex code generation conventions
13859 @cindex options, code generation
13860 @cindex run-time options
13861
13862 These machine-independent options control the interface conventions
13863 used in code generation.
13864
13865 Most of them have both positive and negative forms; the negative form
13866 of @option{-ffoo} would be @option{-fno-foo}.  In the table below, only
13867 one of the forms is listed---the one which is not the default.  You
13868 can figure out the other form by either removing @samp{no-} or adding
13869 it.
13870
13871 @table @gcctabopt
13872 @item -fbounds-check
13873 @opindex fbounds-check
13874 For front-ends that support it, generate additional code to check that
13875 indices used to access arrays are within the declared range.  This is
13876 currently only supported by the Java and Fortran front-ends, where
13877 this option defaults to true and false respectively.
13878
13879 @item -ftrapv
13880 @opindex ftrapv
13881 This option generates traps for signed overflow on addition, subtraction,
13882 multiplication operations.
13883
13884 @item -fwrapv
13885 @opindex fwrapv
13886 This option instructs the compiler to assume that signed arithmetic
13887 overflow of addition, subtraction and multiplication wraps around
13888 using twos-complement representation.  This flag enables some optimizations
13889 and disables others.  This option is enabled by default for the Java
13890 front-end, as required by the Java language specification.
13891
13892 @item -fexceptions
13893 @opindex fexceptions
13894 Enable exception handling.  Generates extra code needed to propagate
13895 exceptions.  For some targets, this implies GCC will generate frame
13896 unwind information for all functions, which can produce significant data
13897 size overhead, although it does not affect execution.  If you do not
13898 specify this option, GCC will enable it by default for languages like
13899 C++ which normally require exception handling, and disable it for
13900 languages like C that do not normally require it.  However, you may need
13901 to enable this option when compiling C code that needs to interoperate
13902 properly with exception handlers written in C++.  You may also wish to
13903 disable this option if you are compiling older C++ programs that don't
13904 use exception handling.
13905
13906 @item -fnon-call-exceptions
13907 @opindex fnon-call-exceptions
13908 Generate code that allows trapping instructions to throw exceptions.
13909 Note that this requires platform-specific runtime support that does
13910 not exist everywhere.  Moreover, it only allows @emph{trapping}
13911 instructions to throw exceptions, i.e.@: memory references or floating
13912 point instructions.  It does not allow exceptions to be thrown from
13913 arbitrary signal handlers such as @code{SIGALRM}.
13914
13915 @item -funwind-tables
13916 @opindex funwind-tables
13917 Similar to @option{-fexceptions}, except that it will just generate any needed
13918 static data, but will not affect the generated code in any other way.
13919 You will normally not enable this option; instead, a language processor
13920 that needs this handling would enable it on your behalf.
13921
13922 @item -fasynchronous-unwind-tables
13923 @opindex fasynchronous-unwind-tables
13924 Generate unwind table in dwarf2 format, if supported by target machine.  The
13925 table is exact at each instruction boundary, so it can be used for stack
13926 unwinding from asynchronous events (such as debugger or garbage collector).
13927
13928 @item -fpcc-struct-return
13929 @opindex fpcc-struct-return
13930 Return ``short'' @code{struct} and @code{union} values in memory like
13931 longer ones, rather than in registers.  This convention is less
13932 efficient, but it has the advantage of allowing intercallability between
13933 GCC-compiled files and files compiled with other compilers, particularly
13934 the Portable C Compiler (pcc).
13935
13936 The precise convention for returning structures in memory depends
13937 on the target configuration macros.
13938
13939 Short structures and unions are those whose size and alignment match
13940 that of some integer type.
13941
13942 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13943 switch is not binary compatible with code compiled with the
13944 @option{-freg-struct-return} switch.
13945 Use it to conform to a non-default application binary interface.
13946
13947 @item -freg-struct-return
13948 @opindex freg-struct-return
13949 Return @code{struct} and @code{union} values in registers when possible.
13950 This is more efficient for small structures than
13951 @option{-fpcc-struct-return}.
13952
13953 If you specify neither @option{-fpcc-struct-return} nor
13954 @option{-freg-struct-return}, GCC defaults to whichever convention is
13955 standard for the target.  If there is no standard convention, GCC
13956 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13957 the principal compiler.  In those cases, we can choose the standard, and
13958 we chose the more efficient register return alternative.
13959
13960 @strong{Warning:} code compiled with the @option{-freg-struct-return}
13961 switch is not binary compatible with code compiled with the
13962 @option{-fpcc-struct-return} switch.
13963 Use it to conform to a non-default application binary interface.
13964
13965 @item -fshort-enums
13966 @opindex fshort-enums
13967 Allocate to an @code{enum} type only as many bytes as it needs for the
13968 declared range of possible values.  Specifically, the @code{enum} type
13969 will be equivalent to the smallest integer type which has enough room.
13970
13971 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13972 code that is not binary compatible with code generated without that switch.
13973 Use it to conform to a non-default application binary interface.
13974
13975 @item -fshort-double
13976 @opindex fshort-double
13977 Use the same size for @code{double} as for @code{float}.
13978
13979 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
13980 code that is not binary compatible with code generated without that switch.
13981 Use it to conform to a non-default application binary interface.
13982
13983 @item -fshort-wchar
13984 @opindex fshort-wchar
13985 Override the underlying type for @samp{wchar_t} to be @samp{short
13986 unsigned int} instead of the default for the target.  This option is
13987 useful for building programs to run under WINE@.
13988
13989 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13990 code that is not binary compatible with code generated without that switch.
13991 Use it to conform to a non-default application binary interface.
13992
13993 @item -fno-common
13994 @opindex fno-common
13995 In C, allocate even uninitialized global variables in the data section of the
13996 object file, rather than generating them as common blocks.  This has the
13997 effect that if the same variable is declared (without @code{extern}) in
13998 two different compilations, you will get an error when you link them.
13999 The only reason this might be useful is if you wish to verify that the
14000 program will work on other systems which always work this way.
14001
14002 @item -fno-ident
14003 @opindex fno-ident
14004 Ignore the @samp{#ident} directive.
14005
14006 @item -finhibit-size-directive
14007 @opindex finhibit-size-directive
14008 Don't output a @code{.size} assembler directive, or anything else that
14009 would cause trouble if the function is split in the middle, and the
14010 two halves are placed at locations far apart in memory.  This option is
14011 used when compiling @file{crtstuff.c}; you should not need to use it
14012 for anything else.
14013
14014 @item -fverbose-asm
14015 @opindex fverbose-asm
14016 Put extra commentary information in the generated assembly code to
14017 make it more readable.  This option is generally only of use to those
14018 who actually need to read the generated assembly code (perhaps while
14019 debugging the compiler itself).
14020
14021 @option{-fno-verbose-asm}, the default, causes the
14022 extra information to be omitted and is useful when comparing two assembler
14023 files.
14024
14025 @item -frecord-gcc-switches
14026 @opindex frecord-gcc-switches
14027 This switch causes the command line that was used to invoke the
14028 compiler to be recorded into the object file that is being created.
14029 This switch is only implemented on some targets and the exact format
14030 of the recording is target and binary file format dependent, but it
14031 usually takes the form of a section containing ASCII text.  This
14032 switch is related to the @option{-fverbose-asm} switch, but that
14033 switch only records information in the assembler output file as
14034 comments, so it never reaches the object file.
14035
14036 @item -fpic
14037 @opindex fpic
14038 @cindex global offset table
14039 @cindex PIC
14040 Generate position-independent code (PIC) suitable for use in a shared
14041 library, if supported for the target machine.  Such code accesses all
14042 constant addresses through a global offset table (GOT)@.  The dynamic
14043 loader resolves the GOT entries when the program starts (the dynamic
14044 loader is not part of GCC; it is part of the operating system).  If
14045 the GOT size for the linked executable exceeds a machine-specific
14046 maximum size, you get an error message from the linker indicating that
14047 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
14048 instead.  (These maximums are 8k on the SPARC and 32k
14049 on the m68k and RS/6000.  The 386 has no such limit.)
14050
14051 Position-independent code requires special support, and therefore works
14052 only on certain machines.  For the 386, GCC supports PIC for System V
14053 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
14054 position-independent.
14055
14056 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14057 are defined to 1.
14058
14059 @item -fPIC
14060 @opindex fPIC
14061 If supported for the target machine, emit position-independent code,
14062 suitable for dynamic linking and avoiding any limit on the size of the
14063 global offset table.  This option makes a difference on the m68k,
14064 PowerPC and SPARC@.
14065
14066 Position-independent code requires special support, and therefore works
14067 only on certain machines.
14068
14069 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14070 are defined to 2.
14071
14072 @item -fpie
14073 @itemx -fPIE
14074 @opindex fpie
14075 @opindex fPIE
14076 These options are similar to @option{-fpic} and @option{-fPIC}, but
14077 generated position independent code can be only linked into executables.
14078 Usually these options are used when @option{-pie} GCC option will be
14079 used during linking.
14080
14081 @item -fno-jump-tables
14082 @opindex fno-jump-tables
14083 Do not use jump tables for switch statements even where it would be
14084 more efficient than other code generation strategies.  This option is
14085 of use in conjunction with @option{-fpic} or @option{-fPIC} for
14086 building code which forms part of a dynamic linker and cannot
14087 reference the address of a jump table.  On some targets, jump tables
14088 do not require a GOT and this option is not needed.
14089
14090 @item -ffixed-@var{reg}
14091 @opindex ffixed
14092 Treat the register named @var{reg} as a fixed register; generated code
14093 should never refer to it (except perhaps as a stack pointer, frame
14094 pointer or in some other fixed role).
14095
14096 @var{reg} must be the name of a register.  The register names accepted
14097 are machine-specific and are defined in the @code{REGISTER_NAMES}
14098 macro in the machine description macro file.
14099
14100 This flag does not have a negative form, because it specifies a
14101 three-way choice.
14102
14103 @item -fcall-used-@var{reg}
14104 @opindex fcall-used
14105 Treat the register named @var{reg} as an allocable register that is
14106 clobbered by function calls.  It may be allocated for temporaries or
14107 variables that do not live across a call.  Functions compiled this way
14108 will not save and restore the register @var{reg}.
14109
14110 It is an error to used this flag with the frame pointer or stack pointer.
14111 Use of this flag for other registers that have fixed pervasive roles in
14112 the machine's execution model will produce disastrous results.
14113
14114 This flag does not have a negative form, because it specifies a
14115 three-way choice.
14116
14117 @item -fcall-saved-@var{reg}
14118 @opindex fcall-saved
14119 Treat the register named @var{reg} as an allocable register saved by
14120 functions.  It may be allocated even for temporaries or variables that
14121 live across a call.  Functions compiled this way will save and restore
14122 the register @var{reg} if they use it.
14123
14124 It is an error to used this flag with the frame pointer or stack pointer.
14125 Use of this flag for other registers that have fixed pervasive roles in
14126 the machine's execution model will produce disastrous results.
14127
14128 A different sort of disaster will result from the use of this flag for
14129 a register in which function values may be returned.
14130
14131 This flag does not have a negative form, because it specifies a
14132 three-way choice.
14133
14134 @item -fpack-struct[=@var{n}]
14135 @opindex fpack-struct
14136 Without a value specified, pack all structure members together without
14137 holes.  When a value is specified (which must be a small power of two), pack
14138 structure members according to this value, representing the maximum
14139 alignment (that is, objects with default alignment requirements larger than
14140 this will be output potentially unaligned at the next fitting location.
14141
14142 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
14143 code that is not binary compatible with code generated without that switch.
14144 Additionally, it makes the code suboptimal.
14145 Use it to conform to a non-default application binary interface.
14146
14147 @item -finstrument-functions
14148 @opindex finstrument-functions
14149 Generate instrumentation calls for entry and exit to functions.  Just
14150 after function entry and just before function exit, the following
14151 profiling functions will be called with the address of the current
14152 function and its call site.  (On some platforms,
14153 @code{__builtin_return_address} does not work beyond the current
14154 function, so the call site information may not be available to the
14155 profiling functions otherwise.)
14156
14157 @smallexample
14158 void __cyg_profile_func_enter (void *this_fn,
14159                                void *call_site);
14160 void __cyg_profile_func_exit  (void *this_fn,
14161                                void *call_site);
14162 @end smallexample
14163
14164 The first argument is the address of the start of the current function,
14165 which may be looked up exactly in the symbol table.
14166
14167 This instrumentation is also done for functions expanded inline in other
14168 functions.  The profiling calls will indicate where, conceptually, the
14169 inline function is entered and exited.  This means that addressable
14170 versions of such functions must be available.  If all your uses of a
14171 function are expanded inline, this may mean an additional expansion of
14172 code size.  If you use @samp{extern inline} in your C code, an
14173 addressable version of such functions must be provided.  (This is
14174 normally the case anyways, but if you get lucky and the optimizer always
14175 expands the functions inline, you might have gotten away without
14176 providing static copies.)
14177
14178 A function may be given the attribute @code{no_instrument_function}, in
14179 which case this instrumentation will not be done.  This can be used, for
14180 example, for the profiling functions listed above, high-priority
14181 interrupt routines, and any functions from which the profiling functions
14182 cannot safely be called (perhaps signal handlers, if the profiling
14183 routines generate output or allocate memory).
14184
14185 @item -fstack-check
14186 @opindex fstack-check
14187 Generate code to verify that you do not go beyond the boundary of the
14188 stack.  You should specify this flag if you are running in an
14189 environment with multiple threads, but only rarely need to specify it in
14190 a single-threaded environment since stack overflow is automatically
14191 detected on nearly all systems if there is only one stack.
14192
14193 Note that this switch does not actually cause checking to be done; the
14194 operating system must do that.  The switch causes generation of code
14195 to ensure that the operating system sees the stack being extended.
14196
14197 @item -fstack-limit-register=@var{reg}
14198 @itemx -fstack-limit-symbol=@var{sym}
14199 @itemx -fno-stack-limit
14200 @opindex fstack-limit-register
14201 @opindex fstack-limit-symbol
14202 @opindex fno-stack-limit
14203 Generate code to ensure that the stack does not grow beyond a certain value,
14204 either the value of a register or the address of a symbol.  If the stack
14205 would grow beyond the value, a signal is raised.  For most targets,
14206 the signal is raised before the stack overruns the boundary, so
14207 it is possible to catch the signal without taking special precautions.
14208
14209 For instance, if the stack starts at absolute address @samp{0x80000000}
14210 and grows downwards, you can use the flags
14211 @option{-fstack-limit-symbol=__stack_limit} and
14212 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
14213 of 128KB@.  Note that this may only work with the GNU linker.
14214
14215 @cindex aliasing of parameters
14216 @cindex parameters, aliased
14217 @item -fargument-alias
14218 @itemx -fargument-noalias
14219 @itemx -fargument-noalias-global
14220 @itemx -fargument-noalias-anything
14221 @opindex fargument-alias
14222 @opindex fargument-noalias
14223 @opindex fargument-noalias-global
14224 @opindex fargument-noalias-anything
14225 Specify the possible relationships among parameters and between
14226 parameters and global data.
14227
14228 @option{-fargument-alias} specifies that arguments (parameters) may
14229 alias each other and may alias global storage.@*
14230 @option{-fargument-noalias} specifies that arguments do not alias
14231 each other, but may alias global storage.@*
14232 @option{-fargument-noalias-global} specifies that arguments do not
14233 alias each other and do not alias global storage.
14234 @option{-fargument-noalias-anything} specifies that arguments do not
14235 alias any other storage.
14236
14237 Each language will automatically use whatever option is required by
14238 the language standard.  You should not need to use these options yourself.
14239
14240 @item -fleading-underscore
14241 @opindex fleading-underscore
14242 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14243 change the way C symbols are represented in the object file.  One use
14244 is to help link with legacy assembly code.
14245
14246 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14247 generate code that is not binary compatible with code generated without that
14248 switch.  Use it to conform to a non-default application binary interface.
14249 Not all targets provide complete support for this switch.
14250
14251 @item -ftls-model=@var{model}
14252 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14253 The @var{model} argument should be one of @code{global-dynamic},
14254 @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
14255
14256 The default without @option{-fpic} is @code{initial-exec}; with
14257 @option{-fpic} the default is @code{global-dynamic}.
14258
14259 @item -fvisibility=@var{default|internal|hidden|protected}
14260 @opindex fvisibility
14261 Set the default ELF image symbol visibility to the specified option---all
14262 symbols will be marked with this unless overridden within the code.
14263 Using this feature can very substantially improve linking and
14264 load times of shared object libraries, produce more optimized
14265 code, provide near-perfect API export and prevent symbol clashes.
14266 It is @strong{strongly} recommended that you use this in any shared objects
14267 you distribute.
14268
14269 Despite the nomenclature, @code{default} always means public ie;
14270 available to be linked against from outside the shared object.
14271 @code{protected} and @code{internal} are pretty useless in real-world
14272 usage so the only other commonly used option will be @code{hidden}.
14273 The default if @option{-fvisibility} isn't specified is
14274 @code{default}, i.e., make every
14275 symbol public---this causes the same behavior as previous versions of
14276 GCC@.
14277
14278 A good explanation of the benefits offered by ensuring ELF
14279 symbols have the correct visibility is given by ``How To Write
14280 Shared Libraries'' by Ulrich Drepper (which can be found at
14281 @w{@uref{http://people.redhat.com/~drepper/}})---however a superior
14282 solution made possible by this option to marking things hidden when
14283 the default is public is to make the default hidden and mark things
14284 public.  This is the norm with DLL's on Windows and with @option{-fvisibility=hidden}
14285 and @code{__attribute__ ((visibility("default")))} instead of
14286 @code{__declspec(dllexport)} you get almost identical semantics with
14287 identical syntax.  This is a great boon to those working with
14288 cross-platform projects.
14289
14290 For those adding visibility support to existing code, you may find
14291 @samp{#pragma GCC visibility} of use.  This works by you enclosing
14292 the declarations you wish to set visibility for with (for example)
14293 @samp{#pragma GCC visibility push(hidden)} and
14294 @samp{#pragma GCC visibility pop}.
14295 Bear in mind that symbol visibility should be viewed @strong{as
14296 part of the API interface contract} and thus all new code should
14297 always specify visibility when it is not the default ie; declarations
14298 only for use within the local DSO should @strong{always} be marked explicitly
14299 as hidden as so to avoid PLT indirection overheads---making this
14300 abundantly clear also aids readability and self-documentation of the code.
14301 Note that due to ISO C++ specification requirements, operator new and
14302 operator delete must always be of default visibility.
14303
14304 Be aware that headers from outside your project, in particular system
14305 headers and headers from any other library you use, may not be
14306 expecting to be compiled with visibility other than the default.  You
14307 may need to explicitly say @samp{#pragma GCC visibility push(default)}
14308 before including any such headers.
14309
14310 @samp{extern} declarations are not affected by @samp{-fvisibility}, so
14311 a lot of code can be recompiled with @samp{-fvisibility=hidden} with
14312 no modifications.  However, this means that calls to @samp{extern}
14313 functions with no explicit visibility will use the PLT, so it is more
14314 effective to use @samp{__attribute ((visibility))} and/or
14315 @samp{#pragma GCC visibility} to tell the compiler which @samp{extern}
14316 declarations should be treated as hidden.
14317
14318 Note that @samp{-fvisibility} does affect C++ vague linkage
14319 entities. This means that, for instance, an exception class that will
14320 be thrown between DSOs must be explicitly marked with default
14321 visibility so that the @samp{type_info} nodes will be unified between
14322 the DSOs.
14323
14324 An overview of these techniques, their benefits and how to use them
14325 is at @w{@uref{http://gcc.gnu.org/wiki/Visibility}}.
14326
14327 @end table
14328
14329 @c man end
14330
14331 @node Environment Variables
14332 @section Environment Variables Affecting GCC
14333 @cindex environment variables
14334
14335 @c man begin ENVIRONMENT
14336 This section describes several environment variables that affect how GCC
14337 operates.  Some of them work by specifying directories or prefixes to use
14338 when searching for various kinds of files.  Some are used to specify other
14339 aspects of the compilation environment.
14340
14341 Note that you can also specify places to search using options such as
14342 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
14343 take precedence over places specified using environment variables, which
14344 in turn take precedence over those specified by the configuration of GCC@.
14345 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
14346 GNU Compiler Collection (GCC) Internals}.
14347
14348 @table @env
14349 @item LANG
14350 @itemx LC_CTYPE
14351 @c @itemx LC_COLLATE
14352 @itemx LC_MESSAGES
14353 @c @itemx LC_MONETARY
14354 @c @itemx LC_NUMERIC
14355 @c @itemx LC_TIME
14356 @itemx LC_ALL
14357 @findex LANG
14358 @findex LC_CTYPE
14359 @c @findex LC_COLLATE
14360 @findex LC_MESSAGES
14361 @c @findex LC_MONETARY
14362 @c @findex LC_NUMERIC
14363 @c @findex LC_TIME
14364 @findex LC_ALL
14365 @cindex locale
14366 These environment variables control the way that GCC uses
14367 localization information that allow GCC to work with different
14368 national conventions.  GCC inspects the locale categories
14369 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
14370 so.  These locale categories can be set to any value supported by your
14371 installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
14372 Kingdom encoded in UTF-8.
14373
14374 The @env{LC_CTYPE} environment variable specifies character
14375 classification.  GCC uses it to determine the character boundaries in
14376 a string; this is needed for some multibyte encodings that contain quote
14377 and escape characters that would otherwise be interpreted as a string
14378 end or escape.
14379
14380 The @env{LC_MESSAGES} environment variable specifies the language to
14381 use in diagnostic messages.
14382
14383 If the @env{LC_ALL} environment variable is set, it overrides the value
14384 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
14385 and @env{LC_MESSAGES} default to the value of the @env{LANG}
14386 environment variable.  If none of these variables are set, GCC
14387 defaults to traditional C English behavior.
14388
14389 @item TMPDIR
14390 @findex TMPDIR
14391 If @env{TMPDIR} is set, it specifies the directory to use for temporary
14392 files.  GCC uses temporary files to hold the output of one stage of
14393 compilation which is to be used as input to the next stage: for example,
14394 the output of the preprocessor, which is the input to the compiler
14395 proper.
14396
14397 @item GCC_EXEC_PREFIX
14398 @findex GCC_EXEC_PREFIX
14399 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
14400 names of the subprograms executed by the compiler.  No slash is added
14401 when this prefix is combined with the name of a subprogram, but you can
14402 specify a prefix that ends with a slash if you wish.
14403
14404 If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
14405 an appropriate prefix to use based on the pathname it was invoked with.
14406
14407 If GCC cannot find the subprogram using the specified prefix, it
14408 tries looking in the usual places for the subprogram.
14409
14410 The default value of @env{GCC_EXEC_PREFIX} is
14411 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
14412 the installed compiler. In many cases @var{prefix} is the value
14413 of @code{prefix} when you ran the @file{configure} script.
14414
14415 Other prefixes specified with @option{-B} take precedence over this prefix.
14416
14417 This prefix is also used for finding files such as @file{crt0.o} that are
14418 used for linking.
14419
14420 In addition, the prefix is used in an unusual way in finding the
14421 directories to search for header files.  For each of the standard
14422 directories whose name normally begins with @samp{/usr/local/lib/gcc}
14423 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
14424 replacing that beginning with the specified prefix to produce an
14425 alternate directory name.  Thus, with @option{-Bfoo/}, GCC will search
14426 @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
14427 These alternate directories are searched first; the standard directories
14428 come next. If a standard directory begins with the configured 
14429 @var{prefix} then the value of @var{prefix} is replaced by 
14430 @env{GCC_EXEC_PREFIX} when looking for header files.
14431
14432 @item COMPILER_PATH
14433 @findex COMPILER_PATH
14434 The value of @env{COMPILER_PATH} is a colon-separated list of
14435 directories, much like @env{PATH}.  GCC tries the directories thus
14436 specified when searching for subprograms, if it can't find the
14437 subprograms using @env{GCC_EXEC_PREFIX}.
14438
14439 @item LIBRARY_PATH
14440 @findex LIBRARY_PATH
14441 The value of @env{LIBRARY_PATH} is a colon-separated list of
14442 directories, much like @env{PATH}.  When configured as a native compiler,
14443 GCC tries the directories thus specified when searching for special
14444 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}.  Linking
14445 using GCC also uses these directories when searching for ordinary
14446 libraries for the @option{-l} option (but directories specified with
14447 @option{-L} come first).
14448
14449 @item LANG
14450 @findex LANG
14451 @cindex locale definition
14452 This variable is used to pass locale information to the compiler.  One way in
14453 which this information is used is to determine the character set to be used
14454 when character literals, string literals and comments are parsed in C and C++.
14455 When the compiler is configured to allow multibyte characters,
14456 the following values for @env{LANG} are recognized:
14457
14458 @table @samp
14459 @item C-JIS
14460 Recognize JIS characters.
14461 @item C-SJIS
14462 Recognize SJIS characters.
14463 @item C-EUCJP
14464 Recognize EUCJP characters.
14465 @end table
14466
14467 If @env{LANG} is not defined, or if it has some other value, then the
14468 compiler will use mblen and mbtowc as defined by the default locale to
14469 recognize and translate multibyte characters.
14470 @end table
14471
14472 @noindent
14473 Some additional environments variables affect the behavior of the
14474 preprocessor.
14475
14476 @include cppenv.texi
14477
14478 @c man end
14479
14480 @node Precompiled Headers
14481 @section Using Precompiled Headers
14482 @cindex precompiled headers
14483 @cindex speed of compilation
14484
14485 Often large projects have many header files that are included in every
14486 source file.  The time the compiler takes to process these header files
14487 over and over again can account for nearly all of the time required to
14488 build the project.  To make builds faster, GCC allows users to
14489 `precompile' a header file; then, if builds can use the precompiled
14490 header file they will be much faster.
14491
14492 To create a precompiled header file, simply compile it as you would any
14493 other file, if necessary using the @option{-x} option to make the driver
14494 treat it as a C or C++ header file.  You will probably want to use a
14495 tool like @command{make} to keep the precompiled header up-to-date when
14496 the headers it contains change.
14497
14498 A precompiled header file will be searched for when @code{#include} is
14499 seen in the compilation.  As it searches for the included file
14500 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
14501 compiler looks for a precompiled header in each directory just before it
14502 looks for the include file in that directory.  The name searched for is
14503 the name specified in the @code{#include} with @samp{.gch} appended.  If
14504 the precompiled header file can't be used, it is ignored.
14505
14506 For instance, if you have @code{#include "all.h"}, and you have
14507 @file{all.h.gch} in the same directory as @file{all.h}, then the
14508 precompiled header file will be used if possible, and the original
14509 header will be used otherwise.
14510
14511 Alternatively, you might decide to put the precompiled header file in a
14512 directory and use @option{-I} to ensure that directory is searched
14513 before (or instead of) the directory containing the original header.
14514 Then, if you want to check that the precompiled header file is always
14515 used, you can put a file of the same name as the original header in this
14516 directory containing an @code{#error} command.
14517
14518 This also works with @option{-include}.  So yet another way to use
14519 precompiled headers, good for projects not designed with precompiled
14520 header files in mind, is to simply take most of the header files used by
14521 a project, include them from another header file, precompile that header
14522 file, and @option{-include} the precompiled header.  If the header files
14523 have guards against multiple inclusion, they will be skipped because
14524 they've already been included (in the precompiled header).
14525
14526 If you need to precompile the same header file for different
14527 languages, targets, or compiler options, you can instead make a
14528 @emph{directory} named like @file{all.h.gch}, and put each precompiled
14529 header in the directory, perhaps using @option{-o}.  It doesn't matter
14530 what you call the files in the directory, every precompiled header in
14531 the directory will be considered.  The first precompiled header
14532 encountered in the directory that is valid for this compilation will
14533 be used; they're searched in no particular order.
14534
14535 There are many other possibilities, limited only by your imagination,
14536 good sense, and the constraints of your build system.
14537
14538 A precompiled header file can be used only when these conditions apply:
14539
14540 @itemize
14541 @item
14542 Only one precompiled header can be used in a particular compilation.
14543
14544 @item
14545 A precompiled header can't be used once the first C token is seen.  You
14546 can have preprocessor directives before a precompiled header; you can
14547 even include a precompiled header from inside another header, so long as
14548 there are no C tokens before the @code{#include}.
14549
14550 @item
14551 The precompiled header file must be produced for the same language as
14552 the current compilation.  You can't use a C precompiled header for a C++
14553 compilation.
14554
14555 @item
14556 The precompiled header file must have been produced by the same compiler
14557 binary as the current compilation is using.
14558
14559 @item
14560 Any macros defined before the precompiled header is included must
14561 either be defined in the same way as when the precompiled header was
14562 generated, or must not affect the precompiled header, which usually
14563 means that they don't appear in the precompiled header at all.
14564
14565 The @option{-D} option is one way to define a macro before a
14566 precompiled header is included; using a @code{#define} can also do it.
14567 There are also some options that define macros implicitly, like
14568 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
14569 defined this way.
14570
14571 @item If debugging information is output when using the precompiled
14572 header, using @option{-g} or similar, the same kind of debugging information
14573 must have been output when building the precompiled header.  However,
14574 a precompiled header built using @option{-g} can be used in a compilation
14575 when no debugging information is being output.
14576
14577 @item The same @option{-m} options must generally be used when building
14578 and using the precompiled header.  @xref{Submodel Options},
14579 for any cases where this rule is relaxed.
14580
14581 @item Each of the following options must be the same when building and using
14582 the precompiled header:
14583
14584 @gccoptlist{-fexceptions -funit-at-a-time}
14585
14586 @item
14587 Some other command-line options starting with @option{-f},
14588 @option{-p}, or @option{-O} must be defined in the same way as when
14589 the precompiled header was generated.  At present, it's not clear
14590 which options are safe to change and which are not; the safest choice
14591 is to use exactly the same options when generating and using the
14592 precompiled header.  The following are known to be safe:
14593
14594 @gccoptlist{-fmessage-length=  -fpreprocessed  -fsched-interblock @gol
14595 -fsched-spec  -fsched-spec-load  -fsched-spec-load-dangerous @gol
14596 -fsched-verbose=<number>  -fschedule-insns  -fvisibility= @gol
14597 -pedantic-errors}
14598
14599 @end itemize
14600
14601 For all of these except the last, the compiler will automatically
14602 ignore the precompiled header if the conditions aren't met.  If you
14603 find an option combination that doesn't work and doesn't cause the
14604 precompiled header to be ignored, please consider filing a bug report,
14605 see @ref{Bugs}.
14606
14607 If you do use differing options when generating and using the
14608 precompiled header, the actual behavior will be a mixture of the
14609 behavior for the options.  For instance, if you use @option{-g} to
14610 generate the precompiled header but not when using it, you may or may
14611 not get debugging information for routines in the precompiled header.
14612
14613 @node Running Protoize
14614 @section Running Protoize
14615
14616 The program @code{protoize} is an optional part of GCC@.  You can use
14617 it to add prototypes to a program, thus converting the program to ISO
14618 C in one respect.  The companion program @code{unprotoize} does the
14619 reverse: it removes argument types from any prototypes that are found.
14620
14621 When you run these programs, you must specify a set of source files as
14622 command line arguments.  The conversion programs start out by compiling
14623 these files to see what functions they define.  The information gathered
14624 about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
14625
14626 After scanning comes actual conversion.  The specified files are all
14627 eligible to be converted; any files they include (whether sources or
14628 just headers) are eligible as well.
14629
14630 But not all the eligible files are converted.  By default,
14631 @code{protoize} and @code{unprotoize} convert only source and header
14632 files in the current directory.  You can specify additional directories
14633 whose files should be converted with the @option{-d @var{directory}}
14634 option.  You can also specify particular files to exclude with the
14635 @option{-x @var{file}} option.  A file is converted if it is eligible, its
14636 directory name matches one of the specified directory names, and its
14637 name within the directory has not been excluded.
14638
14639 Basic conversion with @code{protoize} consists of rewriting most
14640 function definitions and function declarations to specify the types of
14641 the arguments.  The only ones not rewritten are those for varargs
14642 functions.
14643
14644 @code{protoize} optionally inserts prototype declarations at the
14645 beginning of the source file, to make them available for any calls that
14646 precede the function's definition.  Or it can insert prototype
14647 declarations with block scope in the blocks where undeclared functions
14648 are called.
14649
14650 Basic conversion with @code{unprotoize} consists of rewriting most
14651 function declarations to remove any argument types, and rewriting
14652 function definitions to the old-style pre-ISO form.
14653
14654 Both conversion programs print a warning for any function declaration or
14655 definition that they can't convert.  You can suppress these warnings
14656 with @option{-q}.
14657
14658 The output from @code{protoize} or @code{unprotoize} replaces the
14659 original source file.  The original file is renamed to a name ending
14660 with @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
14661 without the original @samp{.c} suffix).  If the @samp{.save} (@samp{.sav}
14662 for DOS) file already exists, then the source file is simply discarded.
14663
14664 @code{protoize} and @code{unprotoize} both depend on GCC itself to
14665 scan the program and collect information about the functions it uses.
14666 So neither of these programs will work until GCC is installed.
14667
14668 Here is a table of the options you can use with @code{protoize} and
14669 @code{unprotoize}.  Each option works with both programs unless
14670 otherwise stated.
14671
14672 @table @code
14673 @item -B @var{directory}
14674 Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
14675 usual directory (normally @file{/usr/local/lib}).  This file contains
14676 prototype information about standard system functions.  This option
14677 applies only to @code{protoize}.
14678
14679 @item -c @var{compilation-options}
14680 Use @var{compilation-options} as the options when running @command{gcc} to
14681 produce the @samp{.X} files.  The special option @option{-aux-info} is
14682 always passed in addition, to tell @command{gcc} to write a @samp{.X} file.
14683
14684 Note that the compilation options must be given as a single argument to
14685 @code{protoize} or @code{unprotoize}.  If you want to specify several
14686 @command{gcc} options, you must quote the entire set of compilation options
14687 to make them a single word in the shell.
14688
14689 There are certain @command{gcc} arguments that you cannot use, because they
14690 would produce the wrong kind of output.  These include @option{-g},
14691 @option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
14692 the @var{compilation-options}, they are ignored.
14693
14694 @item -C
14695 Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file
14696 systems) instead of @samp{.c}.  This is convenient if you are converting
14697 a C program to C++.  This option applies only to @code{protoize}.
14698
14699 @item -g
14700 Add explicit global declarations.  This means inserting explicit
14701 declarations at the beginning of each source file for each function
14702 that is called in the file and was not declared.  These declarations
14703 precede the first function definition that contains a call to an
14704 undeclared function.  This option applies only to @code{protoize}.
14705
14706 @item -i @var{string}
14707 Indent old-style parameter declarations with the string @var{string}.
14708 This option applies only to @code{protoize}.
14709
14710 @code{unprotoize} converts prototyped function definitions to old-style
14711 function definitions, where the arguments are declared between the
14712 argument list and the initial @samp{@{}.  By default, @code{unprotoize}
14713 uses five spaces as the indentation.  If you want to indent with just
14714 one space instead, use @option{-i " "}.
14715
14716 @item -k
14717 Keep the @samp{.X} files.  Normally, they are deleted after conversion
14718 is finished.
14719
14720 @item -l
14721 Add explicit local declarations.  @code{protoize} with @option{-l} inserts
14722 a prototype declaration for each function in each block which calls the
14723 function without any declaration.  This option applies only to
14724 @code{protoize}.
14725
14726 @item -n
14727 Make no real changes.  This mode just prints information about the conversions
14728 that would have been done without @option{-n}.
14729
14730 @item -N
14731 Make no @samp{.save} files.  The original files are simply deleted.
14732 Use this option with caution.
14733
14734 @item -p @var{program}
14735 Use the program @var{program} as the compiler.  Normally, the name
14736 @file{gcc} is used.
14737
14738 @item -q
14739 Work quietly.  Most warnings are suppressed.
14740
14741 @item -v
14742 Print the version number, just like @option{-v} for @command{gcc}.
14743 @end table
14744
14745 If you need special compiler options to compile one of your program's
14746 source files, then you should generate that file's @samp{.X} file
14747 specially, by running @command{gcc} on that source file with the
14748 appropriate options and the option @option{-aux-info}.  Then run
14749 @code{protoize} on the entire set of files.  @code{protoize} will use
14750 the existing @samp{.X} file because it is newer than the source file.
14751 For example:
14752
14753 @smallexample
14754 gcc -Dfoo=bar file1.c -aux-info file1.X
14755 protoize *.c
14756 @end smallexample
14757
14758 @noindent
14759 You need to include the special files along with the rest in the
14760 @code{protoize} command, even though their @samp{.X} files already
14761 exist, because otherwise they won't get converted.
14762
14763 @xref{Protoize Caveats}, for more information on how to use
14764 @code{protoize} successfully.