OSDN Git Service

PR c++/9283
[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 Free Software Foundation, Inc.
3 @c This is part of the GCC manual.
4 @c For copying conditions, see the file gcc.texi.
5
6 @ignore
7 @c man begin COPYRIGHT
8 Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
9 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
10
11 Permission is granted to copy, distribute and/or modify this document
12 under the terms of the GNU Free Documentation License, Version 1.2 or
13 any later version published by the Free Software Foundation; with the
14 Invariant Sections being ``GNU General Public License'' and ``Funding
15 Free Software'', the Front-Cover texts being (a) (see below), and with
16 the Back-Cover Texts being (b) (see below).  A copy of the license is
17 included in the gfdl(7) man page.
18
19 (a) The FSF's Front-Cover Text is:
20
21      A GNU Manual
22
23 (b) The FSF's Back-Cover Text is:
24
25      You have freedom to copy and modify this GNU Manual, like GNU
26      software.  Copies published by the Free Software Foundation raise
27      funds for GNU development.
28 @c man end
29 @c Set file name and title for the man page.
30 @setfilename gcc
31 @settitle GNU project C and C++ compiler
32 @c man begin SYNOPSIS
33 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
34     [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
35     [@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
36     [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
37     [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
38     [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
39     [@option{-o} @var{outfile}] @var{infile}@dots{}
40
41 Only the most useful options are listed here; see below for the
42 remainder.  @samp{g++} accepts mostly the same options as @samp{gcc}.
43 @c man end
44 @c man begin SEEALSO
45 gpl(7), gfdl(7), fsf-funding(7),
46 cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
47 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
48 @file{ld}, @file{binutils} and @file{gdb}.
49 @c man end
50 @c man begin BUGS
51 For instructions on reporting bugs, see
52 @w{@uref{http://gcc.gnu.org/bugs.html}}.  Use of the @command{gccbug}
53 script to report bugs is recommended.
54 @c man end
55 @c man begin AUTHOR
56 See the Info entry for @command{gcc}, or
57 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
58 for contributors to GCC@.
59 @c man end
60 @end ignore
61
62 @node Invoking GCC
63 @chapter GCC Command Options
64 @cindex GCC command options
65 @cindex command options
66 @cindex options, GCC command
67
68 @c man begin DESCRIPTION
69 When you invoke GCC, it normally does preprocessing, compilation,
70 assembly and linking.  The ``overall options'' allow you to stop this
71 process at an intermediate stage.  For example, the @option{-c} option
72 says not to run the linker.  Then the output consists of object files
73 output by the assembler.
74
75 Other options are passed on to one stage of processing.  Some options
76 control the preprocessor and others the compiler itself.  Yet other
77 options control the assembler and linker; most of these are not
78 documented here, since you rarely need to use any of them.
79
80 @cindex C compilation options
81 Most of the command line options that you can use with GCC are useful
82 for C programs; when an option is only useful with another language
83 (usually C++), the explanation says so explicitly.  If the description
84 for a particular option does not mention a source language, you can use
85 that option with all supported languages.
86
87 @cindex C++ compilation options
88 @xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
89 options for compiling C++ programs.
90
91 @cindex grouping options
92 @cindex options, grouping
93 The @command{gcc} program accepts options and file names as operands.  Many
94 options have multi-letter names; therefore multiple single-letter options
95 may @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d
96 -r}}.
97
98 @cindex order of options
99 @cindex options, order
100 You can mix options and other arguments.  For the most part, the order
101 you use doesn't matter.  Order does matter when you use several options
102 of the same kind; for example, if you specify @option{-L} more than once,
103 the directories are searched in the order specified.
104
105 Many options have long names starting with @samp{-f} or with
106 @samp{-W}---for example, @option{-fforce-mem},
107 @option{-fstrength-reduce}, @option{-Wformat} and so on.  Most of
108 these have both positive and negative forms; the negative form of
109 @option{-ffoo} would be @option{-fno-foo}.  This manual documents
110 only one of these two forms, whichever one is not the default.
111
112 @c man end
113
114 @xref{Option Index}, for an index to GCC's options.
115
116 @menu
117 * Option Summary::      Brief list of all options, without explanations.
118 * Overall Options::     Controlling the kind of output:
119                         an executable, object files, assembler files,
120                         or preprocessed source.
121 * Invoking G++::        Compiling C++ programs.
122 * C Dialect Options::   Controlling the variant of C language compiled.
123 * C++ Dialect Options:: Variations on C++.
124 * Objective-C Dialect Options:: Variations on Objective-C.
125 * Language Independent Options:: Controlling how diagnostics should be
126                         formatted.
127 * Warning Options::     How picky should the compiler be?
128 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
129 * Optimize Options::    How much optimization?
130 * Preprocessor Options:: Controlling header files and macro definitions.
131                          Also, getting dependency information for Make.
132 * Assembler Options::   Passing options to the assembler.
133 * Link Options::        Specifying libraries and so on.
134 * Directory Options::   Where to find header files and libraries.
135                         Where to find the compiler executable files.
136 * Spec Files::          How to pass switches to sub-processes.
137 * Target Options::      Running a cross-compiler, or an old version of GCC.
138 * Submodel Options::    Specifying minor hardware or convention variations,
139                         such as 68010 vs 68020.
140 * Code Gen Options::    Specifying conventions for function calls, data layout
141                         and register usage.
142 * Environment Variables:: Env vars that affect GCC.
143 * Precompiled Headers:: Compiling a header once, and using it many times.
144 * Running Protoize::    Automatically adding or removing function prototypes.
145 @end menu
146
147 @c man begin OPTIONS
148
149 @node Option Summary
150 @section Option Summary
151
152 Here is a summary of all the options, grouped by type.  Explanations are
153 in the following sections.
154
155 @table @emph
156 @item Overall Options
157 @xref{Overall Options,,Options Controlling the Kind of Output}.
158 @gccoptlist{-c  -S  -E  -o @var{file}  -combine -pipe  -pass-exit-codes  @gol
159 -x @var{language}  -v  -###  --help  --target-help  --version}
160
161 @item C Language Options
162 @xref{C Dialect Options,,Options Controlling C Dialect}.
163 @gccoptlist{-ansi  -std=@var{standard}  -aux-info @var{filename} @gol
164 -fno-asm  -fno-builtin  -fno-builtin-@var{function} @gol
165 -fhosted  -ffreestanding  -fms-extensions @gol
166 -trigraphs  -no-integrated-cpp  -traditional  -traditional-cpp @gol
167 -fallow-single-precision  -fcond-mismatch @gol
168 -fsigned-bitfields  -fsigned-char @gol
169 -funsigned-bitfields  -funsigned-char}
170
171 @item C++ Language Options
172 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
173 @gccoptlist{-fabi-version=@var{n}  -fno-access-control  -fcheck-new @gol
174 -fconserve-space  -fno-const-strings @gol
175 -fno-elide-constructors @gol
176 -fno-enforce-eh-specs @gol
177 -ffor-scope  -fno-for-scope  -fno-gnu-keywords @gol
178 -fno-implicit-templates @gol
179 -fno-implicit-inline-templates @gol
180 -fno-implement-inlines  -fms-extensions @gol
181 -fno-nonansi-builtins  -fno-operator-names @gol
182 -fno-optional-diags  -fpermissive @gol
183 -frepo  -fno-rtti  -fstats  -ftemplate-depth-@var{n} @gol
184 -fuse-cxa-atexit  -fno-weak  -nostdinc++ @gol
185 -fno-default-inline  -fvisibility-inlines-hidden @gol
186 -Wabi  -Wctor-dtor-privacy @gol
187 -Wnon-virtual-dtor  -Wreorder @gol
188 -Weffc++  -Wno-deprecated @gol
189 -Wno-non-template-friend  -Wold-style-cast @gol
190 -Woverloaded-virtual  -Wno-pmf-conversions @gol
191 -Wsign-promo  -Wsynth}
192
193 @item Objective-C Language Options
194 @xref{Objective-C Dialect Options,,Options Controlling Objective-C Dialect}.
195 @gccoptlist{
196 -fconstant-string-class=@var{class-name} @gol
197 -fgnu-runtime  -fnext-runtime @gol
198 -fno-nil-receivers @gol
199 -fobjc-exceptions @gol
200 -freplace-objc-classes @gol
201 -fzero-link @gol
202 -gen-decls @gol
203 -Wno-protocol  -Wselector -Wundeclared-selector}
204
205 @item Language Independent Options
206 @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
207 @gccoptlist{-fmessage-length=@var{n}  @gol
208 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}}
209
210 @item Warning Options
211 @xref{Warning Options,,Options to Request or Suppress Warnings}.
212 @gccoptlist{-fsyntax-only  -pedantic  -pedantic-errors @gol
213 -w  -Wextra  -Wall  -Waggregate-return @gol
214 -Wcast-align  -Wcast-qual  -Wchar-subscripts  -Wcomment @gol
215 -Wconversion  -Wno-deprecated-declarations @gol
216 -Wdisabled-optimization  -Wno-div-by-zero  -Wendif-labels @gol
217 -Werror  -Werror-implicit-function-declaration @gol
218 -Wfatal-errors  -Wfloat-equal  -Wformat  -Wformat=2 @gol
219 -Wno-format-extra-args -Wformat-nonliteral @gol
220 -Wformat-security  -Wformat-y2k @gol
221 -Wimplicit  -Wimplicit-function-declaration  -Wimplicit-int @gol
222 -Wimport  -Wno-import  -Winit-self  -Winline @gol
223 -Wno-invalid-offsetof  -Winvalid-pch @gol
224 -Wlarger-than-@var{len}  -Wlong-long @gol
225 -Wmain  -Wmissing-braces @gol
226 -Wmissing-format-attribute  -Wmissing-include-dirs @gol
227 -Wmissing-noreturn @gol
228 -Wno-multichar  -Wnonnull  -Wpacked  -Wpadded @gol
229 -Wparentheses  -Wpointer-arith  -Wredundant-decls @gol
230 -Wreturn-type  -Wsequence-point  -Wshadow @gol
231 -Wsign-compare  -Wstrict-aliasing -Wstrict-aliasing=2 @gol
232 -Wswitch  -Wswitch-default  -Wswitch-enum @gol
233 -Wsystem-headers  -Wtrigraphs  -Wundef  -Wuninitialized @gol
234 -Wunknown-pragmas  -Wunreachable-code @gol
235 -Wunused  -Wunused-function  -Wunused-label  -Wunused-parameter @gol
236 -Wunused-value  -Wunused-variable  -Wwrite-strings @gol
237 -Wvariadic-macros}
238
239 @item C-only Warning Options
240 @gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
241 -Wmissing-prototypes  -Wnested-externs  -Wold-style-definition @gol
242 -Wstrict-prototypes  -Wtraditional @gol
243 -Wdeclaration-after-statement}
244
245 @item Debugging Options
246 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
247 @gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
248 -fdump-unnumbered  -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
249 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
250 -fdump-tree-all @gol
251 -fdump-tree-original@r{[}-@var{n}@r{]}  @gol
252 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
253 -fdump-tree-inlined@r{[}-@var{n}@r{]} @gol
254 -fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol
255 -fdump-tree-ch @gol
256 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
257 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
258 -fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
259 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
260 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
261 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
262 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
263 -fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
264 -fdump-tree-nrv @gol
265 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
266 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
267 -feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
268 -feliminate-unused-debug-symbols -fmem-report -fprofile-arcs -ftree-based-profiling @gol
269 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
270 -ftest-coverage  -ftime-report -fvar-tracking @gol
271 -g  -g@var{level}  -gcoff -gdwarf-2 @gol
272 -ggdb  -gstabs  -gstabs+  -gvms  -gxcoff  -gxcoff+ @gol
273 -p  -pg  -print-file-name=@var{library}  -print-libgcc-file-name @gol
274 -print-multi-directory  -print-multi-lib @gol
275 -print-prog-name=@var{program}  -print-search-dirs  -Q @gol
276 -save-temps  -time}
277
278 @item Optimization Options
279 @xref{Optimize Options,,Options that Control Optimization}.
280 @gccoptlist{-falign-functions=@var{n}  -falign-jumps=@var{n} @gol
281 -falign-labels=@var{n}  -falign-loops=@var{n}  @gol
282 -fbounds-check -fmudflap -fmudflapth -fmudflapir @gol
283 -fbranch-probabilities -fprofile-values -fvpt -fbranch-target-load-optimize @gol
284 -fbranch-target-load-optimize2 -fbtr-bb-exclusive @gol
285 -fcaller-saves  -fcprop-registers @gol
286 -fcse-follow-jumps  -fcse-skip-blocks  -fdata-sections @gol
287 -fdelayed-branch  -fdelete-null-pointer-checks @gol
288 -fexpensive-optimizations  -ffast-math  -ffloat-store @gol
289 -fforce-addr  -fforce-mem  -ffunction-sections @gol
290 -fgcse  -fgcse-lm  -fgcse-sm  -fgcse-las  -fgcse-after-reload @gol
291 -floop-optimize -fcrossjumping  -fif-conversion  -fif-conversion2 @gol
292 -finline-functions  -finline-limit=@var{n}  -fkeep-inline-functions @gol
293 -fkeep-static-consts  -fmerge-constants  -fmerge-all-constants @gol
294 -fmodulo-sched -fmove-all-movables  -fnew-ra  -fno-branch-count-reg @gol
295 -fno-default-inline  -fno-defer-pop -floop-optimize2 -fmove-loop-invariants @gol
296 -fno-function-cse  -fno-guess-branch-probability @gol
297 -fno-inline  -fno-math-errno  -fno-peephole  -fno-peephole2 @gol
298 -funsafe-math-optimizations  -ffinite-math-only @gol
299 -fno-trapping-math  -fno-zero-initialized-in-bss @gol
300 -fomit-frame-pointer  -foptimize-register-move @gol
301 -foptimize-sibling-calls  -fprefetch-loop-arrays @gol
302 -fprofile-generate -fprofile-use @gol
303 -freduce-all-givs  -fregmove  -frename-registers @gol
304 -freorder-blocks  -freorder-blocks-and-partition -freorder-functions @gol
305 -frerun-cse-after-loop  -frerun-loop-opt @gol
306 -frounding-math -fschedule-insns  -fschedule-insns2 @gol
307 -fno-sched-interblock  -fno-sched-spec  -fsched-spec-load @gol
308 -fsched-spec-load-dangerous  @gol
309 -fsched-stalled-insns=@var{n} -sched-stalled-insns-dep=@var{n} @gol
310 -fsched2-use-superblocks @gol
311 -fsched2-use-traces  -fsignaling-nans @gol
312 -fsingle-precision-constant  @gol
313 -fstrength-reduce  -fstrict-aliasing  -ftracer  -fthread-jumps @gol
314 -funroll-all-loops  -funroll-loops  -fpeel-loops @gol
315 -funswitch-loops  -fold-unroll-loops  -fold-unroll-all-loops @gol
316 -ftree-pre  -ftree-ccp  -ftree-dce -ftree-loop-optimize @gol
317 -ftree-lim @gol
318 -ftree-dominator-opts -ftree-dse -ftree-copyrename @gol
319 -ftree-ch -ftree-sra -ftree-ter -ftree-lrs -ftree-fre @gol
320 --param @var{name}=@var{value}
321 -O  -O0  -O1  -O2  -O3  -Os}
322
323 @item Preprocessor Options
324 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
325 @gccoptlist{-A@var{question}=@var{answer} @gol
326 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
327 -C  -dD  -dI  -dM  -dN @gol
328 -D@var{macro}@r{[}=@var{defn}@r{]}  -E  -H @gol
329 -idirafter @var{dir} @gol
330 -include @var{file}  -imacros @var{file} @gol
331 -iprefix @var{file}  -iwithprefix @var{dir} @gol
332 -iwithprefixbefore @var{dir}  -isystem @var{dir} @gol
333 -M  -MM  -MF  -MG  -MP  -MQ  -MT  -nostdinc  @gol
334 -P  -fworking-directory  -remap @gol
335 -trigraphs  -undef  -U@var{macro}  -Wp,@var{option} @gol
336 -Xpreprocessor @var{option}}
337
338 @item Assembler Option
339 @xref{Assembler Options,,Passing Options to the Assembler}.
340 @gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
341
342 @item Linker Options
343 @xref{Link Options,,Options for Linking}.
344 @gccoptlist{@var{object-file-name}  -l@var{library} @gol
345 -nostartfiles  -nodefaultlibs  -nostdlib -pie @gol
346 -s  -static  -static-libgcc  -shared  -shared-libgcc  -symbolic @gol
347 -Wl,@var{option}  -Xlinker @var{option} @gol
348 -u @var{symbol}}
349
350 @item Directory Options
351 @xref{Directory Options,,Options for Directory Search}.
352 @gccoptlist{-B@var{prefix}  -I@var{dir}  -iquote@var{dir}  -L@var{dir}  -specs=@var{file}  -I-}
353
354 @item Target Options
355 @c I wrote this xref this way to avoid overfull hbox. -- rms
356 @xref{Target Options}.
357 @gccoptlist{-V @var{version}  -b @var{machine}}
358
359 @item Machine Dependent Options
360 @xref{Submodel Options,,Hardware Models and Configurations}.
361 @c This list is ordered alphanumerically by subsection name.
362 @c Try and put the significant identifier (CPU or system) first,
363 @c so users have a clue at guessing where the ones they want will be.
364
365 @emph{ARC Options}
366 @gccoptlist{-EB  -EL @gol
367 -mmangle-cpu  -mcpu=@var{cpu}  -mtext=@var{text-section} @gol
368 -mdata=@var{data-section}  -mrodata=@var{readonly-data-section}}
369
370 @emph{ARM Options}
371 @gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
372 -mabi=@var{name} @gol
373 -mapcs-stack-check  -mno-apcs-stack-check @gol
374 -mapcs-float  -mno-apcs-float @gol
375 -mapcs-reentrant  -mno-apcs-reentrant @gol
376 -msched-prolog  -mno-sched-prolog @gol
377 -mlittle-endian  -mbig-endian  -mwords-little-endian @gol
378 -mfloat-abi=@var{name}  -msoft-float  -mhard-float  -mfpe @gol
379 -mthumb-interwork  -mno-thumb-interwork @gol
380 -mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
381 -mstructure-size-boundary=@var{n} @gol
382 -mabort-on-noreturn @gol
383 -mlong-calls  -mno-long-calls @gol
384 -msingle-pic-base  -mno-single-pic-base @gol
385 -mpic-register=@var{reg} @gol
386 -mnop-fun-dllimport @gol
387 -mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
388 -mpoke-function-name @gol
389 -mthumb  -marm @gol
390 -mtpcs-frame  -mtpcs-leaf-frame @gol
391 -mcaller-super-interworking  -mcallee-super-interworking}
392
393 @emph{AVR Options}
394 @gccoptlist{-mmcu=@var{mcu}  -msize  -minit-stack=@var{n}  -mno-interrupts @gol
395 -mcall-prologues  -mno-tablejump  -mtiny-stack  -mint8}
396
397 @emph{CRIS Options}
398 @gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}  -mtune=@var{cpu} @gol
399 -mmax-stack-frame=@var{n}  -melinux-stacksize=@var{n} @gol
400 -metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
401 -mstack-align  -mdata-align  -mconst-align @gol
402 -m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue  -mno-gotplt @gol
403 -melf  -maout  -melinux  -mlinux  -sim  -sim2 @gol
404 -mmul-bug-workaround  -mno-mul-bug-workaround}
405
406 @emph{Darwin Options}
407 @gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal @gol
408 -arch_only  -bind_at_load  -bundle  -bundle_loader @gol
409 -client_name  -compatibility_version  -current_version @gol
410 -dependency-file  -dylib_file  -dylinker_install_name @gol
411 -dynamic  -dynamiclib  -exported_symbols_list @gol
412 -filelist  -flat_namespace  -force_cpusubtype_ALL @gol
413 -force_flat_namespace  -headerpad_max_install_names @gol
414 -image_base  -init  -install_name  -keep_private_externs @gol
415 -multi_module  -multiply_defined  -multiply_defined_unused @gol
416 -noall_load  -nofixprebinding -nomultidefs  -noprebind  -noseglinkedit @gol
417 -pagezero_size  -prebind  -prebind_all_twolevel_modules @gol
418 -private_bundle  -read_only_relocs  -sectalign @gol
419 -sectobjectsymbols  -whyload  -seg1addr @gol
420 -sectcreate  -sectobjectsymbols  -sectorder @gol
421 -seg_addr_table  -seg_addr_table_filename  -seglinkedit @gol
422 -segprot  -segs_read_only_addr  -segs_read_write_addr @gol
423 -single_module  -static  -sub_library  -sub_umbrella @gol
424 -twolevel_namespace  -umbrella  -undefined @gol
425 -unexported_symbols_list  -weak_reference_mismatches @gol
426 -whatsloaded -F -gused -gfull}
427
428 @emph{DEC Alpha Options}
429 @gccoptlist{-mno-fp-regs  -msoft-float  -malpha-as  -mgas @gol
430 -mieee  -mieee-with-inexact  -mieee-conformant @gol
431 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
432 -mtrap-precision=@var{mode}  -mbuild-constants @gol
433 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
434 -mbwx  -mmax  -mfix  -mcix @gol
435 -mfloat-vax  -mfloat-ieee @gol
436 -mexplicit-relocs  -msmall-data  -mlarge-data @gol
437 -msmall-text  -mlarge-text @gol
438 -mmemory-latency=@var{time}}
439
440 @emph{DEC Alpha/VMS Options}
441 @gccoptlist{-mvms-return-codes}
442
443 @emph{FRV Options}
444 @gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
445 -mhard-float  -msoft-float @gol
446 -malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
447 -mdouble  -mno-double @gol
448 -mmedia  -mno-media  -mmuladd  -mno-muladd @gol
449 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic -mlinked-fp @gol
450 -mlibrary-pic  -macc-4 -macc-8 @gol
451 -mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
452 -mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
453 -mvliw-branch  -mno-vliw-branch @gol
454 -mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
455 -mno-nested-cond-exec  -mtomcat-stats @gol
456 -mcpu=@var{cpu}}
457
458 @emph{H8/300 Options}
459 @gccoptlist{-mrelax  -mh  -ms  -mn  -mint32  -malign-300}
460
461 @emph{HPPA Options}
462 @gccoptlist{-march=@var{architecture-type} @gol
463 -mbig-switch  -mdisable-fpregs  -mdisable-indexing @gol
464 -mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
465 -mfixed-range=@var{register-range} @gol
466 -mjump-in-delay -mlinker-opt -mlong-calls @gol
467 -mlong-load-store  -mno-big-switch  -mno-disable-fpregs @gol
468 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
469 -mno-jump-in-delay  -mno-long-load-store @gol
470 -mno-portable-runtime  -mno-soft-float @gol
471 -mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
472 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
473 -mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
474 -nolibdld  -static  -threads}
475
476 @emph{i386 and x86-64 Options}
477 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
478 -mfpmath=@var{unit} @gol
479 -masm=@var{dialect}  -mno-fancy-math-387 @gol
480 -mno-fp-ret-in-387  -msoft-float  -msvr3-shlib @gol
481 -mno-wide-multiply  -mrtd  -malign-double @gol
482 -mpreferred-stack-boundary=@var{num} @gol
483 -mmmx  -msse  -msse2 -msse3 -m3dnow @gol
484 -mthreads  -mno-align-stringops  -minline-all-stringops @gol
485 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
486 -m96bit-long-double  -mregparm=@var{num}  -momit-leaf-frame-pointer @gol
487 -mno-red-zone -mno-tls-direct-seg-refs @gol
488 -mcmodel=@var{code-model} @gol
489 -m32  -m64}
490
491 @emph{IA-64 Options}
492 @gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
493 -mvolatile-asm-stop  -mb-step  -mregister-names  -mno-sdata @gol
494 -mconstant-gp  -mauto-pic  -minline-float-divide-min-latency @gol
495 -minline-float-divide-max-throughput @gol
496 -minline-int-divide-min-latency @gol
497 -minline-int-divide-max-throughput  -mno-dwarf2-asm @gol
498 -mfixed-range=@var{register-range}}
499
500 @emph{M32R/D Options}
501 @gccoptlist{-m32r2 -m32rx -m32r @gol
502 -mdebug @gol
503 -malign-loops -mno-align-loops @gol
504 -missue-rate=@var{number} @gol
505 -mbranch-cost=@var{number} @gol
506 -mmodel=@var{code-size-model-type} @gol
507 -msdata=@var{sdata-type} @gol
508 -mno-flush-func -mflush-func=@var{name} @gol
509 -mno-flush-trap -mflush-trap=@var{number} @gol
510 -G @var{num}}
511
512 @emph{M680x0 Options}
513 @gccoptlist{-m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
514 -m68060  -mcpu32  -m5200  -m68881  -mbitfield  -mc68000  -mc68020   @gol
515 -mnobitfield  -mrtd  -mshort  -msoft-float  -mpcrel @gol
516 -malign-int  -mstrict-align  -msep-data  -mno-sep-data @gol
517 -mshared-library-id=n  -mid-shared-library  -mno-id-shared-library}
518
519 @emph{M68hc1x Options}
520 @gccoptlist{-m6811  -m6812  -m68hc11  -m68hc12   -m68hcs12 @gol
521 -mauto-incdec  -minmax  -mlong-calls  -mshort @gol
522 -msoft-reg-count=@var{count}}
523
524 @emph{MCore Options}
525 @gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
526 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
527 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
528 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
529 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
530
531 @emph{MIPS Options}
532 @gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
533 -mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips64 @gol
534 -mips16  -mno-mips16  -mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
535 -mxgot  -mno-xgot  -mgp32  -mgp64  -mfp32  -mfp64 @gol
536 -mhard-float  -msoft-float  -msingle-float  -mdouble-float @gol
537 -mint64  -mlong64  -mlong32 @gol
538 -G@var{num}  -membedded-data  -mno-embedded-data @gol
539 -muninit-const-in-rodata  -mno-uninit-const-in-rodata @gol
540 -msplit-addresses  -mno-split-addresses  @gol
541 -mexplicit-relocs  -mno-explicit-relocs  @gol
542 -mcheck-zero-division  -mno-check-zero-division @gol
543 -mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls @gol
544 -mmad  -mno-mad  -mfused-madd  -mno-fused-madd  -nocpp @gol
545 -mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400 @gol
546 -mfix-vr4120  -mno-fix-vr4120  -mfix-sb1  -mno-fix-sb1 @gol
547 -mflush-func=@var{func}  -mno-flush-func @gol
548 -mbranch-likely  -mno-branch-likely @gol
549 -mfp-exceptions -mno-fp-exceptions @gol
550 -mvr4130-align -mno-vr4130-align}
551
552 @emph{MMIX Options}
553 @gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
554 -mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
555 -melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
556 -mno-base-addresses  -msingle-exit  -mno-single-exit}
557
558 @emph{MN10300 Options}
559 @gccoptlist{-mmult-bug  -mno-mult-bug @gol
560 -mam33  -mno-am33 @gol
561 -mam33-2  -mno-am33-2 @gol
562 -mno-crt0  -mrelax}
563
564 @emph{NS32K Options}
565 @gccoptlist{-m32032  -m32332  -m32532  -m32081  -m32381 @gol
566 -mmult-add  -mnomult-add  -msoft-float  -mrtd  -mnortd @gol
567 -mregparam  -mnoregparam  -msb  -mnosb @gol
568 -mbitfield  -mnobitfield  -mhimem  -mnohimem}
569
570 @emph{PDP-11 Options}
571 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
572 -mbcopy  -mbcopy-builtin  -mint32  -mno-int16 @gol
573 -mint16  -mno-int32  -mfloat32  -mno-float64 @gol
574 -mfloat64  -mno-float32  -mabshi  -mno-abshi @gol
575 -mbranch-expensive  -mbranch-cheap @gol
576 -msplit  -mno-split  -munix-asm  -mdec-asm}
577
578 @emph{PowerPC Options}
579 See RS/6000 and PowerPC Options.
580
581 @emph{RS/6000 and PowerPC Options}
582 @gccoptlist{-mcpu=@var{cpu-type} @gol
583 -mtune=@var{cpu-type} @gol
584 -mpower  -mno-power  -mpower2  -mno-power2 @gol
585 -mpowerpc  -mpowerpc64  -mno-powerpc @gol
586 -maltivec  -mno-altivec @gol
587 -mpowerpc-gpopt  -mno-powerpc-gpopt @gol
588 -mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
589 -mnew-mnemonics  -mold-mnemonics @gol
590 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
591 -m64  -m32  -mxl-call  -mno-xl-call  -mpe @gol
592 -malign-power  -malign-natural @gol
593 -msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
594 -mstring  -mno-string  -mupdate  -mno-update @gol
595 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
596 -mstrict-align  -mno-strict-align  -mrelocatable @gol
597 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
598 -mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
599 -mdynamic-no-pic @gol
600 -mprioritize-restricted-insns=@var{priority} @gol
601 -msched-costly-dep=@var{dependence_type} @gol
602 -minsert-sched-nops=@var{scheme} @gol
603 -mcall-sysv  -mcall-netbsd @gol
604 -maix-struct-return  -msvr4-struct-return @gol
605 -mabi=altivec  -mabi=no-altivec @gol
606 -mabi=spe  -mabi=no-spe @gol
607 -misel=yes  -misel=no @gol
608 -mspe=yes  -mspe=no @gol
609 -mfloat-gprs=yes  -mfloat-gprs=no @gol
610 -mprototype  -mno-prototype @gol
611 -msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
612 -msdata=@var{opt}  -mvxworks  -mwindiss  -G @var{num}  -pthread}
613
614 @emph{S/390 and zSeries Options}
615 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
616 -mhard-float  -msoft-float  -mbackchain  -mno-backchain @gol
617 -msmall-exec  -mno-small-exec  -mmvcle -mno-mvcle @gol
618 -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch @gol
619 -mtpf-trace -mno-tpf-trace  -mfused-madd  -mno-fused-madd}
620
621 @emph{SH Options}
622 @gccoptlist{-m1  -m2  -m2e  -m3  -m3e @gol
623 -m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
624 -m5-64media  -m5-64media-nofpu @gol
625 -m5-32media  -m5-32media-nofpu @gol
626 -m5-compact  -m5-compact-nofpu @gol
627 -mb  -ml  -mdalign  -mrelax @gol
628 -mbigtable  -mfmovd  -mhitachi  -mnomacsave @gol
629 -mieee  -misize  -mpadstruct  -mspace @gol
630 -mprefergot  -musermode}
631
632 @emph{SPARC Options}
633 @gccoptlist{-mcpu=@var{cpu-type} @gol
634 -mtune=@var{cpu-type} @gol
635 -mcmodel=@var{code-model} @gol
636 -m32  -m64  -mapp-regs  -mno-app-regs @gol
637 -mfaster-structs  -mno-faster-structs @gol
638 -mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
639 -mhard-quad-float  -msoft-quad-float @gol
640 -mimpure-text  -mno-impure-text  -mlittle-endian @gol
641 -mstack-bias  -mno-stack-bias @gol
642 -munaligned-doubles  -mno-unaligned-doubles @gol
643 -mv8plus  -mno-v8plus  -mvis  -mno-vis
644 -threads -pthreads}
645
646 @emph{System V Options}
647 @gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
648
649 @emph{TMS320C3x/C4x Options}
650 @gccoptlist{-mcpu=@var{cpu}  -mbig  -msmall  -mregparm  -mmemparm @gol
651 -mfast-fix  -mmpyi  -mbk  -mti  -mdp-isr-reload @gol
652 -mrpts=@var{count}  -mrptb  -mdb  -mloop-unsigned @gol
653 -mparallel-insns  -mparallel-mpy  -mpreserve-float}
654
655 @emph{V850 Options}
656 @gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
657 -mprolog-function  -mno-prolog-function  -mspace @gol
658 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
659 -mapp-regs  -mno-app-regs @gol
660 -mdisable-callt  -mno-disable-callt @gol
661 -mv850e1 @gol
662 -mv850e @gol
663 -mv850  -mbig-switch}
664
665 @emph{VAX Options}
666 @gccoptlist{-mg  -mgnu  -munix}
667
668 @emph{x86-64 Options}
669 See i386 and x86-64 Options.
670
671 @emph{Xstormy16 Options}
672 @gccoptlist{-msim}
673
674 @emph{Xtensa Options}
675 @gccoptlist{-mconst16 -mno-const16 @gol
676 -mfused-madd  -mno-fused-madd @gol
677 -mtext-section-literals  -mno-text-section-literals @gol
678 -mtarget-align  -mno-target-align @gol
679 -mlongcalls  -mno-longcalls}
680
681 @emph{zSeries Options}
682 See S/390 and zSeries Options.
683
684 @item Code Generation Options
685 @xref{Code Gen Options,,Options for Code Generation Conventions}.
686 @gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
687 -ffixed-@var{reg}  -fexceptions @gol
688 -fnon-call-exceptions  -funwind-tables @gol
689 -fasynchronous-unwind-tables @gol
690 -finhibit-size-directive  -finstrument-functions @gol
691 -fno-common  -fno-ident @gol
692 -fpcc-struct-return  -fpic  -fPIC -fpie -fPIE @gol
693 -freg-struct-return  -fshared-data  -fshort-enums @gol
694 -fshort-double  -fshort-wchar @gol
695 -fverbose-asm  -fpack-struct  -fstack-check @gol
696 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
697 -fargument-alias  -fargument-noalias @gol
698 -fargument-noalias-global  -fleading-underscore @gol
699 -ftls-model=@var{model} @gol
700 -ftrapv  -fwrapv  -fbounds-check @gol
701 -fvisibility}
702 @end table
703
704 @menu
705 * Overall Options::     Controlling the kind of output:
706                         an executable, object files, assembler files,
707                         or preprocessed source.
708 * C Dialect Options::   Controlling the variant of C language compiled.
709 * C++ Dialect Options:: Variations on C++.
710 * Objective-C Dialect Options:: Variations on Objective-C.
711 * Language Independent Options:: Controlling how diagnostics should be
712                         formatted.
713 * Warning Options::     How picky should the compiler be?
714 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
715 * Optimize Options::    How much optimization?
716 * Preprocessor Options:: Controlling header files and macro definitions.
717                          Also, getting dependency information for Make.
718 * Assembler Options::   Passing options to the assembler.
719 * Link Options::        Specifying libraries and so on.
720 * Directory Options::   Where to find header files and libraries.
721                         Where to find the compiler executable files.
722 * Spec Files::          How to pass switches to sub-processes.
723 * Target Options::      Running a cross-compiler, or an old version of GCC.
724 @end menu
725
726 @node Overall Options
727 @section Options Controlling the Kind of Output
728
729 Compilation can involve up to four stages: preprocessing, compilation
730 proper, assembly and linking, always in that order.  GCC is capable of
731 preprocessing and compiling several files either into several
732 assembler input files, or into one assembler input file; then each
733 assembler input file produces an object file, and linking combines all
734 the object files (those newly compiled, and those specified as input)
735 into an executable file.
736
737 @cindex file name suffix
738 For any given input file, the file name suffix determines what kind of
739 compilation is done:
740
741 @table @gcctabopt
742 @item @var{file}.c
743 C source code which must be preprocessed.
744
745 @item @var{file}.i
746 C source code which should not be preprocessed.
747
748 @item @var{file}.ii
749 C++ source code which should not be preprocessed.
750
751 @item @var{file}.m
752 Objective-C source code.  Note that you must link with the library
753 @file{libobjc.a} to make an Objective-C program work.
754
755 @item @var{file}.mi
756 Objective-C source code which should not be preprocessed.
757
758 @item @var{file}.h
759 C or C++ header file to be turned into a precompiled header.
760
761 @item @var{file}.cc
762 @itemx @var{file}.cp
763 @itemx @var{file}.cxx
764 @itemx @var{file}.cpp
765 @itemx @var{file}.CPP
766 @itemx @var{file}.c++
767 @itemx @var{file}.C
768 C++ source code which must be preprocessed.  Note that in @samp{.cxx},
769 the last two letters must both be literally @samp{x}.  Likewise,
770 @samp{.C} refers to a literal capital C@.
771
772 @item @var{file}.hh
773 @itemx @var{file}.H
774 C++ header file to be turned into a precompiled header.
775
776 @item @var{file}.f
777 @itemx @var{file}.for
778 @itemx @var{file}.FOR
779 Fortran source code which should not be preprocessed.
780
781 @item @var{file}.F
782 @itemx @var{file}.fpp
783 @itemx @var{file}.FPP
784 Fortran source code which must be preprocessed (with the traditional
785 preprocessor).
786
787 @item @var{file}.r
788 Fortran source code which must be preprocessed with a RATFOR
789 preprocessor (not included with GCC)@.
790
791 @item @var{file}.f90
792 @itemx @var{file}.f95
793 Fortran 90/95 source code which should not be preprocessed.
794
795 @c FIXME: Descriptions of Java file types.
796 @c @var{file}.java
797 @c @var{file}.class
798 @c @var{file}.zip
799 @c @var{file}.jar
800
801 @item @var{file}.ads
802 Ada source code file which contains a library unit declaration (a
803 declaration of a package, subprogram, or generic, or a generic
804 instantiation), or a library unit renaming declaration (a package,
805 generic, or subprogram renaming declaration).  Such files are also
806 called @dfn{specs}.
807
808 @itemx @var{file}.adb
809 Ada source code file containing a library unit body (a subprogram or
810 package body).  Such files are also called @dfn{bodies}.
811
812 @c GCC also knows about some suffixes for languages not yet included:
813 @c Pascal:
814 @c @var{file}.p
815 @c @var{file}.pas
816
817 @item @var{file}.s
818 Assembler code.
819
820 @item @var{file}.S
821 Assembler code which must be preprocessed.
822
823 @item @var{other}
824 An object file to be fed straight into linking.
825 Any file name with no recognized suffix is treated this way.
826 @end table
827
828 @opindex x
829 You can specify the input language explicitly with the @option{-x} option:
830
831 @table @gcctabopt
832 @item -x @var{language}
833 Specify explicitly the @var{language} for the following input files
834 (rather than letting the compiler choose a default based on the file
835 name suffix).  This option applies to all following input files until
836 the next @option{-x} option.  Possible values for @var{language} are:
837 @smallexample
838 c  c-header  cpp-output
839 c++  c++-header  c++-cpp-output
840 objective-c  objective-c-header  objc-cpp-output
841 assembler  assembler-with-cpp
842 ada
843 f77  f77-cpp-input  ratfor
844 f95
845 java
846 treelang
847 @end smallexample
848
849 @item -x none
850 Turn off any specification of a language, so that subsequent files are
851 handled according to their file name suffixes (as they are if @option{-x}
852 has not been used at all).
853
854 @item -pass-exit-codes
855 @opindex pass-exit-codes
856 Normally the @command{gcc} program will exit with the code of 1 if any
857 phase of the compiler returns a non-success return code.  If you specify
858 @option{-pass-exit-codes}, the @command{gcc} program will instead return with
859 numerically highest error produced by any phase that returned an error
860 indication.
861 @end table
862
863 If you only want some of the stages of compilation, you can use
864 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
865 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
866 @command{gcc} is to stop.  Note that some combinations (for example,
867 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
868
869 @table @gcctabopt
870 @item -c
871 @opindex c
872 Compile or assemble the source files, but do not link.  The linking
873 stage simply is not done.  The ultimate output is in the form of an
874 object file for each source file.
875
876 By default, the object file name for a source file is made by replacing
877 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
878
879 Unrecognized input files, not requiring compilation or assembly, are
880 ignored.
881
882 @item -S
883 @opindex S
884 Stop after the stage of compilation proper; do not assemble.  The output
885 is in the form of an assembler code file for each non-assembler input
886 file specified.
887
888 By default, the assembler file name for a source file is made by
889 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
890
891 Input files that don't require compilation are ignored.
892
893 @item -E
894 @opindex E
895 Stop after the preprocessing stage; do not run the compiler proper.  The
896 output is in the form of preprocessed source code, which is sent to the
897 standard output.
898
899 Input files which don't require preprocessing are ignored.
900
901 @cindex output file option
902 @item -o @var{file}
903 @opindex o
904 Place output in file @var{file}.  This applies regardless to whatever
905 sort of output is being produced, whether it be an executable file,
906 an object file, an assembler file or preprocessed C code.
907
908 If @option{-o} is not specified, the default is to put an executable
909 file in @file{a.out}, the object file for
910 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
911 assembler file in @file{@var{source}.s}, a precompiled header file in
912 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
913 standard output.
914
915 @item -v
916 @opindex v
917 Print (on standard error output) the commands executed to run the stages
918 of compilation.  Also print the version number of the compiler driver
919 program and of the preprocessor and the compiler proper.
920
921 @item -###
922 @opindex ###
923 Like @option{-v} except the commands are not executed and all command
924 arguments are quoted.  This is useful for shell scripts to capture the
925 driver-generated command lines.
926
927 @item -pipe
928 @opindex pipe
929 Use pipes rather than temporary files for communication between the
930 various stages of compilation.  This fails to work on some systems where
931 the assembler is unable to read from a pipe; but the GNU assembler has
932 no trouble.
933
934 @item -combine
935 @opindex combine
936 If you are compiling multiple source files, this option tells the driver
937 to pass all the source files to the compiler at once (for those
938 languages for which the compiler can handle this).  This will allow
939 intermodule analysis (IMA) to be performed by the compiler.  Currently the only
940 language for which this is supported is C.  If you pass source files for
941 multiple languages to the driver, using this option, the driver will invoke
942 the compiler(s) that support IMA once each, passing each compiler all the
943 source files appropriate for it.  For those languages that do not support
944 IMA this option will be ignored, and the compiler will be invoked once for
945 each source file in that language.  If you use this option in conjunction
946 with -save-temps, the compiler will generate multiple pre-processed files
947 (one for each source file), but only one (combined) .o or .s file.
948
949 @item --help
950 @opindex help
951 Print (on the standard output) a description of the command line options
952 understood by @command{gcc}.  If the @option{-v} option is also specified
953 then @option{--help} will also be passed on to the various processes
954 invoked by @command{gcc}, so that they can display the command line options
955 they accept.  If the @option{-Wextra} option is also specified then command
956 line options which have no documentation associated with them will also
957 be displayed.
958
959 @item --target-help
960 @opindex target-help
961 Print (on the standard output) a description of target specific command
962 line options for each tool.
963
964 @item --version
965 @opindex version
966 Display the version number and copyrights of the invoked GCC.
967 @end table
968
969 @node Invoking G++
970 @section Compiling C++ Programs
971
972 @cindex suffixes for C++ source
973 @cindex C++ source file suffixes
974 C++ source files conventionally use one of the suffixes @samp{.C},
975 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
976 @samp{.cxx}; C++ header files often use @samp{.hh} or @samp{.H}; and
977 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
978 files with these names and compiles them as C++ programs even if you
979 call the compiler the same way as for compiling C programs (usually
980 with the name @command{gcc}).
981
982 @findex g++
983 @findex c++
984 However, C++ programs often require class libraries as well as a
985 compiler that understands the C++ language---and under some
986 circumstances, you might want to compile programs or header files from
987 standard input, or otherwise without a suffix that flags them as C++
988 programs.  You might also like to precompile a C header file with a
989 @samp{.h} extension to be used in C++ compilations.  @command{g++} is a
990 program that calls GCC with the default language set to C++, and
991 automatically specifies linking against the C++ library.  On many
992 systems, @command{g++} is also installed with the name @command{c++}.
993
994 @cindex invoking @command{g++}
995 When you compile C++ programs, you may specify many of the same
996 command-line options that you use for compiling programs in any
997 language; or command-line options meaningful for C and related
998 languages; or options that are meaningful only for C++ programs.
999 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1000 explanations of options for languages related to C@.
1001 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1002 explanations of options that are meaningful only for C++ programs.
1003
1004 @node C Dialect Options
1005 @section Options Controlling C Dialect
1006 @cindex dialect options
1007 @cindex language dialect options
1008 @cindex options, dialect
1009
1010 The following options control the dialect of C (or languages derived
1011 from C, such as C++ and Objective-C) that the compiler accepts:
1012
1013 @table @gcctabopt
1014 @cindex ANSI support
1015 @cindex ISO support
1016 @item -ansi
1017 @opindex ansi
1018 In C mode, support all ISO C90 programs.  In C++ mode,
1019 remove GNU extensions that conflict with ISO C++.
1020
1021 This turns off certain features of GCC that are incompatible with ISO
1022 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1023 such as the @code{asm} and @code{typeof} keywords, and
1024 predefined macros such as @code{unix} and @code{vax} that identify the
1025 type of system you are using.  It also enables the undesirable and
1026 rarely used ISO trigraph feature.  For the C compiler,
1027 it disables recognition of C++ style @samp{//} comments as well as
1028 the @code{inline} keyword.
1029
1030 The alternate keywords @code{__asm__}, @code{__extension__},
1031 @code{__inline__} and @code{__typeof__} continue to work despite
1032 @option{-ansi}.  You would not want to use them in an ISO C program, of
1033 course, but it is useful to put them in header files that might be included
1034 in compilations done with @option{-ansi}.  Alternate predefined macros
1035 such as @code{__unix__} and @code{__vax__} are also available, with or
1036 without @option{-ansi}.
1037
1038 The @option{-ansi} option does not cause non-ISO programs to be
1039 rejected gratuitously.  For that, @option{-pedantic} is required in
1040 addition to @option{-ansi}.  @xref{Warning Options}.
1041
1042 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1043 option is used.  Some header files may notice this macro and refrain
1044 from declaring certain functions or defining certain macros that the
1045 ISO standard doesn't call for; this is to avoid interfering with any
1046 programs that might use these names for other things.
1047
1048 Functions which would normally be built in but do not have semantics
1049 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1050 functions with @option{-ansi} is used.  @xref{Other Builtins,,Other
1051 built-in functions provided by GCC}, for details of the functions
1052 affected.
1053
1054 @item -std=
1055 @opindex std
1056 Determine the language standard.  This option is currently only
1057 supported when compiling C or C++.  A value for this option must be
1058 provided; possible values are
1059
1060 @table @samp
1061 @item c89
1062 @itemx iso9899:1990
1063 ISO C90 (same as @option{-ansi}).
1064
1065 @item iso9899:199409
1066 ISO C90 as modified in amendment 1.
1067
1068 @item c99
1069 @itemx c9x
1070 @itemx iso9899:1999
1071 @itemx iso9899:199x
1072 ISO C99.  Note that this standard is not yet fully supported; see
1073 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information.  The
1074 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1075
1076 @item gnu89
1077 Default, ISO C90 plus GNU extensions (including some C99 features).
1078
1079 @item gnu99
1080 @itemx gnu9x
1081 ISO C99 plus GNU extensions.  When ISO C99 is fully implemented in GCC,
1082 this will become the default.  The name @samp{gnu9x} is deprecated.
1083
1084 @item c++98
1085 The 1998 ISO C++ standard plus amendments.
1086
1087 @item gnu++98
1088 The same as @option{-std=c++98} plus GNU extensions.  This is the
1089 default for C++ code.
1090 @end table
1091
1092 Even when this option is not specified, you can still use some of the
1093 features of newer standards in so far as they do not conflict with
1094 previous C standards.  For example, you may use @code{__restrict__} even
1095 when @option{-std=c99} is not specified.
1096
1097 The @option{-std} options specifying some version of ISO C have the same
1098 effects as @option{-ansi}, except that features that were not in ISO C90
1099 but are in the specified version (for example, @samp{//} comments and
1100 the @code{inline} keyword in ISO C99) are not disabled.
1101
1102 @xref{Standards,,Language Standards Supported by GCC}, for details of
1103 these standard versions.
1104
1105 @item -aux-info @var{filename}
1106 @opindex aux-info
1107 Output to the given filename prototyped declarations for all functions
1108 declared and/or defined in a translation unit, including those in header
1109 files.  This option is silently ignored in any language other than C@.
1110
1111 Besides declarations, the file indicates, in comments, the origin of
1112 each declaration (source file and line), whether the declaration was
1113 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1114 @samp{O} for old, respectively, in the first character after the line
1115 number and the colon), and whether it came from a declaration or a
1116 definition (@samp{C} or @samp{F}, respectively, in the following
1117 character).  In the case of function definitions, a K&R-style list of
1118 arguments followed by their declarations is also provided, inside
1119 comments, after the declaration.
1120
1121 @item -fno-asm
1122 @opindex fno-asm
1123 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1124 keyword, so that code can use these words as identifiers.  You can use
1125 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1126 instead.  @option{-ansi} implies @option{-fno-asm}.
1127
1128 In C++, this switch only affects the @code{typeof} keyword, since
1129 @code{asm} and @code{inline} are standard keywords.  You may want to
1130 use the @option{-fno-gnu-keywords} flag instead, which has the same
1131 effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1132 switch only affects the @code{asm} and @code{typeof} keywords, since
1133 @code{inline} is a standard keyword in ISO C99.
1134
1135 @item -fno-builtin
1136 @itemx -fno-builtin-@var{function}
1137 @opindex fno-builtin
1138 @cindex built-in functions
1139 Don't recognize built-in functions that do not begin with
1140 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
1141 functions provided by GCC}, for details of the functions affected,
1142 including those which are not built-in functions when @option{-ansi} or
1143 @option{-std} options for strict ISO C conformance are used because they
1144 do not have an ISO standard meaning.
1145
1146 GCC normally generates special code to handle certain built-in functions
1147 more efficiently; for instance, calls to @code{alloca} may become single
1148 instructions that adjust the stack directly, and calls to @code{memcpy}
1149 may become inline copy loops.  The resulting code is often both smaller
1150 and faster, but since the function calls no longer appear as such, you
1151 cannot set a breakpoint on those calls, nor can you change the behavior
1152 of the functions by linking with a different library.
1153
1154 With the @option{-fno-builtin-@var{function}} option
1155 only the built-in function @var{function} is
1156 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
1157 function is named this is not built-in in this version of GCC, this
1158 option is ignored.  There is no corresponding
1159 @option{-fbuiltin-@var{function}} option; if you wish to enable
1160 built-in functions selectively when using @option{-fno-builtin} or
1161 @option{-ffreestanding}, you may define macros such as:
1162
1163 @smallexample
1164 #define abs(n)          __builtin_abs ((n))
1165 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
1166 @end smallexample
1167
1168 @item -fhosted
1169 @opindex fhosted
1170 @cindex hosted environment
1171
1172 Assert that compilation takes place in a hosted environment.  This implies
1173 @option{-fbuiltin}.  A hosted environment is one in which the
1174 entire standard library is available, and in which @code{main} has a return
1175 type of @code{int}.  Examples are nearly everything except a kernel.
1176 This is equivalent to @option{-fno-freestanding}.
1177
1178 @item -ffreestanding
1179 @opindex ffreestanding
1180 @cindex hosted environment
1181
1182 Assert that compilation takes place in a freestanding environment.  This
1183 implies @option{-fno-builtin}.  A freestanding environment
1184 is one in which the standard library may not exist, and program startup may
1185 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
1186 This is equivalent to @option{-fno-hosted}.
1187
1188 @xref{Standards,,Language Standards Supported by GCC}, for details of
1189 freestanding and hosted environments.
1190
1191 @item -fms-extensions
1192 @opindex fms-extensions
1193 Accept some non-standard constructs used in Microsoft header files.
1194
1195 @item -trigraphs
1196 @opindex trigraphs
1197 Support ISO C trigraphs.  The @option{-ansi} option (and @option{-std}
1198 options for strict ISO C conformance) implies @option{-trigraphs}.
1199
1200 @item -no-integrated-cpp
1201 @opindex no-integrated-cpp
1202 Performs a compilation in two passes: preprocessing and compiling.  This
1203 option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1204 @option{-B} option. The user supplied compilation step can then add in
1205 an additional preprocessing step after normal preprocessing but before
1206 compiling. The default is to use the integrated cpp (internal cpp)
1207
1208 The semantics of this option will change if "cc1", "cc1plus", and
1209 "cc1obj" are merged.
1210
1211 @cindex traditional C language
1212 @cindex C language, traditional
1213 @item -traditional
1214 @itemx -traditional-cpp
1215 @opindex traditional-cpp
1216 @opindex traditional
1217 Formerly, these options caused GCC to attempt to emulate a pre-standard
1218 C compiler.  They are now only supported with the @option{-E} switch.
1219 The preprocessor continues to support a pre-standard mode.  See the GNU
1220 CPP manual for details.
1221
1222 @item -fcond-mismatch
1223 @opindex fcond-mismatch
1224 Allow conditional expressions with mismatched types in the second and
1225 third arguments.  The value of such an expression is void.  This option
1226 is not supported for C++.
1227
1228 @item -funsigned-char
1229 @opindex funsigned-char
1230 Let the type @code{char} be unsigned, like @code{unsigned char}.
1231
1232 Each kind of machine has a default for what @code{char} should
1233 be.  It is either like @code{unsigned char} by default or like
1234 @code{signed char} by default.
1235
1236 Ideally, a portable program should always use @code{signed char} or
1237 @code{unsigned char} when it depends on the signedness of an object.
1238 But many programs have been written to use plain @code{char} and
1239 expect it to be signed, or expect it to be unsigned, depending on the
1240 machines they were written for.  This option, and its inverse, let you
1241 make such a program work with the opposite default.
1242
1243 The type @code{char} is always a distinct type from each of
1244 @code{signed char} or @code{unsigned char}, even though its behavior
1245 is always just like one of those two.
1246
1247 @item -fsigned-char
1248 @opindex fsigned-char
1249 Let the type @code{char} be signed, like @code{signed char}.
1250
1251 Note that this is equivalent to @option{-fno-unsigned-char}, which is
1252 the negative form of @option{-funsigned-char}.  Likewise, the option
1253 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1254
1255 @item -fsigned-bitfields
1256 @itemx -funsigned-bitfields
1257 @itemx -fno-signed-bitfields
1258 @itemx -fno-unsigned-bitfields
1259 @opindex fsigned-bitfields
1260 @opindex funsigned-bitfields
1261 @opindex fno-signed-bitfields
1262 @opindex fno-unsigned-bitfields
1263 These options control whether a bit-field is signed or unsigned, when the
1264 declaration does not use either @code{signed} or @code{unsigned}.  By
1265 default, such a bit-field is signed, because this is consistent: the
1266 basic integer types such as @code{int} are signed types.
1267 @end table
1268
1269 @node C++ Dialect Options
1270 @section Options Controlling C++ Dialect
1271
1272 @cindex compiler options, C++
1273 @cindex C++ options, command line
1274 @cindex options, C++
1275 This section describes the command-line options that are only meaningful
1276 for C++ programs; but you can also use most of the GNU compiler options
1277 regardless of what language your program is in.  For example, you
1278 might compile a file @code{firstClass.C} like this:
1279
1280 @smallexample
1281 g++ -g -frepo -O -c firstClass.C
1282 @end smallexample
1283
1284 @noindent
1285 In this example, only @option{-frepo} is an option meant
1286 only for C++ programs; you can use the other options with any
1287 language supported by GCC@.
1288
1289 Here is a list of options that are @emph{only} for compiling C++ programs:
1290
1291 @table @gcctabopt
1292
1293 @item -fabi-version=@var{n}
1294 @opindex fabi-version
1295 Use version @var{n} of the C++ ABI.  Version 2 is the version of the
1296 C++ ABI that first appeared in G++ 3.4.  Version 1 is the version of
1297 the C++ ABI that first appeared in G++ 3.2.  Version 0 will always be
1298 the version that conforms most closely to the C++ ABI specification.
1299 Therefore, the ABI obtained using version 0 will change as ABI bugs
1300 are fixed.
1301
1302 The default is version 2.
1303
1304 @item -fno-access-control
1305 @opindex fno-access-control
1306 Turn off all access checking.  This switch is mainly useful for working
1307 around bugs in the access control code.
1308
1309 @item -fcheck-new
1310 @opindex fcheck-new
1311 Check that the pointer returned by @code{operator new} is non-null
1312 before attempting to modify the storage allocated.  This check is
1313 normally unnecessary because the C++ standard specifies that
1314 @code{operator new} will only return @code{0} if it is declared
1315 @samp{throw()}, in which case the compiler will always check the
1316 return value even without this option.  In all other cases, when
1317 @code{operator new} has a non-empty exception specification, memory
1318 exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
1319 @samp{new (nothrow)}.
1320
1321 @item -fconserve-space
1322 @opindex fconserve-space
1323 Put uninitialized or runtime-initialized global variables into the
1324 common segment, as C does.  This saves space in the executable at the
1325 cost of not diagnosing duplicate definitions.  If you compile with this
1326 flag and your program mysteriously crashes after @code{main()} has
1327 completed, you may have an object that is being destroyed twice because
1328 two definitions were merged.
1329
1330 This option is no longer useful on most targets, now that support has
1331 been added for putting variables into BSS without making them common.
1332
1333 @item -fno-const-strings
1334 @opindex fno-const-strings
1335 Give string constants type @code{char *} instead of type @code{const
1336 char *}.  By default, G++ uses type @code{const char *} as required by
1337 the standard.  Even if you use @option{-fno-const-strings}, you cannot
1338 actually modify the value of a string constant.
1339
1340 This option might be removed in a future release of G++.  For maximum
1341 portability, you should structure your code so that it works with
1342 string constants that have type @code{const char *}.
1343
1344 @item -fno-elide-constructors
1345 @opindex fno-elide-constructors
1346 The C++ standard allows an implementation to omit creating a temporary
1347 which is only used to initialize another object of the same type.
1348 Specifying this option disables that optimization, and forces G++ to
1349 call the copy constructor in all cases.
1350
1351 @item -fno-enforce-eh-specs
1352 @opindex fno-enforce-eh-specs
1353 Don't check for violation of exception specifications at runtime.  This
1354 option violates the C++ standard, but may be useful for reducing code
1355 size in production builds, much like defining @samp{NDEBUG}.  The compiler
1356 will still optimize based on the exception specifications.
1357
1358 @item -ffor-scope
1359 @itemx -fno-for-scope
1360 @opindex ffor-scope
1361 @opindex fno-for-scope
1362 If @option{-ffor-scope} is specified, the scope of variables declared in
1363 a @i{for-init-statement} is limited to the @samp{for} loop itself,
1364 as specified by the C++ standard.
1365 If @option{-fno-for-scope} is specified, the scope of variables declared in
1366 a @i{for-init-statement} extends to the end of the enclosing scope,
1367 as was the case in old versions of G++, and other (traditional)
1368 implementations of C++.
1369
1370 The default if neither flag is given to follow the standard,
1371 but to allow and give a warning for old-style code that would
1372 otherwise be invalid, or have different behavior.
1373
1374 @item -fno-gnu-keywords
1375 @opindex fno-gnu-keywords
1376 Do not recognize @code{typeof} as a keyword, so that code can use this
1377 word as an identifier.  You can use the keyword @code{__typeof__} instead.
1378 @option{-ansi} implies @option{-fno-gnu-keywords}.
1379
1380 @item -fno-implicit-templates
1381 @opindex fno-implicit-templates
1382 Never emit code for non-inline templates which are instantiated
1383 implicitly (i.e.@: by use); only emit code for explicit instantiations.
1384 @xref{Template Instantiation}, for more information.
1385
1386 @item -fno-implicit-inline-templates
1387 @opindex fno-implicit-inline-templates
1388 Don't emit code for implicit instantiations of inline templates, either.
1389 The default is to handle inlines differently so that compiles with and
1390 without optimization will need the same set of explicit instantiations.
1391
1392 @item -fno-implement-inlines
1393 @opindex fno-implement-inlines
1394 To save space, do not emit out-of-line copies of inline functions
1395 controlled by @samp{#pragma implementation}.  This will cause linker
1396 errors if these functions are not inlined everywhere they are called.
1397
1398 @item -fms-extensions
1399 @opindex fms-extensions
1400 Disable pedantic warnings about constructs used in MFC, such as implicit
1401 int and getting a pointer to member function via non-standard syntax.
1402
1403 @item -fno-nonansi-builtins
1404 @opindex fno-nonansi-builtins
1405 Disable built-in declarations of functions that are not mandated by
1406 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
1407 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
1408
1409 @item -fno-operator-names
1410 @opindex fno-operator-names
1411 Do not treat the operator name keywords @code{and}, @code{bitand},
1412 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1413 synonyms as keywords.
1414
1415 @item -fno-optional-diags
1416 @opindex fno-optional-diags
1417 Disable diagnostics that the standard says a compiler does not need to
1418 issue.  Currently, the only such diagnostic issued by G++ is the one for
1419 a name having multiple meanings within a class.
1420
1421 @item -fpermissive
1422 @opindex fpermissive
1423 Downgrade some diagnostics about nonconformant code from errors to
1424 warnings.  Thus, using @option{-fpermissive} will allow some
1425 nonconforming code to compile.
1426
1427 @item -frepo
1428 @opindex frepo
1429 Enable automatic template instantiation at link time.  This option also
1430 implies @option{-fno-implicit-templates}.  @xref{Template
1431 Instantiation}, for more information.
1432
1433 @item -fno-rtti
1434 @opindex fno-rtti
1435 Disable generation of information about every class with virtual
1436 functions for use by the C++ runtime type identification features
1437 (@samp{dynamic_cast} and @samp{typeid}).  If you don't use those parts
1438 of the language, you can save some space by using this flag.  Note that
1439 exception handling uses the same information, but it will generate it as
1440 needed.
1441
1442 @item -fstats
1443 @opindex fstats
1444 Emit statistics about front-end processing at the end of the compilation.
1445 This information is generally only useful to the G++ development team.
1446
1447 @item -ftemplate-depth-@var{n}
1448 @opindex ftemplate-depth
1449 Set the maximum instantiation depth for template classes to @var{n}.
1450 A limit on the template instantiation depth is needed to detect
1451 endless recursions during template class instantiation.  ANSI/ISO C++
1452 conforming programs must not rely on a maximum depth greater than 17.
1453
1454 @item -fuse-cxa-atexit
1455 @opindex fuse-cxa-atexit
1456 Register destructors for objects with static storage duration with the
1457 @code{__cxa_atexit} function rather than the @code{atexit} function.
1458 This option is required for fully standards-compliant handling of static
1459 destructors, but will only work if your C library supports
1460 @code{__cxa_atexit}.
1461
1462 @item -fvisibility-inlines-hidden
1463 @opindex fvisibility-inlines-hidden
1464 Causes all inlined methods to be marked with
1465 @code{__attribute__ ((visibility ("hidden")))} so that they do not
1466 appear in the export table of a DSO and do not require a PLT indirection
1467 when used within the DSO. Enabling this option can have a dramatic effect
1468 on load and link times of a DSO as it massively reduces the size of the
1469 dynamic export table when the library makes heavy use of templates. While
1470 it can cause bloating through duplication of code within each DSO where
1471 it is used, often the wastage is less than the considerable space occupied
1472 by a long symbol name in the export table which is typical when using
1473 templates and namespaces. For even more savings, combine with the
1474 @code{-fvisibility=hidden} switch.
1475
1476 @item -fno-weak
1477 @opindex fno-weak
1478 Do not use weak symbol support, even if it is provided by the linker.
1479 By default, G++ will use weak symbols if they are available.  This
1480 option exists only for testing, and should not be used by end-users;
1481 it will result in inferior code and has no benefits.  This option may
1482 be removed in a future release of G++.
1483
1484 @item -nostdinc++
1485 @opindex nostdinc++
1486 Do not search for header files in the standard directories specific to
1487 C++, but do still search the other standard directories.  (This option
1488 is used when building the C++ library.)
1489 @end table
1490
1491 In addition, these optimization, warning, and code generation options
1492 have meanings only for C++ programs:
1493
1494 @table @gcctabopt
1495 @item -fno-default-inline
1496 @opindex fno-default-inline
1497 Do not assume @samp{inline} for functions defined inside a class scope.
1498 @xref{Optimize Options,,Options That Control Optimization}.  Note that these
1499 functions will have linkage like inline functions; they just won't be
1500 inlined by default.
1501
1502 @item -Wabi @r{(C++ only)}
1503 @opindex Wabi
1504 Warn when G++ generates code that is probably not compatible with the
1505 vendor-neutral C++ ABI.  Although an effort has been made to warn about
1506 all such cases, there are probably some cases that are not warned about,
1507 even though G++ is generating incompatible code.  There may also be
1508 cases where warnings are emitted even though the code that is generated
1509 will be compatible.
1510
1511 You should rewrite your code to avoid these warnings if you are
1512 concerned about the fact that code generated by G++ may not be binary
1513 compatible with code generated by other compilers.
1514
1515 The known incompatibilities at this point include:
1516
1517 @itemize @bullet
1518
1519 @item
1520 Incorrect handling of tail-padding for bit-fields.  G++ may attempt to
1521 pack data into the same byte as a base class.  For example:
1522
1523 @smallexample
1524 struct A @{ virtual void f(); int f1 : 1; @};
1525 struct B : public A @{ int f2 : 1; @};
1526 @end smallexample
1527
1528 @noindent
1529 In this case, G++ will place @code{B::f2} into the same byte
1530 as@code{A::f1}; other compilers will not.  You can avoid this problem
1531 by explicitly padding @code{A} so that its size is a multiple of the
1532 byte size on your platform; that will cause G++ and other compilers to
1533 layout @code{B} identically.
1534
1535 @item
1536 Incorrect handling of tail-padding for virtual bases.  G++ does not use
1537 tail padding when laying out virtual bases.  For example:
1538
1539 @smallexample
1540 struct A @{ virtual void f(); char c1; @};
1541 struct B @{ B(); char c2; @};
1542 struct C : public A, public virtual B @{@};
1543 @end smallexample
1544
1545 @noindent
1546 In this case, G++ will not place @code{B} into the tail-padding for
1547 @code{A}; other compilers will.  You can avoid this problem by
1548 explicitly padding @code{A} so that its size is a multiple of its
1549 alignment (ignoring virtual base classes); that will cause G++ and other
1550 compilers to layout @code{C} identically.
1551
1552 @item
1553 Incorrect handling of bit-fields with declared widths greater than that
1554 of their underlying types, when the bit-fields appear in a union.  For
1555 example:
1556
1557 @smallexample
1558 union U @{ int i : 4096; @};
1559 @end smallexample
1560
1561 @noindent
1562 Assuming that an @code{int} does not have 4096 bits, G++ will make the
1563 union too small by the number of bits in an @code{int}.
1564
1565 @item
1566 Empty classes can be placed at incorrect offsets.  For example:
1567
1568 @smallexample
1569 struct A @{@};
1570
1571 struct B @{
1572   A a;
1573   virtual void f ();
1574 @};
1575
1576 struct C : public B, public A @{@};
1577 @end smallexample
1578
1579 @noindent
1580 G++ will place the @code{A} base class of @code{C} at a nonzero offset;
1581 it should be placed at offset zero.  G++ mistakenly believes that the
1582 @code{A} data member of @code{B} is already at offset zero.
1583
1584 @item
1585 Names of template functions whose types involve @code{typename} or
1586 template template parameters can be mangled incorrectly.
1587
1588 @smallexample
1589 template <typename Q>
1590 void f(typename Q::X) @{@}
1591
1592 template <template <typename> class Q>
1593 void f(typename Q<int>::X) @{@}
1594 @end smallexample
1595
1596 @noindent
1597 Instantiations of these templates may be mangled incorrectly.
1598
1599 @end itemize
1600
1601 @item -Wctor-dtor-privacy @r{(C++ only)}
1602 @opindex Wctor-dtor-privacy
1603 Warn when a class seems unusable because all the constructors or
1604 destructors in that class are private, and it has neither friends nor
1605 public static member functions.
1606
1607 @item -Wnon-virtual-dtor @r{(C++ only)}
1608 @opindex Wnon-virtual-dtor
1609 Warn when a class appears to be polymorphic, thereby requiring a virtual
1610 destructor, yet it declares a non-virtual one.
1611 This warning is enabled by @option{-Wall}.
1612
1613 @item -Wreorder @r{(C++ only)}
1614 @opindex Wreorder
1615 @cindex reordering, warning
1616 @cindex warning for reordering of member initializers
1617 Warn when the order of member initializers given in the code does not
1618 match the order in which they must be executed.  For instance:
1619
1620 @smallexample
1621 struct A @{
1622   int i;
1623   int j;
1624   A(): j (0), i (1) @{ @}
1625 @};
1626 @end smallexample
1627
1628 The compiler will rearrange the member initializers for @samp{i}
1629 and @samp{j} to match the declaration order of the members, emitting
1630 a warning to that effect.  This warning is enabled by @option{-Wall}.
1631 @end table
1632
1633 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
1634
1635 @table @gcctabopt
1636 @item -Weffc++ @r{(C++ only)}
1637 @opindex Weffc++
1638 Warn about violations of the following style guidelines from Scott Meyers'
1639 @cite{Effective C++} book:
1640
1641 @itemize @bullet
1642 @item
1643 Item 11:  Define a copy constructor and an assignment operator for classes
1644 with dynamically allocated memory.
1645
1646 @item
1647 Item 12:  Prefer initialization to assignment in constructors.
1648
1649 @item
1650 Item 14:  Make destructors virtual in base classes.
1651
1652 @item
1653 Item 15:  Have @code{operator=} return a reference to @code{*this}.
1654
1655 @item
1656 Item 23:  Don't try to return a reference when you must return an object.
1657
1658 @end itemize
1659
1660 Also warn about violations of the following style guidelines from
1661 Scott Meyers' @cite{More Effective C++} book:
1662
1663 @itemize @bullet
1664 @item
1665 Item 6:  Distinguish between prefix and postfix forms of increment and
1666 decrement operators.
1667
1668 @item
1669 Item 7:  Never overload @code{&&}, @code{||}, or @code{,}.
1670
1671 @end itemize
1672
1673 When selecting this option, be aware that the standard library
1674 headers do not obey all of these guidelines; use @samp{grep -v}
1675 to filter out those warnings.
1676
1677 @item -Wno-deprecated @r{(C++ only)}
1678 @opindex Wno-deprecated
1679 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
1680
1681 @item -Wno-non-template-friend @r{(C++ only)}
1682 @opindex Wno-non-template-friend
1683 Disable warnings when non-templatized friend functions are declared
1684 within a template.  Since the advent of explicit template specification
1685 support in G++, if the name of the friend is an unqualified-id (i.e.,
1686 @samp{friend foo(int)}), the C++ language specification demands that the
1687 friend declare or define an ordinary, nontemplate function.  (Section
1688 14.5.3).  Before G++ implemented explicit specification, unqualified-ids
1689 could be interpreted as a particular specialization of a templatized
1690 function.  Because this non-conforming behavior is no longer the default
1691 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
1692 check existing code for potential trouble spots and is on by default.
1693 This new compiler behavior can be turned off with
1694 @option{-Wno-non-template-friend} which keeps the conformant compiler code
1695 but disables the helpful warning.
1696
1697 @item -Wold-style-cast @r{(C++ only)}
1698 @opindex Wold-style-cast
1699 Warn if an old-style (C-style) cast to a non-void type is used within
1700 a C++ program.  The new-style casts (@samp{static_cast},
1701 @samp{reinterpret_cast}, and @samp{const_cast}) are less vulnerable to
1702 unintended effects and much easier to search for.
1703
1704 @item -Woverloaded-virtual @r{(C++ only)}
1705 @opindex Woverloaded-virtual
1706 @cindex overloaded virtual fn, warning
1707 @cindex warning for overloaded virtual fn
1708 Warn when a function declaration hides virtual functions from a
1709 base class.  For example, in:
1710
1711 @smallexample
1712 struct A @{
1713   virtual void f();
1714 @};
1715
1716 struct B: public A @{
1717   void f(int);
1718 @};
1719 @end smallexample
1720
1721 the @code{A} class version of @code{f} is hidden in @code{B}, and code
1722 like:
1723
1724 @smallexample
1725 B* b;
1726 b->f();
1727 @end smallexample
1728
1729 will fail to compile.
1730
1731 @item -Wno-pmf-conversions @r{(C++ only)}
1732 @opindex Wno-pmf-conversions
1733 Disable the diagnostic for converting a bound pointer to member function
1734 to a plain pointer.
1735
1736 @item -Wsign-promo @r{(C++ only)}
1737 @opindex Wsign-promo
1738 Warn when overload resolution chooses a promotion from unsigned or
1739 enumerated type to a signed type, over a conversion to an unsigned type of
1740 the same size.  Previous versions of G++ would try to preserve
1741 unsignedness, but the standard mandates the current behavior.
1742
1743 @item -Wsynth @r{(C++ only)}
1744 @opindex Wsynth
1745 @cindex warning for synthesized methods
1746 @cindex synthesized methods, warning
1747 Warn when G++'s synthesis behavior does not match that of cfront.  For
1748 instance:
1749
1750 @smallexample
1751 struct A @{
1752   operator int ();
1753   A& operator = (int);
1754 @};
1755
1756 main ()
1757 @{
1758   A a,b;
1759   a = b;
1760 @}
1761 @end smallexample
1762
1763 In this example, G++ will synthesize a default @samp{A& operator =
1764 (const A&);}, while cfront will use the user-defined @samp{operator =}.
1765 @end table
1766
1767 @node Objective-C Dialect Options
1768 @section Options Controlling Objective-C Dialect
1769
1770 @cindex compiler options, Objective-C
1771 @cindex Objective-C options, command line
1772 @cindex options, Objective-C
1773 (NOTE: This manual does not describe the Objective-C language itself.  See
1774 @w{@uref{http://gcc.gnu.org/readings.html}} for references.)
1775
1776 This section describes the command-line options that are only meaningful
1777 for Objective-C programs, but you can also use most of the GNU compiler
1778 options regardless of what language your program is in.  For example,
1779 you might compile a file @code{some_class.m} like this:
1780
1781 @smallexample
1782 gcc -g -fgnu-runtime -O -c some_class.m
1783 @end smallexample
1784
1785 @noindent
1786 In this example, @option{-fgnu-runtime} is an option meant only for
1787 Objective-C programs; you can use the other options with any language
1788 supported by GCC@.
1789
1790 Here is a list of options that are @emph{only} for compiling Objective-C
1791 programs:
1792
1793 @table @gcctabopt
1794 @item -fconstant-string-class=@var{class-name}
1795 @opindex fconstant-string-class
1796 Use @var{class-name} as the name of the class to instantiate for each
1797 literal string specified with the syntax @code{@@"@dots{}"}.  The default
1798 class name is @code{NXConstantString} if the GNU runtime is being used, and
1799 @code{NSConstantString} if the NeXT runtime is being used (see below).  The
1800 @option{-fconstant-cfstrings} option, if also present, will override the
1801 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
1802 to be laid out as constant CoreFoundation strings.
1803
1804 @item -fgnu-runtime
1805 @opindex fgnu-runtime
1806 Generate object code compatible with the standard GNU Objective-C
1807 runtime.  This is the default for most types of systems.
1808
1809 @item -fnext-runtime
1810 @opindex fnext-runtime
1811 Generate output compatible with the NeXT runtime.  This is the default
1812 for NeXT-based systems, including Darwin and Mac OS X@.  The macro
1813 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
1814 used.
1815
1816 @item -fno-nil-receivers
1817 @opindex fno-nil-receivers
1818 Assume that all Objective-C message dispatches (e.g.,
1819 @code{[receiver message:arg]}) in this translation unit ensure that the receiver
1820 is not @code{nil}.  This allows for more efficient entry points in the runtime to be
1821 used.  Currently, this option is only available in conjunction with
1822 the NeXT runtime on Mac OS X 10.3 and later.
1823
1824 @item -fobjc-exceptions
1825 @opindex fobjc-exceptions
1826 Enable syntactic support for structured exception handling in Objective-C,
1827 similar to what is offered by C++ and Java.  Currently, this option is only
1828 available in conjunction with the NeXT runtime on Mac OS X 10.3 and later.
1829
1830 @smallexample
1831   @@try @{
1832     @dots{}
1833        @@throw expr;
1834     @dots{}
1835   @}
1836   @@catch (AnObjCClass *exc) @{
1837     @dots{}
1838       @@throw expr;
1839     @dots{}
1840       @@throw;
1841     @dots{}
1842   @}
1843   @@catch (AnotherClass *exc) @{
1844     @dots{}
1845   @}
1846   @@catch (id allOthers) @{
1847     @dots{}
1848   @}
1849   @@finally @{
1850     @dots{}
1851       @@throw expr;
1852     @dots{}
1853   @}
1854 @end smallexample
1855
1856 The @code{@@throw} statement may appear anywhere in an Objective-C or
1857 Objective-C++ program; when used inside of a @code{@@catch} block, the
1858 @code{@@throw} may appear without an argument (as shown above), in which case
1859 the object caught by the @code{@@catch} will be rethrown.
1860
1861 Note that only (pointers to) Objective-C objects may be thrown and
1862 caught using this scheme.  When an object is thrown, it will be caught
1863 by the nearest @code{@@catch} clause capable of handling objects of that type,
1864 analogously to how @code{catch} blocks work in C++ and Java.  A
1865 @code{@@catch(id @dots{})} clause (as shown above) may also be provided to catch
1866 any and all Objective-C exceptions not caught by previous @code{@@catch}
1867 clauses (if any).
1868
1869 The @code{@@finally} clause, if present, will be executed upon exit from the
1870 immediately preceding @code{@@try @dots{} @@catch} section.  This will happen
1871 regardless of whether any exceptions are thrown, caught or rethrown
1872 inside the @code{@@try @dots{} @@catch} section, analogously to the behavior
1873 of the @code{finally} clause in Java.
1874
1875 There are several caveats to using the new exception mechanism:
1876
1877 @itemize @bullet
1878 @item
1879 Although currently designed to be binary compatible with @code{NS_HANDLER}-style
1880 idioms provided by the @code{NSException} class, the new
1881 exceptions can only be used on Mac OS X 10.3 (Panther) and later
1882 systems, due to additional functionality needed in the (NeXT) Objective-C
1883 runtime.
1884
1885 @item
1886 As mentioned above, the new exceptions do not support handling
1887 types other than Objective-C objects.   Furthermore, when used from
1888 Objective-C++, the Objective-C exception model does not interoperate with C++
1889 exceptions at this time.  This means you cannot @code{@@throw} an exception
1890 from Objective-C and @code{catch} it in C++, or vice versa
1891 (i.e., @code{throw @dots{} @@catch}).
1892 @end itemize
1893
1894 The @option{-fobjc-exceptions} switch also enables the use of synchronization
1895 blocks for thread-safe execution:
1896
1897 @smallexample
1898   @@synchronized (ObjCClass *guard) @{
1899     @dots{}
1900   @}
1901 @end smallexample
1902
1903 Upon entering the @code{@@synchronized} block, a thread of execution shall
1904 first check whether a lock has been placed on the corresponding @code{guard}
1905 object by another thread.  If it has, the current thread shall wait until
1906 the other thread relinquishes its lock.  Once @code{guard} becomes available,
1907 the current thread will place its own lock on it, execute the code contained in
1908 the @code{@@synchronized} block, and finally relinquish the lock (thereby
1909 making @code{guard} available to other threads).
1910
1911 Unlike Java, Objective-C does not allow for entire methods to be marked
1912 @code{@@synchronized}.  Note that throwing exceptions out of
1913 @code{@@synchronized} blocks is allowed, and will cause the guarding object
1914 to be unlocked properly.
1915
1916 @item -freplace-objc-classes
1917 @opindex freplace-objc-classes
1918 Emit a special marker instructing @command{ld(1)} not to statically link in
1919 the resulting object file, and allow @command{dyld(1)} to load it in at
1920 run time instead.  This is used in conjunction with the Fix-and-Continue
1921 debugging mode, where the object file in question may be recompiled and
1922 dynamically reloaded in the course of program execution, without the need
1923 to restart the program itself.  Currently, Fix-and-Continue functionality
1924 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
1925 and later.
1926
1927 @item -fzero-link
1928 @opindex fzero-link
1929 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
1930 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
1931 compile time) with static class references that get initialized at load time,
1932 which improves run-time performance.  Specifying the @option{-fzero-link} flag
1933 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
1934 to be retained.  This is useful in Zero-Link debugging mode, since it allows
1935 for individual class implementations to be modified during program execution.
1936
1937 @item -gen-decls
1938 @opindex gen-decls
1939 Dump interface declarations for all classes seen in the source file to a
1940 file named @file{@var{sourcename}.decl}.
1941
1942 @item -Wno-protocol
1943 @opindex Wno-protocol
1944 If a class is declared to implement a protocol, a warning is issued for
1945 every method in the protocol that is not implemented by the class.  The
1946 default behavior is to issue a warning for every method not explicitly
1947 implemented in the class, even if a method implementation is inherited
1948 from the superclass.  If you use the @code{-Wno-protocol} option, then
1949 methods inherited from the superclass are considered to be implemented,
1950 and no warning is issued for them.
1951
1952 @item -Wselector
1953 @opindex Wselector
1954 Warn if multiple methods of different types for the same selector are
1955 found during compilation.  The check is performed on the list of methods
1956 in the final stage of compilation.  Additionally, a check is performed
1957 for each selector appearing in a @code{@@selector(@dots{})}
1958 expression, and a corresponding method for that selector has been found
1959 during compilation.  Because these checks scan the method table only at
1960 the end of compilation, these warnings are not produced if the final
1961 stage of compilation is not reached, for example because an error is
1962 found during compilation, or because the @code{-fsyntax-only} option is
1963 being used.
1964
1965 @item -Wundeclared-selector
1966 @opindex Wundeclared-selector
1967 Warn if a @code{@@selector(@dots{})} expression referring to an
1968 undeclared selector is found.  A selector is considered undeclared if no
1969 method with that name has been declared before the
1970 @code{@@selector(@dots{})} expression, either explicitly in an
1971 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
1972 an @code{@@implementation} section.  This option always performs its
1973 checks as soon as a @code{@@selector(@dots{})} expression is found,
1974 while @code{-Wselector} only performs its checks in the final stage of
1975 compilation.  This also enforces the coding style convention
1976 that methods and selectors must be declared before being used.
1977
1978 @item -print-objc-runtime-info
1979 @opindex print-objc-runtime-info
1980 Generate C header describing the largest structure that is passed by
1981 value, if any.
1982
1983 @end table
1984
1985 @node Language Independent Options
1986 @section Options to Control Diagnostic Messages Formatting
1987 @cindex options to control diagnostics formatting
1988 @cindex diagnostic messages
1989 @cindex message formatting
1990
1991 Traditionally, diagnostic messages have been formatted irrespective of
1992 the output device's aspect (e.g.@: its width, @dots{}).  The options described
1993 below can be used to control the diagnostic messages formatting
1994 algorithm, e.g.@: how many characters per line, how often source location
1995 information should be reported.  Right now, only the C++ front end can
1996 honor these options.  However it is expected, in the near future, that
1997 the remaining front ends would be able to digest them correctly.
1998
1999 @table @gcctabopt
2000 @item -fmessage-length=@var{n}
2001 @opindex fmessage-length
2002 Try to format error messages so that they fit on lines of about @var{n}
2003 characters.  The default is 72 characters for @command{g++} and 0 for the rest of
2004 the front ends supported by GCC@.  If @var{n} is zero, then no
2005 line-wrapping will be done; each error message will appear on a single
2006 line.
2007
2008 @opindex fdiagnostics-show-location
2009 @item -fdiagnostics-show-location=once
2010 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
2011 reporter to emit @emph{once} source location information; that is, in
2012 case the message is too long to fit on a single physical line and has to
2013 be wrapped, the source location won't be emitted (as prefix) again,
2014 over and over, in subsequent continuation lines.  This is the default
2015 behavior.
2016
2017 @item -fdiagnostics-show-location=every-line
2018 Only meaningful in line-wrapping mode.  Instructs the diagnostic
2019 messages reporter to emit the same source location information (as
2020 prefix) for physical lines that result from the process of breaking
2021 a message which is too long to fit on a single line.
2022
2023 @end table
2024
2025 @node Warning Options
2026 @section Options to Request or Suppress Warnings
2027 @cindex options to control warnings
2028 @cindex warning messages
2029 @cindex messages, warning
2030 @cindex suppressing warnings
2031
2032 Warnings are diagnostic messages that report constructions which
2033 are not inherently erroneous but which are risky or suggest there
2034 may have been an error.
2035
2036 You can request many specific warnings with options beginning @samp{-W},
2037 for example @option{-Wimplicit} to request warnings on implicit
2038 declarations.  Each of these specific warning options also has a
2039 negative form beginning @samp{-Wno-} to turn off warnings;
2040 for example, @option{-Wno-implicit}.  This manual lists only one of the
2041 two forms, whichever is not the default.
2042
2043 The following options control the amount and kinds of warnings produced
2044 by GCC; for further, language-specific options also refer to
2045 @ref{C++ Dialect Options} and @ref{Objective-C Dialect Options}.
2046
2047 @table @gcctabopt
2048 @cindex syntax checking
2049 @item -fsyntax-only
2050 @opindex fsyntax-only
2051 Check the code for syntax errors, but don't do anything beyond that.
2052
2053 @item -pedantic
2054 @opindex pedantic
2055 Issue all the warnings demanded by strict ISO C and ISO C++;
2056 reject all programs that use forbidden extensions, and some other
2057 programs that do not follow ISO C and ISO C++.  For ISO C, follows the
2058 version of the ISO C standard specified by any @option{-std} option used.
2059
2060 Valid ISO C and ISO C++ programs should compile properly with or without
2061 this option (though a rare few will require @option{-ansi} or a
2062 @option{-std} option specifying the required version of ISO C)@.  However,
2063 without this option, certain GNU extensions and traditional C and C++
2064 features are supported as well.  With this option, they are rejected.
2065
2066 @option{-pedantic} does not cause warning messages for use of the
2067 alternate keywords whose names begin and end with @samp{__}.  Pedantic
2068 warnings are also disabled in the expression that follows
2069 @code{__extension__}.  However, only system header files should use
2070 these escape routes; application programs should avoid them.
2071 @xref{Alternate Keywords}.
2072
2073 Some users try to use @option{-pedantic} to check programs for strict ISO
2074 C conformance.  They soon find that it does not do quite what they want:
2075 it finds some non-ISO practices, but not all---only those for which
2076 ISO C @emph{requires} a diagnostic, and some others for which
2077 diagnostics have been added.
2078
2079 A feature to report any failure to conform to ISO C might be useful in
2080 some instances, but would require considerable additional work and would
2081 be quite different from @option{-pedantic}.  We don't have plans to
2082 support such a feature in the near future.
2083
2084 Where the standard specified with @option{-std} represents a GNU
2085 extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
2086 corresponding @dfn{base standard}, the version of ISO C on which the GNU
2087 extended dialect is based.  Warnings from @option{-pedantic} are given
2088 where they are required by the base standard.  (It would not make sense
2089 for such warnings to be given only for features not in the specified GNU
2090 C dialect, since by definition the GNU dialects of C include all
2091 features the compiler supports with the given option, and there would be
2092 nothing to warn about.)
2093
2094 @item -pedantic-errors
2095 @opindex pedantic-errors
2096 Like @option{-pedantic}, except that errors are produced rather than
2097 warnings.
2098
2099 @item -w
2100 @opindex w
2101 Inhibit all warning messages.
2102
2103 @item -Wno-import
2104 @opindex Wno-import
2105 Inhibit warning messages about the use of @samp{#import}.
2106
2107 @item -Wchar-subscripts
2108 @opindex Wchar-subscripts
2109 Warn if an array subscript has type @code{char}.  This is a common cause
2110 of error, as programmers often forget that this type is signed on some
2111 machines.
2112
2113 @item -Wcomment
2114 @opindex Wcomment
2115 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
2116 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
2117
2118 @item -Wfatal-errors
2119 @opindex Wfatal-errors
2120 This option causes the compiler to abort compilation on the first error
2121 occurred rather than trying to keep going and printing further error
2122 messages.
2123
2124 @item -Wformat
2125 @opindex Wformat
2126 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
2127 the arguments supplied have types appropriate to the format string
2128 specified, and that the conversions specified in the format string make
2129 sense.  This includes standard functions, and others specified by format
2130 attributes (@pxref{Function Attributes}), in the @code{printf},
2131 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
2132 not in the C standard) families (or other target-specific families).
2133
2134 The formats are checked against the format features supported by GNU
2135 libc version 2.2.  These include all ISO C90 and C99 features, as well
2136 as features from the Single Unix Specification and some BSD and GNU
2137 extensions.  Other library implementations may not support all these
2138 features; GCC does not support warning about features that go beyond a
2139 particular library's limitations.  However, if @option{-pedantic} is used
2140 with @option{-Wformat}, warnings will be given about format features not
2141 in the selected standard version (but not for @code{strfmon} formats,
2142 since those are not in any version of the C standard).  @xref{C Dialect
2143 Options,,Options Controlling C Dialect}.
2144
2145 Since @option{-Wformat} also checks for null format arguments for
2146 several functions, @option{-Wformat} also implies @option{-Wnonnull}.
2147
2148 @option{-Wformat} is included in @option{-Wall}.  For more control over some
2149 aspects of format checking, the options @option{-Wformat-y2k},
2150 @option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
2151 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
2152 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
2153
2154 @item -Wformat-y2k
2155 @opindex Wformat-y2k
2156 If @option{-Wformat} is specified, also warn about @code{strftime}
2157 formats which may yield only a two-digit year.
2158
2159 @item -Wno-format-extra-args
2160 @opindex Wno-format-extra-args
2161 If @option{-Wformat} is specified, do not warn about excess arguments to a
2162 @code{printf} or @code{scanf} format function.  The C standard specifies
2163 that such arguments are ignored.
2164
2165 Where the unused arguments lie between used arguments that are
2166 specified with @samp{$} operand number specifications, normally
2167 warnings are still given, since the implementation could not know what
2168 type to pass to @code{va_arg} to skip the unused arguments.  However,
2169 in the case of @code{scanf} formats, this option will suppress the
2170 warning if the unused arguments are all pointers, since the Single
2171 Unix Specification says that such unused arguments are allowed.
2172
2173 @item -Wno-format-zero-length
2174 @opindex Wno-format-zero-length
2175 If @option{-Wformat} is specified, do not warn about zero-length formats.
2176 The C standard specifies that zero-length formats are allowed.
2177
2178 @item -Wformat-nonliteral
2179 @opindex Wformat-nonliteral
2180 If @option{-Wformat} is specified, also warn if the format string is not a
2181 string literal and so cannot be checked, unless the format function
2182 takes its format arguments as a @code{va_list}.
2183
2184 @item -Wformat-security
2185 @opindex Wformat-security
2186 If @option{-Wformat} is specified, also warn about uses of format
2187 functions that represent possible security problems.  At present, this
2188 warns about calls to @code{printf} and @code{scanf} functions where the
2189 format string is not a string literal and there are no format arguments,
2190 as in @code{printf (foo);}.  This may be a security hole if the format
2191 string came from untrusted input and contains @samp{%n}.  (This is
2192 currently a subset of what @option{-Wformat-nonliteral} warns about, but
2193 in future warnings may be added to @option{-Wformat-security} that are not
2194 included in @option{-Wformat-nonliteral}.)
2195
2196 @item -Wformat=2
2197 @opindex Wformat=2
2198 Enable @option{-Wformat} plus format checks not included in
2199 @option{-Wformat}.  Currently equivalent to @samp{-Wformat
2200 -Wformat-nonliteral -Wformat-security -Wformat-y2k}.
2201
2202 @item -Wnonnull
2203 @opindex Wnonnull
2204 Warn about passing a null pointer for arguments marked as
2205 requiring a non-null value by the @code{nonnull} function attribute.
2206
2207 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
2208 can be disabled with the @option{-Wno-nonnull} option.
2209
2210 @item -Winit-self @r{(C, C++, and Objective-C only)}
2211 @opindex Winit-self
2212 Warn about uninitialized variables which are initialized with themselves.
2213 Note this option can only be used with the @option{-Wuninitialized} option,
2214 which in turn only works with @option{-O1} and above.
2215
2216 For example, GCC will warn about @code{i} being uninitialized in the
2217 following snippet only when @option{-Winit-self} has been specified:
2218 @smallexample
2219 @group
2220 int f()
2221 @{
2222   int i = i;
2223   return i;
2224 @}
2225 @end group
2226 @end smallexample
2227
2228 @item -Wimplicit-int
2229 @opindex Wimplicit-int
2230 Warn when a declaration does not specify a type.
2231
2232 @item -Wimplicit-function-declaration
2233 @itemx -Werror-implicit-function-declaration
2234 @opindex Wimplicit-function-declaration
2235 @opindex Werror-implicit-function-declaration
2236 Give a warning (or error) whenever a function is used before being
2237 declared.
2238
2239 @item -Wimplicit
2240 @opindex Wimplicit
2241 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
2242
2243 @item -Wmain
2244 @opindex Wmain
2245 Warn if the type of @samp{main} is suspicious.  @samp{main} should be a
2246 function with external linkage, returning int, taking either zero
2247 arguments, two, or three arguments of appropriate types.
2248
2249 @item -Wmissing-braces
2250 @opindex Wmissing-braces
2251 Warn if an aggregate or union initializer is not fully bracketed.  In
2252 the following example, the initializer for @samp{a} is not fully
2253 bracketed, but that for @samp{b} is fully bracketed.
2254
2255 @smallexample
2256 int a[2][2] = @{ 0, 1, 2, 3 @};
2257 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
2258 @end smallexample
2259
2260 @item -Wmissing-include-dirs @r{(C, C++, and Objective-C only)}
2261 @opindex Wmissing-include-dirs
2262 Warn if a user-supplied include directory does not exist.
2263
2264 @item -Wparentheses
2265 @opindex Wparentheses
2266 Warn if parentheses are omitted in certain contexts, such
2267 as when there is an assignment in a context where a truth value
2268 is expected, or when operators are nested whose precedence people
2269 often get confused about.  Only the warning for an assignment used as
2270 a truth value is supported when compiling C++; the other warnings are
2271 only supported when compiling C@.
2272
2273 Also warn if a comparison like @samp{x<=y<=z} appears; this is
2274 equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
2275 interpretation from that of ordinary mathematical notation.
2276
2277 Also warn about constructions where there may be confusion to which
2278 @code{if} statement an @code{else} branch belongs.  Here is an example of
2279 such a case:
2280
2281 @smallexample
2282 @group
2283 @{
2284   if (a)
2285     if (b)
2286       foo ();
2287   else
2288     bar ();
2289 @}
2290 @end group
2291 @end smallexample
2292
2293 In C, every @code{else} branch belongs to the innermost possible @code{if}
2294 statement, which in this example is @code{if (b)}.  This is often not
2295 what the programmer expected, as illustrated in the above example by
2296 indentation the programmer chose.  When there is the potential for this
2297 confusion, GCC will issue a warning when this flag is specified.
2298 To eliminate the warning, add explicit braces around the innermost
2299 @code{if} statement so there is no way the @code{else} could belong to
2300 the enclosing @code{if}.  The resulting code would look like this:
2301
2302 @smallexample
2303 @group
2304 @{
2305   if (a)
2306     @{
2307       if (b)
2308         foo ();
2309       else
2310         bar ();
2311     @}
2312 @}
2313 @end group
2314 @end smallexample
2315
2316 @item -Wsequence-point
2317 @opindex Wsequence-point
2318 Warn about code that may have undefined semantics because of violations
2319 of sequence point rules in the C standard.
2320
2321 The C standard defines the order in which expressions in a C program are
2322 evaluated in terms of @dfn{sequence points}, which represent a partial
2323 ordering between the execution of parts of the program: those executed
2324 before the sequence point, and those executed after it.  These occur
2325 after the evaluation of a full expression (one which is not part of a
2326 larger expression), after the evaluation of the first operand of a
2327 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
2328 function is called (but after the evaluation of its arguments and the
2329 expression denoting the called function), and in certain other places.
2330 Other than as expressed by the sequence point rules, the order of
2331 evaluation of subexpressions of an expression is not specified.  All
2332 these rules describe only a partial order rather than a total order,
2333 since, for example, if two functions are called within one expression
2334 with no sequence point between them, the order in which the functions
2335 are called is not specified.  However, the standards committee have
2336 ruled that function calls do not overlap.
2337
2338 It is not specified when between sequence points modifications to the
2339 values of objects take effect.  Programs whose behavior depends on this
2340 have undefined behavior; the C standard specifies that ``Between the
2341 previous and next sequence point an object shall have its stored value
2342 modified at most once by the evaluation of an expression.  Furthermore,
2343 the prior value shall be read only to determine the value to be
2344 stored.''.  If a program breaks these rules, the results on any
2345 particular implementation are entirely unpredictable.
2346
2347 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
2348 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
2349 diagnosed by this option, and it may give an occasional false positive
2350 result, but in general it has been found fairly effective at detecting
2351 this sort of problem in programs.
2352
2353 The present implementation of this option only works for C programs.  A
2354 future implementation may also work for C++ programs.
2355
2356 The C standard is worded confusingly, therefore there is some debate
2357 over the precise meaning of the sequence point rules in subtle cases.
2358 Links to discussions of the problem, including proposed formal
2359 definitions, may be found on the GCC readings page, at
2360 @w{@uref{http://gcc.gnu.org/readings.html}}.
2361
2362 @item -Wreturn-type
2363 @opindex Wreturn-type
2364 Warn whenever a function is defined with a return-type that defaults to
2365 @code{int}.  Also warn about any @code{return} statement with no
2366 return-value in a function whose return-type is not @code{void}.
2367
2368 For C, also warn if the return type of a function has a type qualifier
2369 such as @code{const}.  Such a type qualifier has no effect, since the
2370 value returned by a function is not an lvalue.  ISO C prohibits
2371 qualified @code{void} return types on function definitions, so such
2372 return types always receive a warning even without this option.
2373
2374 For C++, a function without return type always produces a diagnostic
2375 message, even when @option{-Wno-return-type} is specified.  The only
2376 exceptions are @samp{main} and functions defined in system headers.
2377
2378 @item -Wswitch
2379 @opindex Wswitch
2380 Warn whenever a @code{switch} statement has an index of enumerated type
2381 and lacks a @code{case} for one or more of the named codes of that
2382 enumeration.  (The presence of a @code{default} label prevents this
2383 warning.)  @code{case} labels outside the enumeration range also
2384 provoke warnings when this option is used.
2385
2386 @item -Wswitch-default
2387 @opindex Wswitch-switch
2388 Warn whenever a @code{switch} statement does not have a @code{default}
2389 case.
2390
2391 @item -Wswitch-enum
2392 @opindex Wswitch-enum
2393 Warn whenever a @code{switch} statement has an index of enumerated type
2394 and lacks a @code{case} for one or more of the named codes of that
2395 enumeration.  @code{case} labels outside the enumeration range also
2396 provoke warnings when this option is used.
2397
2398 @item -Wtrigraphs
2399 @opindex Wtrigraphs
2400 Warn if any trigraphs are encountered that might change the meaning of
2401 the program (trigraphs within comments are not warned about).
2402
2403 @item -Wunused-function
2404 @opindex Wunused-function
2405 Warn whenever a static function is declared but not defined or a
2406 non\-inline static function is unused.
2407
2408 @item -Wunused-label
2409 @opindex Wunused-label
2410 Warn whenever a label is declared but not used.
2411
2412 To suppress this warning use the @samp{unused} attribute
2413 (@pxref{Variable Attributes}).
2414
2415 @item -Wunused-parameter
2416 @opindex Wunused-parameter
2417 Warn whenever a function parameter is unused aside from its declaration.
2418
2419 To suppress this warning use the @samp{unused} attribute
2420 (@pxref{Variable Attributes}).
2421
2422 @item -Wunused-variable
2423 @opindex Wunused-variable
2424 Warn whenever a local variable or non-constant static variable is unused
2425 aside from its declaration
2426
2427 To suppress this warning use the @samp{unused} attribute
2428 (@pxref{Variable Attributes}).
2429
2430 @item -Wunused-value
2431 @opindex Wunused-value
2432 Warn whenever a statement computes a result that is explicitly not used.
2433
2434 To suppress this warning cast the expression to @samp{void}.
2435
2436 @item -Wunused
2437 @opindex Wunused
2438 All the above @option{-Wunused} options combined.
2439
2440 In order to get a warning about an unused function parameter, you must
2441 either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
2442 @samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
2443
2444 @item -Wuninitialized
2445 @opindex Wuninitialized
2446 Warn if an automatic variable is used without first being initialized or
2447 if a variable may be clobbered by a @code{setjmp} call.
2448
2449 These warnings are possible only in optimizing compilation,
2450 because they require data flow information that is computed only
2451 when optimizing.  If you don't specify @option{-O}, you simply won't
2452 get these warnings.
2453
2454 If you want to warn about code which uses the uninitialized value of the
2455 variable in its own initializer, use the @option{-Winit-self} option.
2456
2457 These warnings occur only for variables that are candidates for
2458 register allocation.  Therefore, they do not occur for a variable that
2459 is declared @code{volatile}, or whose address is taken, or whose size
2460 is other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
2461 structures, unions or arrays, even when they are in registers.
2462
2463 Note that there may be no warning about a variable that is used only
2464 to compute a value that itself is never used, because such
2465 computations may be deleted by data flow analysis before the warnings
2466 are printed.
2467
2468 These warnings are made optional because GCC is not smart
2469 enough to see all the reasons why the code might be correct
2470 despite appearing to have an error.  Here is one example of how
2471 this can happen:
2472
2473 @smallexample
2474 @group
2475 @{
2476   int x;
2477   switch (y)
2478     @{
2479     case 1: x = 1;
2480       break;
2481     case 2: x = 4;
2482       break;
2483     case 3: x = 5;
2484     @}
2485   foo (x);
2486 @}
2487 @end group
2488 @end smallexample
2489
2490 @noindent
2491 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
2492 always initialized, but GCC doesn't know this.  Here is
2493 another common case:
2494
2495 @smallexample
2496 @{
2497   int save_y;
2498   if (change_y) save_y = y, y = new_y;
2499   @dots{}
2500   if (change_y) y = save_y;
2501 @}
2502 @end smallexample
2503
2504 @noindent
2505 This has no bug because @code{save_y} is used only if it is set.
2506
2507 @cindex @code{longjmp} warnings
2508 This option also warns when a non-volatile automatic variable might be
2509 changed by a call to @code{longjmp}.  These warnings as well are possible
2510 only in optimizing compilation.
2511
2512 The compiler sees only the calls to @code{setjmp}.  It cannot know
2513 where @code{longjmp} will be called; in fact, a signal handler could
2514 call it at any point in the code.  As a result, you may get a warning
2515 even when there is in fact no problem because @code{longjmp} cannot
2516 in fact be called at the place which would cause a problem.
2517
2518 Some spurious warnings can be avoided if you declare all the functions
2519 you use that never return as @code{noreturn}.  @xref{Function
2520 Attributes}.
2521
2522 @item -Wunknown-pragmas
2523 @opindex Wunknown-pragmas
2524 @cindex warning for unknown pragmas
2525 @cindex unknown pragmas, warning
2526 @cindex pragmas, warning of unknown
2527 Warn when a #pragma directive is encountered which is not understood by
2528 GCC@.  If this command line option is used, warnings will even be issued
2529 for unknown pragmas in system header files.  This is not the case if
2530 the warnings were only enabled by the @option{-Wall} command line option.
2531
2532 @item -Wstrict-aliasing
2533 @opindex Wstrict-aliasing
2534 This option is only active when @option{-fstrict-aliasing} is active.
2535 It warns about code which might break the strict aliasing rules that the
2536 compiler is using for optimization. The warning does not catch all
2537 cases, but does attempt to catch the more common pitfalls. It is
2538 included in @option{-Wall}.
2539
2540 @item -Wstrict-aliasing=2
2541 @opindex Wstrict-aliasing=2
2542 This option is only active when @option{-fstrict-aliasing} is active.
2543 It warns about all code which might break the strict aliasing rules that the
2544 compiler is using for optimization.  This warning catches all cases, but
2545 it will also give a warning for some ambiguous cases that are safe.
2546
2547 @item -Wall
2548 @opindex Wall
2549 All of the above @samp{-W} options combined.  This enables all the
2550 warnings about constructions that some users consider questionable, and
2551 that are easy to avoid (or modify to prevent the warning), even in
2552 conjunction with macros.  This also enables some language-specific
2553 warnings described in @ref{C++ Dialect Options} and
2554 @ref{Objective-C Dialect Options}.
2555 @end table
2556
2557 The following @option{-W@dots{}} options are not implied by @option{-Wall}.
2558 Some of them warn about constructions that users generally do not
2559 consider questionable, but which occasionally you might wish to check
2560 for; others warn about constructions that are necessary or hard to avoid
2561 in some cases, and there is no simple way to modify the code to suppress
2562 the warning.
2563
2564 @table @gcctabopt
2565 @item -Wextra
2566 @opindex W
2567 @opindex Wextra
2568 (This option used to be called @option{-W}.  The older name is still
2569 supported, but the newer name is more descriptive.)  Print extra warning
2570 messages for these events:
2571
2572 @itemize @bullet
2573 @item
2574 A function can return either with or without a value.  (Falling
2575 off the end of the function body is considered returning without
2576 a value.)  For example, this function would evoke such a
2577 warning:
2578
2579 @smallexample
2580 @group
2581 foo (a)
2582 @{
2583   if (a > 0)
2584     return a;
2585 @}
2586 @end group
2587 @end smallexample
2588
2589 @item
2590 An expression-statement or the left-hand side of a comma expression
2591 contains no side effects.
2592 To suppress the warning, cast the unused expression to void.
2593 For example, an expression such as @samp{x[i,j]} will cause a warning,
2594 but @samp{x[(void)i,j]} will not.
2595
2596 @item
2597 An unsigned value is compared against zero with @samp{<} or @samp{>=}.
2598
2599 @item
2600 Storage-class specifiers like @code{static} are not the first things in
2601 a declaration.  According to the C Standard, this usage is obsolescent.
2602
2603 @item
2604 If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
2605 arguments.
2606
2607 @item
2608 A comparison between signed and unsigned values could produce an
2609 incorrect result when the signed value is converted to unsigned.
2610 (But don't warn if @option{-Wno-sign-compare} is also specified.)
2611
2612 @item
2613 An aggregate has an initializer which does not initialize all members.
2614 For example, the following code would cause such a warning, because
2615 @code{x.h} would be implicitly initialized to zero:
2616
2617 @smallexample
2618 struct s @{ int f, g, h; @};
2619 struct s x = @{ 3, 4 @};
2620 @end smallexample
2621
2622 @item
2623 A function parameter is declared without a type specifier in K&R-style
2624 functions:
2625
2626 @smallexample
2627 void foo(bar) @{ @}
2628 @end smallexample
2629
2630 @item
2631 An empty body occurs in an @samp{if} or @samp{else} statement.
2632
2633 @item
2634 A pointer is compared against integer zero with @samp{<}, @samp{<=},
2635 @samp{>}, or @samp{>=}.
2636
2637 @item
2638 A variable might be changed by @samp{longjmp} or @samp{vfork}.
2639
2640 @item
2641 Any of several floating-point events that often indicate errors, such as
2642 overflow, underflow, loss of precision, etc.
2643
2644 @item @r{(C++ only)}
2645 An enumerator and a non-enumerator both appear in a conditional expression.
2646
2647 @item @r{(C++ only)}
2648 A non-static reference or non-static @samp{const} member appears in a
2649 class without constructors.
2650
2651 @item @r{(C++ only)}
2652 Ambiguous virtual bases.
2653
2654 @item @r{(C++ only)}
2655 Subscripting an array which has been declared @samp{register}.
2656
2657 @item @r{(C++ only)}
2658 Taking the address of a variable which has been declared @samp{register}.
2659
2660 @item @r{(C++ only)}
2661 A base class is not initialized in a derived class' copy constructor.
2662 @end itemize
2663
2664 @item -Wno-div-by-zero
2665 @opindex Wno-div-by-zero
2666 @opindex Wdiv-by-zero
2667 Do not warn about compile-time integer division by zero.  Floating point
2668 division by zero is not warned about, as it can be a legitimate way of
2669 obtaining infinities and NaNs.
2670
2671 @item -Wsystem-headers
2672 @opindex Wsystem-headers
2673 @cindex warnings from system headers
2674 @cindex system headers, warnings from
2675 Print warning messages for constructs found in system header files.
2676 Warnings from system headers are normally suppressed, on the assumption
2677 that they usually do not indicate real problems and would only make the
2678 compiler output harder to read.  Using this command line option tells
2679 GCC to emit warnings from system headers as if they occurred in user
2680 code.  However, note that using @option{-Wall} in conjunction with this
2681 option will @emph{not} warn about unknown pragmas in system
2682 headers---for that, @option{-Wunknown-pragmas} must also be used.
2683
2684 @item -Wfloat-equal
2685 @opindex Wfloat-equal
2686 Warn if floating point values are used in equality comparisons.
2687
2688 The idea behind this is that sometimes it is convenient (for the
2689 programmer) to consider floating-point values as approximations to
2690 infinitely precise real numbers.  If you are doing this, then you need
2691 to compute (by analyzing the code, or in some other way) the maximum or
2692 likely maximum error that the computation introduces, and allow for it
2693 when performing comparisons (and when producing output, but that's a
2694 different problem).  In particular, instead of testing for equality, you
2695 would check to see whether the two values have ranges that overlap; and
2696 this is done with the relational operators, so equality comparisons are
2697 probably mistaken.
2698
2699 @item -Wtraditional @r{(C only)}
2700 @opindex Wtraditional
2701 Warn about certain constructs that behave differently in traditional and
2702 ISO C@.  Also warn about ISO C constructs that have no traditional C
2703 equivalent, and/or problematic constructs which should be avoided.
2704
2705 @itemize @bullet
2706 @item
2707 Macro parameters that appear within string literals in the macro body.
2708 In traditional C macro replacement takes place within string literals,
2709 but does not in ISO C@.
2710
2711 @item
2712 In traditional C, some preprocessor directives did not exist.
2713 Traditional preprocessors would only consider a line to be a directive
2714 if the @samp{#} appeared in column 1 on the line.  Therefore
2715 @option{-Wtraditional} warns about directives that traditional C
2716 understands but would ignore because the @samp{#} does not appear as the
2717 first character on the line.  It also suggests you hide directives like
2718 @samp{#pragma} not understood by traditional C by indenting them.  Some
2719 traditional implementations would not recognize @samp{#elif}, so it
2720 suggests avoiding it altogether.
2721
2722 @item
2723 A function-like macro that appears without arguments.
2724
2725 @item
2726 The unary plus operator.
2727
2728 @item
2729 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
2730 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
2731 constants.)  Note, these suffixes appear in macros defined in the system
2732 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
2733 Use of these macros in user code might normally lead to spurious
2734 warnings, however GCC's integrated preprocessor has enough context to
2735 avoid warning in these cases.
2736
2737 @item
2738 A function declared external in one block and then used after the end of
2739 the block.
2740
2741 @item
2742 A @code{switch} statement has an operand of type @code{long}.
2743
2744 @item
2745 A non-@code{static} function declaration follows a @code{static} one.
2746 This construct is not accepted by some traditional C compilers.
2747
2748 @item
2749 The ISO type of an integer constant has a different width or
2750 signedness from its traditional type.  This warning is only issued if
2751 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
2752 typically represent bit patterns, are not warned about.
2753
2754 @item
2755 Usage of ISO string concatenation is detected.
2756
2757 @item
2758 Initialization of automatic aggregates.
2759
2760 @item
2761 Identifier conflicts with labels.  Traditional C lacks a separate
2762 namespace for labels.
2763
2764 @item
2765 Initialization of unions.  If the initializer is zero, the warning is
2766 omitted.  This is done under the assumption that the zero initializer in
2767 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
2768 initializer warnings and relies on default initialization to zero in the
2769 traditional C case.
2770
2771 @item
2772 Conversions by prototypes between fixed/floating point values and vice
2773 versa.  The absence of these prototypes when compiling with traditional
2774 C would cause serious problems.  This is a subset of the possible
2775 conversion warnings, for the full set use @option{-Wconversion}.
2776
2777 @item
2778 Use of ISO C style function definitions.  This warning intentionally is
2779 @emph{not} issued for prototype declarations or variadic functions
2780 because these ISO C features will appear in your code when using
2781 libiberty's traditional C compatibility macros, @code{PARAMS} and
2782 @code{VPARAMS}.  This warning is also bypassed for nested functions
2783 because that feature is already a GCC extension and thus not relevant to
2784 traditional C compatibility.
2785 @end itemize
2786
2787 @item -Wdeclaration-after-statement @r{(C only)}
2788 @opindex Wdeclaration-after-statement
2789 Warn when a declaration is found after a statement in a block.  This
2790 construct, known from C++, was introduced with ISO C99 and is by default
2791 allowed in GCC@.  It is not supported by ISO C90 and was not supported by
2792 GCC versions before GCC 3.0.  @xref{Mixed Declarations}.
2793
2794 @item -Wundef
2795 @opindex Wundef
2796 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
2797
2798 @item -Wendif-labels
2799 @opindex Wendif-labels
2800 Warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
2801
2802 @item -Wshadow
2803 @opindex Wshadow
2804 Warn whenever a local variable shadows another local variable, parameter or
2805 global variable or whenever a built-in function is shadowed.
2806
2807 @item -Wlarger-than-@var{len}
2808 @opindex Wlarger-than
2809 Warn whenever an object of larger than @var{len} bytes is defined.
2810
2811 @item -Wpointer-arith
2812 @opindex Wpointer-arith
2813 Warn about anything that depends on the ``size of'' a function type or
2814 of @code{void}.  GNU C assigns these types a size of 1, for
2815 convenience in calculations with @code{void *} pointers and pointers
2816 to functions.
2817
2818 @item -Wbad-function-cast @r{(C only)}
2819 @opindex Wbad-function-cast
2820 Warn whenever a function call is cast to a non-matching type.
2821 For example, warn if @code{int malloc()} is cast to @code{anything *}.
2822
2823 @item -Wcast-qual
2824 @opindex Wcast-qual
2825 Warn whenever a pointer is cast so as to remove a type qualifier from
2826 the target type.  For example, warn if a @code{const char *} is cast
2827 to an ordinary @code{char *}.
2828
2829 @item -Wcast-align
2830 @opindex Wcast-align
2831 Warn whenever a pointer is cast such that the required alignment of the
2832 target is increased.  For example, warn if a @code{char *} is cast to
2833 an @code{int *} on machines where integers can only be accessed at
2834 two- or four-byte boundaries.
2835
2836 @item -Wwrite-strings
2837 @opindex Wwrite-strings
2838 When compiling C, give string constants the type @code{const
2839 char[@var{length}]} so that
2840 copying the address of one into a non-@code{const} @code{char *}
2841 pointer will get a warning; when compiling C++, warn about the
2842 deprecated conversion from string constants to @code{char *}.
2843 These warnings will help you find at
2844 compile time code that can try to write into a string constant, but
2845 only if you have been very careful about using @code{const} in
2846 declarations and prototypes.  Otherwise, it will just be a nuisance;
2847 this is why we did not make @option{-Wall} request these warnings.
2848
2849 @item -Wconversion
2850 @opindex Wconversion
2851 Warn if a prototype causes a type conversion that is different from what
2852 would happen to the same argument in the absence of a prototype.  This
2853 includes conversions of fixed point to floating and vice versa, and
2854 conversions changing the width or signedness of a fixed point argument
2855 except when the same as the default promotion.
2856
2857 Also, warn if a negative integer constant expression is implicitly
2858 converted to an unsigned type.  For example, warn about the assignment
2859 @code{x = -1} if @code{x} is unsigned.  But do not warn about explicit
2860 casts like @code{(unsigned) -1}.
2861
2862 @item -Wsign-compare
2863 @opindex Wsign-compare
2864 @cindex warning for comparison of signed and unsigned values
2865 @cindex comparison of signed and unsigned values, warning
2866 @cindex signed and unsigned values, comparison warning
2867 Warn when a comparison between signed and unsigned values could produce
2868 an incorrect result when the signed value is converted to unsigned.
2869 This warning is also enabled by @option{-Wextra}; to get the other warnings
2870 of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
2871
2872 @item -Waggregate-return
2873 @opindex Waggregate-return
2874 Warn if any functions that return structures or unions are defined or
2875 called.  (In languages where you can return an array, this also elicits
2876 a warning.)
2877
2878 @item -Wstrict-prototypes @r{(C only)}
2879 @opindex Wstrict-prototypes
2880 Warn if a function is declared or defined without specifying the
2881 argument types.  (An old-style function definition is permitted without
2882 a warning if preceded by a declaration which specifies the argument
2883 types.)
2884
2885 @item -Wold-style-definition @r{(C only)}
2886 @opindex Wold-style-definition
2887 Warn if an old-style function definition is used.  A warning is given
2888 even if there is a previous prototype.
2889
2890 @item -Wmissing-prototypes @r{(C only)}
2891 @opindex Wmissing-prototypes
2892 Warn if a global function is defined without a previous prototype
2893 declaration.  This warning is issued even if the definition itself
2894 provides a prototype.  The aim is to detect global functions that fail
2895 to be declared in header files.
2896
2897 @item -Wmissing-declarations @r{(C only)}
2898 @opindex Wmissing-declarations
2899 Warn if a global function is defined without a previous declaration.
2900 Do so even if the definition itself provides a prototype.
2901 Use this option to detect global functions that are not declared in
2902 header files.
2903
2904 @item -Wmissing-noreturn
2905 @opindex Wmissing-noreturn
2906 Warn about functions which might be candidates for attribute @code{noreturn}.
2907 Note these are only possible candidates, not absolute ones.  Care should
2908 be taken to manually verify functions actually do not ever return before
2909 adding the @code{noreturn} attribute, otherwise subtle code generation
2910 bugs could be introduced.  You will not get a warning for @code{main} in
2911 hosted C environments.
2912
2913 @item -Wmissing-format-attribute
2914 @opindex Wmissing-format-attribute
2915 @opindex Wformat
2916 If @option{-Wformat} is enabled, also warn about functions which might be
2917 candidates for @code{format} attributes.  Note these are only possible
2918 candidates, not absolute ones.  GCC will guess that @code{format}
2919 attributes might be appropriate for any function that calls a function
2920 like @code{vprintf} or @code{vscanf}, but this might not always be the
2921 case, and some functions for which @code{format} attributes are
2922 appropriate may not be detected.  This option has no effect unless
2923 @option{-Wformat} is enabled (possibly by @option{-Wall}).
2924
2925 @item -Wno-multichar
2926 @opindex Wno-multichar
2927 @opindex Wmultichar
2928 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
2929 Usually they indicate a typo in the user's code, as they have
2930 implementation-defined values, and should not be used in portable code.
2931
2932 @item -Wno-deprecated-declarations
2933 @opindex Wno-deprecated-declarations
2934 Do not warn about uses of functions, variables, and types marked as
2935 deprecated by using the @code{deprecated} attribute.
2936 (@pxref{Function Attributes}, @pxref{Variable Attributes},
2937 @pxref{Type Attributes}.)
2938
2939 @item -Wpacked
2940 @opindex Wpacked
2941 Warn if a structure is given the packed attribute, but the packed
2942 attribute has no effect on the layout or size of the structure.
2943 Such structures may be mis-aligned for little benefit.  For
2944 instance, in this code, the variable @code{f.x} in @code{struct bar}
2945 will be misaligned even though @code{struct bar} does not itself
2946 have the packed attribute:
2947
2948 @smallexample
2949 @group
2950 struct foo @{
2951   int x;
2952   char a, b, c, d;
2953 @} __attribute__((packed));
2954 struct bar @{
2955   char z;
2956   struct foo f;
2957 @};
2958 @end group
2959 @end smallexample
2960
2961 @item -Wpadded
2962 @opindex Wpadded
2963 Warn if padding is included in a structure, either to align an element
2964 of the structure or to align the whole structure.  Sometimes when this
2965 happens it is possible to rearrange the fields of the structure to
2966 reduce the padding and so make the structure smaller.
2967
2968 @item -Wredundant-decls
2969 @opindex Wredundant-decls
2970 Warn if anything is declared more than once in the same scope, even in
2971 cases where multiple declaration is valid and changes nothing.
2972
2973 @item -Wnested-externs @r{(C only)}
2974 @opindex Wnested-externs
2975 Warn if an @code{extern} declaration is encountered within a function.
2976
2977 @item -Wunreachable-code
2978 @opindex Wunreachable-code
2979 Warn if the compiler detects that code will never be executed.
2980
2981 This option is intended to warn when the compiler detects that at
2982 least a whole line of source code will never be executed, because
2983 some condition is never satisfied or because it is after a
2984 procedure that never returns.
2985
2986 It is possible for this option to produce a warning even though there
2987 are circumstances under which part of the affected line can be executed,
2988 so care should be taken when removing apparently-unreachable code.
2989
2990 For instance, when a function is inlined, a warning may mean that the
2991 line is unreachable in only one inlined copy of the function.
2992
2993 This option is not made part of @option{-Wall} because in a debugging
2994 version of a program there is often substantial code which checks
2995 correct functioning of the program and is, hopefully, unreachable
2996 because the program does work.  Another common use of unreachable
2997 code is to provide behavior which is selectable at compile-time.
2998
2999 @item -Winline
3000 @opindex Winline
3001 Warn if a function can not be inlined and it was declared as inline.
3002 Even with this option, the compiler will not warn about failures to
3003 inline functions declared in system headers.
3004
3005 The compiler uses a variety of heuristics to determine whether or not
3006 to inline a function.  For example, the compiler takes into account
3007 the size of the function being inlined and the the amount of inlining
3008 that has already been done in the current function.  Therefore,
3009 seemingly insignificant changes in the source program can cause the
3010 warnings produced by @option{-Winline} to appear or disappear.
3011
3012 @item -Wno-invalid-offsetof @r{(C++ only)}
3013 @opindex Wno-invalid-offsetof
3014 Suppress warnings from applying the @samp{offsetof} macro to a non-POD
3015 type.  According to the 1998 ISO C++ standard, applying @samp{offsetof}
3016 to a non-POD type is undefined.  In existing C++ implementations,
3017 however, @samp{offsetof} typically gives meaningful results even when
3018 applied to certain kinds of non-POD types. (Such as a simple
3019 @samp{struct} that fails to be a POD type only by virtue of having a
3020 constructor.)  This flag is for users who are aware that they are
3021 writing nonportable code and who have deliberately chosen to ignore the
3022 warning about it.
3023
3024 The restrictions on @samp{offsetof} may be relaxed in a future version
3025 of the C++ standard.
3026
3027 @item -Winvalid-pch
3028 @opindex Winvalid-pch
3029 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
3030 the search path but can't be used.
3031
3032 @item -Wlong-long
3033 @opindex Wlong-long
3034 @opindex Wno-long-long
3035 Warn if @samp{long long} type is used.  This is default.  To inhibit
3036 the warning messages, use @option{-Wno-long-long}.  Flags
3037 @option{-Wlong-long} and @option{-Wno-long-long} are taken into account
3038 only when @option{-pedantic} flag is used.
3039
3040 @item -Wvariadic-macros
3041 @opindex Wvariadic-macros
3042 @opindex Wno-variadic-macros
3043 Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
3044 alternate syntax when in pedantic ISO C99 mode.  This is default.
3045 To inhibit the warning messages, use @option{-Wno-variadic-macros}.
3046
3047 @item -Wdisabled-optimization
3048 @opindex Wdisabled-optimization
3049 Warn if a requested optimization pass is disabled.  This warning does
3050 not generally indicate that there is anything wrong with your code; it
3051 merely indicates that GCC's optimizers were unable to handle the code
3052 effectively.  Often, the problem is that your code is too big or too
3053 complex; GCC will refuse to optimize programs when the optimization
3054 itself is likely to take inordinate amounts of time.
3055
3056 @item -Werror
3057 @opindex Werror
3058 Make all warnings into errors.
3059 @end table
3060
3061 @node Debugging Options
3062 @section Options for Debugging Your Program or GCC
3063 @cindex options, debugging
3064 @cindex debugging information options
3065
3066 GCC has various special options that are used for debugging
3067 either your program or GCC:
3068
3069 @table @gcctabopt
3070 @item -g
3071 @opindex g
3072 Produce debugging information in the operating system's native format
3073 (stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
3074 information.
3075
3076 On most systems that use stabs format, @option{-g} enables use of extra
3077 debugging information that only GDB can use; this extra information
3078 makes debugging work better in GDB but will probably make other debuggers
3079 crash or
3080 refuse to read the program.  If you want to control for certain whether
3081 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
3082 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
3083
3084 Unlike most other C compilers, GCC allows you to use @option{-g} with
3085 @option{-O}.  The shortcuts taken by optimized code may occasionally
3086 produce surprising results: some variables you declared may not exist
3087 at all; flow of control may briefly move where you did not expect it;
3088 some statements may not be executed because they compute constant
3089 results or their values were already at hand; some statements may
3090 execute in different places because they were moved out of loops.
3091
3092 Nevertheless it proves possible to debug optimized output.  This makes
3093 it reasonable to use the optimizer for programs that might have bugs.
3094
3095 The following options are useful when GCC is generated with the
3096 capability for more than one debugging format.
3097
3098 @item -ggdb
3099 @opindex ggdb
3100 Produce debugging information for use by GDB@.  This means to use the
3101 most expressive format available (DWARF 2, stabs, or the native format
3102 if neither of those are supported), including GDB extensions if at all
3103 possible.
3104
3105 @item -gstabs
3106 @opindex gstabs
3107 Produce debugging information in stabs format (if that is supported),
3108 without GDB extensions.  This is the format used by DBX on most BSD
3109 systems.  On MIPS, Alpha and System V Release 4 systems this option
3110 produces stabs debugging output which is not understood by DBX or SDB@.
3111 On System V Release 4 systems this option requires the GNU assembler.
3112
3113 @item -feliminate-unused-debug-symbols
3114 @opindex feliminate-unused-debug-symbols
3115 Produce debugging information in stabs format (if that is supported),
3116 for only symbols that are actually used.
3117
3118 @item -gstabs+
3119 @opindex gstabs+
3120 Produce debugging information in stabs format (if that is supported),
3121 using GNU extensions understood only by the GNU debugger (GDB)@.  The
3122 use of these extensions is likely to make other debuggers crash or
3123 refuse to read the program.
3124
3125 @item -gcoff
3126 @opindex gcoff
3127 Produce debugging information in COFF format (if that is supported).
3128 This is the format used by SDB on most System V systems prior to
3129 System V Release 4.
3130
3131 @item -gxcoff
3132 @opindex gxcoff
3133 Produce debugging information in XCOFF format (if that is supported).
3134 This is the format used by the DBX debugger on IBM RS/6000 systems.
3135
3136 @item -gxcoff+
3137 @opindex gxcoff+
3138 Produce debugging information in XCOFF format (if that is supported),
3139 using GNU extensions understood only by the GNU debugger (GDB)@.  The
3140 use of these extensions is likely to make other debuggers crash or
3141 refuse to read the program, and may cause assemblers other than the GNU
3142 assembler (GAS) to fail with an error.
3143
3144 @item -gdwarf-2
3145 @opindex gdwarf-2
3146 Produce debugging information in DWARF version 2 format (if that is
3147 supported).  This is the format used by DBX on IRIX 6.
3148
3149 @item -gvms
3150 @opindex gvms
3151 Produce debugging information in VMS debug format (if that is
3152 supported).  This is the format used by DEBUG on VMS systems.
3153
3154 @item -g@var{level}
3155 @itemx -ggdb@var{level}
3156 @itemx -gstabs@var{level}
3157 @itemx -gcoff@var{level}
3158 @itemx -gxcoff@var{level}
3159 @itemx -gvms@var{level}
3160 Request debugging information and also use @var{level} to specify how
3161 much information.  The default level is 2.
3162
3163 Level 1 produces minimal information, enough for making backtraces in
3164 parts of the program that you don't plan to debug.  This includes
3165 descriptions of functions and external variables, but no information
3166 about local variables and no line numbers.
3167
3168 Level 3 includes extra information, such as all the macro definitions
3169 present in the program.  Some debuggers support macro expansion when
3170 you use @option{-g3}.
3171
3172 Note that in order to avoid confusion between DWARF1 debug level 2,
3173 and DWARF2 @option{-gdwarf-2} does not accept a concatenated debug
3174 level.  Instead use an additional @option{-g@var{level}} option to
3175 change the debug level for DWARF2.
3176
3177 @item -feliminate-dwarf2-dups
3178 @opindex feliminate-dwarf2-dups
3179 Compress DWARF2 debugging information by eliminating duplicated
3180 information about each symbol.  This option only makes sense when
3181 generating DWARF2 debugging information with @option{-gdwarf-2}.
3182
3183 @cindex @command{prof}
3184 @item -p
3185 @opindex p
3186 Generate extra code to write profile information suitable for the
3187 analysis program @command{prof}.  You must use this option when compiling
3188 the source files you want data about, and you must also use it when
3189 linking.
3190
3191 @cindex @command{gprof}
3192 @item -pg
3193 @opindex pg
3194 Generate extra code to write profile information suitable for the
3195 analysis program @command{gprof}.  You must use this option when compiling
3196 the source files you want data about, and you must also use it when
3197 linking.
3198
3199 @item -Q
3200 @opindex Q
3201 Makes the compiler print out each function name as it is compiled, and
3202 print some statistics about each pass when it finishes.
3203
3204 @item -ftime-report
3205 @opindex ftime-report
3206 Makes the compiler print some statistics about the time consumed by each
3207 pass when it finishes.
3208
3209 @item -fmem-report
3210 @opindex fmem-report
3211 Makes the compiler print some statistics about permanent memory
3212 allocation when it finishes.
3213
3214 @item -fprofile-arcs
3215 @opindex fprofile-arcs
3216 Add code so that program flow @dfn{arcs} are instrumented.  During
3217 execution the program records how many times each branch and call is
3218 executed and how many times it is taken or returns.  When the compiled
3219 program exits it saves this data to a file called
3220 @file{@var{auxname}.gcda} for each source file. The data may be used for
3221 profile-directed optimizations (@option{-fbranch-probabilities}), or for
3222 test coverage analysis (@option{-ftest-coverage}). Each object file's
3223 @var{auxname} is generated from the name of the output file, if
3224 explicitly specified and it is not the final executable, otherwise it is
3225 the basename of the source file. In both cases any suffix is removed
3226 (e.g.  @file{foo.gcda} for input file @file{dir/foo.c}, or
3227 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
3228
3229 @itemize
3230
3231 @item
3232 Compile the source files with @option{-fprofile-arcs} plus optimization
3233 and code generation options. For test coverage analysis, use the
3234 additional @option{-ftest-coverage} option. You do not need to profile
3235 every source file in a program.
3236
3237 @item
3238 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
3239 (the latter implies the former).
3240
3241 @item
3242 Run the program on a representative workload to generate the arc profile
3243 information. This may be repeated any number of times. You can run
3244 concurrent instances of your program, and provided that the file system
3245 supports locking, the data files will be correctly updated. Also
3246 @code{fork} calls are detected and correctly handled (double counting
3247 will not happen).
3248
3249 @item
3250 For profile-directed optimizations, compile the source files again with
3251 the same optimization and code generation options plus
3252 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
3253 Control Optimization}).
3254
3255 @item
3256 For test coverage analysis, use @command{gcov} to produce human readable
3257 information from the @file{.gcno} and @file{.gcda} files. Refer to the
3258 @command{gcov} documentation for further information.
3259
3260 @end itemize
3261
3262 With @option{-fprofile-arcs}, for each function of your program GCC
3263 creates a program flow graph, then finds a spanning tree for the graph.
3264 Only arcs that are not on the spanning tree have to be instrumented: the
3265 compiler adds code to count the number of times that these arcs are
3266 executed.  When an arc is the only exit or only entrance to a block, the
3267 instrumentation code can be added to the block; otherwise, a new basic
3268 block must be created to hold the instrumentation code.
3269
3270 @item -ftree-based-profiling
3271 @opindex ftree-based-profiling
3272 This option is used in addition to @option{-fprofile-arcs} or
3273 @option{-fbranch-probabilities} to control whether those optimizations
3274 are performed on a tree-based or rtl-based internal representation.
3275 If you use this option when compiling with @option{-fprofile-arcs},
3276 you must also use it when compiling later with @option{-fbranch-probabilities}.
3277 Currently the tree-based optimization is in an early stage of
3278 development, and this option is recommended only for those people
3279 working on improving it.
3280
3281 @need 2000
3282 @item -ftest-coverage
3283 @opindex ftest-coverage
3284 Produce a notes file that the @command{gcov} code-coverage utility
3285 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
3286 show program coverage. Each source file's note file is called
3287 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
3288 above for a description of @var{auxname} and instructions on how to
3289 generate test coverage data. Coverage data will match the source files
3290 more closely, if you do not optimize.
3291
3292 @item -d@var{letters}
3293 @opindex d
3294 Says to make debugging dumps during compilation at times specified by
3295 @var{letters}.  This is used for debugging the compiler.  The file names
3296 for most of the dumps are made by appending a pass number and a word to
3297 the @var{dumpname}. @var{dumpname} is generated from the name of the
3298 output file, if explicitly specified and it is not an executable,
3299 otherwise it is the basename of the source file. In both cases any
3300 suffix is removed (e.g.  @file{foo.01.rtl} or @file{foo.02.sibling}).
3301 Here are the possible letters for use in @var{letters}, and their
3302 meanings:
3303
3304 @table @samp
3305 @item A
3306 @opindex dA
3307 Annotate the assembler output with miscellaneous debugging information.
3308 @item b
3309 @opindex db
3310 Dump after computing branch probabilities, to @file{@var{file}.12.bp}.
3311 @item B
3312 @opindex dB
3313 Dump after block reordering, to @file{@var{file}.32.bbro}.
3314 @item c
3315 @opindex dc
3316 Dump after instruction combination, to the file @file{@var{file}.20.combine}.
3317 @item C
3318 @opindex dC
3319 Dump after the first if conversion, to the file @file{@var{file}.14.ce1}.
3320 Also dump after the second if conversion, to the file @file{@var{file}.21.ce2}.
3321 @item d
3322 @opindex dd
3323 Dump after branch target load optimization, to to @file{@var{file}.33.btl}.
3324 Also dump after delayed branch scheduling, to @file{@var{file}.37.dbr}.
3325 @item D
3326 @opindex dD
3327 Dump all macro definitions, at the end of preprocessing, in addition to
3328 normal output.
3329 @item E
3330 @opindex dE
3331 Dump after the third if conversion, to @file{@var{file}.31.ce3}.
3332 @item f
3333 @opindex df
3334 Dump after control and data flow analysis, to @file{@var{file}.11.cfg}.
3335 Also dump after life analysis, to @file{@var{file}.19.life}.
3336 @item g
3337 @opindex dg
3338 Dump after global register allocation, to @file{@var{file}.26.greg}.
3339 @item G
3340 @opindex dG
3341 Dump after GCSE, to @file{@var{file}.08.gcse}.
3342 Also dump after jump bypassing and control flow optimizations, to
3343 @file{@var{file}.10.bypass}.
3344 @item h
3345 @opindex dh
3346 Dump after finalization of EH handling code, to @file{@var{file}.03.eh}.
3347 @item i
3348 @opindex di
3349 Dump after sibling call optimizations, to @file{@var{file}.02.sibling}.
3350 @item j
3351 @opindex dj
3352 Dump after the first jump optimization, to @file{@var{file}.04.jump}.
3353 @item k
3354 @opindex dk
3355 Dump after conversion from registers to stack, to @file{@var{file}.35.stack}.
3356 @item l
3357 @opindex dl
3358 Dump after local register allocation, to @file{@var{file}.25.lreg}.
3359 @item L
3360 @opindex dL
3361 Dump after loop optimization passes, to @file{@var{file}.09.loop} and
3362 @file{@var{file}.16.loop2}.
3363 @item m
3364 @opindex dm
3365 Dump after modulo scheduling, to @file{@var{file}.23.sms}.
3366 @item M
3367 @opindex dM
3368 Dump after performing the machine dependent reorganization pass, to
3369 @file{@var{file}.36.mach}.
3370 @item n
3371 @opindex dn
3372 Dump after register renumbering, to @file{@var{file}.30.rnreg}.
3373 @item N
3374 @opindex dN
3375 Dump after the register move pass, to @file{@var{file}.22.regmove}.
3376 @item o
3377 @opindex do
3378 Dump after post-reload optimizations, to @file{@var{file}.27.postreload}.
3379 @item r
3380 @opindex dr
3381 Dump after RTL generation, to @file{@var{file}.01.rtl}.
3382 @item R
3383 @opindex dR
3384 Dump after the second scheduling pass, to @file{@var{file}.34.sched2}.
3385 @item s
3386 @opindex ds
3387 Dump after CSE (including the jump optimization that sometimes follows
3388 CSE), to @file{@var{file}.06.cse}.
3389 @item S
3390 @opindex dS
3391 Dump after the first scheduling pass, to @file{@var{file}.24.sched}.
3392 @item t
3393 @opindex dt
3394 Dump after the second CSE pass (including the jump optimization that
3395 sometimes follows CSE), to @file{@var{file}.18.cse2}.
3396 @item T
3397 @opindex dT
3398 Dump after running tracer, to @file{@var{file}.15.tracer}.
3399 @item u
3400 @opindex du
3401 Dump after null pointer elimination pass to @file{@var{file}.05.null}.
3402 @item U
3403 @opindex dU
3404 Dump callgraph and unit-at-a-time optimization @file{@var{file}.00.unit}.
3405 @item V
3406 @opindex dV
3407 Dump after the value profile transformations, to @file{@var{file}.13.vpt}.
3408 Also dump after variable tracking, to @file{@var{file}.35.vartrack}.
3409 @item w
3410 @opindex dw
3411 Dump after the second flow pass, to @file{@var{file}.28.flow2}.
3412 @item z
3413 @opindex dz
3414 Dump after the peephole pass, to @file{@var{file}.29.peephole2}.
3415 @item Z
3416 @opindex dZ
3417 Dump after constructing the web, to @file{@var{file}.17.web}.
3418 @item a
3419 @opindex da
3420 Produce all the dumps listed above.
3421 @item H
3422 @opindex dH
3423 Produce a core dump whenever an error occurs.
3424 @item m
3425 @opindex dm
3426 Print statistics on memory usage, at the end of the run, to
3427 standard error.
3428 @item p
3429 @opindex dp
3430 Annotate the assembler output with a comment indicating which
3431 pattern and alternative was used.  The length of each instruction is
3432 also printed.
3433 @item P
3434 @opindex dP
3435 Dump the RTL in the assembler output as a comment before each instruction.
3436 Also turns on @option{-dp} annotation.
3437 @item v
3438 @opindex dv
3439 For each of the other indicated dump files (except for
3440 @file{@var{file}.01.rtl}), dump a representation of the control flow graph
3441 suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
3442 @item x
3443 @opindex dx
3444 Just generate RTL for a function instead of compiling it.  Usually used
3445 with @samp{r}.
3446 @item y
3447 @opindex dy
3448 Dump debugging information during parsing, to standard error.
3449 @end table
3450
3451 @item -fdump-unnumbered
3452 @opindex fdump-unnumbered
3453 When doing debugging dumps (see @option{-d} option above), suppress instruction
3454 numbers and line number note output.  This makes it more feasible to
3455 use diff on debugging dumps for compiler invocations with different
3456 options, in particular with and without @option{-g}.
3457
3458 @item -fdump-translation-unit @r{(C and C++ only)}
3459 @itemx -fdump-translation-unit-@var{options} @r{(C and C++ only)}
3460 @opindex fdump-translation-unit
3461 Dump a representation of the tree structure for the entire translation
3462 unit to a file.  The file name is made by appending @file{.tu} to the
3463 source file name.  If the @samp{-@var{options}} form is used, @var{options}
3464 controls the details of the dump as described for the
3465 @option{-fdump-tree} options.
3466
3467 @item -fdump-class-hierarchy @r{(C++ only)}
3468 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
3469 @opindex fdump-class-hierarchy
3470 Dump a representation of each class's hierarchy and virtual function
3471 table layout to a file.  The file name is made by appending @file{.class}
3472 to the source file name.  If the @samp{-@var{options}} form is used,
3473 @var{options} controls the details of the dump as described for the
3474 @option{-fdump-tree} options.
3475
3476 @item -fdump-tree-@var{switch} @r{(C and C++ only)}
3477 @itemx -fdump-tree-@var{switch}-@var{options} @r{(C and C++ only)}
3478 @opindex fdump-tree
3479 Control the dumping at various stages of processing the intermediate
3480 language tree to a file.  The file name is generated by appending a switch
3481 specific suffix to the source file name.  If the @samp{-@var{options}}
3482 form is used, @var{options} is a list of @samp{-} separated options that
3483 control the details of the dump. Not all options are applicable to all
3484 dumps, those which are not meaningful will be ignored. The following
3485 options are available
3486
3487 @table @samp
3488 @item address
3489 Print the address of each node.  Usually this is not meaningful as it
3490 changes according to the environment and source file. Its primary use
3491 is for tying up a dump file with a debug environment.
3492 @item slim
3493 Inhibit dumping of members of a scope or body of a function merely
3494 because that scope has been reached.  Only dump such items when they
3495 are directly reachable by some other path.  When dumping pretty-printed
3496 trees, this option inhibits dumping the bodies of control structures.
3497 @item raw
3498 Print a raw representation of the tree.  By default, trees are
3499 pretty-printed into a C-like representation.
3500 @item details
3501 Enable more detailed dumps (not honored by every dump option).
3502 @item stats
3503 Enable dumping various statistics about the pass (not honored by every dump
3504 option).
3505 @item blocks
3506 Enable showing basic block boundaries (disabled in raw dumps).
3507 @item vops
3508 Enable showing virtual operands for every statement.
3509 @item lineno
3510 Enable showing line numbers for statements.
3511 @item uid
3512 Enable showing the unique ID (@code{DECL_UID}) for each variable.
3513 @item all
3514 Turn on all options, except @option{raw}, @option{slim} and @option{lineno}.
3515 @end table
3516
3517 The following tree dumps are possible:
3518 @table @samp
3519
3520 @item original
3521 Dump before any tree based optimization, to @file{@var{file}.original}.
3522
3523 @item optimized
3524 Dump after all tree based optimization, to @file{@var{file}.optimized}.
3525
3526 @item inlined
3527 Dump after function inlining, to @file{@var{file}.inlined}.
3528
3529 @item gimple
3530 @opindex fdump-tree-gimple
3531 Dump each function before and after the gimplification pass to a file.  The
3532 file name is made by appending @file{.gimple} to the source file name.
3533
3534 @item cfg
3535 @opindex fdump-tree-cfg
3536 Dump the control flow graph of each function to a file.  The file name is
3537 made by appending @file{.cfg} to the source file name.
3538
3539 @item vcg
3540 @opindex fdump-tree-vcg
3541 Dump the control flow graph of each function to a file in VCG format.  The
3542 file name is made by appending @file{.vcg} to the source file name.  Note
3543 that if the file contains more than one function, the generated file cannot
3544 be used directly by VCG.  You will need to cut and paste each function's
3545 graph into its own separate file first.
3546
3547 @item ch
3548 @opindex fdump-tree-ch
3549 Dump each function after copying loop headers.  The file name is made by
3550 appending @file{.ch} to the source file name.
3551
3552 @item ssa
3553 @opindex fdump-tree-ssa
3554 Dump SSA related information to a file.  The file name is made by appending
3555 @file{.ssa} to the source file name.
3556
3557 @item alias
3558 @opindex fdump-tree-alias
3559 Dump aliasing information for each function.  The file name is made by
3560 appending @file{.alias} to the source file name.
3561
3562 @item ccp
3563 @opindex fdump-tree-ccp
3564 Dump each function after CCP.  The file name is made by appending
3565 @file{.ccp} to the source file name.
3566
3567 @item pre
3568 @opindex fdump-tree-pre
3569 Dump trees after partial redundancy elimination.  The file name is made
3570 by appending @file{.pre} to the source file name.
3571
3572 @item fre
3573 @opindex fdump-tree-fre
3574 Dump trees after full redundancy elimination.  The file name is made
3575 by appending @file{.fre} to the source file name.
3576
3577 @item dce
3578 @opindex fdump-tree-dce
3579 Dump each function after dead code elimination.  The file name is made by
3580 appending @file{.dce} to the source file name.
3581
3582 @item mudflap
3583 @opindex fdump-tree-mudflap
3584 Dump each function after adding mudflap instrumentation.  The file name is
3585 made by appending @file{.mudflap} to the source file name.
3586
3587 @item sra
3588 @opindex fdump-tree-sra
3589 Dump each function after performing scalar replacement of aggregates.  The
3590 file name is made by appending @file{.sra} to the source file name.
3591
3592 @item dom
3593 @opindex fdump-tree-dom
3594 Dump each function after applying dominator tree optimizations.  The file
3595 name is made by appending @file{.dom} to the source file name.
3596
3597 @item dse
3598 @opindex fdump-tree-dse
3599 Dump each function after applying dead store elimination.  The file
3600 name is made by appending @file{.dse} to the source file name.
3601
3602 @item phiopt
3603 @opindex fdump-tree-phiopt
3604 Dump each function after optimizing PHI nodes into straightline code.  The file
3605 name is made by appending @file{.phiopt} to the source file name.
3606
3607 @item forwprop
3608 @opindex fdump-tree-forwprop
3609 Dump each function after forward propagating single use variables.  The file
3610 name is made by appending @file{.forwprop} to the source file name.
3611
3612 @item copyrename
3613 @opindex fdump-tree-copyrename
3614 Dump each function after applying the copy rename optimization.  The file
3615 name is made by appending @file{.copyrename} to the source file name.
3616
3617 @item nrv
3618 @opindex fdump-tree-nrv
3619 Dump each function after applying the named return value optimization on
3620 generic trees.  The file name is made by appending @file{.nrv} to the source
3621 file name.
3622
3623 @item all
3624 @opindex fdump-tree-all
3625 Enable all the available tree dumps with the flags provided in this option.
3626 @end table
3627
3628 @item -frandom-seed=@var{string}
3629 @opindex frandom-string
3630 This option provides a seed that GCC uses when it would otherwise use
3631 random numbers.  It is used to generate certain symbol names
3632 that have to be different in every compiled file. It is also used to
3633 place unique stamps in coverage data files and the object files that
3634 produce them. You can use the @option{-frandom-seed} option to produce
3635 reproducibly identical object files.
3636
3637 The @var{string} should be different for every file you compile.
3638
3639 @item -fsched-verbose=@var{n}
3640 @opindex fsched-verbose
3641 On targets that use instruction scheduling, this option controls the
3642 amount of debugging output the scheduler prints.  This information is
3643 written to standard error, unless @option{-dS} or @option{-dR} is
3644 specified, in which case it is output to the usual dump
3645 listing file, @file{.sched} or @file{.sched2} respectively.  However
3646 for @var{n} greater than nine, the output is always printed to standard
3647 error.
3648
3649 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
3650 same information as @option{-dRS}.  For @var{n} greater than one, it
3651 also output basic block probabilities, detailed ready list information
3652 and unit/insn info.  For @var{n} greater than two, it includes RTL
3653 at abort point, control-flow and regions info.  And for @var{n} over
3654 four, @option{-fsched-verbose} also includes dependence info.
3655
3656 @item -save-temps
3657 @opindex save-temps
3658 Store the usual ``temporary'' intermediate files permanently; place them
3659 in the current directory and name them based on the source file.  Thus,
3660 compiling @file{foo.c} with @samp{-c -save-temps} would produce files
3661 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
3662 preprocessed @file{foo.i} output file even though the compiler now
3663 normally uses an integrated preprocessor.
3664
3665 @item -time
3666 @opindex time
3667 Report the CPU time taken by each subprocess in the compilation
3668 sequence.  For C source files, this is the compiler proper and assembler
3669 (plus the linker if linking is done).  The output looks like this:
3670
3671 @smallexample
3672 # cc1 0.12 0.01
3673 # as 0.00 0.01
3674 @end smallexample
3675
3676 The first number on each line is the ``user time,'' that is time spent
3677 executing the program itself.  The second number is ``system time,''
3678 time spent executing operating system routines on behalf of the program.
3679 Both numbers are in seconds.
3680
3681 @item -fvar-tracking
3682 @opindex fvar-tracking
3683 Run variable tracking pass. It computes where variables are stored at each
3684 position in code. Better debugging information is then generated
3685 (if the debugging information format supports this information).
3686
3687 It is enabled by default when compiling with optimization (@option{-Os},
3688 @option{-O}, @option{-O2}, ...), debugging information (@option{-g}) and
3689 the debug info format supports it.
3690
3691 @item -print-file-name=@var{library}
3692 @opindex print-file-name
3693 Print the full absolute name of the library file @var{library} that
3694 would be used when linking---and don't do anything else.  With this
3695 option, GCC does not compile or link anything; it just prints the
3696 file name.
3697
3698 @item -print-multi-directory
3699 @opindex print-multi-directory
3700 Print the directory name corresponding to the multilib selected by any
3701 other switches present in the command line.  This directory is supposed
3702 to exist in @env{GCC_EXEC_PREFIX}.
3703
3704 @item -print-multi-lib
3705 @opindex print-multi-lib
3706 Print the mapping from multilib directory names to compiler switches
3707 that enable them.  The directory name is separated from the switches by
3708 @samp{;}, and each switch starts with an @samp{@@} instead of the
3709 @samp{-}, without spaces between multiple switches.  This is supposed to
3710 ease shell-processing.
3711
3712 @item -print-prog-name=@var{program}
3713 @opindex print-prog-name
3714 Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
3715
3716 @item -print-libgcc-file-name
3717 @opindex print-libgcc-file-name
3718 Same as @option{-print-file-name=libgcc.a}.
3719
3720 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
3721 but you do want to link with @file{libgcc.a}.  You can do
3722
3723 @smallexample
3724 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
3725 @end smallexample
3726
3727 @item -print-search-dirs
3728 @opindex print-search-dirs
3729 Print the name of the configured installation directory and a list of
3730 program and library directories @command{gcc} will search---and don't do anything else.
3731
3732 This is useful when @command{gcc} prints the error message
3733 @samp{installation problem, cannot exec cpp0: No such file or directory}.
3734 To resolve this you either need to put @file{cpp0} and the other compiler
3735 components where @command{gcc} expects to find them, or you can set the environment
3736 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
3737 Don't forget the trailing '/'.
3738 @xref{Environment Variables}.
3739
3740 @item -dumpmachine
3741 @opindex dumpmachine
3742 Print the compiler's target machine (for example,
3743 @samp{i686-pc-linux-gnu})---and don't do anything else.
3744
3745 @item -dumpversion
3746 @opindex dumpversion
3747 Print the compiler version (for example, @samp{3.0})---and don't do
3748 anything else.
3749
3750 @item -dumpspecs
3751 @opindex dumpspecs
3752 Print the compiler's built-in specs---and don't do anything else.  (This
3753 is used when GCC itself is being built.)  @xref{Spec Files}.
3754
3755 @item -feliminate-unused-debug-types
3756 @opindex feliminate-unused-debug-types
3757 Normally, when producing DWARF2 output, GCC will emit debugging
3758 information for all types declared in a compilation
3759 unit, regardless of whether or not they are actually used
3760 in that compilation unit.  Sometimes this is useful, such as
3761 if, in the debugger, you want to cast a value to a type that is
3762 not actually used in your program (but is declared).  More often,
3763 however, this results in a significant amount of wasted space.
3764 With this option, GCC will avoid producing debug symbol output
3765 for types that are nowhere used in the source file being compiled.
3766 @end table
3767
3768 @node Optimize Options
3769 @section Options That Control Optimization
3770 @cindex optimize options
3771 @cindex options, optimization
3772
3773 These options control various sorts of optimizations.
3774
3775 Without any optimization option, the compiler's goal is to reduce the
3776 cost of compilation and to make debugging produce the expected
3777 results.  Statements are independent: if you stop the program with a
3778 breakpoint between statements, you can then assign a new value to any
3779 variable or change the program counter to any other statement in the
3780 function and get exactly the results you would expect from the source
3781 code.
3782
3783 Turning on optimization flags makes the compiler attempt to improve
3784 the performance and/or code size at the expense of compilation time
3785 and possibly the ability to debug the program.
3786
3787 The compiler performs optimization based on the knowledge it has of
3788 the program.  Optimization levels @option{-O2} and above, in
3789 particular, enable @emph{unit-at-a-time} mode, which allows the
3790 compiler to consider information gained from later functions in
3791 the file when compiling a function.  Compiling multiple files at
3792 once to a single output file in @emph{unit-at-a-time} mode allows
3793 the compiler to use information gained from all of the files when
3794 compiling each of them.
3795
3796 Not all optimizations are controlled directly by a flag.  Only
3797 optimizations that have a flag are listed.
3798
3799 @table @gcctabopt
3800 @item -O
3801 @itemx -O1
3802 @opindex O
3803 @opindex O1
3804 Optimize.  Optimizing compilation takes somewhat more time, and a lot
3805 more memory for a large function.
3806
3807 With @option{-O}, the compiler tries to reduce code size and execution
3808 time, without performing any optimizations that take a great deal of
3809 compilation time.
3810
3811 @option{-O} turns on the following optimization flags:
3812 @gccoptlist{-fdefer-pop @gol
3813 -fmerge-constants @gol
3814 -fthread-jumps @gol
3815 -floop-optimize @gol
3816 -fif-conversion @gol
3817 -fif-conversion2 @gol
3818 -fdelayed-branch @gol
3819 -fguess-branch-probability @gol
3820 -fcprop-registers}
3821
3822 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
3823 where doing so does not interfere with debugging.
3824
3825 @item -O2
3826 @opindex O2
3827 Optimize even more.  GCC performs nearly all supported optimizations
3828 that do not involve a space-speed tradeoff.  The compiler does not
3829 perform loop unrolling or function inlining when you specify @option{-O2}.
3830 As compared to @option{-O}, this option increases both compilation time
3831 and the performance of the generated code.
3832
3833 @option{-O2} turns on all optimization flags specified by @option{-O}.  It
3834 also turns on the following optimization flags:
3835 @gccoptlist{-fforce-mem @gol
3836 -foptimize-sibling-calls @gol
3837 -fstrength-reduce @gol
3838 -fcse-follow-jumps  -fcse-skip-blocks @gol
3839 -frerun-cse-after-loop  -frerun-loop-opt @gol
3840 -fgcse  -fgcse-lm  -fgcse-sm  -fgcse-las @gol
3841 -fdelete-null-pointer-checks @gol
3842 -fexpensive-optimizations @gol
3843 -fregmove @gol
3844 -fschedule-insns  -fschedule-insns2 @gol
3845 -fsched-interblock  -fsched-spec @gol
3846 -fcaller-saves @gol
3847 -fpeephole2 @gol
3848 -freorder-blocks  -freorder-functions @gol
3849 -fstrict-aliasing @gol
3850 -funit-at-a-time @gol
3851 -falign-functions  -falign-jumps @gol
3852 -falign-loops  -falign-labels @gol
3853 -fcrossjumping}
3854
3855 Please note the warning under @option{-fgcse} about
3856 invoking @option{-O2} on programs that use computed gotos.
3857
3858 @item -O3
3859 @opindex O3
3860 Optimize yet more.  @option{-O3} turns on all optimizations specified by
3861 @option{-O2} and also turns on the @option{-finline-functions},
3862 @option{-fweb} and @option{-fgcse-after-reload} options.
3863
3864 @item -O0
3865 @opindex O0
3866 Do not optimize.  This is the default.
3867
3868 @item -Os
3869 @opindex Os
3870 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations that
3871 do not typically increase code size.  It also performs further
3872 optimizations designed to reduce code size.
3873
3874 @option{-Os} disables the following optimization flags:
3875 @gccoptlist{-falign-functions  -falign-jumps  -falign-loops @gol
3876 -falign-labels  -freorder-blocks  -freorder-blocks-and-partition -fprefetch-loop-arrays}
3877
3878 If you use multiple @option{-O} options, with or without level numbers,
3879 the last such option is the one that is effective.
3880 @end table
3881
3882 Options of the form @option{-f@var{flag}} specify machine-independent
3883 flags.  Most flags have both positive and negative forms; the negative
3884 form of @option{-ffoo} would be @option{-fno-foo}.  In the table
3885 below, only one of the forms is listed---the one you typically will
3886 use.  You can figure out the other form by either removing @samp{no-}
3887 or adding it.
3888
3889 The following options control specific optimizations.  They are either
3890 activated by @option{-O} options or are related to ones that are.  You
3891 can use the following flags in the rare cases when ``fine-tuning'' of
3892 optimizations to be performed is desired.
3893
3894 @table @gcctabopt
3895 @item -fno-default-inline
3896 @opindex fno-default-inline
3897 Do not make member functions inline by default merely because they are
3898 defined inside the class scope (C++ only).  Otherwise, when you specify
3899 @w{@option{-O}}, member functions defined inside class scope are compiled
3900 inline by default; i.e., you don't need to add @samp{inline} in front of
3901 the member function name.
3902
3903 @item -fno-defer-pop
3904 @opindex fno-defer-pop
3905 Always pop the arguments to each function call as soon as that function
3906 returns.  For machines which must pop arguments after a function call,
3907 the compiler normally lets arguments accumulate on the stack for several
3908 function calls and pops them all at once.
3909
3910 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3911
3912 @item -fforce-mem
3913 @opindex fforce-mem
3914 Force memory operands to be copied into registers before doing
3915 arithmetic on them.  This produces better code by making all memory
3916 references potential common subexpressions.  When they are not common
3917 subexpressions, instruction combination should eliminate the separate
3918 register-load.
3919
3920 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3921
3922 @item -fforce-addr
3923 @opindex fforce-addr
3924 Force memory address constants to be copied into registers before
3925 doing arithmetic on them.  This may produce better code just as
3926 @option{-fforce-mem} may.
3927
3928 @item -fomit-frame-pointer
3929 @opindex fomit-frame-pointer
3930 Don't keep the frame pointer in a register for functions that
3931 don't need one.  This avoids the instructions to save, set up and
3932 restore frame pointers; it also makes an extra register available
3933 in many functions.  @strong{It also makes debugging impossible on
3934 some machines.}
3935
3936 On some machines, such as the VAX, this flag has no effect, because
3937 the standard calling sequence automatically handles the frame pointer
3938 and nothing is saved by pretending it doesn't exist.  The
3939 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
3940 whether a target machine supports this flag.  @xref{Registers,,Register
3941 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
3942
3943 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3944
3945 @item -foptimize-sibling-calls
3946 @opindex foptimize-sibling-calls
3947 Optimize sibling and tail recursive calls.
3948
3949 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3950
3951 @item -fno-inline
3952 @opindex fno-inline
3953 Don't pay attention to the @code{inline} keyword.  Normally this option
3954 is used to keep the compiler from expanding any functions inline.
3955 Note that if you are not optimizing, no functions can be expanded inline.
3956
3957 @item -finline-functions
3958 @opindex finline-functions
3959 Integrate all simple functions into their callers.  The compiler
3960 heuristically decides which functions are simple enough to be worth
3961 integrating in this way.
3962
3963 If all calls to a given function are integrated, and the function is
3964 declared @code{static}, then the function is normally not output as
3965 assembler code in its own right.
3966
3967 Enabled at level @option{-O3}.
3968
3969 @item -finline-limit=@var{n}
3970 @opindex finline-limit
3971 By default, GCC limits the size of functions that can be inlined.  This flag
3972 allows the control of this limit for functions that are explicitly marked as
3973 inline (i.e., marked with the inline keyword or defined within the class
3974 definition in c++).  @var{n} is the size of functions that can be inlined in
3975 number of pseudo instructions (not counting parameter handling).  The default
3976 value of @var{n} is 600.
3977 Increasing this value can result in more inlined code at
3978 the cost of compilation time and memory consumption.  Decreasing usually makes
3979 the compilation faster and less code will be inlined (which presumably
3980 means slower programs).  This option is particularly useful for programs that
3981 use inlining heavily such as those based on recursive templates with C++.
3982
3983 Inlining is actually controlled by a number of parameters, which may be
3984 specified individually by using @option{--param @var{name}=@var{value}}.
3985 The @option{-finline-limit=@var{n}} option sets some of these parameters
3986 as follows:
3987
3988 @table @gcctabopt
3989  @item max-inline-insns-single
3990   is set to @var{n}/2.
3991  @item max-inline-insns-auto
3992   is set to @var{n}/2.
3993  @item min-inline-insns
3994   is set to 130 or @var{n}/4, whichever is smaller.
3995  @item max-inline-insns-rtl
3996   is set to @var{n}.
3997 @end table
3998
3999 See below for a documentation of the individual
4000 parameters controlling inlining.
4001
4002 @emph{Note:} pseudo instruction represents, in this particular context, an
4003 abstract measurement of function's size.  In no way, it represents a count
4004 of assembly instructions and as such its exact meaning might change from one
4005 release to an another.
4006
4007 @item -fkeep-inline-functions
4008 @opindex fkeep-inline-functions
4009 Even if all calls to a given function are integrated, and the function
4010 is declared @code{static}, nevertheless output a separate run-time
4011 callable version of the function.  This switch does not affect
4012 @code{extern inline} functions.
4013
4014 @item -fkeep-static-consts
4015 @opindex fkeep-static-consts
4016 Emit variables declared @code{static const} when optimization isn't turned
4017 on, even if the variables aren't referenced.
4018
4019 GCC enables this option by default.  If you want to force the compiler to
4020 check if the variable was referenced, regardless of whether or not
4021 optimization is turned on, use the @option{-fno-keep-static-consts} option.
4022
4023 @item -fmerge-constants
4024 Attempt to merge identical constants (string constants and floating point
4025 constants) across compilation units.
4026
4027 This option is the default for optimized compilation if the assembler and
4028 linker support it.  Use @option{-fno-merge-constants} to inhibit this
4029 behavior.
4030
4031 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4032
4033 @item -fmerge-all-constants
4034 Attempt to merge identical constants and identical variables.
4035
4036 This option implies @option{-fmerge-constants}.  In addition to
4037 @option{-fmerge-constants} this considers e.g. even constant initialized
4038 arrays or initialized constant variables with integral or floating point
4039 types.  Languages like C or C++ require each non-automatic variable to
4040 have distinct location, so using this option will result in non-conforming
4041 behavior.
4042
4043 @item -fmodulo-sched
4044 @opindex fmodulo-sched
4045 Perform swing modulo scheduling immediately before the first scheduling
4046 pass.  This pass looks at innermost loops and reorders their
4047 instructions by overlapping different iterations.
4048
4049 @item -fnew-ra
4050 @opindex fnew-ra
4051 Use a graph coloring register allocator.  Currently this option is meant
4052 only for testing.  Users should not specify this option, since it is not
4053 yet ready for production use.
4054
4055 @item -fno-branch-count-reg
4056 @opindex fno-branch-count-reg
4057 Do not use ``decrement and branch'' instructions on a count register,
4058 but instead generate a sequence of instructions that decrement a
4059 register, compare it against zero, then branch based upon the result.
4060 This option is only meaningful on architectures that support such
4061 instructions, which include x86, PowerPC, IA-64 and S/390.
4062
4063 The default is @option{-fbranch-count-reg}, enabled when
4064 @option{-fstrength-reduce} is enabled.
4065
4066 @item -fno-function-cse
4067 @opindex fno-function-cse
4068 Do not put function addresses in registers; make each instruction that
4069 calls a constant function contain the function's address explicitly.
4070
4071 This option results in less efficient code, but some strange hacks
4072 that alter the assembler output may be confused by the optimizations
4073 performed when this option is not used.
4074
4075 The default is @option{-ffunction-cse}
4076
4077 @item -fno-zero-initialized-in-bss
4078 @opindex fno-zero-initialized-in-bss
4079 If the target supports a BSS section, GCC by default puts variables that
4080 are initialized to zero into BSS@.  This can save space in the resulting
4081 code.
4082
4083 This option turns off this behavior because some programs explicitly
4084 rely on variables going to the data section.  E.g., so that the
4085 resulting executable can find the beginning of that section and/or make
4086 assumptions based on that.
4087
4088 The default is @option{-fzero-initialized-in-bss}.
4089
4090 @item -fbounds-check
4091 @opindex fbounds-check
4092 For front-ends that support it, generate additional code to check that
4093 indices used to access arrays are within the declared range.  This is
4094 currently only supported by the Java and Fortran front-ends, where
4095 this option defaults to true and false respectively.
4096
4097 @item -fmudflap -fmudflapth -fmudflapir
4098 @opindex fmudflap
4099 @opindex fmudflapth
4100 @opindex fmudflapir
4101 @cindex bounds checking
4102 @cindex mudflap
4103 For front-ends that support it (C and C++), instrument all risky
4104 pointer/array dereferencing operations, some standard library
4105 string/heap functions, and some other associated constructs with
4106 range/validity tests.  Modules so instrumented should be immune to
4107 buffer overflows, invalid heap use, and some other classes of C/C++
4108 programming errors.  The instrumentation relies on a separate runtime
4109 library (@file{libmudflap}), which will be linked into a program if
4110 @option{-fmudflap} is given at link time.  Run-time behavior of the
4111 instrumented program is controlled by the @env{MUDFLAP_OPTIONS}
4112 environment variable.  See @code{env MUDFLAP_OPTIONS=-help a.out}
4113 for its options.
4114
4115 Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to
4116 link if your program is multi-threaded.  Use @option{-fmudflapir}, in
4117 addition to @option{-fmudflap} or @option{-fmudflapth}, if
4118 instrumentation should ignore pointer reads.  This produces less
4119 instrumentation (and therefore faster execution) and still provides
4120 some protection against outright memory corrupting writes, but allows
4121 erroneously read data to propagate within a program.
4122
4123 @item -fstrength-reduce
4124 @opindex fstrength-reduce
4125 Perform the optimizations of loop strength reduction and
4126 elimination of iteration variables.
4127
4128 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4129
4130 @item -fthread-jumps
4131 @opindex fthread-jumps
4132 Perform optimizations where we check to see if a jump branches to a
4133 location where another comparison subsumed by the first is found.  If
4134 so, the first branch is redirected to either the destination of the
4135 second branch or a point immediately following it, depending on whether
4136 the condition is known to be true or false.
4137
4138 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4139
4140 @item -fcse-follow-jumps
4141 @opindex fcse-follow-jumps
4142 In common subexpression elimination, scan through jump instructions
4143 when the target of the jump is not reached by any other path.  For
4144 example, when CSE encounters an @code{if} statement with an
4145 @code{else} clause, CSE will follow the jump when the condition
4146 tested is false.
4147
4148 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4149
4150 @item -fcse-skip-blocks
4151 @opindex fcse-skip-blocks
4152 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
4153 follow jumps which conditionally skip over blocks.  When CSE
4154 encounters a simple @code{if} statement with no else clause,
4155 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
4156 body of the @code{if}.
4157
4158 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4159
4160 @item -frerun-cse-after-loop
4161 @opindex frerun-cse-after-loop
4162 Re-run common subexpression elimination after loop optimizations has been
4163 performed.
4164
4165 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4166
4167 @item -frerun-loop-opt
4168 @opindex frerun-loop-opt
4169 Run the loop optimizer twice.
4170
4171 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4172
4173 @item -fgcse
4174 @opindex fgcse
4175 Perform a global common subexpression elimination pass.
4176 This pass also performs global constant and copy propagation.
4177
4178 @emph{Note:} When compiling a program using computed gotos, a GCC
4179 extension, you may get better runtime performance if you disable
4180 the global common subexpression elimination pass by adding
4181 @option{-fno-gcse} to the command line.
4182
4183 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4184
4185 @item -fgcse-lm
4186 @opindex fgcse-lm
4187 When @option{-fgcse-lm} is enabled, global common subexpression elimination will
4188 attempt to move loads which are only killed by stores into themselves.  This
4189 allows a loop containing a load/store sequence to be changed to a load outside
4190 the loop, and a copy/store within the loop.
4191
4192 Enabled by default when gcse is enabled.
4193
4194 @item -fgcse-sm
4195 @opindex fgcse-sm
4196 When @option{-fgcse-sm} is enabled, a store motion pass is run after
4197 global common subexpression elimination.  This pass will attempt to move
4198 stores out of loops.  When used in conjunction with @option{-fgcse-lm},
4199 loops containing a load/store sequence can be changed to a load before
4200 the loop and a store after the loop.
4201
4202 Enabled by default when gcse is enabled.
4203
4204 @item -fgcse-las
4205 @opindex fgcse-las
4206 When @option{-fgcse-las} is enabled, the global common subexpression
4207 elimination pass eliminates redundant loads that come after stores to the
4208 same memory location (both partial and full redundancies).
4209
4210 Enabled by default when gcse is enabled.
4211
4212 @item -fgcse-after-reload
4213 @opindex fgcse-after-reload
4214 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
4215 pass is performed after reload. The purpose of this pass is to cleanup
4216 redundant spilling.
4217
4218 @item -floop-optimize
4219 @opindex floop-optimize
4220 Perform loop optimizations: move constant expressions out of loops, simplify
4221 exit test conditions and optionally do strength-reduction and loop unrolling as
4222 well.
4223
4224 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4225
4226 @item -floop-optimize2
4227 @opindex floop-optimize2
4228 Perform loop optimizations using the new loop optimizer.  The optimizations
4229 (loop unrolling, peeling and unswitching, loop invariant motion) are enabled
4230 by separate flags.
4231
4232 @item -fcrossjumping
4233 @opindex crossjumping
4234 Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The
4235 resulting code may or may not perform better than without cross-jumping.
4236
4237 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4238
4239 @item -fif-conversion
4240 @opindex if-conversion
4241 Attempt to transform conditional jumps into branch-less equivalents.  This
4242 include use of conditional moves, min, max, set flags and abs instructions, and
4243 some tricks doable by standard arithmetics.  The use of conditional execution
4244 on chips where it is available is controlled by @code{if-conversion2}.
4245
4246 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4247
4248 @item -fif-conversion2
4249 @opindex if-conversion2
4250 Use conditional execution (where available) to transform conditional jumps into
4251 branch-less equivalents.
4252
4253 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4254
4255 @item -fdelete-null-pointer-checks
4256 @opindex fdelete-null-pointer-checks
4257 Use global dataflow analysis to identify and eliminate useless checks
4258 for null pointers.  The compiler assumes that dereferencing a null
4259 pointer would have halted the program.  If a pointer is checked after
4260 it has already been dereferenced, it cannot be null.
4261
4262 In some environments, this assumption is not true, and programs can
4263 safely dereference null pointers.  Use
4264 @option{-fno-delete-null-pointer-checks} to disable this optimization
4265 for programs which depend on that behavior.
4266
4267 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4268
4269 @item -fexpensive-optimizations
4270 @opindex fexpensive-optimizations
4271 Perform a number of minor optimizations that are relatively expensive.
4272
4273 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4274
4275 @item -foptimize-register-move
4276 @itemx -fregmove
4277 @opindex foptimize-register-move
4278 @opindex fregmove
4279 Attempt to reassign register numbers in move instructions and as
4280 operands of other simple instructions in order to maximize the amount of
4281 register tying.  This is especially helpful on machines with two-operand
4282 instructions.
4283
4284 Note @option{-fregmove} and @option{-foptimize-register-move} are the same
4285 optimization.
4286
4287 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4288
4289 @item -fdelayed-branch
4290 @opindex fdelayed-branch
4291 If supported for the target machine, attempt to reorder instructions
4292 to exploit instruction slots available after delayed branch
4293 instructions.
4294
4295 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4296
4297 @item -fschedule-insns
4298 @opindex fschedule-insns
4299 If supported for the target machine, attempt to reorder instructions to
4300 eliminate execution stalls due to required data being unavailable.  This
4301 helps machines that have slow floating point or memory load instructions
4302 by allowing other instructions to be issued until the result of the load
4303 or floating point instruction is required.
4304
4305 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4306
4307 @item -fschedule-insns2
4308 @opindex fschedule-insns2
4309 Similar to @option{-fschedule-insns}, but requests an additional pass of
4310 instruction scheduling after register allocation has been done.  This is
4311 especially useful on machines with a relatively small number of
4312 registers and where memory load instructions take more than one cycle.
4313
4314 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4315
4316 @item -fno-sched-interblock
4317 @opindex fno-sched-interblock
4318 Don't schedule instructions across basic blocks.  This is normally
4319 enabled by default when scheduling before register allocation, i.e.@:
4320 with @option{-fschedule-insns} or at @option{-O2} or higher.
4321
4322 @item -fno-sched-spec
4323 @opindex fno-sched-spec
4324 Don't allow speculative motion of non-load instructions.  This is normally
4325 enabled by default when scheduling before register allocation, i.e.@:
4326 with @option{-fschedule-insns} or at @option{-O2} or higher.
4327
4328 @item -fsched-spec-load
4329 @opindex fsched-spec-load
4330 Allow speculative motion of some load instructions.  This only makes
4331 sense when scheduling before register allocation, i.e.@: with
4332 @option{-fschedule-insns} or at @option{-O2} or higher.
4333
4334 @item -fsched-spec-load-dangerous
4335 @opindex fsched-spec-load-dangerous
4336 Allow speculative motion of more load instructions.  This only makes
4337 sense when scheduling before register allocation, i.e.@: with
4338 @option{-fschedule-insns} or at @option{-O2} or higher.
4339
4340 @item -fsched-stalled-insns=@var{n}
4341 @opindex fsched-stalled-insns
4342 Define how many insns (if any) can be moved prematurely from the queue
4343 of stalled insns into the ready list, during the second scheduling pass.
4344
4345 @item -fsched-stalled-insns-dep=@var{n}
4346 @opindex fsched-stalled-insns-dep
4347 Define how many insn groups (cycles) will be examined for a dependency
4348 on a stalled insn that is candidate for premature removal from the queue
4349 of stalled insns.  Has an effect only during the second scheduling pass,
4350 and only if @option{-fsched-stalled-insns} is used and its value is not zero.
4351
4352 @item -fsched2-use-superblocks
4353 @opindex fsched2-use-superblocks
4354 When scheduling after register allocation, do use superblock scheduling
4355 algorithm.  Superblock scheduling allows motion across basic block boundaries
4356 resulting on faster schedules.  This option is experimental, as not all machine
4357 descriptions used by GCC model the CPU closely enough to avoid unreliable
4358 results from the algorithm.
4359
4360 This only makes sense when scheduling after register allocation, i.e.@: with
4361 @option{-fschedule-insns2} or at @option{-O2} or higher.
4362
4363 @item -fsched2-use-traces
4364 @opindex fsched2-use-traces
4365 Use @option{-fsched2-use-superblocks} algorithm when scheduling after register
4366 allocation and additionally perform code duplication in order to increase the
4367 size of superblocks using tracer pass.  See @option{-ftracer} for details on
4368 trace formation.
4369
4370 This mode should produce faster but significantly longer programs.  Also
4371 without @code{-fbranch-probabilities} the traces constructed may not match the
4372 reality and hurt the performance.  This only makes
4373 sense when scheduling after register allocation, i.e.@: with
4374 @option{-fschedule-insns2} or at @option{-O2} or higher.
4375
4376 @item -fcaller-saves
4377 @opindex fcaller-saves
4378 Enable values to be allocated in registers that will be clobbered by
4379 function calls, by emitting extra instructions to save and restore the
4380 registers around such calls.  Such allocation is done only when it
4381 seems to result in better code than would otherwise be produced.
4382
4383 This option is always enabled by default on certain machines, usually
4384 those which have no call-preserved registers to use instead.
4385
4386 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4387
4388 @item -ftree-pre
4389 Perform Partial Redundancy Elimination (PRE) on trees.  This flag is
4390 enabled by default at -O and higher.
4391
4392 @item -ftree-fre
4393 Perform Full Redundancy Elimination (FRE) on trees.  The difference
4394 between FRE and PRE is that FRE only considers expressions
4395 that are computed on all paths leading to the redundant computation.
4396 This analysis faster than PRE, though it exposes fewer redundancies.
4397 This flag is enabled by default at -O and higher.
4398
4399 @item -ftree-ccp
4400 Perform sparse conditional constant propagation (CCP) on trees.  This flag
4401 is enabled by default at -O and higher.
4402
4403 @item -ftree-dce
4404 Perform dead code elimination (DCE) on trees.  This flag is enabled by
4405 default at -O and higher.
4406
4407 @item -ftree-dominator-opts
4408 Perform dead code elimination (DCE) on trees.  This flag is enabled by
4409 default at -O and higher.
4410
4411 @item -ftree-ch
4412 Perform loop header copying on trees.  This is beneficial since it increases
4413 effectivity of code motion optimizations.  It also saves one jump.  This flag
4414 is enabled by default at -O and higher.  It is not enabled for -Os, since it
4415 usually increases code size.
4416
4417 @item -ftree-loop-optimize
4418 Perform loop optimizations on trees.  This flag is enabled by default at -O
4419 and higher.
4420
4421 @item -ftree-lim
4422 Perform loop invariant motion on trees.  This pass moves only invartiants that
4423 would be hard to handle on rtl level (function calls, operations that expand to
4424 nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
4425 operands of conditions that are invariant out of the loop, so that we can use
4426 just trivial invariantness analysis in loop unswitching.  The pass also includes
4427 store motion.
4428
4429 @item -ftree-sra
4430 Perform scalar replacement of aggregates.  This pass replaces structure
4431 references with scalars to prevent committing structures to memory too
4432 early.  This flag is enabled by default at -O and higher.
4433
4434 @item -ftree-copyrename
4435 Perform copy renaming on trees.  This pass attempts to rename compiler
4436 temporaries to other variables at copy locations, usually resulting in
4437 variable names which more closely resemble the original variables.  This flag
4438 is enabled by default at -O and higher.
4439
4440 @item -ftree-ter
4441 Perform temporary expression replacement during the SSA->normal phase.  Single
4442 use/single def temporaries are replaced at their use location with their
4443 defining expression.  This results in non-GIMPLE code, but gives the expanders
4444 much more complex trees to work on resulting in better RTL generation.  This is
4445 enabled by default at -O and higher.
4446
4447 @item -ftree-lrs
4448 Perform live range splitting during the SSA->normal phase.  Distinct live
4449 ranges of a variable are split into unique variables, allowing for better
4450 optimization later.  This is enabled by default at -O and higher.
4451
4452 @item -ftracer
4453 @opindex ftracer
4454 Perform tail duplication to enlarge superblock size. This transformation
4455 simplifies the control flow of the function allowing other optimizations to do
4456 better job.
4457
4458 @item -funroll-loops
4459 @opindex funroll-loops
4460 Unroll loops whose number of iterations can be determined at compile
4461 time or upon entry to the loop.  @option{-funroll-loops} implies both
4462 @option{-fstrength-reduce} and @option{-frerun-cse-after-loop}.  This
4463 option makes code larger, and may or may not make it run faster.
4464
4465 @item -funroll-all-loops
4466 @opindex funroll-all-loops
4467 Unroll all loops, even if their number of iterations is uncertain when
4468 the loop is entered.  This usually makes programs run more slowly.
4469 @option{-funroll-all-loops} implies the same options as
4470 @option{-funroll-loops},
4471
4472 @item -fprefetch-loop-arrays
4473 @opindex fprefetch-loop-arrays
4474 If supported by the target machine, generate instructions to prefetch
4475 memory to improve the performance of loops that access large arrays.
4476
4477 @item -fmove-all-movables
4478 @opindex fmove-all-movables
4479 Forces all invariant computations in loops to be moved
4480 outside the loop.
4481
4482 @item -freduce-all-givs
4483 @opindex freduce-all-givs
4484 Forces all general-induction variables in loops to be
4485 strength-reduced.
4486
4487 @emph{Note:} When compiling programs written in Fortran,
4488 @option{-fmove-all-movables} and @option{-freduce-all-givs} are enabled
4489 by default when you use the optimizer.
4490
4491 These options may generate better or worse code; results are highly
4492 dependent on the structure of loops within the source code.
4493
4494 These two options are intended to be removed someday, once
4495 they have helped determine the efficacy of various
4496 approaches to improving loop optimizations.
4497
4498 Please contact @w{@email{gcc@@gcc.gnu.org}}, and describe how use of
4499 these options affects the performance of your production code.
4500 Examples of code that runs @emph{slower} when these options are
4501 @emph{enabled} are very valuable.
4502
4503 @item -fno-peephole
4504 @itemx -fno-peephole2
4505 @opindex fno-peephole
4506 @opindex fno-peephole2
4507 Disable any machine-specific peephole optimizations.  The difference
4508 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
4509 are implemented in the compiler; some targets use one, some use the
4510 other, a few use both.
4511
4512 @option{-fpeephole} is enabled by default.
4513 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4514
4515 @item -fno-guess-branch-probability
4516 @opindex fno-guess-branch-probability
4517 Do not guess branch probabilities using a randomized model.
4518
4519 Sometimes GCC will opt to use a randomized model to guess branch
4520 probabilities, when none are available from either profiling feedback
4521 (@option{-fprofile-arcs}) or @samp{__builtin_expect}.  This means that
4522 different runs of the compiler on the same program may produce different
4523 object code.
4524
4525 In a hard real-time system, people don't want different runs of the
4526 compiler to produce code that has different behavior; minimizing
4527 non-determinism is of paramount import.  This switch allows users to
4528 reduce non-determinism, possibly at the expense of inferior
4529 optimization.
4530
4531 The default is @option{-fguess-branch-probability} at levels
4532 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4533
4534 @item -freorder-blocks
4535 @opindex freorder-blocks
4536 Reorder basic blocks in the compiled function in order to reduce number of
4537 taken branches and improve code locality.
4538
4539 Enabled at levels @option{-O2}, @option{-O3}.
4540
4541 @item -freorder-blocks-and-partition
4542 @opindex freorder-blocks-and-partition
4543 In addition to reordering basic blocks in the compiled function, in order
4544 to reduce number of taken branches, partitions hot and cold basic blocks
4545 into separate sections of the assembly and .o files, to improve
4546 paging and cache locality performance.
4547
4548 @item -freorder-functions
4549 @opindex freorder-functions
4550 Reorder basic blocks in the compiled function in order to reduce number of
4551 taken branches and improve code locality. This is implemented by using special
4552 subsections @code{.text.hot} for most frequently executed functions and
4553 @code{.text.unlikely} for unlikely executed functions.  Reordering is done by
4554 the linker so object file format must support named sections and linker must
4555 place them in a reasonable way.
4556
4557 Also profile feedback must be available in to make this option effective.  See
4558 @option{-fprofile-arcs} for details.
4559
4560 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4561
4562 @item -fstrict-aliasing
4563 @opindex fstrict-aliasing
4564 Allows the compiler to assume the strictest aliasing rules applicable to
4565 the language being compiled.  For C (and C++), this activates
4566 optimizations based on the type of expressions.  In particular, an
4567 object of one type is assumed never to reside at the same address as an
4568 object of a different type, unless the types are almost the same.  For
4569 example, an @code{unsigned int} can alias an @code{int}, but not a
4570 @code{void*} or a @code{double}.  A character type may alias any other
4571 type.
4572
4573 Pay special attention to code like this:
4574 @smallexample
4575 union a_union @{
4576   int i;
4577   double d;
4578 @};
4579
4580 int f() @{
4581   a_union t;
4582   t.d = 3.0;
4583   return t.i;
4584 @}
4585 @end smallexample
4586 The practice of reading from a different union member than the one most
4587 recently written to (called ``type-punning'') is common.  Even with
4588 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
4589 is accessed through the union type.  So, the code above will work as
4590 expected.  However, this code might not:
4591 @smallexample
4592 int f() @{
4593   a_union t;
4594   int* ip;
4595   t.d = 3.0;
4596   ip = &t.i;
4597   return *ip;
4598 @}
4599 @end smallexample
4600
4601 Every language that wishes to perform language-specific alias analysis
4602 should define a function that computes, given an @code{tree}
4603 node, an alias set for the node.  Nodes in different alias sets are not
4604 allowed to alias.  For an example, see the C front-end function
4605 @code{c_get_alias_set}.
4606
4607 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4608
4609 @item -falign-functions
4610 @itemx -falign-functions=@var{n}
4611 @opindex falign-functions
4612 Align the start of functions to the next power-of-two greater than
4613 @var{n}, skipping up to @var{n} bytes.  For instance,
4614 @option{-falign-functions=32} aligns functions to the next 32-byte
4615 boundary, but @option{-falign-functions=24} would align to the next
4616 32-byte boundary only if this can be done by skipping 23 bytes or less.
4617
4618 @option{-fno-align-functions} and @option{-falign-functions=1} are
4619 equivalent and mean that functions will not be aligned.
4620
4621 Some assemblers only support this flag when @var{n} is a power of two;
4622 in that case, it is rounded up.
4623
4624 If @var{n} is not specified or is zero, use a machine-dependent default.
4625
4626 Enabled at levels @option{-O2}, @option{-O3}.
4627
4628 @item -falign-labels
4629 @itemx -falign-labels=@var{n}
4630 @opindex falign-labels
4631 Align all branch targets to a power-of-two boundary, skipping up to
4632 @var{n} bytes like @option{-falign-functions}.  This option can easily
4633 make code slower, because it must insert dummy operations for when the
4634 branch target is reached in the usual flow of the code.
4635
4636 @option{-fno-align-labels} and @option{-falign-labels=1} are
4637 equivalent and mean that labels will not be aligned.
4638
4639 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
4640 are greater than this value, then their values are used instead.
4641
4642 If @var{n} is not specified or is zero, use a machine-dependent default
4643 which is very likely to be @samp{1}, meaning no alignment.
4644
4645 Enabled at levels @option{-O2}, @option{-O3}.
4646
4647 @item -falign-loops
4648 @itemx -falign-loops=@var{n}
4649 @opindex falign-loops
4650 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
4651 like @option{-falign-functions}.  The hope is that the loop will be
4652 executed many times, which will make up for any execution of the dummy
4653 operations.
4654
4655 @option{-fno-align-loops} and @option{-falign-loops=1} are
4656 equivalent and mean that loops will not be aligned.
4657
4658 If @var{n} is not specified or is zero, use a machine-dependent default.
4659
4660 Enabled at levels @option{-O2}, @option{-O3}.
4661
4662 @item -falign-jumps
4663 @itemx -falign-jumps=@var{n}
4664 @opindex falign-jumps
4665 Align branch targets to a power-of-two boundary, for branch targets
4666 where the targets can only be reached by jumping, skipping up to @var{n}
4667 bytes like @option{-falign-functions}.  In this case, no dummy operations
4668 need be executed.
4669
4670 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
4671 equivalent and mean that loops will not be aligned.
4672
4673 If @var{n} is not specified or is zero, use a machine-dependent default.
4674
4675 Enabled at levels @option{-O2}, @option{-O3}.
4676
4677 @item -funit-at-a-time
4678 @opindex funit-at-a-time
4679 Parse the whole compilation unit before starting to produce code.
4680 This allows some extra optimizations to take place but consumes
4681 more memory (in general).  There are some compatibility issues
4682 with @emph{unit-at-at-time} mode:
4683 @itemize @bullet
4684 @item
4685 enabling @emph{unit-at-a-time} mode may change the order
4686 in which functions, variables, and top-level @code{asm} statements
4687 are emitted, and will likely break code relying on some particular
4688 ordering.  The majority of such top-level @code{asm} statements,
4689 though, can be replaced by @code{section} attributes.
4690
4691 @item
4692 @emph{unit-at-a-time} mode removes unreferenced static variables
4693 and functions are removed.  This may result in undefined references
4694 when an @code{asm} statement refers directly to variables or functions
4695 that are otherwise unused.  In that case either the variable/function
4696 shall be listed as an operand of the @code{asm} statement operand or,
4697 in the case of top-level @code{asm} statements the attribute @code{used}
4698 shall be used on the declaration.
4699
4700 @item
4701 Static functions now can use non-standard passing conventions that
4702 may break @code{asm} statements calling functions directly. Again,
4703 attribute @code{used} will prevent this behavior.
4704 @end itemize
4705
4706 As a temporary workaround, @option{-fno-unit-at-a-time} can be used,
4707 but this scheme may not be supported by future releases of GCC.
4708
4709 Enabled at levels @option{-O2}, @option{-O3}.
4710
4711 @item -fweb
4712 @opindex fweb
4713 Constructs webs as commonly used for register allocation purposes and assign
4714 each web individual pseudo register.  This allows the register allocation pass
4715 to operate on pseudos directly, but also strengthens several other optimization
4716 passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
4717 however, make debugging impossible, since variables will no longer stay in a
4718 ``home register''.
4719
4720 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os},
4721 on targets where the default format for debugging information supports
4722 variable tracking.
4723
4724 @item -fno-cprop-registers
4725 @opindex fno-cprop-registers
4726 After register allocation and post-register allocation instruction splitting,
4727 we perform a copy-propagation pass to try to reduce scheduling dependencies
4728 and occasionally eliminate the copy.
4729
4730 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4731
4732 @item -fprofile-generate
4733 @opindex fprofile-generate
4734
4735 Enable options usually used for instrumenting application to produce
4736 profile useful for later recompilation with profile feedback based
4737 optimization.  You must use @code{-fprofile-generate} both when
4738 compiling and when linking your program.
4739
4740 The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
4741
4742 @item -fprofile-use
4743 @opindex fprofile-use
4744 Enable profile feedback directed optimizations, and optimizations
4745 generally profitable only with profile feedback available.
4746
4747 The following options are enabled: @code{-fbranch-probabilities},
4748 @code{-fvpt}, @code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}.
4749
4750 @end table
4751
4752 The following options control compiler behavior regarding floating
4753 point arithmetic.  These options trade off between speed and
4754 correctness.  All must be specifically enabled.
4755
4756 @table @gcctabopt
4757 @item -ffloat-store
4758 @opindex ffloat-store
4759 Do not store floating point variables in registers, and inhibit other
4760 options that might change whether a floating point value is taken from a
4761 register or memory.
4762
4763 @cindex floating point precision
4764 This option prevents undesirable excess precision on machines such as
4765 the 68000 where the floating registers (of the 68881) keep more
4766 precision than a @code{double} is supposed to have.  Similarly for the
4767 x86 architecture.  For most programs, the excess precision does only
4768 good, but a few programs rely on the precise definition of IEEE floating
4769 point.  Use @option{-ffloat-store} for such programs, after modifying
4770 them to store all pertinent intermediate computations into variables.
4771
4772 @item -ffast-math
4773 @opindex ffast-math
4774 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @*
4775 @option{-fno-trapping-math}, @option{-ffinite-math-only},
4776 @option{-fno-rounding-math} and @option{-fno-signaling-nans}.
4777
4778 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
4779
4780 This option should never be turned on by any @option{-O} option since
4781 it can result in incorrect output for programs which depend on
4782 an exact implementation of IEEE or ISO rules/specifications for
4783 math functions.
4784
4785 @item -fno-math-errno
4786 @opindex fno-math-errno
4787 Do not set ERRNO after calling math functions that are executed
4788 with a single instruction, e.g., sqrt.  A program that relies on
4789 IEEE exceptions for math error handling may want to use this flag
4790 for speed while maintaining IEEE arithmetic compatibility.
4791
4792 This option should never be turned on by any @option{-O} option since
4793 it can result in incorrect output for programs which depend on
4794 an exact implementation of IEEE or ISO rules/specifications for
4795 math functions.
4796
4797 The default is @option{-fmath-errno}.
4798
4799 @item -funsafe-math-optimizations
4800 @opindex funsafe-math-optimizations
4801 Allow optimizations for floating-point arithmetic that (a) assume
4802 that arguments and results are valid and (b) may violate IEEE or
4803 ANSI standards.  When used at link-time, it may include libraries
4804 or startup files that change the default FPU control word or other
4805 similar optimizations.
4806
4807 This option should never be turned on by any @option{-O} option since
4808 it can result in incorrect output for programs which depend on
4809 an exact implementation of IEEE or ISO rules/specifications for
4810 math functions.
4811
4812 The default is @option{-fno-unsafe-math-optimizations}.
4813
4814 @item -ffinite-math-only
4815 @opindex ffinite-math-only
4816 Allow optimizations for floating-point arithmetic that assume
4817 that arguments and results are not NaNs or +-Infs.
4818
4819 This option should never be turned on by any @option{-O} option since
4820 it can result in incorrect output for programs which depend on
4821 an exact implementation of IEEE or ISO rules/specifications.
4822
4823 The default is @option{-fno-finite-math-only}.
4824
4825 @item -fno-trapping-math
4826 @opindex fno-trapping-math
4827 Compile code assuming that floating-point operations cannot generate
4828 user-visible traps.  These traps include division by zero, overflow,
4829 underflow, inexact result and invalid operation.  This option implies
4830 @option{-fno-signaling-nans}.  Setting this option may allow faster
4831 code if one relies on ``non-stop'' IEEE arithmetic, for example.
4832
4833 This option should never be turned on by any @option{-O} option since
4834 it can result in incorrect output for programs which depend on
4835 an exact implementation of IEEE or ISO rules/specifications for
4836 math functions.
4837
4838 The default is @option{-ftrapping-math}.
4839
4840 @item -frounding-math
4841 @opindex frounding-math
4842 Disable transformations and optimizations that assume default floating
4843 point rounding behavior.  This is round-to-zero for all floating point
4844 to integer conversions, and round-to-nearest for all other arithmetic
4845 truncations.  This option should be specified for programs that change
4846 the FP rounding mode dynamically, or that may be executed with a
4847 non-default rounding mode.  This option disables constant folding of
4848 floating point expressions at compile-time (which may be affected by
4849 rounding mode) and arithmetic transformations that are unsafe in the
4850 presence of sign-dependent rounding modes.
4851
4852 The default is @option{-fno-rounding-math}.
4853
4854 This option is experimental and does not currently guarantee to
4855 disable all GCC optimizations that are affected by rounding mode.
4856 Future versions of GCC may provide finer control of this setting
4857 using C99's @code{FENV_ACCESS} pragma.  This command line option
4858 will be used to specify the default state for @code{FENV_ACCESS}.
4859
4860 @item -fsignaling-nans
4861 @opindex fsignaling-nans
4862 Compile code assuming that IEEE signaling NaNs may generate user-visible
4863 traps during floating-point operations.  Setting this option disables
4864 optimizations that may change the number of exceptions visible with
4865 signaling NaNs.  This option implies @option{-ftrapping-math}.
4866
4867 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
4868 be defined.
4869
4870 The default is @option{-fno-signaling-nans}.
4871
4872 This option is experimental and does not currently guarantee to
4873 disable all GCC optimizations that affect signaling NaN behavior.
4874
4875 @item -fsingle-precision-constant
4876 @opindex fsingle-precision-constant
4877 Treat floating point constant as single precision constant instead of
4878 implicitly converting it to double precision constant.
4879
4880
4881 @end table
4882
4883 The following options control optimizations that may improve
4884 performance, but are not enabled by any @option{-O} options.  This
4885 section includes experimental options that may produce broken code.
4886
4887 @table @gcctabopt
4888 @item -fbranch-probabilities
4889 @opindex fbranch-probabilities
4890 After running a program compiled with @option{-fprofile-arcs}
4891 (@pxref{Debugging Options,, Options for Debugging Your Program or
4892 @command{gcc}}), you can compile it a second time using
4893 @option{-fbranch-probabilities}, to improve optimizations based on
4894 the number of times each branch was taken.  When the program
4895 compiled with @option{-fprofile-arcs} exits it saves arc execution
4896 counts to a file called @file{@var{sourcename}.gcda} for each source
4897 file  The information in this data file is very dependent on the
4898 structure of the generated code, so you must use the same source code
4899 and the same optimization options for both compilations.
4900
4901 With @option{-fbranch-probabilities}, GCC puts a
4902 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
4903 These can be used to improve optimization.  Currently, they are only
4904 used in one place: in @file{reorg.c}, instead of guessing which path a
4905 branch is mostly to take, the @samp{REG_BR_PROB} values are used to
4906 exactly determine which path is taken more often.
4907
4908 @item -fprofile-values
4909 @opindex fprofile-values
4910 If combined with @option{-fprofile-arcs}, it adds code so that some
4911 data about values of expressions in the program is gathered.
4912
4913 With @option{-fbranch-probabilities}, it reads back the data gathered
4914 from profiling values of expressions and adds @samp{REG_VALUE_PROFILE}
4915 notes to instructions for their later usage in optimizations.
4916
4917 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
4918
4919 @item -fvpt
4920 @opindex fvpt
4921 If combined with @option{-fprofile-arcs}, it instructs the compiler to add
4922 a code to gather information about values of expressions.
4923
4924 With @option{-fbranch-probabilities}, it reads back the data gathered
4925 and actually performs the optimizations based on them.
4926 Currently the optimizations include specialization of division operation
4927 using the knowledge about the value of the denominator.
4928
4929 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
4930
4931 @item -frename-registers
4932 @opindex frename-registers
4933 Attempt to avoid false dependencies in scheduled code by making use
4934 of registers left over after register allocation.  This optimization
4935 will most benefit processors with lots of registers.  Depending on the
4936 debug information format adopted by the target, however, it can
4937 make debugging impossible, since variables will no longer stay in
4938 a ``home register''.
4939
4940 Not enabled by default at any level because it has known bugs.
4941
4942 @item -fnew-ra
4943 @opindex fnew-ra
4944 Use a graph coloring register allocator.  Currently this option is meant
4945 for testing, so we are interested to hear about miscompilations with
4946 @option{-fnew-ra}.
4947
4948 @item -ftracer
4949 @opindex ftracer
4950 Perform tail duplication to enlarge superblock size. This transformation
4951 simplifies the control flow of the function allowing other optimizations to do
4952 better job.
4953
4954 Enabled with @option{-fprofile-use}.
4955
4956 @item -funroll-loops
4957 @opindex funroll-loops
4958 Unroll loops whose number of iterations can be determined at compile time or
4959 upon entry to the loop.  @option{-funroll-loops} implies
4960 @option{-frerun-cse-after-loop}.  It also turns on complete loop peeling
4961 (i.e. complete removal of loops with small constant number of iterations).
4962 This option makes code larger, and may or may not make it run faster.
4963
4964 Enabled with @option{-fprofile-use}.
4965
4966 @item -funroll-all-loops
4967 @opindex funroll-all-loops
4968 Unroll all loops, even if their number of iterations is uncertain when
4969 the loop is entered.  This usually makes programs run more slowly.
4970 @option{-funroll-all-loops} implies the same options as
4971 @option{-funroll-loops}.
4972
4973 @item -fpeel-loops
4974 @opindex fpeel-loops
4975 Peels the loops for that there is enough information that they do not
4976 roll much (from profile feedback).  It also turns on complete loop peeling
4977 (i.e. complete removal of loops with small constant number of iterations).
4978
4979 Enabled with @option{-fprofile-use}.
4980
4981 @item -fmove-loop-invariants
4982 @opindex fmove-loop-invariants
4983 Enables the loop invariant motion pass in the new loop optimizer.  Enabled
4984 at level @option{-O1}
4985
4986 @item -funswitch-loops
4987 @opindex funswitch-loops
4988 Move branches with loop invariant conditions out of the loop, with duplicates
4989 of the loop on both branches (modified according to result of the condition).
4990
4991 @item -fold-unroll-loops
4992 @opindex fold-unroll-loops
4993 Unroll loops whose number of iterations can be determined at compile
4994 time or upon entry to the loop, using the old loop unroller whose loop
4995 recognition is based on notes from frontend.  @option{-fold-unroll-loops} implies
4996 both @option{-fstrength-reduce} and @option{-frerun-cse-after-loop}.  This
4997 option makes code larger, and may or may not make it run faster.
4998
4999 @item -fold-unroll-all-loops
5000 @opindex fold-unroll-all-loops
5001 Unroll all loops, even if their number of iterations is uncertain when
5002 the loop is entered. This is done using the old loop unroller whose loop
5003 recognition is based on notes from frontend.  This usually makes programs run more slowly.
5004 @option{-fold-unroll-all-loops} implies the same options as
5005 @option{-fold-unroll-loops}.
5006
5007 @item -fprefetch-loop-arrays
5008 @opindex fprefetch-loop-arrays
5009 If supported by the target machine, generate instructions to prefetch
5010 memory to improve the performance of loops that access large arrays.
5011
5012 Disabled at level @option{-Os}.
5013
5014 @item -ffunction-sections
5015 @itemx -fdata-sections
5016 @opindex ffunction-sections
5017 @opindex fdata-sections
5018 Place each function or data item into its own section in the output
5019 file if the target supports arbitrary sections.  The name of the
5020 function or the name of the data item determines the section's name
5021 in the output file.
5022
5023 Use these options on systems where the linker can perform optimizations
5024 to improve locality of reference in the instruction space.  Most systems
5025 using the ELF object format and SPARC processors running Solaris 2 have
5026 linkers with such optimizations.  AIX may have these optimizations in
5027 the future.
5028
5029 Only use these options when there are significant benefits from doing
5030 so.  When you specify these options, the assembler and linker will
5031 create larger object and executable files and will also be slower.
5032 You will not be able to use @code{gprof} on all systems if you
5033 specify this option and you may have problems with debugging if
5034 you specify both this option and @option{-g}.
5035
5036 @item -fbranch-target-load-optimize
5037 @opindex fbranch-target-load-optimize
5038 Perform branch target register load optimization before prologue / epilogue
5039 threading.
5040 The use of target registers can typically be exposed only during reload,
5041 thus hoisting loads out of loops and doing inter-block scheduling needs
5042 a separate optimization pass.
5043
5044 @item -fbranch-target-load-optimize2
5045 @opindex fbranch-target-load-optimize2
5046 Perform branch target register load optimization after prologue / epilogue
5047 threading.
5048
5049 @item -fbtr-bb-exclusive
5050 @opindex fbtr-bb-exclusive
5051 When performing branch target register load optimization, don't reuse
5052 branch target registers in within any basic block.
5053
5054 @item --param @var{name}=@var{value}
5055 @opindex param
5056 In some places, GCC uses various constants to control the amount of
5057 optimization that is done.  For example, GCC will not inline functions
5058 that contain more that a certain number of instructions.  You can
5059 control some of these constants on the command-line using the
5060 @option{--param} option.
5061
5062 The names of specific parameters, and the meaning of the values, are
5063 tied to the internals of the compiler, and are subject to change
5064 without notice in future releases.
5065
5066 In each case, the @var{value} is an integer.  The allowable choices for
5067 @var{name} are given in the following table:
5068
5069 @table @gcctabopt
5070 @item max-crossjump-edges
5071 The maximum number of incoming edges to consider for crossjumping.
5072 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
5073 the number of edges incoming to each block.  Increasing values mean
5074 more aggressive optimization, making the compile time increase with
5075 probably small improvement in executable size.
5076
5077 @item max-delay-slot-insn-search
5078 The maximum number of instructions to consider when looking for an
5079 instruction to fill a delay slot.  If more than this arbitrary number of
5080 instructions is searched, the time savings from filling the delay slot
5081 will be minimal so stop searching.  Increasing values mean more
5082 aggressive optimization, making the compile time increase with probably
5083 small improvement in executable run time.
5084
5085 @item max-delay-slot-live-search
5086 When trying to fill delay slots, the maximum number of instructions to
5087 consider when searching for a block with valid live register
5088 information.  Increasing this arbitrarily chosen value means more
5089 aggressive optimization, increasing the compile time.  This parameter
5090 should be removed when the delay slot code is rewritten to maintain the
5091 control-flow graph.
5092
5093 @item max-gcse-memory
5094 The approximate maximum amount of memory that will be allocated in
5095 order to perform the global common subexpression elimination
5096 optimization.  If more memory than specified is required, the
5097 optimization will not be done.
5098
5099 @item max-gcse-passes
5100 The maximum number of passes of GCSE to run.  The default is 1.
5101
5102 @item max-pending-list-length
5103 The maximum number of pending dependencies scheduling will allow
5104 before flushing the current state and starting over.  Large functions
5105 with few branches or calls can create excessively large lists which
5106 needlessly consume memory and resources.
5107
5108 @item max-inline-insns-single
5109 Several parameters control the tree inliner used in gcc.
5110 This number sets the maximum number of instructions (counted in GCC's
5111 internal representation) in a single function that the tree inliner
5112 will consider for inlining.  This only affects functions declared
5113 inline and methods implemented in a class declaration (C++).
5114 The default value is 500.
5115
5116 @item max-inline-insns-auto
5117 When you use @option{-finline-functions} (included in @option{-O3}),
5118 a lot of functions that would otherwise not be considered for inlining
5119 by the compiler will be investigated.  To those functions, a different
5120 (more restrictive) limit compared to functions declared inline can
5121 be applied.
5122 The default value is 120.
5123
5124 @item large-function-insns
5125 The limit specifying really large functions.  For functions greater than this
5126 limit inlining is constrained by @option{--param large-function-growth}.
5127 This parameter is useful primarily to avoid extreme compilation time caused by non-linear
5128 algorithms used by the backend.
5129 This parameter is ignored when @option{-funit-at-a-time} is not used.
5130 The default value is 3000.
5131
5132 @item large-function-growth
5133 Specifies maximal growth of large function caused by inlining in percents.
5134 This parameter is ignored when @option{-funit-at-a-time} is not used.
5135 The default value is 200.
5136
5137 @item inline-unit-growth
5138 Specifies maximal overall growth of the compilation unit caused by inlining.
5139 This parameter is ignored when @option{-funit-at-a-time} is not used.
5140 The default value is 150.
5141
5142 @item max-inline-insns-recursive
5143 @itemx max-inline-insns-recursive-auto
5144 Specifies maximum number of instructions out-of-line copy of self recursive inline
5145 function can grow into by performing recursive inlining.
5146
5147 For functions declared inline @option{--param max-inline-insns-recursive} is
5148 taken into acount.  For function not declared inline, recursive inlining
5149 happens only when @option{-finline-functions} (included in @option{-O3}) is
5150 enabled and @option{--param max-inline-insns-recursive-auto} is used.  The
5151 default value is 500.
5152
5153 @item max-inline-recursive-depth
5154 @itemx max-inline-recursive-depth-auto
5155 Specifies maximum recursion depth used by the recursive inlining.
5156
5157 For functions declared inline @option{--param max-inline-recursive-depth} is
5158 taken into acount.  For function not declared inline, recursive inlining
5159 happens only when @option{-finline-functions} (included in @option{-O3}) is
5160 enabled and @option{--param max-inline-recursive-depth-auto} is used.  The
5161 default value is 500.
5162
5163 @item max-inline-insns-rtl
5164 For languages that use the RTL inliner (this happens at a later stage
5165 than tree inlining), you can set the maximum allowable size (counted
5166 in RTL instructions) for the RTL inliner with this parameter.
5167 The default value is 600.
5168
5169 @item max-unrolled-insns
5170 The maximum number of instructions that a loop should have if that loop
5171 is unrolled, and if the loop is unrolled, it determines how many times
5172 the loop code is unrolled.
5173
5174 @item max-average-unrolled-insns
5175 The maximum number of instructions biased by probabilities of their execution
5176 that a loop should have if that loop is unrolled, and if the loop is unrolled,
5177 it determines how many times the loop code is unrolled.
5178
5179 @item max-unroll-times
5180 The maximum number of unrollings of a single loop.
5181
5182 @item max-peeled-insns
5183 The maximum number of instructions that a loop should have if that loop
5184 is peeled, and if the loop is peeled, it determines how many times
5185 the loop code is peeled.
5186
5187 @item max-peel-times
5188 The maximum number of peelings of a single loop.
5189
5190 @item max-completely-peeled-insns
5191 The maximum number of insns of a completely peeled loop.
5192
5193 @item max-completely-peel-times
5194 The maximum number of iterations of a loop to be suitable for complete peeling.
5195
5196 @item max-unswitch-insns
5197 The maximum number of insns of an unswitched loop.
5198
5199 @item max-unswitch-level
5200 The maximum number of branches unswitched in a single loop.
5201
5202 @item lim-expensive
5203 The minimum cost of an expensive expression in the loop invariant motion.
5204
5205 @item max-iterations-to-track
5206
5207 The maximum number of iterations of a loop the brute force algorithm
5208 for analysis of # of iterations of the loop tries to evaluate.
5209
5210 @item hot-bb-count-fraction
5211 Select fraction of the maximal count of repetitions of basic block in program
5212 given basic block needs to have to be considered hot.
5213
5214 @item hot-bb-frequency-fraction
5215 Select fraction of the maximal frequency of executions of basic block in
5216 function given basic block needs to have to be considered hot
5217
5218 @item tracer-dynamic-coverage
5219 @itemx tracer-dynamic-coverage-feedback
5220
5221 This value is used to limit superblock formation once the given percentage of
5222 executed instructions is covered.  This limits unnecessary code size
5223 expansion.
5224
5225 The @option{tracer-dynamic-coverage-feedback} is used only when profile
5226 feedback is available.  The real profiles (as opposed to statically estimated
5227 ones) are much less balanced allowing the threshold to be larger value.
5228
5229 @item tracer-max-code-growth
5230 Stop tail duplication once code growth has reached given percentage.  This is
5231 rather hokey argument, as most of the duplicates will be eliminated later in
5232 cross jumping, so it may be set to much higher values than is the desired code
5233 growth.
5234
5235 @item tracer-min-branch-ratio
5236
5237 Stop reverse growth when the reverse probability of best edge is less than this
5238 threshold (in percent).
5239
5240 @item tracer-min-branch-ratio
5241 @itemx tracer-min-branch-ratio-feedback
5242
5243 Stop forward growth if the best edge do have probability lower than this
5244 threshold.
5245
5246 Similarly to @option{tracer-dynamic-coverage} two values are present, one for
5247 compilation for profile feedback and one for compilation without.  The value
5248 for compilation with profile feedback needs to be more conservative (higher) in
5249 order to make tracer effective.
5250
5251 @item max-cse-path-length
5252
5253 Maximum number of basic blocks on path that cse considers.  The default is 10.
5254
5255 @item global-var-threshold
5256
5257 Counts the number of function calls (N) and the number of
5258 call-clobbered variables (V).  If NxV is larger than this limit, a
5259 single artificial variable will be created to represent all the
5260 call-clobbered variables at function call sites.  This artificial
5261 variable will then be made to alias every call-clobbered variable.
5262 (done as int * size_t on the host machine; beware overflow).
5263
5264 @item max-aliased-vops
5265
5266 Maxiumum number of virtual operands allowed to represent aliases
5267 before triggering the alias grouping heuristic.  Alias grouping
5268 reduces compile times and memory consumption needed for aliasing at
5269 the expense of precision loss in alias information.
5270
5271 @item ggc-min-expand
5272
5273 GCC uses a garbage collector to manage its own memory allocation.  This
5274 parameter specifies the minimum percentage by which the garbage
5275 collector's heap should be allowed to expand between collections.
5276 Tuning this may improve compilation speed; it has no effect on code
5277 generation.
5278
5279 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
5280 RAM >= 1GB.  If @code{getrlimit} is available, the notion of "RAM" is
5281 the smallest of actual RAM, RLIMIT_RSS, RLIMIT_DATA and RLIMIT_AS.  If
5282 GCC is not able to calculate RAM on a particular platform, the lower
5283 bound of 30% is used.  Setting this parameter and
5284 @option{ggc-min-heapsize} to zero causes a full collection to occur at
5285 every opportunity.  This is extremely slow, but can be useful for
5286 debugging.
5287
5288 @item ggc-min-heapsize
5289
5290 Minimum size of the garbage collector's heap before it begins bothering
5291 to collect garbage.  The first collection occurs after the heap expands
5292 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
5293 tuning this may improve compilation speed, and has no effect on code
5294 generation.
5295
5296 The default is RAM/8, with a lower bound of 4096 (four megabytes) and an
5297 upper bound of 131072 (128 megabytes).  If @code{getrlimit} is
5298 available, the notion of "RAM" is the smallest of actual RAM,
5299 RLIMIT_RSS, RLIMIT_DATA and RLIMIT_AS.  If GCC is not able to calculate
5300 RAM on a particular platform, the lower bound is used.  Setting this
5301 parameter very large effectively disables garbage collection.  Setting
5302 this parameter and @option{ggc-min-expand} to zero causes a full
5303 collection to occur at every opportunity.
5304
5305 @item max-reload-search-insns
5306 The maximum number of instruction reload should look backward for equivalent
5307 register.  Increasing values mean more aggressive optimization, making the
5308 compile time increase with probably slightly better performance.  The default
5309 value is 100.
5310
5311 @item max-cselib-memory-location
5312 The maximum number of memory locations cselib should take into acount.
5313 Increasing values mean more aggressive optimization, making the compile time
5314 increase with probably slightly better performance.  The default value is 500.
5315
5316 @item reorder-blocks-duplicate
5317 @itemx reorder-blocks-duplicate-feedback
5318
5319 Used by basic block reordering pass to decide whether to use unconditional
5320 branch or duplicate the code on its destination.  Code is duplicated when its
5321 estimated size is smaller than this value multiplied by the estimated size of
5322 unconditional jump in the hot spots of the program.
5323
5324 The @option{reorder-block-duplicate-feedback} is used only when profile
5325 feedback is available and may be set to higher values than
5326 @option{reorder-block-duplicate} since information about the hot spots is more
5327 accurate.
5328
5329 @item max-sched-region-blocks
5330 The maximum number of blocks in a region to be considered for
5331 interblock scheduling.  The default value is 10.
5332
5333 @item max-sched-region-insns
5334 The maximum number of insns in a region to be considered for
5335 interblock scheduling.  The default value is 100.
5336 @end table
5337 @end table
5338
5339 @node Preprocessor Options
5340 @section Options Controlling the Preprocessor
5341 @cindex preprocessor options
5342 @cindex options, preprocessor
5343
5344 These options control the C preprocessor, which is run on each C source
5345 file before actual compilation.
5346
5347 If you use the @option{-E} option, nothing is done except preprocessing.
5348 Some of these options make sense only together with @option{-E} because
5349 they cause the preprocessor output to be unsuitable for actual
5350 compilation.
5351
5352 @table @gcctabopt
5353 @opindex Wp
5354 You can use @option{-Wp,@var{option}} to bypass the compiler driver
5355 and pass @var{option} directly through to the preprocessor.  If
5356 @var{option} contains commas, it is split into multiple options at the
5357 commas.  However, many options are modified, translated or interpreted
5358 by the compiler driver before being passed to the preprocessor, and
5359 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
5360 interface is undocumented and subject to change, so whenever possible
5361 you should avoid using @option{-Wp} and let the driver handle the
5362 options instead.
5363
5364 @item -Xpreprocessor @var{option}
5365 @opindex preprocessor
5366 Pass @var{option} as an option to the preprocessor.  You can use this to
5367 supply system-specific preprocessor options which GCC does not know how to
5368 recognize.
5369
5370 If you want to pass an option that takes an argument, you must use
5371 @option{-Xpreprocessor} twice, once for the option and once for the argument.
5372 @end table
5373
5374 @include cppopts.texi
5375
5376 @node Assembler Options
5377 @section Passing Options to the Assembler
5378
5379 @c prevent bad page break with this line
5380 You can pass options to the assembler.
5381
5382 @table @gcctabopt
5383 @item -Wa,@var{option}
5384 @opindex Wa
5385 Pass @var{option} as an option to the assembler.  If @var{option}
5386 contains commas, it is split into multiple options at the commas.
5387
5388 @item -Xassembler @var{option}
5389 @opindex Xassembler
5390 Pass @var{option} as an option to the assembler.  You can use this to
5391 supply system-specific assembler options which GCC does not know how to
5392 recognize.
5393
5394 If you want to pass an option that takes an argument, you must use
5395 @option{-Xassembler} twice, once for the option and once for the argument.
5396
5397 @end table
5398
5399 @node Link Options
5400 @section Options for Linking
5401 @cindex link options
5402 @cindex options, linking
5403
5404 These options come into play when the compiler links object files into
5405 an executable output file.  They are meaningless if the compiler is
5406 not doing a link step.
5407
5408 @table @gcctabopt
5409 @cindex file names
5410 @item @var{object-file-name}
5411 A file name that does not end in a special recognized suffix is
5412 considered to name an object file or library.  (Object files are
5413 distinguished from libraries by the linker according to the file
5414 contents.)  If linking is done, these object files are used as input
5415 to the linker.
5416
5417 @item -c
5418 @itemx -S
5419 @itemx -E
5420 @opindex c
5421 @opindex S
5422 @opindex E
5423 If any of these options is used, then the linker is not run, and
5424 object file names should not be used as arguments.  @xref{Overall
5425 Options}.
5426
5427 @cindex Libraries
5428 @item -l@var{library}
5429 @itemx -l @var{library}
5430 @opindex l
5431 Search the library named @var{library} when linking.  (The second
5432 alternative with the library as a separate argument is only for
5433 POSIX compliance and is not recommended.)
5434
5435 It makes a difference where in the command you write this option; the
5436 linker searches and processes libraries and object files in the order they
5437 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
5438 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
5439 to functions in @samp{z}, those functions may not be loaded.
5440
5441 The linker searches a standard list of directories for the library,
5442 which is actually a file named @file{lib@var{library}.a}.  The linker
5443 then uses this file as if it had been specified precisely by name.
5444
5445 The directories searched include several standard system directories
5446 plus any that you specify with @option{-L}.
5447
5448 Normally the files found this way are library files---archive files
5449 whose members are object files.  The linker handles an archive file by
5450 scanning through it for members which define symbols that have so far
5451 been referenced but not defined.  But if the file that is found is an
5452 ordinary object file, it is linked in the usual fashion.  The only
5453 difference between using an @option{-l} option and specifying a file name
5454 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
5455 and searches several directories.
5456
5457 @item -lobjc
5458 @opindex lobjc
5459 You need this special case of the @option{-l} option in order to
5460 link an Objective-C program.
5461
5462 @item -nostartfiles
5463 @opindex nostartfiles
5464 Do not use the standard system startup files when linking.
5465 The standard system libraries are used normally, unless @option{-nostdlib}
5466 or @option{-nodefaultlibs} is used.
5467
5468 @item -nodefaultlibs
5469 @opindex nodefaultlibs
5470 Do not use the standard system libraries when linking.
5471 Only the libraries you specify will be passed to the linker.
5472 The standard startup files are used normally, unless @option{-nostartfiles}
5473 is used.  The compiler may generate calls to @code{memcmp},
5474 @code{memset}, @code{memcpy} and @code{memmove}.
5475 These entries are usually resolved by entries in
5476 libc.  These entry points should be supplied through some other
5477 mechanism when this option is specified.
5478
5479 @item -nostdlib
5480 @opindex nostdlib
5481 Do not use the standard system startup files or libraries when linking.
5482 No startup files and only the libraries you specify will be passed to
5483 the linker.  The compiler may generate calls to @code{memcmp}, @code{memset},
5484 @code{memcpy} and @code{memmove}.
5485 These entries are usually resolved by entries in
5486 libc.  These entry points should be supplied through some other
5487 mechanism when this option is specified.
5488
5489 @cindex @option{-lgcc}, use with @option{-nostdlib}
5490 @cindex @option{-nostdlib} and unresolved references
5491 @cindex unresolved references and @option{-nostdlib}
5492 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
5493 @cindex @option{-nodefaultlibs} and unresolved references
5494 @cindex unresolved references and @option{-nodefaultlibs}
5495 One of the standard libraries bypassed by @option{-nostdlib} and
5496 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
5497 that GCC uses to overcome shortcomings of particular machines, or special
5498 needs for some languages.
5499 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
5500 Collection (GCC) Internals},
5501 for more discussion of @file{libgcc.a}.)
5502 In most cases, you need @file{libgcc.a} even when you want to avoid
5503 other standard libraries.  In other words, when you specify @option{-nostdlib}
5504 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
5505 This ensures that you have no unresolved references to internal GCC
5506 library subroutines.  (For example, @samp{__main}, used to ensure C++
5507 constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
5508 GNU Compiler Collection (GCC) Internals}.)
5509
5510 @item -pie
5511 @opindex pie
5512 Produce a position independent executable on targets which support it.
5513 For predictable results, you must also specify the same set of options
5514 that were used to generate code (@option{-fpie}, @option{-fPIE},
5515 or model suboptions) when you specify this option.
5516
5517 @item -s
5518 @opindex s
5519 Remove all symbol table and relocation information from the executable.
5520
5521 @item -static
5522 @opindex static
5523 On systems that support dynamic linking, this prevents linking with the shared
5524 libraries.  On other systems, this option has no effect.
5525
5526 @item -shared
5527 @opindex shared
5528 Produce a shared object which can then be linked with other objects to
5529 form an executable.  Not all systems support this option.  For predictable
5530 results, you must also specify the same set of options that were used to
5531 generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
5532 when you specify this option.@footnote{On some systems, @samp{gcc -shared}
5533 needs to build supplementary stub code for constructors to work.  On
5534 multi-libbed systems, @samp{gcc -shared} must select the correct support
5535 libraries to link against.  Failing to supply the correct flags may lead
5536 to subtle defects.  Supplying them in cases where they are not necessary
5537 is innocuous.}
5538
5539 @item -shared-libgcc
5540 @itemx -static-libgcc
5541 @opindex shared-libgcc
5542 @opindex static-libgcc
5543 On systems that provide @file{libgcc} as a shared library, these options
5544 force the use of either the shared or static version respectively.
5545 If no shared version of @file{libgcc} was built when the compiler was
5546 configured, these options have no effect.
5547
5548 There are several situations in which an application should use the
5549 shared @file{libgcc} instead of the static version.  The most common
5550 of these is when the application wishes to throw and catch exceptions
5551 across different shared libraries.  In that case, each of the libraries
5552 as well as the application itself should use the shared @file{libgcc}.
5553
5554 Therefore, the G++ and GCJ drivers automatically add
5555 @option{-shared-libgcc} whenever you build a shared library or a main
5556 executable, because C++ and Java programs typically use exceptions, so
5557 this is the right thing to do.
5558
5559 If, instead, you use the GCC driver to create shared libraries, you may
5560 find that they will not always be linked with the shared @file{libgcc}.
5561 If GCC finds, at its configuration time, that you have a non-GNU linker
5562 or a GNU linker that does not support option @option{--eh-frame-hdr},
5563 it will link the shared version of @file{libgcc} into shared libraries
5564 by default.  Otherwise, it will take advantage of the linker and optimize
5565 away the linking with the shared version of @file{libgcc}, linking with
5566 the static version of libgcc by default.  This allows exceptions to
5567 propagate through such shared libraries, without incurring relocation
5568 costs at library load time.
5569
5570 However, if a library or main executable is supposed to throw or catch
5571 exceptions, you must link it using the G++ or GCJ driver, as appropriate
5572 for the languages used in the program, or using the option
5573 @option{-shared-libgcc}, such that it is linked with the shared
5574 @file{libgcc}.
5575
5576 @item -symbolic
5577 @opindex symbolic
5578 Bind references to global symbols when building a shared object.  Warn
5579 about any unresolved references (unless overridden by the link editor
5580 option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
5581 this option.
5582
5583 @item -Xlinker @var{option}
5584 @opindex Xlinker
5585 Pass @var{option} as an option to the linker.  You can use this to
5586 supply system-specific linker options which GCC does not know how to
5587 recognize.
5588
5589 If you want to pass an option that takes an argument, you must use
5590 @option{-Xlinker} twice, once for the option and once for the argument.
5591 For example, to pass @option{-assert definitions}, you must write
5592 @samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
5593 @option{-Xlinker "-assert definitions"}, because this passes the entire
5594 string as a single argument, which is not what the linker expects.
5595
5596 @item -Wl,@var{option}
5597 @opindex Wl
5598 Pass @var{option} as an option to the linker.  If @var{option} contains
5599 commas, it is split into multiple options at the commas.
5600
5601 @item -u @var{symbol}
5602 @opindex u
5603 Pretend the symbol @var{symbol} is undefined, to force linking of
5604 library modules to define it.  You can use @option{-u} multiple times with
5605 different symbols to force loading of additional library modules.
5606 @end table
5607
5608 @node Directory Options
5609 @section Options for Directory Search
5610 @cindex directory options
5611 @cindex options, directory search
5612 @cindex search path
5613
5614 These options specify directories to search for header files, for
5615 libraries and for parts of the compiler:
5616
5617 @table @gcctabopt
5618 @item -I@var{dir}
5619 @opindex I
5620 Add the directory @var{dir} to the head of the list of directories to be
5621 searched for header files.  This can be used to override a system header
5622 file, substituting your own version, since these directories are
5623 searched before the system header file directories.  However, you should
5624 not use this option to add directories that contain vendor-supplied
5625 system header files (use @option{-isystem} for that).  If you use more than
5626 one @option{-I} option, the directories are scanned in left-to-right
5627 order; the standard system directories come after.
5628
5629 If a standard system include directory, or a directory specified with
5630 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
5631 option will be ignored.  The directory will still be searched but as a
5632 system directory at its normal position in the system include chain.
5633 This is to ensure that GCC's procedure to fix buggy system headers and
5634 the ordering for the include_next directive are not inadvertently changed.
5635 If you really need to change the search order for system directories,
5636 use the @option{-nostdinc} and/or @option{-isystem} options.
5637
5638 @item -iquote@var{dir}
5639 @opindex iquote
5640 Add the directory @var{dir} to the head of the list of directories to
5641 be searched for header files only for the case of @samp{#include
5642 "@var{file}"}; they are not searched for @samp{#include <@var{file}>},
5643 otherwise just like @option{-I}.
5644
5645 @item -L@var{dir}
5646 @opindex L
5647 Add directory @var{dir} to the list of directories to be searched
5648 for @option{-l}.
5649
5650 @item -B@var{prefix}
5651 @opindex B
5652 This option specifies where to find the executables, libraries,
5653 include files, and data files of the compiler itself.
5654
5655 The compiler driver program runs one or more of the subprograms
5656 @file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
5657 @var{prefix} as a prefix for each program it tries to run, both with and
5658 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
5659
5660 For each subprogram to be run, the compiler driver first tries the
5661 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
5662 was not specified, the driver tries two standard prefixes, which are
5663 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
5664 those results in a file name that is found, the unmodified program
5665 name is searched for using the directories specified in your
5666 @env{PATH} environment variable.
5667
5668 The compiler will check to see if the path provided by the @option{-B}
5669 refers to a directory, and if necessary it will add a directory
5670 separator character at the end of the path.
5671
5672 @option{-B} prefixes that effectively specify directory names also apply
5673 to libraries in the linker, because the compiler translates these
5674 options into @option{-L} options for the linker.  They also apply to
5675 includes files in the preprocessor, because the compiler translates these
5676 options into @option{-isystem} options for the preprocessor.  In this case,
5677 the compiler appends @samp{include} to the prefix.
5678
5679 The run-time support file @file{libgcc.a} can also be searched for using
5680 the @option{-B} prefix, if needed.  If it is not found there, the two
5681 standard prefixes above are tried, and that is all.  The file is left
5682 out of the link if it is not found by those means.
5683
5684 Another way to specify a prefix much like the @option{-B} prefix is to use
5685 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
5686 Variables}.
5687
5688 As a special kludge, if the path provided by @option{-B} is
5689 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
5690 9, then it will be replaced by @file{[dir/]include}.  This is to help
5691 with boot-strapping the compiler.
5692
5693 @item -specs=@var{file}
5694 @opindex specs
5695 Process @var{file} after the compiler reads in the standard @file{specs}
5696 file, in order to override the defaults that the @file{gcc} driver
5697 program uses when determining what switches to pass to @file{cc1},
5698 @file{cc1plus}, @file{as}, @file{ld}, etc.  More than one
5699 @option{-specs=@var{file}} can be specified on the command line, and they
5700 are processed in order, from left to right.
5701
5702 @item -I-
5703 @opindex I-
5704 This option has been deprecated.  Please use @option{-iquote} instead for
5705 @option{-I} directories before the @option{-I-} and remove the @option{-I-}.
5706 Any directories you specify with @option{-I} options before the @option{-I-}
5707 option are searched only for the case of @samp{#include "@var{file}"};
5708 they are not searched for @samp{#include <@var{file}>}.
5709
5710 If additional directories are specified with @option{-I} options after
5711 the @option{-I-}, these directories are searched for all @samp{#include}
5712 directives.  (Ordinarily @emph{all} @option{-I} directories are used
5713 this way.)
5714
5715 In addition, the @option{-I-} option inhibits the use of the current
5716 directory (where the current input file came from) as the first search
5717 directory for @samp{#include "@var{file}"}.  There is no way to
5718 override this effect of @option{-I-}.  With @option{-I.} you can specify
5719 searching the directory which was current when the compiler was
5720 invoked.  That is not exactly the same as what the preprocessor does
5721 by default, but it is often satisfactory.
5722
5723 @option{-I-} does not inhibit the use of the standard system directories
5724 for header files.  Thus, @option{-I-} and @option{-nostdinc} are
5725 independent.
5726 @end table
5727
5728 @c man end
5729
5730 @node Spec Files
5731 @section Specifying subprocesses and the switches to pass to them
5732 @cindex Spec Files
5733
5734 @command{gcc} is a driver program.  It performs its job by invoking a
5735 sequence of other programs to do the work of compiling, assembling and
5736 linking.  GCC interprets its command-line parameters and uses these to
5737 deduce which programs it should invoke, and which command-line options
5738 it ought to place on their command lines.  This behavior is controlled
5739 by @dfn{spec strings}.  In most cases there is one spec string for each
5740 program that GCC can invoke, but a few programs have multiple spec
5741 strings to control their behavior.  The spec strings built into GCC can
5742 be overridden by using the @option{-specs=} command-line switch to specify
5743 a spec file.
5744
5745 @dfn{Spec files} are plaintext files that are used to construct spec
5746 strings.  They consist of a sequence of directives separated by blank
5747 lines.  The type of directive is determined by the first non-whitespace
5748 character on the line and it can be one of the following:
5749
5750 @table @code
5751 @item %@var{command}
5752 Issues a @var{command} to the spec file processor.  The commands that can
5753 appear here are:
5754
5755 @table @code
5756 @item %include <@var{file}>
5757 @cindex %include
5758 Search for @var{file} and insert its text at the current point in the
5759 specs file.
5760
5761 @item %include_noerr <@var{file}>
5762 @cindex %include_noerr
5763 Just like @samp{%include}, but do not generate an error message if the include
5764 file cannot be found.
5765
5766 @item %rename @var{old_name} @var{new_name}
5767 @cindex %rename
5768 Rename the spec string @var{old_name} to @var{new_name}.
5769
5770 @end table
5771
5772 @item *[@var{spec_name}]:
5773 This tells the compiler to create, override or delete the named spec
5774 string.  All lines after this directive up to the next directive or
5775 blank line are considered to be the text for the spec string.  If this
5776 results in an empty string then the spec will be deleted.  (Or, if the
5777 spec did not exist, then nothing will happened.)  Otherwise, if the spec
5778 does not currently exist a new spec will be created.  If the spec does
5779 exist then its contents will be overridden by the text of this
5780 directive, unless the first character of that text is the @samp{+}
5781 character, in which case the text will be appended to the spec.
5782
5783 @item [@var{suffix}]:
5784 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
5785 and up to the next directive or blank line are considered to make up the
5786 spec string for the indicated suffix.  When the compiler encounters an
5787 input file with the named suffix, it will processes the spec string in
5788 order to work out how to compile that file.  For example:
5789
5790 @smallexample
5791 .ZZ:
5792 z-compile -input %i
5793 @end smallexample
5794
5795 This says that any input file whose name ends in @samp{.ZZ} should be
5796 passed to the program @samp{z-compile}, which should be invoked with the
5797 command-line switch @option{-input} and with the result of performing the
5798 @samp{%i} substitution.  (See below.)
5799
5800 As an alternative to providing a spec string, the text that follows a
5801 suffix directive can be one of the following:
5802
5803 @table @code
5804 @item @@@var{language}
5805 This says that the suffix is an alias for a known @var{language}.  This is
5806 similar to using the @option{-x} command-line switch to GCC to specify a
5807 language explicitly.  For example:
5808
5809 @smallexample
5810 .ZZ:
5811 @@c++
5812 @end smallexample
5813
5814 Says that .ZZ files are, in fact, C++ source files.
5815
5816 @item #@var{name}
5817 This causes an error messages saying:
5818
5819 @smallexample
5820 @var{name} compiler not installed on this system.
5821 @end smallexample
5822 @end table
5823
5824 GCC already has an extensive list of suffixes built into it.
5825 This directive will add an entry to the end of the list of suffixes, but
5826 since the list is searched from the end backwards, it is effectively
5827 possible to override earlier entries using this technique.
5828
5829 @end table
5830
5831 GCC has the following spec strings built into it.  Spec files can
5832 override these strings or create their own.  Note that individual
5833 targets can also add their own spec strings to this list.
5834
5835 @smallexample
5836 asm          Options to pass to the assembler
5837 asm_final    Options to pass to the assembler post-processor
5838 cpp          Options to pass to the C preprocessor
5839 cc1          Options to pass to the C compiler
5840 cc1plus      Options to pass to the C++ compiler
5841 endfile      Object files to include at the end of the link
5842 link         Options to pass to the linker
5843 lib          Libraries to include on the command line to the linker
5844 libgcc       Decides which GCC support library to pass to the linker
5845 linker       Sets the name of the linker
5846 predefines   Defines to be passed to the C preprocessor
5847 signed_char  Defines to pass to CPP to say whether @code{char} is signed
5848              by default
5849 startfile    Object files to include at the start of the link
5850 @end smallexample
5851
5852 Here is a small example of a spec file:
5853
5854 @smallexample
5855 %rename lib                 old_lib
5856
5857 *lib:
5858 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
5859 @end smallexample
5860
5861 This example renames the spec called @samp{lib} to @samp{old_lib} and
5862 then overrides the previous definition of @samp{lib} with a new one.
5863 The new definition adds in some extra command-line options before
5864 including the text of the old definition.
5865
5866 @dfn{Spec strings} are a list of command-line options to be passed to their
5867 corresponding program.  In addition, the spec strings can contain
5868 @samp{%}-prefixed sequences to substitute variable text or to
5869 conditionally insert text into the command line.  Using these constructs
5870 it is possible to generate quite complex command lines.
5871
5872 Here is a table of all defined @samp{%}-sequences for spec
5873 strings.  Note that spaces are not generated automatically around the
5874 results of expanding these sequences.  Therefore you can concatenate them
5875 together or combine them with constant text in a single argument.
5876
5877 @table @code
5878 @item %%
5879 Substitute one @samp{%} into the program name or argument.
5880
5881 @item %i
5882 Substitute the name of the input file being processed.
5883
5884 @item %b
5885 Substitute the basename of the input file being processed.
5886 This is the substring up to (and not including) the last period
5887 and not including the directory.
5888
5889 @item %B
5890 This is the same as @samp{%b}, but include the file suffix (text after
5891 the last period).
5892
5893 @item %d
5894 Marks the argument containing or following the @samp{%d} as a
5895 temporary file name, so that that file will be deleted if GCC exits
5896 successfully.  Unlike @samp{%g}, this contributes no text to the
5897 argument.
5898
5899 @item %g@var{suffix}
5900 Substitute a file name that has suffix @var{suffix} and is chosen
5901 once per compilation, and mark the argument in the same way as
5902 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
5903 name is now chosen in a way that is hard to predict even when previously
5904 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
5905 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
5906 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
5907 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
5908 was simply substituted with a file name chosen once per compilation,
5909 without regard to any appended suffix (which was therefore treated
5910 just like ordinary text), making such attacks more likely to succeed.
5911
5912 @item %u@var{suffix}
5913 Like @samp{%g}, but generates a new temporary file name even if
5914 @samp{%u@var{suffix}} was already seen.
5915
5916 @item %U@var{suffix}
5917 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
5918 new one if there is no such last file name.  In the absence of any
5919 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
5920 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
5921 would involve the generation of two distinct file names, one
5922 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
5923 simply substituted with a file name chosen for the previous @samp{%u},
5924 without regard to any appended suffix.
5925
5926 @item %j@var{suffix}
5927 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
5928 writable, and if save-temps is off; otherwise, substitute the name
5929 of a temporary file, just like @samp{%u}.  This temporary file is not
5930 meant for communication between processes, but rather as a junk
5931 disposal mechanism.
5932
5933 @item %|@var{suffix}
5934 @itemx %m@var{suffix}
5935 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
5936 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
5937 all.  These are the two most common ways to instruct a program that it
5938 should read from standard input or write to standard output.  If you
5939 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
5940 construct: see for example @file{f/lang-specs.h}.
5941
5942 @item %.@var{SUFFIX}
5943 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
5944 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
5945 terminated by the next space or %.
5946
5947 @item %w
5948 Marks the argument containing or following the @samp{%w} as the
5949 designated output file of this compilation.  This puts the argument
5950 into the sequence of arguments that @samp{%o} will substitute later.
5951
5952 @item %o
5953 Substitutes the names of all the output files, with spaces
5954 automatically placed around them.  You should write spaces
5955 around the @samp{%o} as well or the results are undefined.
5956 @samp{%o} is for use in the specs for running the linker.
5957 Input files whose names have no recognized suffix are not compiled
5958 at all, but they are included among the output files, so they will
5959 be linked.
5960
5961 @item %O
5962 Substitutes the suffix for object files.  Note that this is
5963 handled specially when it immediately follows @samp{%g, %u, or %U},
5964 because of the need for those to form complete file names.  The
5965 handling is such that @samp{%O} is treated exactly as if it had already
5966 been substituted, except that @samp{%g, %u, and %U} do not currently
5967 support additional @var{suffix} characters following @samp{%O} as they would
5968 following, for example, @samp{.o}.
5969
5970 @item %p
5971 Substitutes the standard macro predefinitions for the
5972 current target machine.  Use this when running @code{cpp}.
5973
5974 @item %P
5975 Like @samp{%p}, but puts @samp{__} before and after the name of each
5976 predefined macro, except for macros that start with @samp{__} or with
5977 @samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
5978 C@.
5979
5980 @item %I
5981 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
5982 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), and
5983 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
5984 as necessary.
5985
5986 @item %s
5987 Current argument is the name of a library or startup file of some sort.
5988 Search for that file in a standard list of directories and substitute
5989 the full name found.
5990
5991 @item %e@var{str}
5992 Print @var{str} as an error message.  @var{str} is terminated by a newline.
5993 Use this when inconsistent options are detected.
5994
5995 @item %(@var{name})
5996 Substitute the contents of spec string @var{name} at this point.
5997
5998 @item %[@var{name}]
5999 Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
6000
6001 @item %x@{@var{option}@}
6002 Accumulate an option for @samp{%X}.
6003
6004 @item %X
6005 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
6006 spec string.
6007
6008 @item %Y
6009 Output the accumulated assembler options specified by @option{-Wa}.
6010
6011 @item %Z
6012 Output the accumulated preprocessor options specified by @option{-Wp}.
6013
6014 @item %a
6015 Process the @code{asm} spec.  This is used to compute the
6016 switches to be passed to the assembler.
6017
6018 @item %A
6019 Process the @code{asm_final} spec.  This is a spec string for
6020 passing switches to an assembler post-processor, if such a program is
6021 needed.
6022
6023 @item %l
6024 Process the @code{link} spec.  This is the spec for computing the
6025 command line passed to the linker.  Typically it will make use of the
6026 @samp{%L %G %S %D and %E} sequences.
6027
6028 @item %D
6029 Dump out a @option{-L} option for each directory that GCC believes might
6030 contain startup files.  If the target supports multilibs then the
6031 current multilib directory will be prepended to each of these paths.
6032
6033 @item %M
6034 Output the multilib directory with directory separators replaced with
6035 @samp{_}.  If multilib directories are not set, or the multilib directory is
6036 @file{.} then this option emits nothing.
6037
6038 @item %L
6039 Process the @code{lib} spec.  This is a spec string for deciding which
6040 libraries should be included on the command line to the linker.
6041
6042 @item %G
6043 Process the @code{libgcc} spec.  This is a spec string for deciding
6044 which GCC support library should be included on the command line to the linker.
6045
6046 @item %S
6047 Process the @code{startfile} spec.  This is a spec for deciding which
6048 object files should be the first ones passed to the linker.  Typically
6049 this might be a file named @file{crt0.o}.
6050
6051 @item %E
6052 Process the @code{endfile} spec.  This is a spec string that specifies
6053 the last object files that will be passed to the linker.
6054
6055 @item %C
6056 Process the @code{cpp} spec.  This is used to construct the arguments
6057 to be passed to the C preprocessor.
6058
6059 @item %1
6060 Process the @code{cc1} spec.  This is used to construct the options to be
6061 passed to the actual C compiler (@samp{cc1}).
6062
6063 @item %2
6064 Process the @code{cc1plus} spec.  This is used to construct the options to be
6065 passed to the actual C++ compiler (@samp{cc1plus}).
6066
6067 @item %*
6068 Substitute the variable part of a matched option.  See below.
6069 Note that each comma in the substituted string is replaced by
6070 a single space.
6071
6072 @item %<@code{S}
6073 Remove all occurrences of @code{-S} from the command line.  Note---this
6074 command is position dependent.  @samp{%} commands in the spec string
6075 before this one will see @code{-S}, @samp{%} commands in the spec string
6076 after this one will not.
6077
6078 @item %:@var{function}(@var{args})
6079 Call the named function @var{function}, passing it @var{args}.
6080 @var{args} is first processed as a nested spec string, then split
6081 into an argument vector in the usual fashion.  The function returns
6082 a string which is processed as if it had appeared literally as part
6083 of the current spec.
6084
6085 The following built-in spec functions are provided:
6086
6087 @table @code
6088 @item @code{if-exists}
6089 The @code{if-exists} spec function takes one argument, an absolute
6090 pathname to a file.  If the file exists, @code{if-exists} returns the
6091 pathname.  Here is a small example of its usage:
6092
6093 @smallexample
6094 *startfile:
6095 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
6096 @end smallexample
6097
6098 @item @code{if-exists-else}
6099 The @code{if-exists-else} spec function is similar to the @code{if-exists}
6100 spec function, except that it takes two arguments.  The first argument is
6101 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
6102 returns the pathname.  If it does not exist, it returns the second argument.
6103 This way, @code{if-exists-else} can be used to select one file or another,
6104 based on the existence of the first.  Here is a small example of its usage:
6105
6106 @smallexample
6107 *startfile:
6108 crt0%O%s %:if-exists(crti%O%s) \
6109 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
6110 @end smallexample
6111 @end table
6112
6113 @item %@{@code{S}@}
6114 Substitutes the @code{-S} switch, if that switch was given to GCC@.
6115 If that switch was not specified, this substitutes nothing.  Note that
6116 the leading dash is omitted when specifying this option, and it is
6117 automatically inserted if the substitution is performed.  Thus the spec
6118 string @samp{%@{foo@}} would match the command-line option @option{-foo}
6119 and would output the command line option @option{-foo}.
6120
6121 @item %W@{@code{S}@}
6122 Like %@{@code{S}@} but mark last argument supplied within as a file to be
6123 deleted on failure.
6124
6125 @item %@{@code{S}*@}
6126 Substitutes all the switches specified to GCC whose names start
6127 with @code{-S}, but which also take an argument.  This is used for
6128 switches like @option{-o}, @option{-D}, @option{-I}, etc.
6129 GCC considers @option{-o foo} as being
6130 one switch whose names starts with @samp{o}.  %@{o*@} would substitute this
6131 text, including the space.  Thus two arguments would be generated.
6132
6133 @item %@{@code{S}*&@code{T}*@}
6134 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
6135 (the order of @code{S} and @code{T} in the spec is not significant).
6136 There can be any number of ampersand-separated variables; for each the
6137 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
6138
6139 @item %@{@code{S}:@code{X}@}
6140 Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
6141
6142 @item %@{!@code{S}:@code{X}@}
6143 Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
6144
6145 @item %@{@code{S}*:@code{X}@}
6146 Substitutes @code{X} if one or more switches whose names start with
6147 @code{-S} are specified to GCC@.  Normally @code{X} is substituted only
6148 once, no matter how many such switches appeared.  However, if @code{%*}
6149 appears somewhere in @code{X}, then @code{X} will be substituted once
6150 for each matching switch, with the @code{%*} replaced by the part of
6151 that switch that matched the @code{*}.
6152
6153 @item %@{.@code{S}:@code{X}@}
6154 Substitutes @code{X}, if processing a file with suffix @code{S}.
6155
6156 @item %@{!.@code{S}:@code{X}@}
6157 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
6158
6159 @item %@{@code{S}|@code{P}:@code{X}@}
6160 Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@.
6161 This may be combined with @samp{!}, @samp{.}, and @code{*} sequences as well,
6162 although they have a stronger binding than the @samp{|}.  If @code{%*}
6163 appears in @code{X}, all of the alternatives must be starred, and only
6164 the first matching alternative is substituted.
6165
6166 For example, a spec string like this:
6167
6168 @smallexample
6169 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
6170 @end smallexample
6171
6172 will output the following command-line options from the following input
6173 command-line options:
6174
6175 @smallexample
6176 fred.c        -foo -baz
6177 jim.d         -bar -boggle
6178 -d fred.c     -foo -baz -boggle
6179 -d jim.d      -bar -baz -boggle
6180 @end smallexample
6181
6182 @item %@{S:X; T:Y; :D@}
6183
6184 If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
6185 given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
6186 be as many clauses as you need.  This may be combined with @code{.},
6187 @code{!}, @code{|}, and @code{*} as needed.
6188
6189
6190 @end table
6191
6192 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
6193 construct may contain other nested @samp{%} constructs or spaces, or
6194 even newlines.  They are processed as usual, as described above.
6195 Trailing white space in @code{X} is ignored.  White space may also
6196 appear anywhere on the left side of the colon in these constructs,
6197 except between @code{.} or @code{*} and the corresponding word.
6198
6199 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
6200 handled specifically in these constructs.  If another value of
6201 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
6202 @option{-W} switch is found later in the command line, the earlier
6203 switch value is ignored, except with @{@code{S}*@} where @code{S} is
6204 just one letter, which passes all matching options.
6205
6206 The character @samp{|} at the beginning of the predicate text is used to
6207 indicate that a command should be piped to the following command, but
6208 only if @option{-pipe} is specified.
6209
6210 It is built into GCC which switches take arguments and which do not.
6211 (You might think it would be useful to generalize this to allow each
6212 compiler's spec to say which switches take arguments.  But this cannot
6213 be done in a consistent fashion.  GCC cannot even decide which input
6214 files have been specified without knowing which switches take arguments,
6215 and it must know which input files to compile in order to tell which
6216 compilers to run).
6217
6218 GCC also knows implicitly that arguments starting in @option{-l} are to be
6219 treated as compiler output files, and passed to the linker in their
6220 proper position among the other output files.
6221
6222 @c man begin OPTIONS
6223
6224 @node Target Options
6225 @section Specifying Target Machine and Compiler Version
6226 @cindex target options
6227 @cindex cross compiling
6228 @cindex specifying machine version
6229 @cindex specifying compiler version and target machine
6230 @cindex compiler version, specifying
6231 @cindex target machine, specifying
6232
6233 The usual way to run GCC is to run the executable called @file{gcc}, or
6234 @file{<machine>-gcc} when cross-compiling, or
6235 @file{<machine>-gcc-<version>} to run a version other than the one that
6236 was installed last.  Sometimes this is inconvenient, so GCC provides
6237 options that will switch to another cross-compiler or version.
6238
6239 @table @gcctabopt
6240 @item -b @var{machine}
6241 @opindex b
6242 The argument @var{machine} specifies the target machine for compilation.
6243
6244 The value to use for @var{machine} is the same as was specified as the
6245 machine type when configuring GCC as a cross-compiler.  For
6246 example, if a cross-compiler was configured with @samp{configure
6247 i386v}, meaning to compile for an 80386 running System V, then you
6248 would specify @option{-b i386v} to run that cross compiler.
6249
6250 @item -V @var{version}
6251 @opindex V
6252 The argument @var{version} specifies which version of GCC to run.
6253 This is useful when multiple versions are installed.  For example,
6254 @var{version} might be @samp{2.0}, meaning to run GCC version 2.0.
6255 @end table
6256
6257 The @option{-V} and @option{-b} options work by running the
6258 @file{<machine>-gcc-<version>} executable, so there's no real reason to
6259 use them if you can just run that directly.
6260
6261 @node Submodel Options
6262 @section Hardware Models and Configurations
6263 @cindex submodel options
6264 @cindex specifying hardware config
6265 @cindex hardware models and configurations, specifying
6266 @cindex machine dependent options
6267
6268 Earlier we discussed the standard option @option{-b} which chooses among
6269 different installed compilers for completely different target
6270 machines, such as VAX vs.@: 68000 vs.@: 80386.
6271
6272 In addition, each of these target machine types can have its own
6273 special options, starting with @samp{-m}, to choose among various
6274 hardware models or configurations---for example, 68010 vs 68020,
6275 floating coprocessor or none.  A single installed version of the
6276 compiler can compile for any model or configuration, according to the
6277 options specified.
6278
6279 Some configurations of the compiler also support additional special
6280 options, usually for compatibility with other compilers on the same
6281 platform.
6282
6283 These options are defined by the macro @code{TARGET_SWITCHES} in the
6284 machine description.  The default for the options is also defined by
6285 that macro, which enables you to change the defaults.
6286
6287 @c This list is ordered alphanumerically by subsection name.
6288 @c It should be the same order and spelling as these options are listed
6289 @c in Machine Dependent Options
6290
6291 @menu
6292 * ARC Options::
6293 * ARM Options::
6294 * AVR Options::
6295 * CRIS Options::
6296 * Darwin Options::
6297 * DEC Alpha Options::
6298 * DEC Alpha/VMS Options::
6299 * FRV Options::
6300 * H8/300 Options::
6301 * HPPA Options::
6302 * i386 and x86-64 Options::
6303 * IA-64 Options::
6304 * M32R/D Options::
6305 * M680x0 Options::
6306 * M68hc1x Options::
6307 * MCore Options::
6308 * MIPS Options::
6309 * MMIX Options::
6310 * MN10300 Options::
6311 * NS32K Options::
6312 * PDP-11 Options::
6313 * PowerPC Options::
6314 * RS/6000 and PowerPC Options::
6315 * S/390 and zSeries Options::
6316 * SH Options::
6317 * SPARC Options::
6318 * System V Options::
6319 * TMS320C3x/C4x Options::
6320 * V850 Options::
6321 * VAX Options::
6322 * x86-64 Options::
6323 * Xstormy16 Options::
6324 * Xtensa Options::
6325 * zSeries Options::
6326 @end menu
6327
6328 @node ARC Options
6329 @subsection ARC Options
6330 @cindex ARC Options
6331
6332 These options are defined for ARC implementations:
6333
6334 @table @gcctabopt
6335 @item -EL
6336 @opindex EL
6337 Compile code for little endian mode.  This is the default.
6338
6339 @item -EB
6340 @opindex EB
6341 Compile code for big endian mode.
6342
6343 @item -mmangle-cpu
6344 @opindex mmangle-cpu
6345 Prepend the name of the cpu to all public symbol names.
6346 In multiple-processor systems, there are many ARC variants with different
6347 instruction and register set characteristics.  This flag prevents code
6348 compiled for one cpu to be linked with code compiled for another.
6349 No facility exists for handling variants that are ``almost identical''.
6350 This is an all or nothing option.
6351
6352 @item -mcpu=@var{cpu}
6353 @opindex mcpu
6354 Compile code for ARC variant @var{cpu}.
6355 Which variants are supported depend on the configuration.
6356 All variants support @option{-mcpu=base}, this is the default.
6357
6358 @item -mtext=@var{text-section}
6359 @itemx -mdata=@var{data-section}
6360 @itemx -mrodata=@var{readonly-data-section}
6361 @opindex mtext
6362 @opindex mdata
6363 @opindex mrodata
6364 Put functions, data, and readonly data in @var{text-section},
6365 @var{data-section}, and @var{readonly-data-section} respectively
6366 by default.  This can be overridden with the @code{section} attribute.
6367 @xref{Variable Attributes}.
6368
6369 @end table
6370
6371 @node ARM Options
6372 @subsection ARM Options
6373 @cindex ARM options
6374
6375 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
6376 architectures:
6377
6378 @table @gcctabopt
6379 @item -mabi=@var{name}
6380 @opindex mabi
6381 Generate code for the specified ABI.  Permissible values are: @samp{apcs-gnu},
6382 @samp{atpcs}, @samp{aapcs} and @samp{iwmmxt}.
6383
6384 @item -mapcs-frame
6385 @opindex mapcs-frame
6386 Generate a stack frame that is compliant with the ARM Procedure Call
6387 Standard for all functions, even if this is not strictly necessary for
6388 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
6389 with this option will cause the stack frames not to be generated for
6390 leaf functions.  The default is @option{-mno-apcs-frame}.
6391
6392 @item -mapcs
6393 @opindex mapcs
6394 This is a synonym for @option{-mapcs-frame}.
6395
6396 @ignore
6397 @c not currently implemented
6398 @item -mapcs-stack-check
6399 @opindex mapcs-stack-check
6400 Generate code to check the amount of stack space available upon entry to
6401 every function (that actually uses some stack space).  If there is
6402 insufficient space available then either the function
6403 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
6404 called, depending upon the amount of stack space required.  The run time
6405 system is required to provide these functions.  The default is
6406 @option{-mno-apcs-stack-check}, since this produces smaller code.
6407
6408 @c not currently implemented
6409 @item -mapcs-float
6410 @opindex mapcs-float
6411 Pass floating point arguments using the float point registers.  This is
6412 one of the variants of the APCS@.  This option is recommended if the
6413 target hardware has a floating point unit or if a lot of floating point
6414 arithmetic is going to be performed by the code.  The default is
6415 @option{-mno-apcs-float}, since integer only code is slightly increased in
6416 size if @option{-mapcs-float} is used.
6417
6418 @c not currently implemented
6419 @item -mapcs-reentrant
6420 @opindex mapcs-reentrant
6421 Generate reentrant, position independent code.  The default is
6422 @option{-mno-apcs-reentrant}.
6423 @end ignore
6424
6425 @item -mthumb-interwork
6426 @opindex mthumb-interwork
6427 Generate code which supports calling between the ARM and Thumb
6428 instruction sets.  Without this option the two instruction sets cannot
6429 be reliably used inside one program.  The default is
6430 @option{-mno-thumb-interwork}, since slightly larger code is generated
6431 when @option{-mthumb-interwork} is specified.
6432
6433 @item -mno-sched-prolog
6434 @opindex mno-sched-prolog
6435 Prevent the reordering of instructions in the function prolog, or the
6436 merging of those instruction with the instructions in the function's
6437 body.  This means that all functions will start with a recognizable set
6438 of instructions (or in fact one of a choice from a small set of
6439 different function prologues), and this information can be used to
6440 locate the start if functions inside an executable piece of code.  The
6441 default is @option{-msched-prolog}.
6442
6443 @item -mhard-float
6444 @opindex mhard-float
6445 Generate output containing floating point instructions.  This is the
6446 default.
6447
6448 @item -msoft-float
6449 @opindex msoft-float
6450 Generate output containing library calls for floating point.
6451 @strong{Warning:} the requisite libraries are not available for all ARM
6452 targets.  Normally the facilities of the machine's usual C compiler are
6453 used, but this cannot be done directly in cross-compilation.  You must make
6454 your own arrangements to provide suitable library functions for
6455 cross-compilation.
6456
6457 @option{-msoft-float} changes the calling convention in the output file;
6458 therefore, it is only useful if you compile @emph{all} of a program with
6459 this option.  In particular, you need to compile @file{libgcc.a}, the
6460 library that comes with GCC, with @option{-msoft-float} in order for
6461 this to work.
6462
6463 @item -mfloat-abi=@var{name}
6464 @opindex mfloat-abi
6465 Specifies which ABI to use for floating point values.  Permissible values
6466 are: @samp{soft}, @samp{softfp} and @samp{hard}.
6467
6468 @samp{soft} and @samp{hard} are equivalent to @option{-msoft-float}
6469 and @option{-mhard-float} respectively.  @samp{softfp} allows the generation
6470 of floating point instructions, but still uses the soft-float calling
6471 conventions.
6472
6473 @item -mlittle-endian
6474 @opindex mlittle-endian
6475 Generate code for a processor running in little-endian mode.  This is
6476 the default for all standard configurations.
6477
6478 @item -mbig-endian
6479 @opindex mbig-endian
6480 Generate code for a processor running in big-endian mode; the default is
6481 to compile code for a little-endian processor.
6482
6483 @item -mwords-little-endian
6484 @opindex mwords-little-endian
6485 This option only applies when generating code for big-endian processors.
6486 Generate code for a little-endian word order but a big-endian byte
6487 order.  That is, a byte order of the form @samp{32107654}.  Note: this
6488 option should only be used if you require compatibility with code for
6489 big-endian ARM processors generated by versions of the compiler prior to
6490 2.8.
6491
6492 @item -mcpu=@var{name}
6493 @opindex mcpu
6494 This specifies the name of the target ARM processor.  GCC uses this name
6495 to determine what kind of instructions it can emit when generating
6496 assembly code.  Permissible names are: @samp{arm2}, @samp{arm250},
6497 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
6498 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
6499 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
6500 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
6501 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm8},
6502 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
6503 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
6504 @samp{arm920t}, @samp{arm926ejs}, @samp{arm940t}, @samp{arm9tdmi},
6505 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ejs},
6506 @samp{arm1136js}, @samp{arm1136jfs} ,@samp{xscale}, @samp{iwmmxt},
6507 @samp{ep9312}.
6508
6509 @itemx -mtune=@var{name}
6510 @opindex mtune
6511 This option is very similar to the @option{-mcpu=} option, except that
6512 instead of specifying the actual target processor type, and hence
6513 restricting which instructions can be used, it specifies that GCC should
6514 tune the performance of the code as if the target were of the type
6515 specified in this option, but still choosing the instructions that it
6516 will generate based on the cpu specified by a @option{-mcpu=} option.
6517 For some ARM implementations better performance can be obtained by using
6518 this option.
6519
6520 @item -march=@var{name}
6521 @opindex march
6522 This specifies the name of the target ARM architecture.  GCC uses this
6523 name to determine what kind of instructions it can emit when generating
6524 assembly code.  This option can be used in conjunction with or instead
6525 of the @option{-mcpu=} option.  Permissible names are: @samp{armv2},
6526 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
6527 @samp{armv5}, @samp{armv5t}, @samp{armv5te}, @samp{armv6}, @samp{armv6j},
6528 @samp{iwmmxt}, @samp{ep9312}.
6529
6530 @item -mfpu=@var{name}
6531 @itemx -mfpe=@var{number}
6532 @itemx -mfp=@var{number}
6533 @opindex mfpu
6534 @opindex mfpe
6535 @opindex mfp
6536 This specifies what floating point hardware (or hardware emulation) is
6537 available on the target.  Permissible names are: @samp{fpa}, @samp{fpe2},
6538 @samp{fpe3}, @samp{maverick}, @samp{vfp}.  @option{-mfp} and @option{-mfpe}
6539 are synonyms for @option{-mfpu}=@samp{fpe}@var{number}, for compatibility
6540 with older versions of GCC@.
6541
6542 If @option{-msoft-float} is specified this specifies the format of
6543 floating point values.
6544
6545 @item -mstructure-size-boundary=@var{n}
6546 @opindex mstructure-size-boundary
6547 The size of all structures and unions will be rounded up to a multiple
6548 of the number of bits set by this option.  Permissible values are 8, 32
6549 and 64.  The default value varies for different toolchains.  For the COFF
6550 targeted toolchain the default value is 8.  A value of 64 is only allowed
6551 if the underlying ABI supports it.
6552
6553 Specifying the larger number can produce faster, more efficient code, but
6554 can also increase the size of the program.  Different values are potentially
6555 incompatible.  Code compiled with one value cannot necessarily expect to
6556 work with code or libraries compiled with another value, if they exchange
6557 information using structures or unions.
6558
6559 @item -mabort-on-noreturn
6560 @opindex mabort-on-noreturn
6561 Generate a call to the function @code{abort} at the end of a
6562 @code{noreturn} function.  It will be executed if the function tries to
6563 return.
6564
6565 @item -mlong-calls
6566 @itemx -mno-long-calls
6567 @opindex mlong-calls
6568 @opindex mno-long-calls
6569 Tells the compiler to perform function calls by first loading the
6570 address of the function into a register and then performing a subroutine
6571 call on this register.  This switch is needed if the target function
6572 will lie outside of the 64 megabyte addressing range of the offset based
6573 version of subroutine call instruction.
6574
6575 Even if this switch is enabled, not all function calls will be turned
6576 into long calls.  The heuristic is that static functions, functions
6577 which have the @samp{short-call} attribute, functions that are inside
6578 the scope of a @samp{#pragma no_long_calls} directive and functions whose
6579 definitions have already been compiled within the current compilation
6580 unit, will not be turned into long calls.  The exception to this rule is
6581 that weak function definitions, functions with the @samp{long-call}
6582 attribute or the @samp{section} attribute, and functions that are within
6583 the scope of a @samp{#pragma long_calls} directive, will always be
6584 turned into long calls.
6585
6586 This feature is not enabled by default.  Specifying
6587 @option{-mno-long-calls} will restore the default behavior, as will
6588 placing the function calls within the scope of a @samp{#pragma
6589 long_calls_off} directive.  Note these switches have no effect on how
6590 the compiler generates code to handle function calls via function
6591 pointers.
6592
6593 @item -mnop-fun-dllimport
6594 @opindex mnop-fun-dllimport
6595 Disable support for the @code{dllimport} attribute.
6596
6597 @item -msingle-pic-base
6598 @opindex msingle-pic-base
6599 Treat the register used for PIC addressing as read-only, rather than
6600 loading it in the prologue for each function.  The run-time system is
6601 responsible for initializing this register with an appropriate value
6602 before execution begins.
6603
6604 @item -mpic-register=@var{reg}
6605 @opindex mpic-register
6606 Specify the register to be used for PIC addressing.  The default is R10
6607 unless stack-checking is enabled, when R9 is used.
6608
6609 @item -mcirrus-fix-invalid-insns
6610 @opindex mcirrus-fix-invalid-insns
6611 @opindex mno-cirrus-fix-invalid-insns
6612 Insert NOPs into the instruction stream to in order to work around
6613 problems with invalid Maverick instruction combinations.  This option
6614 is only valid if the @option{-mcpu=ep9312} option has been used to
6615 enable generation of instructions for the Cirrus Maverick floating
6616 point co-processor.  This option is not enabled by default, since the
6617 problem is only present in older Maverick implementations.  The default
6618 can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
6619 switch.
6620
6621 @item -mpoke-function-name
6622 @opindex mpoke-function-name
6623 Write the name of each function into the text section, directly
6624 preceding the function prologue.  The generated code is similar to this:
6625
6626 @smallexample
6627      t0
6628          .ascii "arm_poke_function_name", 0
6629          .align
6630      t1
6631          .word 0xff000000 + (t1 - t0)
6632      arm_poke_function_name
6633          mov     ip, sp
6634          stmfd   sp!, @{fp, ip, lr, pc@}
6635          sub     fp, ip, #4
6636 @end smallexample
6637
6638 When performing a stack backtrace, code can inspect the value of
6639 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
6640 location @code{pc - 12} and the top 8 bits are set, then we know that
6641 there is a function name embedded immediately preceding this location
6642 and has length @code{((pc[-3]) & 0xff000000)}.
6643
6644 @item -mthumb
6645 @opindex mthumb
6646 Generate code for the 16-bit Thumb instruction set.  The default is to
6647 use the 32-bit ARM instruction set.
6648
6649 @item -mtpcs-frame
6650 @opindex mtpcs-frame
6651 Generate a stack frame that is compliant with the Thumb Procedure Call
6652 Standard for all non-leaf functions.  (A leaf function is one that does
6653 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
6654
6655 @item -mtpcs-leaf-frame
6656 @opindex mtpcs-leaf-frame
6657 Generate a stack frame that is compliant with the Thumb Procedure Call
6658 Standard for all leaf functions.  (A leaf function is one that does
6659 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
6660
6661 @item -mcallee-super-interworking
6662 @opindex mcallee-super-interworking
6663 Gives all externally visible functions in the file being compiled an ARM
6664 instruction set header which switches to Thumb mode before executing the
6665 rest of the function.  This allows these functions to be called from
6666 non-interworking code.
6667
6668 @item -mcaller-super-interworking
6669 @opindex mcaller-super-interworking
6670 Allows calls via function pointers (including virtual functions) to
6671 execute correctly regardless of whether the target code has been
6672 compiled for interworking or not.  There is a small overhead in the cost
6673 of executing a function pointer if this option is enabled.
6674
6675 @end table
6676
6677 @node AVR Options
6678 @subsection AVR Options
6679 @cindex AVR Options
6680
6681 These options are defined for AVR implementations:
6682
6683 @table @gcctabopt
6684 @item -mmcu=@var{mcu}
6685 @opindex mmcu
6686 Specify ATMEL AVR instruction set or MCU type.
6687
6688 Instruction set avr1 is for the minimal AVR core, not supported by the C
6689 compiler, only for assembler programs (MCU types: at90s1200, attiny10,
6690 attiny11, attiny12, attiny15, attiny28).
6691
6692 Instruction set avr2 (default) is for the classic AVR core with up to
6693 8K program memory space (MCU types: at90s2313, at90s2323, attiny22,
6694 at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
6695 at90c8534, at90s8535).
6696
6697 Instruction set avr3 is for the classic AVR core with up to 128K program
6698 memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
6699
6700 Instruction set avr4 is for the enhanced AVR core with up to 8K program
6701 memory space (MCU types: atmega8, atmega83, atmega85).
6702
6703 Instruction set avr5 is for the enhanced AVR core with up to 128K program
6704 memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
6705 atmega64, atmega128, at43usb355, at94k).
6706
6707 @item -msize
6708 @opindex msize
6709 Output instruction sizes to the asm file.
6710
6711 @item -minit-stack=@var{N}
6712 @opindex minit-stack
6713 Specify the initial stack address, which may be a symbol or numeric value,
6714 @samp{__stack} is the default.
6715
6716 @item -mno-interrupts
6717 @opindex mno-interrupts
6718 Generated code is not compatible with hardware interrupts.
6719 Code size will be smaller.
6720
6721 @item -mcall-prologues
6722 @opindex mcall-prologues
6723 Functions prologues/epilogues expanded as call to appropriate
6724 subroutines.  Code size will be smaller.
6725
6726 @item -mno-tablejump
6727 @opindex mno-tablejump
6728 Do not generate tablejump insns which sometimes increase code size.
6729
6730 @item -mtiny-stack
6731 @opindex mtiny-stack
6732 Change only the low 8 bits of the stack pointer.
6733
6734 @item -mint8
6735 @opindex mint8
6736 Assume int to be 8 bit integer. This affects the sizes of all types: A
6737 char will be 1 byte, an int will be 1 byte, an long will be 2 bytes
6738 and long long will be 4 bytes. Please note that this option does not
6739 comply to the C standards, but it will provide you with smaller code
6740 size.
6741 @end table
6742
6743 @node CRIS Options
6744 @subsection CRIS Options
6745 @cindex CRIS Options
6746
6747 These options are defined specifically for the CRIS ports.
6748
6749 @table @gcctabopt
6750 @item -march=@var{architecture-type}
6751 @itemx -mcpu=@var{architecture-type}
6752 @opindex march
6753 @opindex mcpu
6754 Generate code for the specified architecture.  The choices for
6755 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
6756 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX.
6757 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
6758 @samp{v10}.
6759
6760 @item -mtune=@var{architecture-type}
6761 @opindex mtune
6762 Tune to @var{architecture-type} everything applicable about the generated
6763 code, except for the ABI and the set of available instructions.  The
6764 choices for @var{architecture-type} are the same as for
6765 @option{-march=@var{architecture-type}}.
6766
6767 @item -mmax-stack-frame=@var{n}
6768 @opindex mmax-stack-frame
6769 Warn when the stack frame of a function exceeds @var{n} bytes.
6770
6771 @item -melinux-stacksize=@var{n}
6772 @opindex melinux-stacksize
6773 Only available with the @samp{cris-axis-aout} target.  Arranges for
6774 indications in the program to the kernel loader that the stack of the
6775 program should be set to @var{n} bytes.
6776
6777 @item -metrax4
6778 @itemx -metrax100
6779 @opindex metrax4
6780 @opindex metrax100
6781 The options @option{-metrax4} and @option{-metrax100} are synonyms for
6782 @option{-march=v3} and @option{-march=v8} respectively.
6783
6784 @item -mmul-bug-workaround
6785 @itemx -mno-mul-bug-workaround
6786 @opindex mmul-bug-workaround
6787 @opindex mno-mul-bug-workaround
6788 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
6789 models where it applies.  This option is active by default.
6790
6791 @item -mpdebug
6792 @opindex mpdebug
6793 Enable CRIS-specific verbose debug-related information in the assembly
6794 code.  This option also has the effect to turn off the @samp{#NO_APP}
6795 formatted-code indicator to the assembler at the beginning of the
6796 assembly file.
6797
6798 @item -mcc-init
6799 @opindex mcc-init
6800 Do not use condition-code results from previous instruction; always emit
6801 compare and test instructions before use of condition codes.
6802
6803 @item -mno-side-effects
6804 @opindex mno-side-effects
6805 Do not emit instructions with side-effects in addressing modes other than
6806 post-increment.
6807
6808 @item -mstack-align
6809 @itemx -mno-stack-align
6810 @itemx -mdata-align
6811 @itemx -mno-data-align
6812 @itemx -mconst-align
6813 @itemx -mno-const-align
6814 @opindex mstack-align
6815 @opindex mno-stack-align
6816 @opindex mdata-align
6817 @opindex mno-data-align
6818 @opindex mconst-align
6819 @opindex mno-const-align
6820 These options (no-options) arranges (eliminate arrangements) for the
6821 stack-frame, individual data and constants to be aligned for the maximum
6822 single data access size for the chosen CPU model.  The default is to
6823 arrange for 32-bit alignment.  ABI details such as structure layout are
6824 not affected by these options.
6825
6826 @item -m32-bit
6827 @itemx -m16-bit
6828 @itemx -m8-bit
6829 @opindex m32-bit
6830 @opindex m16-bit
6831 @opindex m8-bit
6832 Similar to the stack- data- and const-align options above, these options
6833 arrange for stack-frame, writable data and constants to all be 32-bit,
6834 16-bit or 8-bit aligned.  The default is 32-bit alignment.
6835
6836 @item -mno-prologue-epilogue
6837 @itemx -mprologue-epilogue
6838 @opindex mno-prologue-epilogue
6839 @opindex mprologue-epilogue
6840 With @option{-mno-prologue-epilogue}, the normal function prologue and
6841 epilogue that sets up the stack-frame are omitted and no return
6842 instructions or return sequences are generated in the code.  Use this
6843 option only together with visual inspection of the compiled code: no
6844 warnings or errors are generated when call-saved registers must be saved,
6845 or storage for local variable needs to be allocated.
6846
6847 @item -mno-gotplt
6848 @itemx -mgotplt
6849 @opindex mno-gotplt
6850 @opindex mgotplt
6851 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
6852 instruction sequences that load addresses for functions from the PLT part
6853 of the GOT rather than (traditional on other architectures) calls to the
6854 PLT.  The default is @option{-mgotplt}.
6855
6856 @item -maout
6857 @opindex maout
6858 Legacy no-op option only recognized with the cris-axis-aout target.
6859
6860 @item -melf
6861 @opindex melf
6862 Legacy no-op option only recognized with the cris-axis-elf and
6863 cris-axis-linux-gnu targets.
6864
6865 @item -melinux
6866 @opindex melinux
6867 Only recognized with the cris-axis-aout target, where it selects a
6868 GNU/linux-like multilib, include files and instruction set for
6869 @option{-march=v8}.
6870
6871 @item -mlinux
6872 @opindex mlinux
6873 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
6874
6875 @item -sim
6876 @opindex sim
6877 This option, recognized for the cris-axis-aout and cris-axis-elf arranges
6878 to link with input-output functions from a simulator library.  Code,
6879 initialized data and zero-initialized data are allocated consecutively.
6880
6881 @item -sim2
6882 @opindex sim2
6883 Like @option{-sim}, but pass linker options to locate initialized data at
6884 0x40000000 and zero-initialized data at 0x80000000.
6885 @end table
6886
6887 @node Darwin Options
6888 @subsection Darwin Options
6889 @cindex Darwin options
6890
6891 These options are defined for all architectures running the Darwin operating
6892 system.  They are useful for compatibility with other Mac OS compilers.
6893
6894 @table @gcctabopt
6895 @item -F@var{dir}
6896 @opindex F
6897 Add the framework directory @var{dir} to the head of the list of
6898 directories to be searched for header files.  These directories are
6899 interleaved with those specified by @option{-I} options and are
6900 scanned in a left-to-right order.
6901
6902 A framework directory is a directory with frameworks in it.  A
6903 framework is a directory with a @samp{"Headers"} and/or
6904 @samp{"PrivateHeaders"} directory contained directly in it that ends
6905 in @samp{".framework"}.  The name of a framework is the name of this
6906 directory excluding the @samp{".framework"}.  Headers associated with
6907 the framework are found in one of those two directories, with
6908 @samp{"Headers"} being searched first.  A subframework is a framework
6909 directory that is in a framework's @samp{"Frameworks"} directory.
6910 Includes of subframework headers can only appear in a header of a
6911 framework that contains the subframework, or in a sibling subframework
6912 header.  Two subframeworks are siblings if they occur in the same
6913 framework.  A subframework should not have the same name as a
6914 framework, a warning will be issued if this is violated.  Currently a
6915 subframework cannot have subframeworks, in the future, the mechanism
6916 may be extended to support this.  The standard frameworks can be found
6917 in @samp{"/System/Library/Frameworks"}, @samp{"/Library/Frameworks"}
6918 and @samp{"/Local/Library/Frameworks"}.  An example include looks like
6919 @code{#include <Framework/header.h>}, where @samp{Framework} denotes
6920 the name of the framework and header.h is found in the
6921 @samp{"PrivateHeaders"} or @samp{"Headers"} directory.
6922
6923 @item -gused
6924 @opindex -gused
6925 Emit debugging information for symbols that are used. For STABS
6926 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
6927 This is by default ON.
6928
6929 @item -gfull
6930 @opindex -gfull
6931 Emit debugging information for all symbols and types.
6932
6933 @item -all_load
6934 @opindex all_load
6935 Loads all members of static archive libraries.
6936 See man ld(1) for more information.
6937
6938 @item -arch_errors_fatal
6939 @opindex arch_errors_fatal
6940 Cause the errors having to do with files that have the wrong architecture
6941 to be fatal.
6942
6943 @item -bind_at_load
6944 @opindex bind_at_load
6945 Causes the output file to be marked such that the dynamic linker will
6946 bind all undefined references when the file is loaded or launched.
6947
6948 @item -bundle
6949 @opindex bundle
6950 Produce a Mach-o bundle format file.
6951 See man ld(1) for more information.
6952
6953 @item -bundle_loader @var{executable}
6954 @opindex bundle_loader
6955 This specifies the @var{executable} that will be loading the build
6956 output file being linked. See man ld(1) for more information.
6957
6958 @item -allowable_client  @var{client_name}
6959 @itemx -arch_only
6960
6961 @itemx -client_name
6962 @itemx -compatibility_version
6963 @itemx -current_version
6964 @itemx -dependency-file
6965 @itemx -dylib_file
6966 @itemx -dylinker_install_name
6967 @itemx -dynamic
6968 @itemx -dynamiclib
6969 @itemx -exported_symbols_list
6970 @itemx -filelist
6971 @itemx -flat_namespace
6972 @itemx -force_cpusubtype_ALL
6973 @itemx -force_flat_namespace
6974 @itemx -headerpad_max_install_names
6975 @itemx -image_base
6976 @itemx -init
6977 @itemx -install_name
6978 @itemx -keep_private_externs
6979 @itemx -multi_module
6980 @itemx -multiply_defined
6981 @itemx -multiply_defined_unused
6982 @itemx -noall_load
6983 @itemx -nofixprebinding
6984 @itemx -nomultidefs
6985 @itemx -noprebind
6986 @itemx -noseglinkedit
6987 @itemx -pagezero_size
6988 @itemx -prebind
6989 @itemx -prebind_all_twolevel_modules
6990 @itemx -private_bundle
6991 @itemx -read_only_relocs
6992 @itemx -sectalign
6993 @itemx -sectobjectsymbols
6994 @itemx -whyload
6995 @itemx -seg1addr
6996 @itemx -sectcreate
6997 @itemx -sectobjectsymbols
6998 @itemx -sectorder
6999 @itemx -seg_addr_table
7000 @itemx -seg_addr_table_filename
7001 @itemx -seglinkedit
7002 @itemx -segprot
7003 @itemx -segs_read_only_addr
7004 @itemx -segs_read_write_addr
7005 @itemx -single_module
7006 @itemx -static
7007 @itemx -sub_library
7008 @itemx -sub_umbrella
7009 @itemx -twolevel_namespace
7010 @itemx -umbrella
7011 @itemx -undefined
7012 @itemx -unexported_symbols_list
7013 @itemx -weak_reference_mismatches
7014 @itemx -whatsloaded
7015
7016 @opindex allowable_client
7017 @opindex arch_only
7018 @opindex client_name
7019 @opindex compatibility_version
7020 @opindex current_version
7021 @opindex dependency-file
7022 @opindex dylib_file
7023 @opindex dylinker_install_name
7024 @opindex dynamic
7025 @opindex dynamiclib
7026 @opindex exported_symbols_list
7027 @opindex filelist
7028 @opindex flat_namespace
7029 @opindex force_cpusubtype_ALL
7030 @opindex force_flat_namespace
7031 @opindex headerpad_max_install_names
7032 @opindex image_base
7033 @opindex init
7034 @opindex install_name
7035 @opindex keep_private_externs
7036 @opindex multi_module
7037 @opindex multiply_defined
7038 @opindex multiply_defined_unused
7039 @opindex noall_load
7040 @opindex nofixprebinding
7041 @opindex nomultidefs
7042 @opindex noprebind
7043 @opindex noseglinkedit
7044 @opindex pagezero_size
7045 @opindex prebind
7046 @opindex prebind_all_twolevel_modules
7047 @opindex private_bundle
7048 @opindex read_only_relocs
7049 @opindex sectalign
7050 @opindex sectobjectsymbols
7051 @opindex whyload
7052 @opindex seg1addr
7053 @opindex sectcreate
7054 @opindex sectobjectsymbols
7055 @opindex sectorder
7056 @opindex seg_addr_table
7057 @opindex seg_addr_table_filename
7058 @opindex seglinkedit
7059 @opindex segprot
7060 @opindex segs_read_only_addr
7061 @opindex segs_read_write_addr
7062 @opindex single_module
7063 @opindex static
7064 @opindex sub_library
7065 @opindex sub_umbrella
7066 @opindex twolevel_namespace
7067 @opindex umbrella
7068 @opindex undefined
7069 @opindex unexported_symbols_list
7070 @opindex weak_reference_mismatches
7071 @opindex whatsloaded
7072
7073 These options are available for Darwin linker. Darwin linker man page
7074 describes them in detail.
7075 @end table
7076
7077 @node DEC Alpha Options
7078 @subsection DEC Alpha Options
7079
7080 These @samp{-m} options are defined for the DEC Alpha implementations:
7081
7082 @table @gcctabopt
7083 @item -mno-soft-float
7084 @itemx -msoft-float
7085 @opindex mno-soft-float
7086 @opindex msoft-float
7087 Use (do not use) the hardware floating-point instructions for
7088 floating-point operations.  When @option{-msoft-float} is specified,
7089 functions in @file{libgcc.a} will be used to perform floating-point
7090 operations.  Unless they are replaced by routines that emulate the
7091 floating-point operations, or compiled in such a way as to call such
7092 emulations routines, these routines will issue floating-point
7093 operations.   If you are compiling for an Alpha without floating-point
7094 operations, you must ensure that the library is built so as not to call
7095 them.
7096
7097 Note that Alpha implementations without floating-point operations are
7098 required to have floating-point registers.
7099
7100 @item -mfp-reg
7101 @itemx -mno-fp-regs
7102 @opindex mfp-reg
7103 @opindex mno-fp-regs
7104 Generate code that uses (does not use) the floating-point register set.
7105 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
7106 register set is not used, floating point operands are passed in integer
7107 registers as if they were integers and floating-point results are passed
7108 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
7109 so any function with a floating-point argument or return value called by code
7110 compiled with @option{-mno-fp-regs} must also be compiled with that
7111 option.
7112
7113 A typical use of this option is building a kernel that does not use,
7114 and hence need not save and restore, any floating-point registers.
7115
7116 @item -mieee
7117 @opindex mieee
7118 The Alpha architecture implements floating-point hardware optimized for
7119 maximum performance.  It is mostly compliant with the IEEE floating
7120 point standard.  However, for full compliance, software assistance is
7121 required.  This option generates code fully IEEE compliant code
7122 @emph{except} that the @var{inexact-flag} is not maintained (see below).
7123 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
7124 defined during compilation.  The resulting code is less efficient but is
7125 able to correctly support denormalized numbers and exceptional IEEE
7126 values such as not-a-number and plus/minus infinity.  Other Alpha
7127 compilers call this option @option{-ieee_with_no_inexact}.
7128
7129 @item -mieee-with-inexact
7130 @opindex mieee-with-inexact
7131 This is like @option{-mieee} except the generated code also maintains
7132 the IEEE @var{inexact-flag}.  Turning on this option causes the
7133 generated code to implement fully-compliant IEEE math.  In addition to
7134 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
7135 macro.  On some Alpha implementations the resulting code may execute
7136 significantly slower than the code generated by default.  Since there is
7137 very little code that depends on the @var{inexact-flag}, you should
7138 normally not specify this option.  Other Alpha compilers call this
7139 option @option{-ieee_with_inexact}.
7140
7141 @item -mfp-trap-mode=@var{trap-mode}
7142 @opindex mfp-trap-mode
7143 This option controls what floating-point related traps are enabled.
7144 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
7145 The trap mode can be set to one of four values:
7146
7147 @table @samp
7148 @item n
7149 This is the default (normal) setting.  The only traps that are enabled
7150 are the ones that cannot be disabled in software (e.g., division by zero
7151 trap).
7152
7153 @item u
7154 In addition to the traps enabled by @samp{n}, underflow traps are enabled
7155 as well.
7156
7157 @item su
7158 Like @samp{su}, but the instructions are marked to be safe for software
7159 completion (see Alpha architecture manual for details).
7160
7161 @item sui
7162 Like @samp{su}, but inexact traps are enabled as well.
7163 @end table
7164
7165 @item -mfp-rounding-mode=@var{rounding-mode}
7166 @opindex mfp-rounding-mode
7167 Selects the IEEE rounding mode.  Other Alpha compilers call this option
7168 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
7169 of:
7170
7171 @table @samp
7172 @item n
7173 Normal IEEE rounding mode.  Floating point numbers are rounded towards
7174 the nearest machine number or towards the even machine number in case
7175 of a tie.
7176
7177 @item m
7178 Round towards minus infinity.
7179
7180 @item c
7181 Chopped rounding mode.  Floating point numbers are rounded towards zero.
7182
7183 @item d
7184 Dynamic rounding mode.  A field in the floating point control register
7185 (@var{fpcr}, see Alpha architecture reference manual) controls the
7186 rounding mode in effect.  The C library initializes this register for
7187 rounding towards plus infinity.  Thus, unless your program modifies the
7188 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
7189 @end table
7190
7191 @item -mtrap-precision=@var{trap-precision}
7192 @opindex mtrap-precision
7193 In the Alpha architecture, floating point traps are imprecise.  This
7194 means without software assistance it is impossible to recover from a
7195 floating trap and program execution normally needs to be terminated.
7196 GCC can generate code that can assist operating system trap handlers
7197 in determining the exact location that caused a floating point trap.
7198 Depending on the requirements of an application, different levels of
7199 precisions can be selected:
7200
7201 @table @samp
7202 @item p
7203 Program precision.  This option is the default and means a trap handler
7204 can only identify which program caused a floating point exception.
7205
7206 @item f
7207 Function precision.  The trap handler can determine the function that
7208 caused a floating point exception.
7209
7210 @item i
7211 Instruction precision.  The trap handler can determine the exact
7212 instruction that caused a floating point exception.
7213 @end table
7214
7215 Other Alpha compilers provide the equivalent options called
7216 @option{-scope_safe} and @option{-resumption_safe}.
7217
7218 @item -mieee-conformant
7219 @opindex mieee-conformant
7220 This option marks the generated code as IEEE conformant.  You must not
7221 use this option unless you also specify @option{-mtrap-precision=i} and either
7222 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
7223 is to emit the line @samp{.eflag 48} in the function prologue of the
7224 generated assembly file.  Under DEC Unix, this has the effect that
7225 IEEE-conformant math library routines will be linked in.
7226
7227 @item -mbuild-constants
7228 @opindex mbuild-constants
7229 Normally GCC examines a 32- or 64-bit integer constant to
7230 see if it can construct it from smaller constants in two or three
7231 instructions.  If it cannot, it will output the constant as a literal and
7232 generate code to load it from the data segment at runtime.
7233
7234 Use this option to require GCC to construct @emph{all} integer constants
7235 using code, even if it takes more instructions (the maximum is six).
7236
7237 You would typically use this option to build a shared library dynamic
7238 loader.  Itself a shared library, it must relocate itself in memory
7239 before it can find the variables and constants in its own data segment.
7240
7241 @item -malpha-as
7242 @itemx -mgas
7243 @opindex malpha-as
7244 @opindex mgas
7245 Select whether to generate code to be assembled by the vendor-supplied
7246 assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
7247
7248 @item -mbwx
7249 @itemx -mno-bwx
7250 @itemx -mcix
7251 @itemx -mno-cix
7252 @itemx -mfix
7253 @itemx -mno-fix
7254 @itemx -mmax
7255 @itemx -mno-max
7256 @opindex mbwx
7257 @opindex mno-bwx
7258 @opindex mcix
7259 @opindex mno-cix
7260 @opindex mfix
7261 @opindex mno-fix
7262 @opindex mmax
7263 @opindex mno-max
7264 Indicate whether GCC should generate code to use the optional BWX,
7265 CIX, FIX and MAX instruction sets.  The default is to use the instruction
7266 sets supported by the CPU type specified via @option{-mcpu=} option or that
7267 of the CPU on which GCC was built if none was specified.
7268
7269 @item -mfloat-vax
7270 @itemx -mfloat-ieee
7271 @opindex mfloat-vax
7272 @opindex mfloat-ieee
7273 Generate code that uses (does not use) VAX F and G floating point
7274 arithmetic instead of IEEE single and double precision.
7275
7276 @item -mexplicit-relocs
7277 @itemx -mno-explicit-relocs
7278 @opindex mexplicit-relocs
7279 @opindex mno-explicit-relocs
7280 Older Alpha assemblers provided no way to generate symbol relocations
7281 except via assembler macros.  Use of these macros does not allow
7282 optimal instruction scheduling.  GNU binutils as of version 2.12
7283 supports a new syntax that allows the compiler to explicitly mark
7284 which relocations should apply to which instructions.  This option
7285 is mostly useful for debugging, as GCC detects the capabilities of
7286 the assembler when it is built and sets the default accordingly.
7287
7288 @item -msmall-data
7289 @itemx -mlarge-data
7290 @opindex msmall-data
7291 @opindex mlarge-data
7292 When @option{-mexplicit-relocs} is in effect, static data is
7293 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
7294 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
7295 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
7296 16-bit relocations off of the @code{$gp} register.  This limits the
7297 size of the small data area to 64KB, but allows the variables to be
7298 directly accessed via a single instruction.
7299
7300 The default is @option{-mlarge-data}.  With this option the data area
7301 is limited to just below 2GB.  Programs that require more than 2GB of
7302 data must use @code{malloc} or @code{mmap} to allocate the data in the
7303 heap instead of in the program's data segment.
7304
7305 When generating code for shared libraries, @option{-fpic} implies
7306 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
7307
7308 @item -msmall-text
7309 @itemx -mlarge-text
7310 @opindex msmall-text
7311 @opindex mlarge-text
7312 When @option{-msmall-text} is used, the compiler assumes that the
7313 code of the entire program (or shared library) fits in 4MB, and is
7314 thus reachable with a branch instruction.  When @option{-msmall-data}
7315 is used, the compiler can assume that all local symbols share the
7316 same @code{$gp} value, and thus reduce the number of instructions
7317 required for a function call from 4 to 1.
7318
7319 The default is @option{-mlarge-text}.
7320
7321 @item -mcpu=@var{cpu_type}
7322 @opindex mcpu
7323 Set the instruction set and instruction scheduling parameters for
7324 machine type @var{cpu_type}.  You can specify either the @samp{EV}
7325 style name or the corresponding chip number.  GCC supports scheduling
7326 parameters for the EV4, EV5 and EV6 family of processors and will
7327 choose the default values for the instruction set from the processor
7328 you specify.  If you do not specify a processor type, GCC will default
7329 to the processor on which the compiler was built.
7330
7331 Supported values for @var{cpu_type} are
7332
7333 @table @samp
7334 @item ev4
7335 @itemx ev45
7336 @itemx 21064
7337 Schedules as an EV4 and has no instruction set extensions.
7338
7339 @item ev5
7340 @itemx 21164
7341 Schedules as an EV5 and has no instruction set extensions.
7342
7343 @item ev56
7344 @itemx 21164a
7345 Schedules as an EV5 and supports the BWX extension.
7346
7347 @item pca56
7348 @itemx 21164pc
7349 @itemx 21164PC
7350 Schedules as an EV5 and supports the BWX and MAX extensions.
7351
7352 @item ev6
7353 @itemx 21264
7354 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
7355
7356 @item ev67
7357 @itemx 21264a
7358 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
7359 @end table
7360
7361 @item -mtune=@var{cpu_type}
7362 @opindex mtune
7363 Set only the instruction scheduling parameters for machine type
7364 @var{cpu_type}.  The instruction set is not changed.
7365
7366 @item -mmemory-latency=@var{time}
7367 @opindex mmemory-latency
7368 Sets the latency the scheduler should assume for typical memory
7369 references as seen by the application.  This number is highly
7370 dependent on the memory access patterns used by the application
7371 and the size of the external cache on the machine.
7372
7373 Valid options for @var{time} are
7374
7375 @table @samp
7376 @item @var{number}
7377 A decimal number representing clock cycles.
7378
7379 @item L1
7380 @itemx L2
7381 @itemx L3
7382 @itemx main
7383 The compiler contains estimates of the number of clock cycles for
7384 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
7385 (also called Dcache, Scache, and Bcache), as well as to main memory.
7386 Note that L3 is only valid for EV5.
7387
7388 @end table
7389 @end table
7390
7391 @node DEC Alpha/VMS Options
7392 @subsection DEC Alpha/VMS Options
7393
7394 These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
7395
7396 @table @gcctabopt
7397 @item -mvms-return-codes
7398 @opindex mvms-return-codes
7399 Return VMS condition codes from main.  The default is to return POSIX
7400 style condition (e.g.@ error) codes.
7401 @end table
7402
7403 @node FRV Options
7404 @subsection FRV Options
7405 @cindex FRV Options
7406
7407 @table @gcctabopt
7408 @item -mgpr-32
7409 @opindex mgpr-32
7410
7411 Only use the first 32 general purpose registers.
7412
7413 @item -mgpr-64
7414 @opindex mgpr-64
7415
7416 Use all 64 general purpose registers.
7417
7418 @item -mfpr-32
7419 @opindex mfpr-32
7420
7421 Use only the first 32 floating point registers.
7422
7423 @item -mfpr-64
7424 @opindex mfpr-64
7425
7426 Use all 64 floating point registers
7427
7428 @item -mhard-float
7429 @opindex mhard-float
7430
7431 Use hardware instructions for floating point operations.
7432
7433 @item -msoft-float
7434 @opindex msoft-float
7435
7436 Use library routines for floating point operations.
7437
7438 @item -malloc-cc
7439 @opindex malloc-cc
7440
7441 Dynamically allocate condition code registers.
7442
7443 @item -mfixed-cc
7444 @opindex mfixed-cc
7445
7446 Do not try to dynamically allocate condition code registers, only
7447 use @code{icc0} and @code{fcc0}.
7448
7449 @item -mdword
7450 @opindex mdword
7451
7452 Change ABI to use double word insns.
7453
7454 @item -mno-dword
7455 @opindex mno-dword
7456
7457 Do not use double word instructions.
7458
7459 @item -mdouble
7460 @opindex mdouble
7461
7462 Use floating point double instructions.
7463
7464 @item -mno-double
7465 @opindex mno-double
7466
7467 Do not use floating point double instructions.
7468
7469 @item -mmedia
7470 @opindex mmedia
7471
7472 Use media instructions.
7473
7474 @item -mno-media
7475 @opindex mno-media
7476
7477 Do not use media instructions.
7478
7479 @item -mmuladd
7480 @opindex mmuladd
7481
7482 Use multiply and add/subtract instructions.
7483
7484 @item -mno-muladd
7485 @opindex mno-muladd
7486
7487 Do not use multiply and add/subtract instructions.
7488
7489 @item -mlibrary-pic
7490 @opindex mlibrary-pic
7491
7492 Generate position-independent EABI code.
7493
7494 @item -macc-4
7495 @opindex macc-4
7496
7497 Use only the first four media accumulator registers.
7498
7499 @item -macc-8
7500 @opindex macc-8
7501
7502 Use all eight media accumulator registers.
7503
7504 @item -mpack
7505 @opindex mpack
7506
7507 Pack VLIW instructions.
7508
7509 @item -mno-pack
7510 @opindex mno-pack
7511
7512 Do not pack VLIW instructions.
7513
7514 @item -mno-eflags
7515 @opindex mno-eflags
7516
7517 Do not mark ABI switches in e_flags.
7518
7519 @item -mcond-move
7520 @opindex mcond-move
7521
7522 Enable the use of conditional-move instructions (default).
7523
7524 This switch is mainly for debugging the compiler and will likely be removed
7525 in a future version.
7526
7527 @item -mno-cond-move
7528 @opindex mno-cond-move
7529
7530 Disable the use of conditional-move instructions.
7531
7532 This switch is mainly for debugging the compiler and will likely be removed
7533 in a future version.
7534
7535 @item -mscc
7536 @opindex mscc
7537
7538 Enable the use of conditional set instructions (default).
7539
7540 This switch is mainly for debugging the compiler and will likely be removed
7541 in a future version.
7542
7543 @item -mno-scc
7544 @opindex mno-scc
7545
7546 Disable the use of conditional set instructions.
7547
7548 This switch is mainly for debugging the compiler and will likely be removed
7549 in a future version.
7550
7551 @item -mcond-exec
7552 @opindex mcond-exec
7553
7554 Enable the use of conditional execution (default).
7555
7556 This switch is mainly for debugging the compiler and will likely be removed
7557 in a future version.
7558
7559 @item -mno-cond-exec
7560 @opindex mno-cond-exec
7561
7562 Disable the use of conditional execution.
7563
7564 This switch is mainly for debugging the compiler and will likely be removed
7565 in a future version.
7566
7567 @item -mvliw-branch
7568 @opindex mvliw-branch
7569
7570 Run a pass to pack branches into VLIW instructions (default).
7571
7572 This switch is mainly for debugging the compiler and will likely be removed
7573 in a future version.
7574
7575 @item -mno-vliw-branch
7576 @opindex mno-vliw-branch
7577
7578 Do not run a pass to pack branches into VLIW instructions.
7579
7580 This switch is mainly for debugging the compiler and will likely be removed
7581 in a future version.
7582
7583 @item -mmulti-cond-exec
7584 @opindex mmulti-cond-exec
7585
7586 Enable optimization of @code{&&} and @code{||} in conditional execution
7587 (default).
7588
7589 This switch is mainly for debugging the compiler and will likely be removed
7590 in a future version.
7591
7592 @item -mno-multi-cond-exec
7593 @opindex mno-multi-cond-exec
7594
7595 Disable optimization of @code{&&} and @code{||} in conditional execution.
7596
7597 This switch is mainly for debugging the compiler and will likely be removed
7598 in a future version.
7599
7600 @item -mnested-cond-exec
7601 @opindex mnested-cond-exec
7602
7603 Enable nested conditional execution optimizations (default).
7604
7605 This switch is mainly for debugging the compiler and will likely be removed
7606 in a future version.
7607
7608 @item -mno-nested-cond-exec
7609 @opindex mno-nested-cond-exec
7610
7611 Disable nested conditional execution optimizations.
7612
7613 This switch is mainly for debugging the compiler and will likely be removed
7614 in a future version.
7615
7616 @item -mtomcat-stats
7617 @opindex mtomcat-stats
7618
7619 Cause gas to print out tomcat statistics.
7620
7621 @item -mcpu=@var{cpu}
7622 @opindex mcpu
7623
7624 Select the processor type for which to generate code.  Possible values are
7625 @samp{simple}, @samp{tomcat}, @samp{fr500}, @samp{fr400}, @samp{fr300},
7626 @samp{frv}.
7627
7628 @end table
7629
7630 @node H8/300 Options
7631 @subsection H8/300 Options
7632
7633 These @samp{-m} options are defined for the H8/300 implementations:
7634
7635 @table @gcctabopt
7636 @item -mrelax
7637 @opindex mrelax
7638 Shorten some address references at link time, when possible; uses the
7639 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
7640 ld, Using ld}, for a fuller description.
7641
7642 @item -mh
7643 @opindex mh
7644 Generate code for the H8/300H@.
7645
7646 @item -ms
7647 @opindex ms
7648 Generate code for the H8S@.
7649
7650 @item -mn
7651 @opindex mn
7652 Generate code for the H8S and H8/300H in the normal mode.  This switch
7653 must be used either with -mh or -ms.
7654
7655 @item -ms2600
7656 @opindex ms2600
7657 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
7658
7659 @item -mint32
7660 @opindex mint32
7661 Make @code{int} data 32 bits by default.
7662
7663 @item -malign-300
7664 @opindex malign-300
7665 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
7666 The default for the H8/300H and H8S is to align longs and floats on 4
7667 byte boundaries.
7668 @option{-malign-300} causes them to be aligned on 2 byte boundaries.
7669 This option has no effect on the H8/300.
7670 @end table
7671
7672 @node HPPA Options
7673 @subsection HPPA Options
7674 @cindex HPPA Options
7675
7676 These @samp{-m} options are defined for the HPPA family of computers:
7677
7678 @table @gcctabopt
7679 @item -march=@var{architecture-type}
7680 @opindex march
7681 Generate code for the specified architecture.  The choices for
7682 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
7683 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
7684 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
7685 architecture option for your machine.  Code compiled for lower numbered
7686 architectures will run on higher numbered architectures, but not the
7687 other way around.
7688
7689 PA 2.0 support currently requires gas snapshot 19990413 or later.  The
7690 next release of binutils (current is 2.9.1) will probably contain PA 2.0
7691 support.
7692
7693 @item -mpa-risc-1-0
7694 @itemx -mpa-risc-1-1
7695 @itemx -mpa-risc-2-0
7696 @opindex mpa-risc-1-0
7697 @opindex mpa-risc-1-1
7698 @opindex mpa-risc-2-0
7699 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
7700
7701 @item -mbig-switch
7702 @opindex mbig-switch
7703 Generate code suitable for big switch tables.  Use this option only if
7704 the assembler/linker complain about out of range branches within a switch
7705 table.
7706
7707 @item -mjump-in-delay
7708 @opindex mjump-in-delay
7709 Fill delay slots of function calls with unconditional jump instructions
7710 by modifying the return pointer for the function call to be the target
7711 of the conditional jump.
7712
7713 @item -mdisable-fpregs
7714 @opindex mdisable-fpregs
7715 Prevent floating point registers from being used in any manner.  This is
7716 necessary for compiling kernels which perform lazy context switching of
7717 floating point registers.  If you use this option and attempt to perform
7718 floating point operations, the compiler will abort.
7719
7720 @item -mdisable-indexing
7721 @opindex mdisable-indexing
7722 Prevent the compiler from using indexing address modes.  This avoids some
7723 rather obscure problems when compiling MIG generated code under MACH@.
7724
7725 @item -mno-space-regs
7726 @opindex mno-space-regs
7727 Generate code that assumes the target has no space registers.  This allows
7728 GCC to generate faster indirect calls and use unscaled index address modes.
7729
7730 Such code is suitable for level 0 PA systems and kernels.
7731
7732 @item -mfast-indirect-calls
7733 @opindex mfast-indirect-calls
7734 Generate code that assumes calls never cross space boundaries.  This
7735 allows GCC to emit code which performs faster indirect calls.
7736
7737 This option will not work in the presence of shared libraries or nested
7738 functions.
7739
7740 @item -mfixed-range=@var{register-range}
7741 @opindex mfixed-range
7742 Generate code treating the given register range as fixed registers.
7743 A fixed register is one that the register allocator can not use.  This is
7744 useful when compiling kernel code.  A register range is specified as
7745 two registers separated by a dash.  Multiple register ranges can be
7746 specified separated by a comma.
7747
7748 @item -mlong-load-store
7749 @opindex mlong-load-store
7750 Generate 3-instruction load and store sequences as sometimes required by
7751 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
7752 the HP compilers.
7753
7754 @item -mportable-runtime
7755 @opindex mportable-runtime
7756 Use the portable calling conventions proposed by HP for ELF systems.
7757
7758 @item -mgas
7759 @opindex mgas
7760 Enable the use of assembler directives only GAS understands.
7761
7762 @item -mschedule=@var{cpu-type}
7763 @opindex mschedule
7764 Schedule code according to the constraints for the machine type
7765 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
7766 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
7767 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
7768 proper scheduling option for your machine.  The default scheduling is
7769 @samp{8000}.
7770
7771 @item -mlinker-opt
7772 @opindex mlinker-opt
7773 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
7774 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
7775 linkers in which they give bogus error messages when linking some programs.
7776
7777 @item -msoft-float
7778 @opindex msoft-float
7779 Generate output containing library calls for floating point.
7780 @strong{Warning:} the requisite libraries are not available for all HPPA
7781 targets.  Normally the facilities of the machine's usual C compiler are
7782 used, but this cannot be done directly in cross-compilation.  You must make
7783 your own arrangements to provide suitable library functions for
7784 cross-compilation.  The embedded target @samp{hppa1.1-*-pro}
7785 does provide software floating point support.
7786
7787 @option{-msoft-float} changes the calling convention in the output file;
7788 therefore, it is only useful if you compile @emph{all} of a program with
7789 this option.  In particular, you need to compile @file{libgcc.a}, the
7790 library that comes with GCC, with @option{-msoft-float} in order for
7791 this to work.
7792
7793 @item -msio
7794 @opindex msio
7795 Generate the predefine, @code{_SIO}, for server IO.  The default is
7796 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
7797 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO.  These
7798 options are available under HP-UX and HI-UX.
7799
7800 @item -mgnu-ld
7801 @opindex gnu-ld
7802 Use GNU ld specific options.  This passes @option{-shared} to ld when
7803 building a shared library.  It is the default when GCC is configured,
7804 explicitly or implicitly, with the GNU linker.  This option does not
7805 have any affect on which ld is called, it only changes what parameters
7806 are passed to that ld.  The ld that is called is determined by the
7807 @option{--with-ld} configure option, GCC's program search path, and
7808 finally by the user's @env{PATH}.  The linker used by GCC can be printed
7809 using @samp{which `gcc -print-prog-name=ld`}.
7810
7811 @item -mhp-ld
7812 @opindex hp-ld
7813 Use HP ld specific options.  This passes @option{-b} to ld when building
7814 a shared library and passes @option{+Accept TypeMismatch} to ld on all
7815 links.  It is the default when GCC is configured, explicitly or
7816 implicitly, with the HP linker.  This option does not have any affect on
7817 which ld is called, it only changes what parameters are passed to that
7818 ld.  The ld that is called is determined by the @option{--with-ld}
7819 configure option, GCC's program search path, and finally by the user's
7820 @env{PATH}.  The linker used by GCC can be printed using @samp{which
7821 `gcc -print-prog-name=ld`}.
7822
7823 @item -mfdpic
7824 @opindex mfdpic
7825
7826 Select the FDPIC ABI, that uses function descriptors to represent
7827 pointers to functions.  Without any PIC/PIE-related options, it
7828 implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
7829 assumes GOT entries and small data are within a 12-bit range from the
7830 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
7831 are computed with 32 bits.
7832
7833 @item -minline-plt
7834 @opindex minline-plt
7835
7836 Enable inlining of PLT entries in function calls to functions that are
7837 not known to bind locally.  It has no effect without @option{-mfdpic}.
7838 It's enabled by default if optimizing for speed and compiling for
7839 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
7840 optimization option such as @option{-O3} or above is present in the
7841 command line.
7842
7843 @item -mgprel-ro
7844 @opindex mgprel-ro
7845
7846 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
7847 that is known to be in read-only sections.  It's enabled by default,
7848 except for @option{-fpic} or @option{-fpie}: even though it may help
7849 make the global offset table smaller, it trades 1 instruction for 4.
7850 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
7851 one of which may be shared by multiple symbols, and it avoids the need
7852 for a GOT entry for the referenced symbol, so it's more likely to be a
7853 win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
7854
7855 @item -multilib-library-pic
7856 @opindex multilib-library-pic
7857
7858 Link with the (library, not FD) pic libraries.  It's implied by
7859 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
7860 @option{-fpic} without @option{-mfdpic}.  You should never have to use
7861 it explicitly.
7862
7863 @item -mlinked-fp
7864 @opindex mlinked-fp
7865
7866 Follow the EABI requirement of always creating a frame pointer whenever
7867 a stack frame is allocated.  This option is enabled by default and can
7868 be disabled with @option{-mno-linked-fp}.
7869
7870 @item -mlong-calls
7871 @opindex mno-long-calls
7872 Generate code that uses long call sequences.  This ensures that a call
7873 is always able to reach linker generated stubs.  The default is to generate
7874 long calls only when the distance from the call site to the beginning
7875 of the function or translation unit, as the case may be, exceeds a
7876 predefined limit set by the branch type being used.  The limits for
7877 normal calls are 7,600,000 and 240,000 bytes, respectively for the
7878 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
7879 240,000 bytes.
7880
7881 Distances are measured from the beginning of functions when using the
7882 @option{-ffunction-sections} option, or when using the @option{-mgas}
7883 and @option{-mno-portable-runtime} options together under HP-UX with
7884 the SOM linker.
7885
7886 It is normally not desirable to use this option as it will degrade
7887 performance.  However, it may be useful in large applications,
7888 particularly when partial linking is used to build the application.
7889
7890 The types of long calls used depends on the capabilities of the
7891 assembler and linker, and the type of code being generated.  The
7892 impact on systems that support long absolute calls, and long pic
7893 symbol-difference or pc-relative calls should be relatively small.
7894 However, an indirect call is used on 32-bit ELF systems in pic code
7895 and it is quite long.
7896
7897 @item -nolibdld
7898 @opindex nolibdld
7899 Suppress the generation of link options to search libdld.sl when the
7900 @option{-static} option is specified on HP-UX 10 and later.
7901
7902 @item -static
7903 @opindex static
7904 The HP-UX implementation of setlocale in libc has a dependency on
7905 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
7906 when the @option{-static} option is specified, special link options
7907 are needed to resolve this dependency.
7908
7909 On HP-UX 10 and later, the GCC driver adds the necessary options to
7910 link with libdld.sl when the @option{-static} option is specified.
7911 This causes the resulting binary to be dynamic.  On the 64-bit port,
7912 the linkers generate dynamic binaries by default in any case.  The
7913 @option{-nolibdld} option can be used to prevent the GCC driver from
7914 adding these link options.
7915
7916 @item -threads
7917 @opindex threads
7918 Add support for multithreading with the @dfn{dce thread} library
7919 under HP-UX.  This option sets flags for both the preprocessor and
7920 linker.
7921 @end table
7922
7923 @node i386 and x86-64 Options
7924 @subsection Intel 386 and AMD x86-64 Options
7925 @cindex i386 Options
7926 @cindex x86-64 Options
7927 @cindex Intel 386 Options
7928 @cindex AMD x86-64 Options
7929
7930 These @samp{-m} options are defined for the i386 and x86-64 family of
7931 computers:
7932
7933 @table @gcctabopt
7934 @item -mtune=@var{cpu-type}
7935 @opindex mtune
7936 Tune to @var{cpu-type} everything applicable about the generated code, except
7937 for the ABI and the set of available instructions.  The choices for
7938 @var{cpu-type} are:
7939 @table @emph
7940 @item i386
7941 Original Intel's i386 CPU.
7942 @item i486
7943 Intel's i486 CPU.  (No scheduling is implemented for this chip.)
7944 @item i586, pentium
7945 Intel Pentium CPU with no MMX support.
7946 @item pentium-mmx
7947 Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
7948 @item i686, pentiumpro
7949 Intel PentiumPro CPU.
7950 @item pentium2
7951 Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
7952 @item pentium3, pentium3m
7953 Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
7954 support.
7955 @item pentium-m
7956 Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set
7957 support.  Used by Centrino notebooks.
7958 @item pentium4, pentium4m
7959 Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
7960 @item prescott
7961 Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction
7962 set support.
7963 @item nocona
7964 Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE,
7965 SSE2 and SSE3 instruction set support.
7966 @item k6
7967 AMD K6 CPU with MMX instruction set support.
7968 @item k6-2, k6-3
7969 Improved versions of AMD K6 CPU with MMX and 3dNOW! instruction set support.
7970 @item athlon, athlon-tbird
7971 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE prefetch instructions
7972 support.
7973 @item athlon-4, athlon-xp, athlon-mp
7974 Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and full SSE
7975 instruction set support.
7976 @item k8, opteron, athlon64, athlon-fx
7977 AMD K8 core based CPUs with x86-64 instruction set support.  (This supersets
7978 MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.)
7979 @item winchip-c6
7980 IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
7981 set support.
7982 @item winchip2
7983 IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW!
7984 instruction set support.
7985 @item c3
7986 Via C3 CPU with MMX and 3dNOW!  instruction set support.  (No scheduling is
7987 implemented for this chip.)
7988 @item c3-2
7989 Via C3-2 CPU with MMX and SSE instruction set support.  (No scheduling is
7990 implemented for this chip.)
7991 @end table
7992
7993 While picking a specific @var{cpu-type} will schedule things appropriately
7994 for that particular chip, the compiler will not generate any code that
7995 does not run on the i386 without the @option{-march=@var{cpu-type}} option
7996 being used.
7997
7998 @item -march=@var{cpu-type}
7999 @opindex march
8000 Generate instructions for the machine type @var{cpu-type}.  The choices
8001 for @var{cpu-type} are the same as for @option{-mtune}.  Moreover,
8002 specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
8003
8004 @item -mcpu=@var{cpu-type}
8005 @opindex mcpu
8006 A deprecated synonym for @option{-mtune}.
8007
8008 @item -m386
8009 @itemx -m486
8010 @itemx -mpentium
8011 @itemx -mpentiumpro
8012 @opindex m386
8013 @opindex m486
8014 @opindex mpentium
8015 @opindex mpentiumpro
8016 These options are synonyms for @option{-mtune=i386}, @option{-mtune=i486},
8017 @option{-mtune=pentium}, and @option{-mtune=pentiumpro} respectively.
8018 These synonyms are deprecated.
8019
8020 @item -mfpmath=@var{unit}
8021 @opindex march
8022 Generate floating point arithmetics for selected unit @var{unit}.  The choices
8023 for @var{unit} are:
8024
8025 @table @samp
8026 @item 387
8027 Use the standard 387 floating point coprocessor present majority of chips and
8028 emulated otherwise.  Code compiled with this option will run almost everywhere.
8029 The temporary results are computed in 80bit precision instead of precision
8030 specified by the type resulting in slightly different results compared to most
8031 of other chips. See @option{-ffloat-store} for more detailed description.
8032
8033 This is the default choice for i386 compiler.
8034
8035 @item sse
8036 Use scalar floating point instructions present in the SSE instruction set.
8037 This instruction set is supported by Pentium3 and newer chips, in the AMD line
8038 by Athlon-4, Athlon-xp and Athlon-mp chips.  The earlier version of SSE
8039 instruction set supports only single precision arithmetics, thus the double and
8040 extended precision arithmetics is still done using 387.  Later version, present
8041 only in Pentium4 and the future AMD x86-64 chips supports double precision
8042 arithmetics too.
8043
8044 For i387 you need to use @option{-march=@var{cpu-type}}, @option{-msse} or
8045 @option{-msse2} switches to enable SSE extensions and make this option
8046 effective.  For x86-64 compiler, these extensions are enabled by default.
8047
8048 The resulting code should be considerably faster in the majority of cases and avoid
8049 the numerical instability problems of 387 code, but may break some existing
8050 code that expects temporaries to be 80bit.
8051
8052 This is the default choice for the x86-64 compiler.
8053
8054 @item sse,387
8055 Attempt to utilize both instruction sets at once.  This effectively double the
8056 amount of available registers and on chips with separate execution units for
8057 387 and SSE the execution resources too.  Use this option with care, as it is
8058 still experimental, because the GCC register allocator does not model separate
8059 functional units well resulting in instable performance.
8060 @end table
8061
8062 @item -masm=@var{dialect}
8063 @opindex masm=@var{dialect}
8064 Output asm instructions using selected @var{dialect}. Supported choices are
8065 @samp{intel} or @samp{att} (the default one).
8066
8067 @item -mieee-fp
8068 @itemx -mno-ieee-fp
8069 @opindex mieee-fp
8070 @opindex mno-ieee-fp
8071 Control whether or not the compiler uses IEEE floating point
8072 comparisons.  These handle correctly the case where the result of a
8073 comparison is unordered.
8074
8075 @item -msoft-float
8076 @opindex msoft-float
8077 Generate output containing library calls for floating point.
8078 @strong{Warning:} the requisite libraries are not part of GCC@.
8079 Normally the facilities of the machine's usual C compiler are used, but
8080 this can't be done directly in cross-compilation.  You must make your
8081 own arrangements to provide suitable library functions for
8082 cross-compilation.
8083
8084 On machines where a function returns floating point results in the 80387
8085 register stack, some floating point opcodes may be emitted even if
8086 @option{-msoft-float} is used.
8087
8088 @item -mno-fp-ret-in-387
8089 @opindex mno-fp-ret-in-387
8090 Do not use the FPU registers for return values of functions.
8091
8092 The usual calling convention has functions return values of types
8093 @code{float} and @code{double} in an FPU register, even if there
8094 is no FPU@.  The idea is that the operating system should emulate
8095 an FPU@.
8096
8097 The option @option{-mno-fp-ret-in-387} causes such values to be returned
8098 in ordinary CPU registers instead.
8099
8100 @item -mno-fancy-math-387
8101 @opindex mno-fancy-math-387
8102 Some 387 emulators do not support the @code{sin}, @code{cos} and
8103 @code{sqrt} instructions for the 387.  Specify this option to avoid
8104 generating those instructions.  This option is the default on FreeBSD,
8105 OpenBSD and NetBSD@.  This option is overridden when @option{-march}
8106 indicates that the target cpu will always have an FPU and so the
8107 instruction will not need emulation.  As of revision 2.6.1, these
8108 instructions are not generated unless you also use the
8109 @option{-funsafe-math-optimizations} switch.
8110
8111 @item -malign-double
8112 @itemx -mno-align-double
8113 @opindex malign-double
8114 @opindex mno-align-double
8115 Control whether GCC aligns @code{double}, @code{long double}, and
8116 @code{long long} variables on a two word boundary or a one word
8117 boundary.  Aligning @code{double} variables on a two word boundary will
8118 produce code that runs somewhat faster on a @samp{Pentium} at the
8119 expense of more memory.
8120
8121 @strong{Warning:} if you use the @option{-malign-double} switch,
8122 structures containing the above types will be aligned differently than
8123 the published application binary interface specifications for the 386
8124 and will not be binary compatible with structures in code compiled
8125 without that switch.
8126
8127 @item -m96bit-long-double
8128 @itemx -m128bit-long-double
8129 @opindex m96bit-long-double
8130 @opindex m128bit-long-double
8131 These switches control the size of @code{long double} type. The i386
8132 application binary interface specifies the size to be 96 bits,
8133 so @option{-m96bit-long-double} is the default in 32 bit mode.
8134
8135 Modern architectures (Pentium and newer) would prefer @code{long double}
8136 to be aligned to an 8 or 16 byte boundary.  In arrays or structures
8137 conforming to the ABI, this would not be possible.  So specifying a
8138 @option{-m128bit-long-double} will align @code{long double}
8139 to a 16 byte boundary by padding the @code{long double} with an additional
8140 32 bit zero.
8141
8142 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
8143 its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
8144
8145 Notice that neither of these options enable any extra precision over the x87
8146 standard of 80 bits for a @code{long double}.
8147
8148 @strong{Warning:} if you override the default value for your target ABI, the
8149 structures and arrays containing @code{long double} variables will change
8150 their size as well as function calling convention for function taking
8151 @code{long double} will be modified.  Hence they will not be binary
8152 compatible with arrays or structures in code compiled without that switch.
8153
8154
8155 @item -msvr3-shlib
8156 @itemx -mno-svr3-shlib
8157 @opindex msvr3-shlib
8158 @opindex mno-svr3-shlib
8159 Control whether GCC places uninitialized local variables into the
8160 @code{bss} or @code{data} segments.  @option{-msvr3-shlib} places them
8161 into @code{bss}.  These options are meaningful only on System V Release 3.
8162
8163 @item -mrtd
8164 @opindex mrtd
8165 Use a different function-calling convention, in which functions that
8166 take a fixed number of arguments return with the @code{ret} @var{num}
8167 instruction, which pops their arguments while returning.  This saves one
8168 instruction in the caller since there is no need to pop the arguments
8169 there.
8170
8171 You can specify that an individual function is called with this calling
8172 sequence with the function attribute @samp{stdcall}.  You can also
8173 override the @option{-mrtd} option by using the function attribute
8174 @samp{cdecl}.  @xref{Function Attributes}.
8175
8176 @strong{Warning:} this calling convention is incompatible with the one
8177 normally used on Unix, so you cannot use it if you need to call
8178 libraries compiled with the Unix compiler.
8179
8180 Also, you must provide function prototypes for all functions that
8181 take variable numbers of arguments (including @code{printf});
8182 otherwise incorrect code will be generated for calls to those
8183 functions.
8184
8185 In addition, seriously incorrect code will result if you call a
8186 function with too many arguments.  (Normally, extra arguments are
8187 harmlessly ignored.)
8188
8189 @item -mregparm=@var{num}
8190 @opindex mregparm
8191 Control how many registers are used to pass integer arguments.  By
8192 default, no registers are used to pass arguments, and at most 3
8193 registers can be used.  You can control this behavior for a specific
8194 function by using the function attribute @samp{regparm}.
8195 @xref{Function Attributes}.
8196
8197 @strong{Warning:} if you use this switch, and
8198 @var{num} is nonzero, then you must build all modules with the same
8199 value, including any libraries.  This includes the system libraries and
8200 startup modules.
8201
8202 @item -mpreferred-stack-boundary=@var{num}
8203 @opindex mpreferred-stack-boundary
8204 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
8205 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
8206 the default is 4 (16 bytes or 128 bits), except when optimizing for code
8207 size (@option{-Os}), in which case the default is the minimum correct
8208 alignment (4 bytes for x86, and 8 bytes for x86-64).
8209
8210 On Pentium and PentiumPro, @code{double} and @code{long double} values
8211 should be aligned to an 8 byte boundary (see @option{-malign-double}) or
8212 suffer significant run time performance penalties.  On Pentium III, the
8213 Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar
8214 penalties if it is not 16 byte aligned.
8215
8216 To ensure proper alignment of this values on the stack, the stack boundary
8217 must be as aligned as that required by any value stored on the stack.
8218 Further, every function must be generated such that it keeps the stack
8219 aligned.  Thus calling a function compiled with a higher preferred
8220 stack boundary from a function compiled with a lower preferred stack
8221 boundary will most likely misalign the stack.  It is recommended that
8222 libraries that use callbacks always use the default setting.
8223
8224 This extra alignment does consume extra stack space, and generally
8225 increases code size.  Code that is sensitive to stack space usage, such
8226 as embedded systems and operating system kernels, may want to reduce the
8227 preferred alignment to @option{-mpreferred-stack-boundary=2}.
8228
8229 @item -mmmx
8230 @itemx -mno-mmx
8231 @item -msse
8232 @itemx -mno-sse
8233 @item -msse2
8234 @itemx -mno-sse2
8235 @item -msse3
8236 @itemx -mno-sse3
8237 @item -m3dnow
8238 @itemx -mno-3dnow
8239 @opindex mmmx
8240 @opindex mno-mmx
8241 @opindex msse
8242 @opindex mno-sse
8243 @opindex m3dnow
8244 @opindex mno-3dnow
8245 These switches enable or disable the use of built-in functions that allow
8246 direct access to the MMX, SSE, SSE2, SSE3 and 3Dnow extensions of the
8247 instruction set.
8248
8249 @xref{X86 Built-in Functions}, for details of the functions enabled
8250 and disabled by these switches.
8251
8252 To have SSE/SSE2 instructions generated automatically from floating-point
8253 code, see @option{-mfpmath=sse}.
8254
8255 @item -mpush-args
8256 @itemx -mno-push-args
8257 @opindex mpush-args
8258 @opindex mno-push-args
8259 Use PUSH operations to store outgoing parameters.  This method is shorter
8260 and usually equally fast as method using SUB/MOV operations and is enabled
8261 by default.  In some cases disabling it may improve performance because of
8262 improved scheduling and reduced dependencies.
8263
8264 @item -maccumulate-outgoing-args
8265 @opindex maccumulate-outgoing-args
8266 If enabled, the maximum amount of space required for outgoing arguments will be
8267 computed in the function prologue.  This is faster on most modern CPUs
8268 because of reduced dependencies, improved scheduling and reduced stack usage
8269 when preferred stack boundary is not equal to 2.  The drawback is a notable
8270 increase in code size.  This switch implies @option{-mno-push-args}.
8271
8272 @item -mthreads
8273 @opindex mthreads
8274 Support thread-safe exception handling on @samp{Mingw32}.  Code that relies
8275 on thread-safe exception handling must compile and link all code with the
8276 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
8277 @option{-D_MT}; when linking, it links in a special thread helper library
8278 @option{-lmingwthrd} which cleans up per thread exception handling data.
8279
8280 @item -mno-align-stringops
8281 @opindex mno-align-stringops
8282 Do not align destination of inlined string operations.  This switch reduces
8283 code size and improves performance in case the destination is already aligned,
8284 but GCC doesn't know about it.
8285
8286 @item -minline-all-stringops
8287 @opindex minline-all-stringops
8288 By default GCC inlines string operations only when destination is known to be
8289 aligned at least to 4 byte boundary.  This enables more inlining, increase code
8290 size, but may improve performance of code that depends on fast memcpy, strlen
8291 and memset for short lengths.
8292
8293 @item -momit-leaf-frame-pointer
8294 @opindex momit-leaf-frame-pointer
8295 Don't keep the frame pointer in a register for leaf functions.  This
8296 avoids the instructions to save, set up and restore frame pointers and
8297 makes an extra register available in leaf functions.  The option
8298 @option{-fomit-frame-pointer} removes the frame pointer for all functions
8299 which might make debugging harder.
8300
8301 @item -mtls-direct-seg-refs
8302 @itemx -mno-tls-direct-seg-refs
8303 @opindex mtls-direct-seg-refs
8304 Controls whether TLS variables may be accessed with offsets from the
8305 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
8306 or whether the thread base pointer must be added.  Whether or not this
8307 is legal depends on the operating system, and whether it maps the
8308 segment to cover the entire TLS area.
8309
8310 For systems that use GNU libc, the default is on.
8311 @end table
8312
8313 These @samp{-m} switches are supported in addition to the above
8314 on AMD x86-64 processors in 64-bit environments.
8315
8316 @table @gcctabopt
8317 @item -m32
8318 @itemx -m64
8319 @opindex m32
8320 @opindex m64
8321 Generate code for a 32-bit or 64-bit environment.
8322 The 32-bit environment sets int, long and pointer to 32 bits and
8323 generates code that runs on any i386 system.
8324 The 64-bit environment sets int to 32 bits and long and pointer
8325 to 64 bits and generates code for AMD's x86-64 architecture.
8326
8327 @item -mno-red-zone
8328 @opindex no-red-zone
8329 Do not use a so called red zone for x86-64 code.  The red zone is mandated
8330 by the x86-64 ABI, it is a 128-byte area beyond the location of the
8331 stack pointer that will not be modified by signal or interrupt handlers
8332 and therefore can be used for temporary data without adjusting the stack
8333 pointer.  The flag @option{-mno-red-zone} disables this red zone.
8334
8335 @item -mcmodel=small
8336 @opindex mcmodel=small
8337 Generate code for the small code model: the program and its symbols must
8338 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
8339 Programs can be statically or dynamically linked.  This is the default
8340 code model.
8341
8342 @item -mcmodel=kernel
8343 @opindex mcmodel=kernel
8344 Generate code for the kernel code model.  The kernel runs in the
8345 negative 2 GB of the address space.
8346 This model has to be used for Linux kernel code.
8347
8348 @item -mcmodel=medium
8349 @opindex mcmodel=medium
8350 Generate code for the medium model: The program is linked in the lower 2
8351 GB of the address space but symbols can be located anywhere in the
8352 address space.  Programs can be statically or dynamically linked, but
8353 building of shared libraries are not supported with the medium model.
8354
8355 @item -mcmodel=large
8356 @opindex mcmodel=large
8357 Generate code for the large model: This model makes no assumptions
8358 about addresses and sizes of sections.  Currently GCC does not implement
8359 this model.
8360 @end table
8361
8362 @node IA-64 Options
8363 @subsection IA-64 Options
8364 @cindex IA-64 Options
8365
8366 These are the @samp{-m} options defined for the Intel IA-64 architecture.
8367
8368 @table @gcctabopt
8369 @item -mbig-endian
8370 @opindex mbig-endian
8371 Generate code for a big endian target.  This is the default for HP-UX@.
8372
8373 @item -mlittle-endian
8374 @opindex mlittle-endian
8375 Generate code for a little endian target.  This is the default for AIX5
8376 and GNU/Linux.
8377
8378 @item -mgnu-as
8379 @itemx -mno-gnu-as
8380 @opindex mgnu-as
8381 @opindex mno-gnu-as
8382 Generate (or don't) code for the GNU assembler.  This is the default.
8383 @c Also, this is the default if the configure option @option{--with-gnu-as}
8384 @c is used.
8385
8386 @item -mgnu-ld
8387 @itemx -mno-gnu-ld
8388 @opindex mgnu-ld
8389 @opindex mno-gnu-ld
8390 Generate (or don't) code for the GNU linker.  This is the default.
8391 @c Also, this is the default if the configure option @option{--with-gnu-ld}
8392 @c is used.
8393
8394 @item -mno-pic
8395 @opindex mno-pic
8396 Generate code that does not use a global pointer register.  The result
8397 is not position independent code, and violates the IA-64 ABI@.
8398
8399 @item -mvolatile-asm-stop
8400 @itemx -mno-volatile-asm-stop
8401 @opindex mvolatile-asm-stop
8402 @opindex mno-volatile-asm-stop
8403 Generate (or don't) a stop bit immediately before and after volatile asm
8404 statements.
8405
8406 @item -mb-step
8407 @opindex mb-step
8408 Generate code that works around Itanium B step errata.
8409
8410 @item -mregister-names
8411 @itemx -mno-register-names
8412 @opindex mregister-names
8413 @opindex mno-register-names
8414 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
8415 the stacked registers.  This may make assembler output more readable.
8416
8417 @item -mno-sdata
8418 @itemx -msdata
8419 @opindex mno-sdata
8420 @opindex msdata
8421 Disable (or enable) optimizations that use the small data section.  This may
8422 be useful for working around optimizer bugs.
8423
8424 @item -mconstant-gp
8425 @opindex mconstant-gp
8426 Generate code that uses a single constant global pointer value.  This is
8427 useful when compiling kernel code.
8428
8429 @item -mauto-pic
8430 @opindex mauto-pic
8431 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
8432 This is useful when compiling firmware code.
8433
8434 @item -minline-float-divide-min-latency
8435 @opindex minline-float-divide-min-latency
8436 Generate code for inline divides of floating point values
8437 using the minimum latency algorithm.
8438
8439 @item -minline-float-divide-max-throughput
8440 @opindex minline-float-divide-max-throughput
8441 Generate code for inline divides of floating point values
8442 using the maximum throughput algorithm.
8443
8444 @item -minline-int-divide-min-latency
8445 @opindex minline-int-divide-min-latency
8446 Generate code for inline divides of integer values
8447 using the minimum latency algorithm.
8448
8449 @item -minline-int-divide-max-throughput
8450 @opindex minline-int-divide-max-throughput
8451 Generate code for inline divides of integer values
8452 using the maximum throughput algorithm.
8453
8454 @item -mno-dwarf2-asm
8455 @itemx -mdwarf2-asm
8456 @opindex mno-dwarf2-asm
8457 @opindex mdwarf2-asm
8458 Don't (or do) generate assembler code for the DWARF2 line number debugging
8459 info.  This may be useful when not using the GNU assembler.
8460
8461 @item -mfixed-range=@var{register-range}
8462 @opindex mfixed-range
8463 Generate code treating the given register range as fixed registers.
8464 A fixed register is one that the register allocator can not use.  This is
8465 useful when compiling kernel code.  A register range is specified as
8466 two registers separated by a dash.  Multiple register ranges can be
8467 specified separated by a comma.
8468
8469 @item -mearly-stop-bits
8470 @itemx -mno-early-stop-bits
8471 @opindex mearly-stop-bits
8472 @opindex mno-early-stop-bits
8473 Allow stop bits to be placed earlier than immediately preceding the
8474 instruction that triggered the stop bit.  This can improve instruction
8475 scheduling, but does not always do so.
8476 @end table
8477
8478 @node M32R/D Options
8479 @subsection M32R/D Options
8480 @cindex M32R/D options
8481
8482 These @option{-m} options are defined for Renesas M32R/D architectures:
8483
8484 @table @gcctabopt
8485 @item -m32r2
8486 @opindex m32r2
8487 Generate code for the M32R/2@.
8488
8489 @item -m32rx
8490 @opindex m32rx
8491 Generate code for the M32R/X@.
8492
8493 @item -m32r
8494 @opindex m32r
8495 Generate code for the M32R@.  This is the default.
8496
8497 @item -mmodel=small
8498 @opindex mmodel=small
8499 Assume all objects live in the lower 16MB of memory (so that their addresses
8500 can be loaded with the @code{ld24} instruction), and assume all subroutines
8501 are reachable with the @code{bl} instruction.
8502 This is the default.
8503
8504 The addressability of a particular object can be set with the
8505 @code{model} attribute.
8506
8507 @item -mmodel=medium
8508 @opindex mmodel=medium
8509 Assume objects may be anywhere in the 32-bit address space (the compiler
8510 will generate @code{seth/add3} instructions to load their addresses), and
8511 assume all subroutines are reachable with the @code{bl} instruction.
8512
8513 @item -mmodel=large
8514 @opindex mmodel=large
8515 Assume objects may be anywhere in the 32-bit address space (the compiler
8516 will generate @code{seth/add3} instructions to load their addresses), and
8517 assume subroutines may not be reachable with the @code{bl} instruction
8518 (the compiler will generate the much slower @code{seth/add3/jl}
8519 instruction sequence).
8520
8521 @item -msdata=none
8522 @opindex msdata=none
8523 Disable use of the small data area.  Variables will be put into
8524 one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
8525 @code{section} attribute has been specified).
8526 This is the default.
8527
8528 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
8529 Objects may be explicitly put in the small data area with the
8530 @code{section} attribute using one of these sections.
8531
8532 @item -msdata=sdata
8533 @opindex msdata=sdata
8534 Put small global and static data in the small data area, but do not
8535 generate special code to reference them.
8536
8537 @item -msdata=use
8538 @opindex msdata=use
8539 Put small global and static data in the small data area, and generate
8540 special instructions to reference them.
8541
8542 @item -G @var{num}
8543 @opindex G
8544 @cindex smaller data references
8545 Put global and static objects less than or equal to @var{num} bytes
8546 into the small data or bss sections instead of the normal data or bss
8547 sections.  The default value of @var{num} is 8.
8548 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
8549 for this option to have any effect.
8550
8551 All modules should be compiled with the same @option{-G @var{num}} value.
8552 Compiling with different values of @var{num} may or may not work; if it
8553 doesn't the linker will give an error message---incorrect code will not be
8554 generated.
8555
8556 @item -mdebug
8557 @opindex mdebug
8558 Makes the M32R specific code in the compiler display some statistics
8559 that might help in debugging programs.
8560
8561 @item -malign-loops
8562 @opindex malign-loops
8563 Align all loops to a 32-byte boundary.
8564
8565 @item -mno-align-loops
8566 @opindex mno-align-loops
8567 Do not enforce a 32-byte alignment for loops.  This is the default.
8568
8569 @item -missue-rate=@var{number}
8570 @opindex missue-rate=@var{number}
8571 Issue @var{number} instructions per cycle.  @var{number} can only be 1
8572 or 2.
8573
8574 @item -mbranch-cost=@var{number}
8575 @opindex mbranch-cost=@var{number}
8576 @var{number} can only be 1 or 2.  If it is 1 then branches will be
8577 preferred over conditional code, if it is 2, then the opposite will
8578 apply.
8579
8580 @item -mflush-trap=@var{number}
8581 @opindex mflush-trap=@var{number}
8582 Specifies the trap number to use to flush the cache.  The default is
8583 12.  Valid numbers are between 0 and 15 inclusive.
8584
8585 @item -mno-flush-trap
8586 @opindex mno-flush-trap
8587 Specifies that the cache cannot be flushed by using a trap.
8588
8589 @item -mflush-func=@var{name}
8590 @opindex mflush-func=@var{name}
8591 Specifies the name of the operating system function to call to flush
8592 the cache.  The default is @emph{_flush_cache}, but a function call
8593 will only be used if a trap is not available.
8594
8595 @item -mno-flush-func
8596 @opindex mno-flush-func
8597 Indicates that there is no OS function for flushing the cache.
8598
8599 @end table
8600
8601 @node M680x0 Options
8602 @subsection M680x0 Options
8603 @cindex M680x0 options
8604
8605 These are the @samp{-m} options defined for the 68000 series.  The default
8606 values for these options depends on which style of 68000 was selected when
8607 the compiler was configured; the defaults for the most common choices are
8608 given below.
8609
8610 @table @gcctabopt
8611 @item -m68000
8612 @itemx -mc68000
8613 @opindex m68000
8614 @opindex mc68000
8615 Generate output for a 68000.  This is the default
8616 when the compiler is configured for 68000-based systems.
8617
8618 Use this option for microcontrollers with a 68000 or EC000 core,
8619 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
8620
8621 @item -m68020
8622 @itemx -mc68020
8623 @opindex m68020
8624 @opindex mc68020
8625 Generate output for a 68020.  This is the default
8626 when the compiler is configured for 68020-based systems.
8627
8628 @item -m68881
8629 @opindex m68881
8630 Generate output containing 68881 instructions for floating point.
8631 This is the default for most 68020 systems unless @option{--nfp} was
8632 specified when the compiler was configured.
8633
8634 @item -m68030
8635 @opindex m68030
8636 Generate output for a 68030.  This is the default when the compiler is
8637 configured for 68030-based systems.
8638
8639 @item -m68040
8640 @opindex m68040
8641 Generate output for a 68040.  This is the default when the compiler is
8642 configured for 68040-based systems.
8643
8644 This option inhibits the use of 68881/68882 instructions that have to be
8645 emulated by software on the 68040.  Use this option if your 68040 does not
8646 have code to emulate those instructions.
8647
8648 @item -m68060
8649 @opindex m68060
8650 Generate output for a 68060.  This is the default when the compiler is
8651 configured for 68060-based systems.
8652
8653 This option inhibits the use of 68020 and 68881/68882 instructions that
8654 have to be emulated by software on the 68060.  Use this option if your 68060
8655 does not have code to emulate those instructions.
8656
8657 @item -mcpu32
8658 @opindex mcpu32
8659 Generate output for a CPU32.  This is the default
8660 when the compiler is configured for CPU32-based systems.
8661
8662 Use this option for microcontrollers with a
8663 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
8664 68336, 68340, 68341, 68349 and 68360.
8665
8666 @item -m5200
8667 @opindex m5200
8668 Generate output for a 520X ``coldfire'' family cpu.  This is the default
8669 when the compiler is configured for 520X-based systems.
8670
8671 Use this option for microcontroller with a 5200 core, including
8672 the MCF5202, MCF5203, MCF5204 and MCF5202.
8673
8674
8675 @item -m68020-40
8676 @opindex m68020-40
8677 Generate output for a 68040, without using any of the new instructions.
8678 This results in code which can run relatively efficiently on either a
8679 68020/68881 or a 68030 or a 68040.  The generated code does use the
8680 68881 instructions that are emulated on the 68040.
8681
8682 @item -m68020-60
8683 @opindex m68020-60
8684 Generate output for a 68060, without using any of the new instructions.
8685 This results in code which can run relatively efficiently on either a
8686 68020/68881 or a 68030 or a 68040.  The generated code does use the
8687 68881 instructions that are emulated on the 68060.
8688
8689 @item -msoft-float
8690 @opindex msoft-float
8691 Generate output containing library calls for floating point.
8692 @strong{Warning:} the requisite libraries are not available for all m68k
8693 targets.  Normally the facilities of the machine's usual C compiler are
8694 used, but this can't be done directly in cross-compilation.  You must
8695 make your own arrangements to provide suitable library functions for
8696 cross-compilation.  The embedded targets @samp{m68k-*-aout} and
8697 @samp{m68k-*-coff} do provide software floating point support.
8698
8699 @item -mshort
8700 @opindex mshort
8701 Consider type @code{int} to be 16 bits wide, like @code{short int}.
8702 Additionally, parameters passed on the stack are also aligned to a
8703 16-bit boundary even on targets whose API mandates promotion to 32-bit.
8704
8705 @item -mnobitfield
8706 @opindex mnobitfield
8707 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
8708 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
8709
8710 @item -mbitfield
8711 @opindex mbitfield
8712 Do use the bit-field instructions.  The @option{-m68020} option implies
8713 @option{-mbitfield}.  This is the default if you use a configuration
8714 designed for a 68020.
8715
8716 @item -mrtd
8717 @opindex mrtd
8718 Use a different function-calling convention, in which functions
8719 that take a fixed number of arguments return with the @code{rtd}
8720 instruction, which pops their arguments while returning.  This
8721 saves one instruction in the caller since there is no need to pop
8722 the arguments there.
8723
8724 This calling convention is incompatible with the one normally
8725 used on Unix, so you cannot use it if you need to call libraries
8726 compiled with the Unix compiler.
8727
8728 Also, you must provide function prototypes for all functions that
8729 take variable numbers of arguments (including @code{printf});
8730 otherwise incorrect code will be generated for calls to those
8731 functions.
8732
8733 In addition, seriously incorrect code will result if you call a
8734 function with too many arguments.  (Normally, extra arguments are
8735 harmlessly ignored.)
8736
8737 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
8738 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
8739
8740 @item -malign-int
8741 @itemx -mno-align-int
8742 @opindex malign-int
8743 @opindex mno-align-int
8744 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
8745 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
8746 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
8747 Aligning variables on 32-bit boundaries produces code that runs somewhat
8748 faster on processors with 32-bit busses at the expense of more memory.
8749
8750 @strong{Warning:} if you use the @option{-malign-int} switch, GCC will
8751 align structures containing the above types  differently than
8752 most published application binary interface specifications for the m68k.
8753
8754 @item -mpcrel
8755 @opindex mpcrel
8756 Use the pc-relative addressing mode of the 68000 directly, instead of
8757 using a global offset table.  At present, this option implies @option{-fpic},
8758 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
8759 not presently supported with @option{-mpcrel}, though this could be supported for
8760 68020 and higher processors.
8761
8762 @item -mno-strict-align
8763 @itemx -mstrict-align
8764 @opindex mno-strict-align
8765 @opindex mstrict-align
8766 Do not (do) assume that unaligned memory references will be handled by
8767 the system.
8768
8769 @item -msep-data
8770 Generate code that allows the data segment to be located in a different
8771 area of memory from the text segment.  This allows for execute in place in
8772 an environment without virtual memory management.  This option implies -fPIC.
8773
8774 @item -mno-sep-data
8775 Generate code that assumes that the data segment follows the text segment.
8776 This is the default.
8777
8778 @item -mid-shared-library
8779 Generate code that supports shared libraries via the library ID method.
8780 This allows for execute in place and shared libraries in an environment
8781 without virtual memory management.  This option implies -fPIC.
8782
8783 @item -mno-id-shared-library
8784 Generate code that doesn't assume ID based shared libraries are being used.
8785 This is the default.
8786
8787 @item -mshared-library-id=n
8788 Specified the identification number of the ID based shared library being
8789 compiled.  Specifying a value of 0 will generate more compact code, specifying
8790 other values will force the allocation of that number to the current
8791 library but is no more space or time efficient than omitting this option.
8792
8793 @end table
8794
8795 @node M68hc1x Options
8796 @subsection M68hc1x Options
8797 @cindex M68hc1x options
8798
8799 These are the @samp{-m} options defined for the 68hc11 and 68hc12
8800 microcontrollers.  The default values for these options depends on
8801 which style of microcontroller was selected when the compiler was configured;
8802 the defaults for the most common choices are given below.
8803
8804 @table @gcctabopt
8805 @item -m6811
8806 @itemx -m68hc11
8807 @opindex m6811
8808 @opindex m68hc11
8809 Generate output for a 68HC11.  This is the default
8810 when the compiler is configured for 68HC11-based systems.
8811
8812 @item -m6812
8813 @itemx -m68hc12
8814 @opindex m6812
8815 @opindex m68hc12
8816 Generate output for a 68HC12.  This is the default
8817 when the compiler is configured for 68HC12-based systems.
8818
8819 @item -m68S12
8820 @itemx -m68hcs12
8821 @opindex m68S12
8822 @opindex m68hcs12
8823 Generate output for a 68HCS12.
8824
8825 @item -mauto-incdec
8826 @opindex mauto-incdec
8827 Enable the use of 68HC12 pre and post auto-increment and auto-decrement
8828 addressing modes.
8829
8830 @item -minmax
8831 @itemx -nominmax
8832 @opindex minmax
8833 @opindex mnominmax
8834 Enable the use of 68HC12 min and max instructions.
8835
8836 @item -mlong-calls
8837 @itemx -mno-long-calls
8838 @opindex mlong-calls
8839 @opindex mno-long-calls
8840 Treat all calls as being far away (near).  If calls are assumed to be
8841 far away, the compiler will use the @code{call} instruction to
8842 call a function and the @code{rtc} instruction for returning.
8843
8844 @item -mshort
8845 @opindex mshort
8846 Consider type @code{int} to be 16 bits wide, like @code{short int}.
8847
8848 @item -msoft-reg-count=@var{count}
8849 @opindex msoft-reg-count
8850 Specify the number of pseudo-soft registers which are used for the
8851 code generation.  The maximum number is 32.  Using more pseudo-soft
8852 register may or may not result in better code depending on the program.
8853 The default is 4 for 68HC11 and 2 for 68HC12.
8854
8855 @end table
8856
8857 @node MCore Options
8858 @subsection MCore Options
8859 @cindex MCore options
8860
8861 These are the @samp{-m} options defined for the Motorola M*Core
8862 processors.
8863
8864 @table @gcctabopt
8865
8866 @item -mhardlit
8867 @itemx -mno-hardlit
8868 @opindex mhardlit
8869 @opindex mno-hardlit
8870 Inline constants into the code stream if it can be done in two
8871 instructions or less.
8872
8873 @item -mdiv
8874 @itemx -mno-div
8875 @opindex mdiv
8876 @opindex mno-div
8877 Use the divide instruction.  (Enabled by default).
8878
8879 @item -mrelax-immediate
8880 @itemx -mno-relax-immediate
8881 @opindex mrelax-immediate
8882 @opindex mno-relax-immediate
8883 Allow arbitrary sized immediates in bit operations.
8884
8885 @item -mwide-bitfields
8886 @itemx -mno-wide-bitfields
8887 @opindex mwide-bitfields
8888 @opindex mno-wide-bitfields
8889 Always treat bit-fields as int-sized.
8890
8891 @item -m4byte-functions
8892 @itemx -mno-4byte-functions
8893 @opindex m4byte-functions
8894 @opindex mno-4byte-functions
8895 Force all functions to be aligned to a four byte boundary.
8896
8897 @item -mcallgraph-data
8898 @itemx -mno-callgraph-data
8899 @opindex mcallgraph-data
8900 @opindex mno-callgraph-data
8901 Emit callgraph information.
8902
8903 @item -mslow-bytes
8904 @itemx -mno-slow-bytes
8905 @opindex mslow-bytes
8906 @opindex mno-slow-bytes
8907 Prefer word access when reading byte quantities.
8908
8909 @item -mlittle-endian
8910 @itemx -mbig-endian
8911 @opindex mlittle-endian
8912 @opindex mbig-endian
8913 Generate code for a little endian target.
8914
8915 @item -m210
8916 @itemx -m340
8917 @opindex m210
8918 @opindex m340
8919 Generate code for the 210 processor.
8920 @end table
8921
8922 @node MIPS Options
8923 @subsection MIPS Options
8924 @cindex MIPS options
8925
8926 @table @gcctabopt
8927
8928 @item -EB
8929 @opindex EB
8930 Generate big-endian code.
8931
8932 @item -EL
8933 @opindex EL
8934 Generate little-endian code.  This is the default for @samp{mips*el-*-*}
8935 configurations.
8936
8937 @item -march=@var{arch}
8938 @opindex march
8939 Generate code that will run on @var{arch}, which can be the name of a
8940 generic MIPS ISA, or the name of a particular processor.
8941 The ISA names are:
8942 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
8943 @samp{mips32}, @samp{mips32r2}, and @samp{mips64}.
8944 The processor names are:
8945 @samp{4kc}, @samp{4kp}, @samp{5kc}, @samp{20kc},
8946 @samp{m4k},
8947 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
8948 @samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000}, @samp{rm7000},
8949 @samp{rm9000},
8950 @samp{orion},
8951 @samp{sb1},
8952 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
8953 @samp{vr5000}, @samp{vr5400} and @samp{vr5500}.
8954 The special value @samp{from-abi} selects the
8955 most compatible architecture for the selected ABI (that is,
8956 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
8957
8958 In processor names, a final @samp{000} can be abbreviated as @samp{k}
8959 (for example, @samp{-march=r2k}).  Prefixes are optional, and
8960 @samp{vr} may be written @samp{r}.
8961
8962 GCC defines two macros based on the value of this option.  The first
8963 is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
8964 a string.  The second has the form @samp{_MIPS_ARCH_@var{foo}},
8965 where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
8966 For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
8967 to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
8968
8969 Note that the @samp{_MIPS_ARCH} macro uses the processor names given
8970 above.  In other words, it will have the full prefix and will not
8971 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
8972 the macro names the resolved architecture (either @samp{"mips1"} or
8973 @samp{"mips3"}).  It names the default architecture when no
8974 @option{-march} option is given.
8975
8976 @item -mtune=@var{arch}
8977 @opindex mtune
8978 Optimize for @var{arch}.  Among other things, this option controls
8979 the way instructions are scheduled, and the perceived cost of arithmetic
8980 operations.  The list of @var{arch} values is the same as for
8981 @option{-march}.
8982
8983 When this option is not used, GCC will optimize for the processor
8984 specified by @option{-march}.  By using @option{-march} and
8985 @option{-mtune} together, it is possible to generate code that will
8986 run on a family of processors, but optimize the code for one
8987 particular member of that family.
8988
8989 @samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
8990 @samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
8991 @samp{-march} ones described above.
8992
8993 @item -mips1
8994 @opindex mips1
8995 Equivalent to @samp{-march=mips1}.
8996
8997 @item -mips2
8998 @opindex mips2
8999 Equivalent to @samp{-march=mips2}.
9000
9001 @item -mips3
9002 @opindex mips3
9003 Equivalent to @samp{-march=mips3}.
9004
9005 @item -mips4
9006 @opindex mips4
9007 Equivalent to @samp{-march=mips4}.
9008
9009 @item -mips32
9010 @opindex mips32
9011 Equivalent to @samp{-march=mips32}.
9012
9013 @item -mips32r2
9014 @opindex mips32r2
9015 Equivalent to @samp{-march=mips32r2}.
9016
9017 @item -mips64
9018 @opindex mips64
9019 Equivalent to @samp{-march=mips64}.
9020
9021 @item -mips16
9022 @itemx -mno-mips16
9023 @opindex mips16
9024 @opindex mno-mips16
9025 Use (do not use) the MIPS16 ISA.
9026
9027 @item -mabi=32
9028 @itemx -mabi=o64
9029 @itemx -mabi=n32
9030 @itemx -mabi=64
9031 @itemx -mabi=eabi
9032 @opindex mabi=32
9033 @opindex mabi=o64
9034 @opindex mabi=n32
9035 @opindex mabi=64
9036 @opindex mabi=eabi
9037 Generate code for the given ABI@.
9038
9039 Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
9040 generates 64-bit code when you select a 64-bit architecture, but you
9041 can use @option{-mgp32} to get 32-bit code instead.
9042
9043 For information about the O64 ABI, see
9044 @w{@uref{http://gcc.gnu.org/projects/mipso64-abi.html}}.
9045
9046 @item -mabicalls
9047 @itemx -mno-abicalls
9048 @opindex mabicalls
9049 @opindex mno-abicalls
9050 Generate (do not generate) SVR4-style position-independent code.
9051 @option{-mabicalls} is the default for SVR4-based systems.
9052
9053 @item -mxgot
9054 @itemx -mno-xgot
9055 @opindex mxgot
9056 @opindex mno-xgot
9057 Lift (do not lift) the usual restrictions on the size of the global
9058 offset table.
9059
9060 GCC normally uses a single instruction to load values from the GOT.
9061 While this is relatively efficient, it will only work if the GOT
9062 is smaller than about 64k.  Anything larger will cause the linker
9063 to report an error such as:
9064
9065 @cindex relocation truncated to fit (MIPS)
9066 @smallexample
9067 relocation truncated to fit: R_MIPS_GOT16 foobar
9068 @end smallexample
9069
9070 If this happens, you should recompile your code with @option{-mxgot}.
9071 It should then work with very large GOTs, although it will also be
9072 less efficient, since it will take three instructions to fetch the
9073 value of a global symbol.
9074
9075 Note that some linkers can create multiple GOTs.  If you have such a
9076 linker, you should only need to use @option{-mxgot} when a single object
9077 file accesses more than 64k's worth of GOT entries.  Very few do.
9078
9079 These options have no effect unless GCC is generating position
9080 independent code.
9081
9082 @item -mgp32
9083 @opindex mgp32
9084 Assume that general-purpose registers are 32 bits wide.
9085
9086 @item -mgp64
9087 @opindex mgp64
9088 Assume that general-purpose registers are 64 bits wide.
9089
9090 @item -mfp32
9091 @opindex mfp32
9092 Assume that floating-point registers are 32 bits wide.
9093
9094 @item -mfp64
9095 @opindex mfp64
9096 Assume that floating-point registers are 64 bits wide.
9097
9098 @item -mhard-float
9099 @opindex mhard-float
9100 Use floating-point coprocessor instructions.
9101
9102 @item -msoft-float
9103 @opindex msoft-float
9104 Do not use floating-point coprocessor instructions.  Implement
9105 floating-point calculations using library calls instead.
9106
9107 @item -msingle-float
9108 @opindex msingle-float
9109 Assume that the floating-point coprocessor only supports single-precision
9110 operations.
9111
9112 @itemx -mdouble-float
9113 @opindex mdouble-float
9114 Assume that the floating-point coprocessor supports double-precision
9115 operations.  This is the default.
9116
9117 @item -mint64
9118 @opindex mint64
9119 Force @code{int} and @code{long} types to be 64 bits wide.  See
9120 @option{-mlong32} for an explanation of the default and the way
9121 that the pointer size is determined.
9122
9123 @item -mlong64
9124 @opindex mlong64
9125 Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
9126 an explanation of the default and the way that the pointer size is
9127 determined.
9128
9129 @item -mlong32
9130 @opindex mlong32
9131 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
9132
9133 The default size of @code{int}s, @code{long}s and pointers depends on
9134 the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
9135 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
9136 32-bit @code{long}s.  Pointers are the same size as @code{long}s,
9137 or the same size as integer registers, whichever is smaller.
9138
9139 @item -G @var{num}
9140 @opindex G
9141 @cindex smaller data references (MIPS)
9142 @cindex gp-relative references (MIPS)
9143 Put global and static items less than or equal to @var{num} bytes into
9144 the small data or bss section instead of the normal data or bss section.
9145 This allows the data to be accessed using a single instruction.
9146
9147 All modules should be compiled with the same @option{-G @var{num}}
9148 value.
9149
9150 @item -membedded-data
9151 @itemx -mno-embedded-data
9152 @opindex membedded-data
9153 @opindex mno-embedded-data
9154 Allocate variables to the read-only data section first if possible, then
9155 next in the small data section if possible, otherwise in data.  This gives
9156 slightly slower code than the default, but reduces the amount of RAM required
9157 when executing, and thus may be preferred for some embedded systems.
9158
9159 @item -muninit-const-in-rodata
9160 @itemx -mno-uninit-const-in-rodata
9161 @opindex muninit-const-in-rodata
9162 @opindex mno-uninit-const-in-rodata
9163 Put uninitialized @code{const} variables in the read-only data section.
9164 This option is only meaningful in conjunction with @option{-membedded-data}.
9165
9166 @item -msplit-addresses
9167 @itemx -mno-split-addresses
9168 @opindex msplit-addresses
9169 @opindex mno-split-addresses
9170 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
9171 relocation operators.  This option has been superceded by
9172 @option{-mexplicit-relocs} but is retained for backwards compatibility.
9173
9174 @item -mexplicit-relocs
9175 @itemx -mno-explicit-relocs
9176 @opindex mexplicit-relocs
9177 @opindex mno-explicit-relocs
9178 Use (do not use) assembler relocation operators when dealing with symbolic
9179 addresses.  The alternative, selected by @option{-mno-explicit-relocs},
9180 is to use assembler macros instead.
9181
9182 @option{-mexplicit-relocs} is usually the default if GCC was configured
9183 to use an assembler that supports relocation operators.  However, the
9184 combination of @option{-mabicalls} and @option{-fno-unit-at-a-time}
9185 implies @option{-mno-explicit-relocs} unless explicitly overridden.
9186 This is because, when generating abicalls, the choice of relocation
9187 depends on whether a symbol is local or global.  In some rare cases,
9188 GCC will not be able to decide this until the whole compilation unit
9189 has been read.
9190
9191 @item -mcheck-zero-division
9192 @itemx -mno-check-zero-division
9193 @opindex mcheck-zero-division
9194 @opindex mno-check-zero-division
9195 Trap (do not trap) on integer division by zero.  The default is
9196 @option{-mcheck-zero-division}.
9197
9198 @item -mmemcpy
9199 @itemx -mno-memcpy
9200 @opindex mmemcpy
9201 @opindex mno-memcpy
9202 Force (do not force) the use of @code{memcpy()} for non-trivial block
9203 moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
9204 most constant-sized copies.
9205
9206 @item -mlong-calls
9207 @itemx -mno-long-calls
9208 @opindex mlong-calls
9209 @opindex mno-long-calls
9210 Disable (do not disable) use of the @code{jal} instruction.  Calling
9211 functions using @code{jal} is more efficient but requires the caller
9212 and callee to be in the same 256 megabyte segment.
9213
9214 This option has no effect on abicalls code.  The default is
9215 @option{-mno-long-calls}.
9216
9217 @item -mmad
9218 @itemx -mno-mad
9219 @opindex mmad
9220 @opindex mno-mad
9221 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
9222 instructions, as provided by the R4650 ISA.
9223
9224 @item -mfused-madd
9225 @itemx -mno-fused-madd
9226 @opindex mfused-madd
9227 @opindex mno-fused-madd
9228 Enable (disable) use of the floating point multiply-accumulate
9229 instructions, when they are available.  The default is
9230 @option{-mfused-madd}.
9231
9232 When multiply-accumulate instructions are used, the intermediate
9233 product is calculated to infinite precision and is not subject to
9234 the FCSR Flush to Zero bit.  This may be undesirable in some
9235 circumstances.
9236
9237 @item -nocpp
9238 @opindex nocpp
9239 Tell the MIPS assembler to not run its preprocessor over user
9240 assembler files (with a @samp{.s} suffix) when assembling them.
9241
9242 @item -mfix-r4000
9243 @itemx -mno-fix-r4000
9244 @opindex mfix-r4000
9245 @opindex mno-fix-r4000
9246 Work around certain R4000 CPU errata:
9247 @itemize @minus
9248 @item
9249 A double-word or a variable shift may give an incorrect result if executed
9250 immediately after starting an integer division.
9251 @item
9252 A double-word or a variable shift may give an incorrect result if executed
9253 while an integer multiplication is in progress.
9254 @item
9255 An integer division may give an incorrect result if started in a delay slot
9256 of a taken branch or a jump.
9257 @end itemize
9258
9259 @item -mfix-r4400
9260 @itemx -mno-fix-r4400
9261 @opindex mfix-r4400
9262 @opindex mno-fix-r4400
9263 Work around certain R4400 CPU errata:
9264 @itemize @minus
9265 @item
9266 A double-word or a variable shift may give an incorrect result if executed
9267 immediately after starting an integer division.
9268 @end itemize
9269
9270 @item -mfix-vr4120
9271 @itemx -mno-fix-vr4120
9272 @opindex mfix-vr4120
9273 Work around certain VR4120 errata:
9274 @itemize @minus
9275 @item
9276 @code{dmultu} does not always produce the correct result.
9277 @item
9278 @code{div} and @code{ddiv} do not always produce the correct result if one
9279 of the operands is negative.
9280 @end itemize
9281 The workarounds for the division errata rely on special functions in
9282 @file{libgcc.a}.  At present, these functions are only provided by
9283 the @code{mips64vr*-elf} configurations.
9284
9285 Other VR4120 errata require a nop to be inserted between certain pairs of
9286 instructions.  These errata are handled by the assembler, not by GCC itself.
9287
9288 @item -mfix-sb1
9289 @itemx -mno-fix-sb1
9290 @opindex mfix-sb1
9291 Work around certain SB-1 CPU core errata.
9292 (This flag currently works around the SB-1 revision 2
9293 ``F1'' and ``F2'' floating point errata.)
9294
9295 @item -mflush-func=@var{func}
9296 @itemx -mno-flush-func
9297 @opindex mflush-func
9298 Specifies the function to call to flush the I and D caches, or to not
9299 call any such function.  If called, the function must take the same
9300 arguments as the common @code{_flush_func()}, that is, the address of the
9301 memory range for which the cache is being flushed, the size of the
9302 memory range, and the number 3 (to flush both caches).  The default
9303 depends on the target GCC was configured for, but commonly is either
9304 @samp{_flush_func} or @samp{__cpu_flush}.
9305
9306 @item -mbranch-likely
9307 @itemx -mno-branch-likely
9308 @opindex mbranch-likely
9309 @opindex mno-branch-likely
9310 Enable or disable use of Branch Likely instructions, regardless of the
9311 default for the selected architecture.  By default, Branch Likely
9312 instructions may be generated if they are supported by the selected
9313 architecture.  An exception is for the MIPS32 and MIPS64 architectures
9314 and processors which implement those architectures; for those, Branch
9315 Likely instructions will not be generated by default because the MIPS32
9316 and MIPS64 architectures specifically deprecate their use.
9317
9318 @item -mfp-exceptions
9319 @itemx -mno-fp-exceptions
9320 @opindex mfp-exceptions
9321 Specifies whether FP exceptions are enabled.  This affects how we schedule
9322 FP instructions for some processors.  The default is that FP exceptions are
9323 enabled.
9324
9325 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
9326 64-bit code, then we can use both FP pipes.  Otherwise, we can only use one
9327 FP pipe.
9328
9329 @item -mvr4130-align
9330 @itemx -mno-vr4130-align
9331 @opindex mvr4130-align
9332 The VR4130 pipeline is two-way superscalar, but can only issue two
9333 instructions together if the first one is 8-byte aligned.  When this
9334 option is enabled, GCC will align pairs of instructions that it
9335 thinks should execute in parallel.
9336
9337 This option only has an effect when optimizing for the VR4130.
9338 It normally makes code faster, but at the expense of making it bigger.
9339 It is enabled by default at optimization level @option{-O3}.
9340 @end table
9341
9342 @node MMIX Options
9343 @subsection MMIX Options
9344 @cindex MMIX Options
9345
9346 These options are defined for the MMIX:
9347
9348 @table @gcctabopt
9349 @item -mlibfuncs
9350 @itemx -mno-libfuncs
9351 @opindex mlibfuncs
9352 @opindex mno-libfuncs
9353 Specify that intrinsic library functions are being compiled, passing all
9354 values in registers, no matter the size.
9355
9356 @item -mepsilon
9357 @itemx -mno-epsilon
9358 @opindex mepsilon
9359 @opindex mno-epsilon
9360 Generate floating-point comparison instructions that compare with respect
9361 to the @code{rE} epsilon register.
9362
9363 @item -mabi=mmixware
9364 @itemx -mabi=gnu
9365 @opindex mabi-mmixware
9366 @opindex mabi=gnu
9367 Generate code that passes function parameters and return values that (in
9368 the called function) are seen as registers @code{$0} and up, as opposed to
9369 the GNU ABI which uses global registers @code{$231} and up.
9370
9371 @item -mzero-extend
9372 @itemx -mno-zero-extend
9373 @opindex mzero-extend
9374 @opindex mno-zero-extend
9375 When reading data from memory in sizes shorter than 64 bits, use (do not
9376 use) zero-extending load instructions by default, rather than
9377 sign-extending ones.
9378
9379 @item -mknuthdiv
9380 @itemx -mno-knuthdiv
9381 @opindex mknuthdiv
9382 @opindex mno-knuthdiv
9383 Make the result of a division yielding a remainder have the same sign as
9384 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
9385 remainder follows the sign of the dividend.  Both methods are
9386 arithmetically valid, the latter being almost exclusively used.
9387
9388 @item -mtoplevel-symbols
9389 @itemx -mno-toplevel-symbols
9390 @opindex mtoplevel-symbols
9391 @opindex mno-toplevel-symbols
9392 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
9393 code can be used with the @code{PREFIX} assembly directive.
9394
9395 @item -melf
9396 @opindex melf
9397 Generate an executable in the ELF format, rather than the default
9398 @samp{mmo} format used by the @command{mmix} simulator.
9399
9400 @item -mbranch-predict
9401 @itemx -mno-branch-predict
9402 @opindex mbranch-predict
9403 @opindex mno-branch-predict
9404 Use (do not use) the probable-branch instructions, when static branch
9405 prediction indicates a probable branch.
9406
9407 @item -mbase-addresses
9408 @itemx -mno-base-addresses
9409 @opindex mbase-addresses
9410 @opindex mno-base-addresses
9411 Generate (do not generate) code that uses @emph{base addresses}.  Using a
9412 base address automatically generates a request (handled by the assembler
9413 and the linker) for a constant to be set up in a global register.  The
9414 register is used for one or more base address requests within the range 0
9415 to 255 from the value held in the register.  The generally leads to short
9416 and fast code, but the number of different data items that can be
9417 addressed is limited.  This means that a program that uses lots of static
9418 data may require @option{-mno-base-addresses}.
9419
9420 @item -msingle-exit
9421 @itemx -mno-single-exit
9422 @opindex msingle-exit
9423 @opindex mno-single-exit
9424 Force (do not force) generated code to have a single exit point in each
9425 function.
9426 @end table
9427
9428 @node MN10300 Options
9429 @subsection MN10300 Options
9430 @cindex MN10300 options
9431
9432 These @option{-m} options are defined for Matsushita MN10300 architectures:
9433
9434 @table @gcctabopt
9435 @item -mmult-bug
9436 @opindex mmult-bug
9437 Generate code to avoid bugs in the multiply instructions for the MN10300
9438 processors.  This is the default.
9439
9440 @item -mno-mult-bug
9441 @opindex mno-mult-bug
9442 Do not generate code to avoid bugs in the multiply instructions for the
9443 MN10300 processors.
9444
9445 @item -mam33
9446 @opindex mam33
9447 Generate code which uses features specific to the AM33 processor.
9448
9449 @item -mno-am33
9450 @opindex mno-am33
9451 Do not generate code which uses features specific to the AM33 processor.  This
9452 is the default.
9453
9454 @item -mno-crt0
9455 @opindex mno-crt0
9456 Do not link in the C run-time initialization object file.
9457
9458 @item -mrelax
9459 @opindex mrelax
9460 Indicate to the linker that it should perform a relaxation optimization pass
9461 to shorten branches, calls and absolute memory addresses.  This option only
9462 has an effect when used on the command line for the final link step.
9463
9464 This option makes symbolic debugging impossible.
9465 @end table
9466
9467 @node NS32K Options
9468 @subsection NS32K Options
9469 @cindex NS32K options
9470
9471 These are the @samp{-m} options defined for the 32000 series.  The default
9472 values for these options depends on which style of 32000 was selected when
9473 the compiler was configured; the defaults for the most common choices are
9474 given below.
9475
9476 @table @gcctabopt
9477 @item -m32032
9478 @itemx -m32032
9479 @opindex m32032
9480 @opindex m32032
9481 Generate output for a 32032.  This is the default
9482 when the compiler is configured for 32032 and 32016 based systems.
9483
9484 @item -m32332
9485 @itemx -m32332
9486 @opindex m32332
9487 @opindex m32332
9488 Generate output for a 32332.  This is the default
9489 when the compiler is configured for 32332-based systems.
9490
9491 @item -m32532
9492 @itemx -m32532
9493 @opindex m32532
9494 @opindex m32532
9495 Generate output for a 32532.  This is the default
9496 when the compiler is configured for 32532-based systems.
9497
9498 @item -m32081
9499 @opindex m32081
9500 Generate output containing 32081 instructions for floating point.
9501 This is the default for all systems.
9502
9503 @item -m32381
9504 @opindex m32381
9505 Generate output containing 32381 instructions for floating point.  This
9506 also implies @option{-m32081}.  The 32381 is only compatible with the 32332
9507 and 32532 cpus.  This is the default for the pc532-netbsd configuration.
9508
9509 @item -mmulti-add
9510 @opindex mmulti-add
9511 Try and generate multiply-add floating point instructions @code{polyF}
9512 and @code{dotF}.  This option is only available if the @option{-m32381}
9513 option is in effect.  Using these instructions requires changes to
9514 register allocation which generally has a negative impact on
9515 performance.  This option should only be enabled when compiling code
9516 particularly likely to make heavy use of multiply-add instructions.
9517
9518 @item -mnomulti-add
9519 @opindex mnomulti-add
9520 Do not try and generate multiply-add floating point instructions
9521 @code{polyF} and @code{dotF}.  This is the default on all platforms.
9522
9523 @item -msoft-float
9524 @opindex msoft-float
9525 Generate output containing library calls for floating point.
9526 @strong{Warning:} the requisite libraries may not be available.
9527
9528 @item -mieee-compare
9529 @itemx -mno-ieee-compare
9530 @opindex mieee-compare
9531 @opindex mno-ieee-compare
9532 Control whether or not the compiler uses IEEE floating point
9533 comparisons.  These handle correctly the case where the result of a
9534 comparison is unordered.
9535 @strong{Warning:} the requisite kernel support may not be available.
9536
9537 @item -mnobitfield
9538 @opindex mnobitfield
9539 Do not use the bit-field instructions.  On some machines it is faster to
9540 use shifting and masking operations.  This is the default for the pc532.
9541
9542 @item -mbitfield
9543 @opindex mbitfield
9544 Do use the bit-field instructions.  This is the default for all platforms
9545 except the pc532.
9546
9547 @item -mrtd
9548 @opindex mrtd
9549 Use a different function-calling convention, in which functions
9550 that take a fixed number of arguments return pop their
9551 arguments on return with the @code{ret} instruction.
9552
9553 This calling convention is incompatible with the one normally
9554 used on Unix, so you cannot use it if you need to call libraries
9555 compiled with the Unix compiler.
9556
9557 Also, you must provide function prototypes for all functions that
9558 take variable numbers of arguments (including @code{printf});
9559 otherwise incorrect code will be generated for calls to those
9560 functions.
9561
9562 In addition, seriously incorrect code will result if you call a
9563 function with too many arguments.  (Normally, extra arguments are
9564 harmlessly ignored.)
9565
9566 This option takes its name from the 680x0 @code{rtd} instruction.
9567
9568
9569 @item -mregparam
9570 @opindex mregparam
9571 Use a different function-calling convention where the first two arguments
9572 are passed in registers.
9573
9574 This calling convention is incompatible with the one normally
9575 used on Unix, so you cannot use it if you need to call libraries
9576 compiled with the Unix compiler.
9577
9578 @item -mnoregparam
9579 @opindex mnoregparam
9580 Do not pass any arguments in registers.  This is the default for all
9581 targets.
9582
9583 @item -msb
9584 @opindex msb
9585 It is OK to use the sb as an index register which is always loaded with
9586 zero.  This is the default for the pc532-netbsd target.
9587
9588 @item -mnosb
9589 @opindex mnosb
9590 The sb register is not available for use or has not been initialized to
9591 zero by the run time system.  This is the default for all targets except
9592 the pc532-netbsd.  It is also implied whenever @option{-mhimem} or
9593 @option{-fpic} is set.
9594
9595 @item -mhimem
9596 @opindex mhimem
9597 Many ns32000 series addressing modes use displacements of up to 512MB@.
9598 If an address is above 512MB then displacements from zero can not be used.
9599 This option causes code to be generated which can be loaded above 512MB@.
9600 This may be useful for operating systems or ROM code.
9601
9602 @item -mnohimem
9603 @opindex mnohimem
9604 Assume code will be loaded in the first 512MB of virtual address space.
9605 This is the default for all platforms.
9606
9607 @end table
9608
9609 @node PDP-11 Options
9610 @subsection PDP-11 Options
9611 @cindex PDP-11 Options
9612
9613 These options are defined for the PDP-11:
9614
9615 @table @gcctabopt
9616 @item -mfpu
9617 @opindex mfpu
9618 Use hardware FPP floating point.  This is the default.  (FIS floating
9619 point on the PDP-11/40 is not supported.)
9620
9621 @item -msoft-float
9622 @opindex msoft-float
9623 Do not use hardware floating point.
9624
9625 @item -mac0
9626 @opindex mac0
9627 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
9628
9629 @item -mno-ac0
9630 @opindex mno-ac0
9631 Return floating-point results in memory.  This is the default.
9632
9633 @item -m40
9634 @opindex m40
9635 Generate code for a PDP-11/40.
9636
9637 @item -m45
9638 @opindex m45
9639 Generate code for a PDP-11/45.  This is the default.
9640
9641 @item -m10
9642 @opindex m10
9643 Generate code for a PDP-11/10.
9644
9645 @item -mbcopy-builtin
9646 @opindex bcopy-builtin
9647 Use inline @code{movmemhi} patterns for copying memory.  This is the
9648 default.
9649
9650 @item -mbcopy
9651 @opindex mbcopy
9652 Do not use inline @code{movmemhi} patterns for copying memory.
9653
9654 @item -mint16
9655 @itemx -mno-int32
9656 @opindex mint16
9657 @opindex mno-int32
9658 Use 16-bit @code{int}.  This is the default.
9659
9660 @item -mint32
9661 @itemx -mno-int16
9662 @opindex mint32
9663 @opindex mno-int16
9664 Use 32-bit @code{int}.
9665
9666 @item -mfloat64
9667 @itemx -mno-float32
9668 @opindex mfloat64
9669 @opindex mno-float32
9670 Use 64-bit @code{float}.  This is the default.
9671
9672 @item -mfloat32
9673 @itemx -mno-float64
9674 @opindex mfloat32
9675 @opindex mno-float64
9676 Use 32-bit @code{float}.
9677
9678 @item -mabshi
9679 @opindex mabshi
9680 Use @code{abshi2} pattern.  This is the default.
9681
9682 @item -mno-abshi
9683 @opindex mno-abshi
9684 Do not use @code{abshi2} pattern.
9685
9686 @item -mbranch-expensive
9687 @opindex mbranch-expensive
9688 Pretend that branches are expensive.  This is for experimenting with
9689 code generation only.
9690
9691 @item -mbranch-cheap
9692 @opindex mbranch-cheap
9693 Do not pretend that branches are expensive.  This is the default.
9694
9695 @item -msplit
9696 @opindex msplit
9697 Generate code for a system with split I&D.
9698
9699 @item -mno-split
9700 @opindex mno-split
9701 Generate code for a system without split I&D.  This is the default.
9702
9703 @item -munix-asm
9704 @opindex munix-asm
9705 Use Unix assembler syntax.  This is the default when configured for
9706 @samp{pdp11-*-bsd}.
9707
9708 @item -mdec-asm
9709 @opindex mdec-asm
9710 Use DEC assembler syntax.  This is the default when configured for any
9711 PDP-11 target other than @samp{pdp11-*-bsd}.
9712 @end table
9713
9714 @node PowerPC Options
9715 @subsection PowerPC Options
9716 @cindex PowerPC options
9717
9718 These are listed under @xref{RS/6000 and PowerPC Options}.
9719
9720 @node RS/6000 and PowerPC Options
9721 @subsection IBM RS/6000 and PowerPC Options
9722 @cindex RS/6000 and PowerPC Options
9723 @cindex IBM RS/6000 and PowerPC Options
9724
9725 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
9726 @table @gcctabopt
9727 @item -mpower
9728 @itemx -mno-power
9729 @itemx -mpower2
9730 @itemx -mno-power2
9731 @itemx -mpowerpc
9732 @itemx -mno-powerpc
9733 @itemx -mpowerpc-gpopt
9734 @itemx -mno-powerpc-gpopt
9735 @itemx -mpowerpc-gfxopt
9736 @itemx -mno-powerpc-gfxopt
9737 @itemx -mpowerpc64
9738 @itemx -mno-powerpc64
9739 @opindex mpower
9740 @opindex mno-power
9741 @opindex mpower2
9742 @opindex mno-power2
9743 @opindex mpowerpc
9744 @opindex mno-powerpc
9745 @opindex mpowerpc-gpopt
9746 @opindex mno-powerpc-gpopt
9747 @opindex mpowerpc-gfxopt
9748 @opindex mno-powerpc-gfxopt
9749 @opindex mpowerpc64
9750 @opindex mno-powerpc64
9751 GCC supports two related instruction set architectures for the
9752 RS/6000 and PowerPC@.  The @dfn{POWER} instruction set are those
9753 instructions supported by the @samp{rios} chip set used in the original
9754 RS/6000 systems and the @dfn{PowerPC} instruction set is the
9755 architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and
9756 the IBM 4xx microprocessors.
9757
9758 Neither architecture is a subset of the other.  However there is a
9759 large common subset of instructions supported by both.  An MQ
9760 register is included in processors supporting the POWER architecture.
9761
9762 You use these options to specify which instructions are available on the
9763 processor you are using.  The default value of these options is
9764 determined when configuring GCC@.  Specifying the
9765 @option{-mcpu=@var{cpu_type}} overrides the specification of these
9766 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
9767 rather than the options listed above.
9768
9769 The @option{-mpower} option allows GCC to generate instructions that
9770 are found only in the POWER architecture and to use the MQ register.
9771 Specifying @option{-mpower2} implies @option{-power} and also allows GCC
9772 to generate instructions that are present in the POWER2 architecture but
9773 not the original POWER architecture.
9774
9775 The @option{-mpowerpc} option allows GCC to generate instructions that
9776 are found only in the 32-bit subset of the PowerPC architecture.
9777 Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
9778 GCC to use the optional PowerPC architecture instructions in the
9779 General Purpose group, including floating-point square root.  Specifying
9780 @option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
9781 use the optional PowerPC architecture instructions in the Graphics
9782 group, including floating-point select.
9783
9784 The @option{-mpowerpc64} option allows GCC to generate the additional
9785 64-bit instructions that are found in the full PowerPC64 architecture
9786 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
9787 @option{-mno-powerpc64}.
9788
9789 If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
9790 will use only the instructions in the common subset of both
9791 architectures plus some special AIX common-mode calls, and will not use
9792 the MQ register.  Specifying both @option{-mpower} and @option{-mpowerpc}
9793 permits GCC to use any instruction from either architecture and to
9794 allow use of the MQ register; specify this for the Motorola MPC601.
9795
9796 @item -mnew-mnemonics
9797 @itemx -mold-mnemonics
9798 @opindex mnew-mnemonics
9799 @opindex mold-mnemonics
9800 Select which mnemonics to use in the generated assembler code.  With
9801 @option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
9802 the PowerPC architecture.  With @option{-mold-mnemonics} it uses the
9803 assembler mnemonics defined for the POWER architecture.  Instructions
9804 defined in only one architecture have only one mnemonic; GCC uses that
9805 mnemonic irrespective of which of these options is specified.
9806
9807 GCC defaults to the mnemonics appropriate for the architecture in
9808 use.  Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
9809 value of these option.  Unless you are building a cross-compiler, you
9810 should normally not specify either @option{-mnew-mnemonics} or
9811 @option{-mold-mnemonics}, but should instead accept the default.
9812
9813 @item -mcpu=@var{cpu_type}
9814 @opindex mcpu
9815 Set architecture type, register usage, choice of mnemonics, and
9816 instruction scheduling parameters for machine type @var{cpu_type}.
9817 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
9818 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{505},
9819 @samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604},
9820 @samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400},
9821 @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
9822 @samp{860}, @samp{970}, @samp{common}, @samp{ec603e}, @samp{G3},
9823 @samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3},
9824 @samp{power4}, @samp{power5}, @samp{powerpc}, @samp{powerpc64},
9825 @samp{rios}, @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64a}.
9826
9827 @option{-mcpu=common} selects a completely generic processor.  Code
9828 generated under this option will run on any POWER or PowerPC processor.
9829 GCC will use only the instructions in the common subset of both
9830 architectures, and will not use the MQ register.  GCC assumes a generic
9831 processor model for scheduling purposes.
9832
9833 @option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
9834 @option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
9835 PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
9836 types, with an appropriate, generic processor model assumed for
9837 scheduling purposes.
9838
9839 The other options specify a specific processor.  Code generated under
9840 those options will run best on that processor, and may not run at all on
9841 others.
9842
9843 The @option{-mcpu} options automatically enable or disable the
9844 following options: @option{-maltivec}, @option{-mhard-float},
9845 @option{-mmfcrf}, @option{-mmultiple}, @option{-mnew-mnemonics},
9846 @option{-mpower}, @option{-mpower2}, @option{-mpowerpc64},
9847 @option{-mpowerpc-gpopt}, @option{-mpowerpc-gfxopt},
9848 @option{-mstring}.  The particular options set for any particular CPU
9849 will vary between compiler versions, depending on what setting seems
9850 to produce optimal code for that CPU; it doesn't necessarily reflect
9851 the actual hardware's capabilities.  If you wish to set an individual
9852 option to a particular value, you may specify it after the
9853 @option{-mcpu} option, like @samp{-mcpu=970 -mno-altivec}.
9854
9855 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
9856 not enabled or disabled by the @option{-mcpu} option at present, since
9857 AIX does not have full support for these options.  You may still
9858 enable or disable them individually if you're sure it'll work in your
9859 environment.
9860
9861 @item -mtune=@var{cpu_type}
9862 @opindex mtune
9863 Set the instruction scheduling parameters for machine type
9864 @var{cpu_type}, but do not set the architecture type, register usage, or
9865 choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would.  The same
9866 values for @var{cpu_type} are used for @option{-mtune} as for
9867 @option{-mcpu}.  If both are specified, the code generated will use the
9868 architecture, registers, and mnemonics set by @option{-mcpu}, but the
9869 scheduling parameters set by @option{-mtune}.
9870
9871 @item -maltivec
9872 @itemx -mno-altivec
9873 @opindex maltivec
9874 @opindex mno-altivec
9875 These switches enable or disable the use of built-in functions that
9876 allow access to the AltiVec instruction set.  You may also need to set
9877 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
9878 enhancements.
9879
9880 @item -mabi=spe
9881 @opindex mabi=spe
9882 Extend the current ABI with SPE ABI extensions.  This does not change
9883 the default ABI, instead it adds the SPE ABI extensions to the current
9884 ABI@.
9885
9886 @item -mabi=no-spe
9887 @opindex mabi=no-spe
9888 Disable Booke SPE ABI extensions for the current ABI.
9889
9890 @item -misel=@var{yes/no}
9891 @itemx -misel
9892 @opindex misel
9893 This switch enables or disables the generation of ISEL instructions.
9894
9895 @item -mspe=@var{yes/no}
9896 @itemx -mspe
9897 @opindex mspe
9898 This switch enables or disables the generation of SPE simd
9899 instructions.
9900
9901 @item -mfloat-gprs=@var{yes/no}
9902 @itemx -mfloat-gprs
9903 @opindex mfloat-gprs
9904 This switch enables or disables the generation of floating point
9905 operations on the general purpose registers for architectures that
9906 support it.  This option is currently only available on the MPC8540.
9907
9908 @item -mfull-toc
9909 @itemx -mno-fp-in-toc
9910 @itemx -mno-sum-in-toc
9911 @itemx -mminimal-toc
9912 @opindex mfull-toc
9913 @opindex mno-fp-in-toc
9914 @opindex mno-sum-in-toc
9915 @opindex mminimal-toc
9916 Modify generation of the TOC (Table Of Contents), which is created for
9917 every executable file.  The @option{-mfull-toc} option is selected by
9918 default.  In that case, GCC will allocate at least one TOC entry for
9919 each unique non-automatic variable reference in your program.  GCC
9920 will also place floating-point constants in the TOC@.  However, only
9921 16,384 entries are available in the TOC@.
9922
9923 If you receive a linker error message that saying you have overflowed
9924 the available TOC space, you can reduce the amount of TOC space used
9925 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
9926 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
9927 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
9928 generate code to calculate the sum of an address and a constant at
9929 run-time instead of putting that sum into the TOC@.  You may specify one
9930 or both of these options.  Each causes GCC to produce very slightly
9931 slower and larger code at the expense of conserving TOC space.
9932
9933 If you still run out of space in the TOC even when you specify both of
9934 these options, specify @option{-mminimal-toc} instead.  This option causes
9935 GCC to make only one TOC entry for every file.  When you specify this
9936 option, GCC will produce code that is slower and larger but which
9937 uses extremely little TOC space.  You may wish to use this option
9938 only on files that contain less frequently executed code.
9939
9940 @item -maix64
9941 @itemx -maix32
9942 @opindex maix64
9943 @opindex maix32
9944 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
9945 @code{long} type, and the infrastructure needed to support them.
9946 Specifying @option{-maix64} implies @option{-mpowerpc64} and
9947 @option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
9948 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
9949
9950 @item -mxl-call
9951 @itemx -mno-xl-call
9952 @opindex mxl-call
9953 @opindex mno-xl-call
9954 On AIX, pass floating-point arguments to prototyped functions beyond the
9955 register save area (RSA) on the stack in addition to argument FPRs.  The
9956 AIX calling convention was extended but not initially documented to
9957 handle an obscure K&R C case of calling a function that takes the
9958 address of its arguments with fewer arguments than declared.  AIX XL
9959 compilers access floating point arguments which do not fit in the
9960 RSA from the stack when a subroutine is compiled without
9961 optimization.  Because always storing floating-point arguments on the
9962 stack is inefficient and rarely needed, this option is not enabled by
9963 default and only is necessary when calling subroutines compiled by AIX
9964 XL compilers without optimization.
9965
9966 @item -mpe
9967 @opindex mpe
9968 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
9969 application written to use message passing with special startup code to
9970 enable the application to run.  The system must have PE installed in the
9971 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
9972 must be overridden with the @option{-specs=} option to specify the
9973 appropriate directory location.  The Parallel Environment does not
9974 support threads, so the @option{-mpe} option and the @option{-pthread}
9975 option are incompatible.
9976
9977 @item -malign-natural
9978 @itemx -malign-power
9979 @opindex malign-natural
9980 @opindex malign-power
9981 On AIX, Darwin, and 64-bit PowerPC GNU/Linux, the option
9982 @option{-malign-natural} overrides the ABI-defined alignment of larger
9983 types, such as floating-point doubles, on their natural size-based boundary.
9984 The option @option{-malign-power} instructs GCC to follow the ABI-specified
9985 alignment rules.  GCC defaults to the standard alignment defined in the ABI.
9986
9987 @item -msoft-float
9988 @itemx -mhard-float
9989 @opindex msoft-float
9990 @opindex mhard-float
9991 Generate code that does not use (uses) the floating-point register set.
9992 Software floating point emulation is provided if you use the
9993 @option{-msoft-float} option, and pass the option to GCC when linking.
9994
9995 @item -mmultiple
9996 @itemx -mno-multiple
9997 @opindex mmultiple
9998 @opindex mno-multiple
9999 Generate code that uses (does not use) the load multiple word
10000 instructions and the store multiple word instructions.  These
10001 instructions are generated by default on POWER systems, and not
10002 generated on PowerPC systems.  Do not use @option{-mmultiple} on little
10003 endian PowerPC systems, since those instructions do not work when the
10004 processor is in little endian mode.  The exceptions are PPC740 and
10005 PPC750 which permit the instructions usage in little endian mode.
10006
10007 @item -mstring
10008 @itemx -mno-string
10009 @opindex mstring
10010 @opindex mno-string
10011 Generate code that uses (does not use) the load string instructions
10012 and the store string word instructions to save multiple registers and
10013 do small block moves.  These instructions are generated by default on
10014 POWER systems, and not generated on PowerPC systems.  Do not use
10015 @option{-mstring} on little endian PowerPC systems, since those
10016 instructions do not work when the processor is in little endian mode.
10017 The exceptions are PPC740 and PPC750 which permit the instructions
10018 usage in little endian mode.
10019
10020 @item -mupdate
10021 @itemx -mno-update
10022 @opindex mupdate
10023 @opindex mno-update
10024 Generate code that uses (does not use) the load or store instructions
10025 that update the base register to the address of the calculated memory
10026 location.  These instructions are generated by default.  If you use
10027 @option{-mno-update}, there is a small window between the time that the
10028 stack pointer is updated and the address of the previous frame is
10029 stored, which means code that walks the stack frame across interrupts or
10030 signals may get corrupted data.
10031
10032 @item -mfused-madd
10033 @itemx -mno-fused-madd
10034 @opindex mfused-madd
10035 @opindex mno-fused-madd
10036 Generate code that uses (does not use) the floating point multiply and
10037 accumulate instructions.  These instructions are generated by default if
10038 hardware floating is used.
10039
10040 @item -mno-bit-align
10041 @itemx -mbit-align
10042 @opindex mno-bit-align
10043 @opindex mbit-align
10044 On System V.4 and embedded PowerPC systems do not (do) force structures
10045 and unions that contain bit-fields to be aligned to the base type of the
10046 bit-field.
10047
10048 For example, by default a structure containing nothing but 8
10049 @code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
10050 boundary and have a size of 4 bytes.  By using @option{-mno-bit-align},
10051 the structure would be aligned to a 1 byte boundary and be one byte in
10052 size.
10053
10054 @item -mno-strict-align
10055 @itemx -mstrict-align
10056 @opindex mno-strict-align
10057 @opindex mstrict-align
10058 On System V.4 and embedded PowerPC systems do not (do) assume that
10059 unaligned memory references will be handled by the system.
10060
10061 @item -mrelocatable
10062 @itemx -mno-relocatable
10063 @opindex mrelocatable
10064 @opindex mno-relocatable
10065 On embedded PowerPC systems generate code that allows (does not allow)
10066 the program to be relocated to a different address at runtime.  If you
10067 use @option{-mrelocatable} on any module, all objects linked together must
10068 be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
10069
10070 @item -mrelocatable-lib
10071 @itemx -mno-relocatable-lib
10072 @opindex mrelocatable-lib
10073 @opindex mno-relocatable-lib
10074 On embedded PowerPC systems generate code that allows (does not allow)
10075 the program to be relocated to a different address at runtime.  Modules
10076 compiled with @option{-mrelocatable-lib} can be linked with either modules
10077 compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
10078 with modules compiled with the @option{-mrelocatable} options.
10079
10080 @item -mno-toc
10081 @itemx -mtoc
10082 @opindex mno-toc
10083 @opindex mtoc
10084 On System V.4 and embedded PowerPC systems do not (do) assume that
10085 register 2 contains a pointer to a global area pointing to the addresses
10086 used in the program.
10087
10088 @item -mlittle
10089 @itemx -mlittle-endian
10090 @opindex mlittle
10091 @opindex mlittle-endian
10092 On System V.4 and embedded PowerPC systems compile code for the
10093 processor in little endian mode.  The @option{-mlittle-endian} option is
10094 the same as @option{-mlittle}.
10095
10096 @item -mbig
10097 @itemx -mbig-endian
10098 @opindex mbig
10099 @opindex mbig-endian
10100 On System V.4 and embedded PowerPC systems compile code for the
10101 processor in big endian mode.  The @option{-mbig-endian} option is
10102 the same as @option{-mbig}.
10103
10104 @item -mdynamic-no-pic
10105 @opindex mdynamic-no-pic
10106 On Darwin and Mac OS X systems, compile code so that it is not
10107 relocatable, but that its external references are relocatable.  The
10108 resulting code is suitable for applications, but not shared
10109 libraries.
10110
10111 @item -mprioritize-restricted-insns=@var{priority}
10112 @opindex mprioritize-restricted-insns
10113 This option controls the priority that is assigned to
10114 dispatch-slot restricted instructions during the second scheduling
10115 pass.  The argument @var{priority} takes the value @var{0/1/2} to assign
10116 @var{no/highest/second-highest} priority to dispatch slot restricted
10117 instructions.
10118
10119 @item -msched-costly-dep=@var{dependence_type}
10120 @opindex msched-costly-dep
10121 This option controls which dependences are considered costly
10122 by the target during instruction scheduling.  The argument
10123 @var{dependence_type} takes one of the following values:
10124 @var{no}: no dependence is costly,
10125 @var{all}: all dependences are costly,
10126 @var{true_store_to_load}: a true dependence from store to load is costly,
10127 @var{store_to_load}: any dependence from store to load is costly,
10128 @var{number}: any dependence which latency >= @var{number} is costly.
10129
10130 @item -minsert-sched-nops=@var{scheme}
10131 @opindex minsert-sched-nops
10132 This option controls which nop insertion scheme will be used during
10133 the second scheduling pass. The argument @var{scheme} takes one of the
10134 following values:
10135 @var{no}: Don't insert nops.
10136 @var{pad}: Pad with nops any dispatch group which has vacant issue slots,
10137 according to the scheduler's grouping.
10138 @var{regroup_exact}: Insert nops to force costly dependent insns into
10139 separate groups.  Insert exactly as many nops as needed to force an insn
10140 to a new group, according to the estimated processor grouping.
10141 @var{number}: Insert nops to force costly dependent insns into
10142 separate groups.  Insert @var{number} nops to force an insn to a new group.
10143
10144 @item -mcall-sysv
10145 @opindex mcall-sysv
10146 On System V.4 and embedded PowerPC systems compile code using calling
10147 conventions that adheres to the March 1995 draft of the System V
10148 Application Binary Interface, PowerPC processor supplement.  This is the
10149 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
10150
10151 @item -mcall-sysv-eabi
10152 @opindex mcall-sysv-eabi
10153 Specify both @option{-mcall-sysv} and @option{-meabi} options.
10154
10155 @item -mcall-sysv-noeabi
10156 @opindex mcall-sysv-noeabi
10157 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
10158
10159 @item -mcall-solaris
10160 @opindex mcall-solaris
10161 On System V.4 and embedded PowerPC systems compile code for the Solaris
10162 operating system.
10163
10164 @item -mcall-linux
10165 @opindex mcall-linux
10166 On System V.4 and embedded PowerPC systems compile code for the
10167 Linux-based GNU system.
10168
10169 @item -mcall-gnu
10170 @opindex mcall-gnu
10171 On System V.4 and embedded PowerPC systems compile code for the
10172 Hurd-based GNU system.
10173
10174 @item -mcall-netbsd
10175 @opindex mcall-netbsd
10176 On System V.4 and embedded PowerPC systems compile code for the
10177 NetBSD operating system.
10178
10179 @item -maix-struct-return
10180 @opindex maix-struct-return
10181 Return all structures in memory (as specified by the AIX ABI)@.
10182
10183 @item -msvr4-struct-return
10184 @opindex msvr4-struct-return
10185 Return structures smaller than 8 bytes in registers (as specified by the
10186 SVR4 ABI)@.
10187
10188 @item -mabi=altivec
10189 @opindex mabi=altivec
10190 Extend the current ABI with AltiVec ABI extensions.  This does not
10191 change the default ABI, instead it adds the AltiVec ABI extensions to
10192 the current ABI@.
10193
10194 @item -mabi=no-altivec
10195 @opindex mabi=no-altivec
10196 Disable AltiVec ABI extensions for the current ABI.
10197
10198 @item -mprototype
10199 @itemx -mno-prototype
10200 @opindex mprototype
10201 @opindex mno-prototype
10202 On System V.4 and embedded PowerPC systems assume that all calls to
10203 variable argument functions are properly prototyped.  Otherwise, the
10204 compiler must insert an instruction before every non prototyped call to
10205 set or clear bit 6 of the condition code register (@var{CR}) to
10206 indicate whether floating point values were passed in the floating point
10207 registers in case the function takes a variable arguments.  With
10208 @option{-mprototype}, only calls to prototyped variable argument functions
10209 will set or clear the bit.
10210
10211 @item -msim
10212 @opindex msim
10213 On embedded PowerPC systems, assume that the startup module is called
10214 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
10215 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}.
10216 configurations.
10217
10218 @item -mmvme
10219 @opindex mmvme
10220 On embedded PowerPC systems, assume that the startup module is called
10221 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
10222 @file{libc.a}.
10223
10224 @item -mads
10225 @opindex mads
10226 On embedded PowerPC systems, assume that the startup module is called
10227 @file{crt0.o} and the standard C libraries are @file{libads.a} and
10228 @file{libc.a}.
10229
10230 @item -myellowknife
10231 @opindex myellowknife
10232 On embedded PowerPC systems, assume that the startup module is called
10233 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
10234 @file{libc.a}.
10235
10236 @item -mvxworks
10237 @opindex mvxworks
10238 On System V.4 and embedded PowerPC systems, specify that you are
10239 compiling for a VxWorks system.
10240
10241 @item -mwindiss
10242 @opindex mwindiss
10243 Specify that you are compiling for the WindISS simulation environment.
10244
10245 @item -memb
10246 @opindex memb
10247 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
10248 header to indicate that @samp{eabi} extended relocations are used.
10249
10250 @item -meabi
10251 @itemx -mno-eabi
10252 @opindex meabi
10253 @opindex mno-eabi
10254 On System V.4 and embedded PowerPC systems do (do not) adhere to the
10255 Embedded Applications Binary Interface (eabi) which is a set of
10256 modifications to the System V.4 specifications.  Selecting @option{-meabi}
10257 means that the stack is aligned to an 8 byte boundary, a function
10258 @code{__eabi} is called to from @code{main} to set up the eabi
10259 environment, and the @option{-msdata} option can use both @code{r2} and
10260 @code{r13} to point to two separate small data areas.  Selecting
10261 @option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
10262 do not call an initialization function from @code{main}, and the
10263 @option{-msdata} option will only use @code{r13} to point to a single
10264 small data area.  The @option{-meabi} option is on by default if you
10265 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
10266
10267 @item -msdata=eabi
10268 @opindex msdata=eabi
10269 On System V.4 and embedded PowerPC systems, put small initialized
10270 @code{const} global and static data in the @samp{.sdata2} section, which
10271 is pointed to by register @code{r2}.  Put small initialized
10272 non-@code{const} global and static data in the @samp{.sdata} section,
10273 which is pointed to by register @code{r13}.  Put small uninitialized
10274 global and static data in the @samp{.sbss} section, which is adjacent to
10275 the @samp{.sdata} section.  The @option{-msdata=eabi} option is
10276 incompatible with the @option{-mrelocatable} option.  The
10277 @option{-msdata=eabi} option also sets the @option{-memb} option.
10278
10279 @item -msdata=sysv
10280 @opindex msdata=sysv
10281 On System V.4 and embedded PowerPC systems, put small global and static
10282 data in the @samp{.sdata} section, which is pointed to by register
10283 @code{r13}.  Put small uninitialized global and static data in the
10284 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
10285 The @option{-msdata=sysv} option is incompatible with the
10286 @option{-mrelocatable} option.
10287
10288 @item -msdata=default
10289 @itemx -msdata
10290 @opindex msdata=default
10291 @opindex msdata
10292 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
10293 compile code the same as @option{-msdata=eabi}, otherwise compile code the
10294 same as @option{-msdata=sysv}.
10295
10296 @item -msdata-data
10297 @opindex msdata-data
10298 On System V.4 and embedded PowerPC systems, put small global and static
10299 data in the @samp{.sdata} section.  Put small uninitialized global and
10300 static data in the @samp{.sbss} section.  Do not use register @code{r13}
10301 to address small data however.  This is the default behavior unless
10302 other @option{-msdata} options are used.
10303
10304 @item -msdata=none
10305 @itemx -mno-sdata
10306 @opindex msdata=none
10307 @opindex mno-sdata
10308 On embedded PowerPC systems, put all initialized global and static data
10309 in the @samp{.data} section, and all uninitialized data in the
10310 @samp{.bss} section.
10311
10312 @item -G @var{num}
10313 @opindex G
10314 @cindex smaller data references (PowerPC)
10315 @cindex .sdata/.sdata2 references (PowerPC)
10316 On embedded PowerPC systems, put global and static items less than or
10317 equal to @var{num} bytes into the small data or bss sections instead of
10318 the normal data or bss section.  By default, @var{num} is 8.  The
10319 @option{-G @var{num}} switch is also passed to the linker.
10320 All modules should be compiled with the same @option{-G @var{num}} value.
10321
10322 @item -mregnames
10323 @itemx -mno-regnames
10324 @opindex mregnames
10325 @opindex mno-regnames
10326 On System V.4 and embedded PowerPC systems do (do not) emit register
10327 names in the assembly language output using symbolic forms.
10328
10329 @item -mlongcall
10330 @itemx -mno-longcall
10331 @opindex mlongcall
10332 @opindex mno-longcall
10333 Default to making all function calls indirectly, using a register, so
10334 that functions which reside further than 32 megabytes (33,554,432
10335 bytes) from the current location can be called.  This setting can be
10336 overridden by the @code{shortcall} function attribute, or by
10337 @code{#pragma longcall(0)}.
10338
10339 Some linkers are capable of detecting out-of-range calls and generating
10340 glue code on the fly.  On these systems, long calls are unnecessary and
10341 generate slower code.  As of this writing, the AIX linker can do this,
10342 as can the GNU linker for PowerPC/64.  It is planned to add this feature
10343 to the GNU linker for 32-bit PowerPC systems as well.
10344
10345 On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr
10346 callee, L42'', plus a ``branch island'' (glue code).  The two target
10347 addresses represent the callee and the ``branch island.'' The
10348 Darwin/PPC linker will prefer the first address and generate a ``bl
10349 callee'' if the PPC ``bl'' instruction will reach the callee directly;
10350 otherwise, the linker will generate ``bl L42'' to call the ``branch
10351 island.''  The ``branch island'' is appended to the body of the
10352 calling function; it computes the full 32-bit address of the callee
10353 and jumps to it.
10354
10355 On Mach-O (Darwin) systems, this option directs the compiler emit to
10356 the glue for every direct call, and the Darwin linker decides whether
10357 to use or discard it.
10358
10359 In the future, we may cause GCC to ignore all longcall specifications
10360 when the linker is known to generate glue.
10361
10362 @item -pthread
10363 @opindex pthread
10364 Adds support for multithreading with the @dfn{pthreads} library.
10365 This option sets flags for both the preprocessor and linker.
10366
10367 @end table
10368
10369 @node S/390 and zSeries Options
10370 @subsection S/390 and zSeries Options
10371 @cindex S/390 and zSeries Options
10372
10373 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
10374
10375 @table @gcctabopt
10376 @item -mhard-float
10377 @itemx -msoft-float
10378 @opindex mhard-float
10379 @opindex msoft-float
10380 Use (do not use) the hardware floating-point instructions and registers
10381 for floating-point operations.  When @option{-msoft-float} is specified,
10382 functions in @file{libgcc.a} will be used to perform floating-point
10383 operations.  When @option{-mhard-float} is specified, the compiler
10384 generates IEEE floating-point instructions.  This is the default.
10385
10386 @item -mbackchain
10387 @itemx -mno-backchain
10388 @opindex mbackchain
10389 @opindex mno-backchain
10390 Generate (or do not generate) code which maintains an explicit
10391 backchain within the stack frame that points to the caller's frame.
10392 This may be needed to allow debugging using tools that do not understand
10393 DWARF-2 call frame information.  The default is not to generate the
10394 backchain.
10395
10396 @item -msmall-exec
10397 @itemx -mno-small-exec
10398 @opindex msmall-exec
10399 @opindex mno-small-exec
10400 Generate (or do not generate) code using the @code{bras} instruction
10401 to do subroutine calls.
10402 This only works reliably if the total executable size does not
10403 exceed 64k.  The default is to use the @code{basr} instruction instead,
10404 which does not have this limitation.
10405
10406 @item -m64
10407 @itemx -m31
10408 @opindex m64
10409 @opindex m31
10410 When @option{-m31} is specified, generate code compliant to the
10411 GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
10412 code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
10413 particular to generate 64-bit instructions.  For the @samp{s390}
10414 targets, the default is @option{-m31}, while the @samp{s390x}
10415 targets default to @option{-m64}.
10416
10417 @item -mzarch
10418 @itemx -mesa
10419 @opindex mzarch
10420 @opindex mesa
10421 When @option{-mzarch} is specified, generate code using the
10422 instructions available on z/Architecture.
10423 When @option{-mesa} is specified, generate code using the
10424 instructions available on ESA/390. Note that @option{-mesa} is
10425 not possible with @option{-m64}.
10426 When generating code compliant to the GNU/Linux for S/390 ABI,
10427 the default is @option{-mesa}.  When generating code compliant
10428 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
10429
10430 @item -mmvcle
10431 @itemx -mno-mvcle
10432 @opindex mmvcle
10433 @opindex mno-mvcle
10434 Generate (or do not generate) code using the @code{mvcle} instruction
10435 to perform block moves.  When @option{-mno-mvcle} is specified,
10436 use a @code{mvc} loop instead.  This is the default.
10437
10438 @item -mdebug
10439 @itemx -mno-debug
10440 @opindex mdebug
10441 @opindex mno-debug
10442 Print (or do not print) additional debug information when compiling.
10443 The default is to not print debug information.
10444
10445 @item -march=@var{cpu-type}
10446 @opindex march
10447 Generate code that will run on @var{cpu-type}, which is the name of a system
10448 representing a certain processor type. Possible values for
10449 @var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}.
10450 When generating code using the instructions available on z/Architecture,
10451 the default is @option{-march=z900}.  Otherwise, the default is
10452 @option{-march=g5}.
10453
10454 @item -mtune=@var{cpu-type}
10455 @opindex mtune
10456 Tune to @var{cpu-type} everything applicable about the generated code,
10457 except for the ABI and the set of available instructions.
10458 The list of @var{cpu-type} values is the same as for @option{-march}.
10459 The default is the value used for @option{-march}.
10460
10461 @item -mtpf-trace
10462 @itemx -mno-tpf-trace
10463 @opindex mtpf-trace
10464 @opindex mno-tpf-trace
10465 Generate code that adds (does not add) in TPF OS specific branches to trace
10466 routines in the operating system.  This option is off by default, even
10467 when compiling for the TPF OS.
10468
10469 @item -mfused-madd
10470 @itemx -mno-fused-madd
10471 @opindex mfused-madd
10472 @opindex mno-fused-madd
10473 Generate code that uses (does not use) the floating point multiply and
10474 accumulate instructions.  These instructions are generated by default if
10475 hardware floating point is used.
10476 @end table
10477
10478 @node SH Options
10479 @subsection SH Options
10480
10481 These @samp{-m} options are defined for the SH implementations:
10482
10483 @table @gcctabopt
10484 @item -m1
10485 @opindex m1
10486 Generate code for the SH1.
10487
10488 @item -m2
10489 @opindex m2
10490 Generate code for the SH2.
10491
10492 @item -m2e
10493 Generate code for the SH2e.
10494
10495 @item -m3
10496 @opindex m3
10497 Generate code for the SH3.
10498
10499 @item -m3e
10500 @opindex m3e
10501 Generate code for the SH3e.
10502
10503 @item -m4-nofpu
10504 @opindex m4-nofpu
10505 Generate code for the SH4 without a floating-point unit.
10506
10507 @item -m4-single-only
10508 @opindex m4-single-only
10509 Generate code for the SH4 with a floating-point unit that only
10510 supports single-precision arithmetic.
10511
10512 @item -m4-single
10513 @opindex m4-single
10514 Generate code for the SH4 assuming the floating-point unit is in
10515 single-precision mode by default.
10516
10517 @item -m4
10518 @opindex m4
10519 Generate code for the SH4.
10520
10521 @item -mb
10522 @opindex mb
10523 Compile code for the processor in big endian mode.
10524
10525 @item -ml
10526 @opindex ml
10527 Compile code for the processor in little endian mode.
10528
10529 @item -mdalign
10530 @opindex mdalign
10531 Align doubles at 64-bit boundaries.  Note that this changes the calling
10532 conventions, and thus some functions from the standard C library will
10533 not work unless you recompile it first with @option{-mdalign}.
10534
10535 @item -mrelax
10536 @opindex mrelax
10537 Shorten some address references at link time, when possible; uses the
10538 linker option @option{-relax}.
10539
10540 @item -mbigtable
10541 @opindex mbigtable
10542 Use 32-bit offsets in @code{switch} tables.  The default is to use
10543 16-bit offsets.
10544
10545 @item -mfmovd
10546 @opindex mfmovd
10547 Enable the use of the instruction @code{fmovd}.
10548
10549 @item -mhitachi
10550 @opindex mhitachi
10551 Comply with the calling conventions defined by Renesas.
10552
10553 @item -mnomacsave
10554 @opindex mnomacsave
10555 Mark the @code{MAC} register as call-clobbered, even if
10556 @option{-mhitachi} is given.
10557
10558 @item -mieee
10559 @opindex mieee
10560 Increase IEEE-compliance of floating-point code.
10561
10562 @item -misize
10563 @opindex misize
10564 Dump instruction size and location in the assembly code.
10565
10566 @item -mpadstruct
10567 @opindex mpadstruct
10568 This option is deprecated.  It pads structures to multiple of 4 bytes,
10569 which is incompatible with the SH ABI@.
10570
10571 @item -mspace
10572 @opindex mspace
10573 Optimize for space instead of speed.  Implied by @option{-Os}.
10574
10575 @item -mprefergot
10576 @opindex mprefergot
10577 When generating position-independent code, emit function calls using
10578 the Global Offset Table instead of the Procedure Linkage Table.
10579
10580 @item -musermode
10581 @opindex musermode
10582 Generate a library function call to invalidate instruction cache
10583 entries, after fixing up a trampoline.  This library function call
10584 doesn't assume it can write to the whole memory address space.  This
10585 is the default when the target is @code{sh-*-linux*}.
10586 @end table
10587
10588 @node SPARC Options
10589 @subsection SPARC Options
10590 @cindex SPARC options
10591
10592 These @samp{-m} options are supported on the SPARC:
10593
10594 @table @gcctabopt
10595 @item -mno-app-regs
10596 @itemx -mapp-regs
10597 @opindex mno-app-regs
10598 @opindex mapp-regs
10599 Specify @option{-mapp-regs} to generate output using the global registers
10600 2 through 4, which the SPARC SVR4 ABI reserves for applications.  This
10601 is the default.
10602
10603 To be fully SVR4 ABI compliant at the cost of some performance loss,
10604 specify @option{-mno-app-regs}.  You should compile libraries and system
10605 software with this option.
10606
10607 @item -mfpu
10608 @itemx -mhard-float
10609 @opindex mfpu
10610 @opindex mhard-float
10611 Generate output containing floating point instructions.  This is the
10612 default.
10613
10614 @item -mno-fpu
10615 @itemx -msoft-float
10616 @opindex mno-fpu
10617 @opindex msoft-float
10618 Generate output containing library calls for floating point.
10619 @strong{Warning:} the requisite libraries are not available for all SPARC
10620 targets.  Normally the facilities of the machine's usual C compiler are
10621 used, but this cannot be done directly in cross-compilation.  You must make
10622 your own arrangements to provide suitable library functions for
10623 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
10624 @samp{sparclite-*-*} do provide software floating point support.
10625
10626 @option{-msoft-float} changes the calling convention in the output file;
10627 therefore, it is only useful if you compile @emph{all} of a program with
10628 this option.  In particular, you need to compile @file{libgcc.a}, the
10629 library that comes with GCC, with @option{-msoft-float} in order for
10630 this to work.
10631
10632 @item -mhard-quad-float
10633 @opindex mhard-quad-float
10634 Generate output containing quad-word (long double) floating point
10635 instructions.
10636
10637 @item -msoft-quad-float
10638 @opindex msoft-quad-float
10639 Generate output containing library calls for quad-word (long double)
10640 floating point instructions.  The functions called are those specified
10641 in the SPARC ABI@.  This is the default.
10642
10643 As of this writing, there are no SPARC implementations that have hardware
10644 support for the quad-word floating point instructions.  They all invoke
10645 a trap handler for one of these instructions, and then the trap handler
10646 emulates the effect of the instruction.  Because of the trap handler overhead,
10647 this is much slower than calling the ABI library routines.  Thus the
10648 @option{-msoft-quad-float} option is the default.
10649
10650 @item -mno-unaligned-doubles
10651 @itemx -munaligned-doubles
10652 @opindex mno-unaligned-doubles
10653 @opindex munaligned-doubles
10654 Assume that doubles have 8 byte alignment.  This is the default.
10655
10656 With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
10657 alignment only if they are contained in another type, or if they have an
10658 absolute address.  Otherwise, it assumes they have 4 byte alignment.
10659 Specifying this option avoids some rare compatibility problems with code
10660 generated by other compilers.  It is not the default because it results
10661 in a performance loss, especially for floating point code.
10662
10663 @item -mno-faster-structs
10664 @itemx -mfaster-structs
10665 @opindex mno-faster-structs
10666 @opindex mfaster-structs
10667 With @option{-mfaster-structs}, the compiler assumes that structures
10668 should have 8 byte alignment.  This enables the use of pairs of
10669 @code{ldd} and @code{std} instructions for copies in structure
10670 assignment, in place of twice as many @code{ld} and @code{st} pairs.
10671 However, the use of this changed alignment directly violates the SPARC
10672 ABI@.  Thus, it's intended only for use on targets where the developer
10673 acknowledges that their resulting code will not be directly in line with
10674 the rules of the ABI@.
10675
10676 @item -mimpure-text
10677 @opindex mimpure-text
10678 @option{-mimpure-text}, used in addition to @option{-shared}, tells
10679 the compiler to not pass @option{-z text} to the linker when linking a
10680 shared object.  Using this option, you can link position-dependent
10681 code into a shared object.
10682
10683 @option{-mimpure-text} suppresses the ``relocations remain against
10684 allocatable but non-writable sections'' linker error message.
10685 However, the necessary relocations will trigger copy-on-write, and the
10686 shared object is not actually shared across processes.  Instead of
10687 using @option{-mimpure-text}, you should compile all source code with
10688 @option{-fpic} or @option{-fPIC}.
10689
10690 This option is only available on SunOS and Solaris.
10691
10692 @item -mcpu=@var{cpu_type}
10693 @opindex mcpu
10694 Set the instruction set, register set, and instruction scheduling parameters
10695 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
10696 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
10697 @samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x},
10698 @samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc}, and
10699 @samp{ultrasparc3}.
10700
10701 Default instruction scheduling parameters are used for values that select
10702 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
10703 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
10704
10705 Here is a list of each supported architecture and their supported
10706 implementations.
10707
10708 @smallexample
10709     v7:             cypress
10710     v8:             supersparc, hypersparc
10711     sparclite:      f930, f934, sparclite86x
10712     sparclet:       tsc701
10713     v9:             ultrasparc, ultrasparc3
10714 @end smallexample
10715
10716 By default (unless configured otherwise), GCC generates code for the V7
10717 variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
10718 additionally optimizes it for the Cypress CY7C602 chip, as used in the
10719 SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
10720 SPARCStation 1, 2, IPX etc.
10721
10722 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
10723 architecture.  The only difference from V7 code is that the compiler emits
10724 the integer multiply and integer divide instructions which exist in SPARC-V8
10725 but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
10726 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
10727 2000 series.
10728
10729 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
10730 the SPARC architecture.  This adds the integer multiply, integer divide step
10731 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
10732 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
10733 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU.  With
10734 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
10735 MB86934 chip, which is the more recent SPARClite with FPU.
10736
10737 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
10738 the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
10739 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
10740 but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
10741 optimizes it for the TEMIC SPARClet chip.
10742
10743 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
10744 architecture.  This adds 64-bit integer and floating-point move instructions,
10745 3 additional floating-point condition code registers and conditional move
10746 instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
10747 optimizes it for the Sun UltraSPARC I/II chips.  With
10748 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
10749 Sun UltraSPARC III chip.
10750
10751 @item -mtune=@var{cpu_type}
10752 @opindex mtune
10753 Set the instruction scheduling parameters for machine type
10754 @var{cpu_type}, but do not set the instruction set or register set that the
10755 option @option{-mcpu=@var{cpu_type}} would.
10756
10757 The same values for @option{-mcpu=@var{cpu_type}} can be used for
10758 @option{-mtune=@var{cpu_type}}, but the only useful values are those
10759 that select a particular cpu implementation.  Those are @samp{cypress},
10760 @samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
10761 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, and
10762 @samp{ultrasparc3}.
10763
10764 @item -mv8plus
10765 @itemx -mno-v8plus
10766 @opindex mv8plus
10767 @opindex mno-v8plus
10768 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI.  The
10769 difference from the V8 ABI is that the global and out registers are
10770 considered 64-bit wide.  This is enabled by default on Solaris in 32-bit
10771 mode for all SPARC-V9 processors.
10772
10773 @item -mvis
10774 @itemx -mno-vis
10775 @opindex mvis
10776 @opindex mno-vis
10777 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
10778 Visual Instruction Set extensions.  The default is @option{-mno-vis}.
10779 @end table
10780
10781 These @samp{-m} options are supported in addition to the above
10782 on SPARC-V9 processors in 64-bit environments:
10783
10784 @table @gcctabopt
10785 @item -mlittle-endian
10786 @opindex mlittle-endian
10787 Generate code for a processor running in little-endian mode. It is only
10788 available for a few configurations and most notably not on Solaris.
10789
10790 @item -m32
10791 @itemx -m64
10792 @opindex m32
10793 @opindex m64
10794 Generate code for a 32-bit or 64-bit environment.
10795 The 32-bit environment sets int, long and pointer to 32 bits.
10796 The 64-bit environment sets int to 32 bits and long and pointer
10797 to 64 bits.
10798
10799 @item -mcmodel=medlow
10800 @opindex mcmodel=medlow
10801 Generate code for the Medium/Low code model: 64-bit addresses, programs
10802 must be linked in the low 32 bits of memory.  Programs can be statically
10803 or dynamically linked.
10804
10805 @item -mcmodel=medmid
10806 @opindex mcmodel=medmid
10807 Generate code for the Medium/Middle code model: 64-bit addresses, programs
10808 must be linked in the low 44 bits of memory, the text and data segments must
10809 be less than 2GB in size and the data segment must be located within 2GB of
10810 the text segment.
10811
10812 @item -mcmodel=medany
10813 @opindex mcmodel=medany
10814 Generate code for the Medium/Anywhere code model: 64-bit addresses, programs
10815 may be linked anywhere in memory, the text and data segments must be less
10816 than 2GB in size and the data segment must be located within 2GB of the
10817 text segment.
10818
10819 @item -mcmodel=embmedany
10820 @opindex mcmodel=embmedany
10821 Generate code for the Medium/Anywhere code model for embedded systems:
10822 64-bit addresses, the text and data segments must be less than 2GB in
10823 size, both starting anywhere in memory (determined at link time).  The
10824 global register %g4 points to the base of the data segment.  Programs
10825 are statically linked and PIC is not supported.
10826
10827 @item -mstack-bias
10828 @itemx -mno-stack-bias
10829 @opindex mstack-bias
10830 @opindex mno-stack-bias
10831 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
10832 frame pointer if present, are offset by @minus{}2047 which must be added back
10833 when making stack frame references.  This is the default in 64-bit mode.
10834 Otherwise, assume no such offset is present.
10835 @end table
10836
10837 These switches are supported in addition to the above on Solaris:
10838
10839 @table @gcctabopt
10840 @item -threads
10841 @opindex threads
10842 Add support for multithreading using the Solaris threads library.  This
10843 option sets flags for both the preprocessor and linker.  This option does
10844 not affect the thread safety of object code produced by the compiler or
10845 that of libraries supplied with it.
10846
10847 @item -pthreads
10848 @opindex pthreads
10849 Add support for multithreading using the POSIX threads library.  This
10850 option sets flags for both the preprocessor and linker.  This option does
10851 not affect the thread safety of object code produced  by the compiler or
10852 that of libraries supplied with it.
10853 @end table
10854
10855 @node System V Options
10856 @subsection Options for System V
10857
10858 These additional options are available on System V Release 4 for
10859 compatibility with other compilers on those systems:
10860
10861 @table @gcctabopt
10862 @item -G
10863 @opindex G
10864 Create a shared object.
10865 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
10866
10867 @item -Qy
10868 @opindex Qy
10869 Identify the versions of each tool used by the compiler, in a
10870 @code{.ident} assembler directive in the output.
10871
10872 @item -Qn
10873 @opindex Qn
10874 Refrain from adding @code{.ident} directives to the output file (this is
10875 the default).
10876
10877 @item -YP,@var{dirs}
10878 @opindex YP
10879 Search the directories @var{dirs}, and no others, for libraries
10880 specified with @option{-l}.
10881
10882 @item -Ym,@var{dir}
10883 @opindex Ym
10884 Look in the directory @var{dir} to find the M4 preprocessor.
10885 The assembler uses this option.
10886 @c This is supposed to go with a -Yd for predefined M4 macro files, but
10887 @c the generic assembler that comes with Solaris takes just -Ym.
10888 @end table
10889
10890 @node TMS320C3x/C4x Options
10891 @subsection TMS320C3x/C4x Options
10892 @cindex TMS320C3x/C4x Options
10893
10894 These @samp{-m} options are defined for TMS320C3x/C4x implementations:
10895
10896 @table @gcctabopt
10897
10898 @item -mcpu=@var{cpu_type}
10899 @opindex mcpu
10900 Set the instruction set, register set, and instruction scheduling
10901 parameters for machine type @var{cpu_type}.  Supported values for
10902 @var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
10903 @samp{c44}.  The default is @samp{c40} to generate code for the
10904 TMS320C40.
10905
10906 @item -mbig-memory
10907 @itemx -mbig
10908 @itemx -msmall-memory
10909 @itemx -msmall
10910 @opindex mbig-memory
10911 @opindex mbig
10912 @opindex msmall-memory
10913 @opindex msmall
10914 Generates code for the big or small memory model.  The small memory
10915 model assumed that all data fits into one 64K word page.  At run-time
10916 the data page (DP) register must be set to point to the 64K page
10917 containing the .bss and .data program sections.  The big memory model is
10918 the default and requires reloading of the DP register for every direct
10919 memory access.
10920
10921 @item -mbk
10922 @itemx -mno-bk
10923 @opindex mbk
10924 @opindex mno-bk
10925 Allow (disallow) allocation of general integer operands into the block
10926 count register BK@.
10927
10928 @item -mdb
10929 @itemx -mno-db
10930 @opindex mdb
10931 @opindex mno-db
10932 Enable (disable) generation of code using decrement and branch,
10933 DBcond(D), instructions.  This is enabled by default for the C4x.  To be
10934 on the safe side, this is disabled for the C3x, since the maximum
10935 iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than
10936 @math{2^{23}} times on the C3x?).  Note that GCC will try to reverse a loop so
10937 that it can utilize the decrement and branch instruction, but will give
10938 up if there is more than one memory reference in the loop.  Thus a loop
10939 where the loop counter is decremented can generate slightly more
10940 efficient code, in cases where the RPTB instruction cannot be utilized.
10941
10942 @item -mdp-isr-reload
10943 @itemx -mparanoid
10944 @opindex mdp-isr-reload
10945 @opindex mparanoid
10946 Force the DP register to be saved on entry to an interrupt service
10947 routine (ISR), reloaded to point to the data section, and restored on
10948 exit from the ISR@.  This should not be required unless someone has
10949 violated the small memory model by modifying the DP register, say within
10950 an object library.
10951
10952 @item -mmpyi
10953 @itemx -mno-mpyi
10954 @opindex mmpyi
10955 @opindex mno-mpyi
10956 For the C3x use the 24-bit MPYI instruction for integer multiplies
10957 instead of a library call to guarantee 32-bit results.  Note that if one
10958 of the operands is a constant, then the multiplication will be performed
10959 using shifts and adds.  If the @option{-mmpyi} option is not specified for the C3x,
10960 then squaring operations are performed inline instead of a library call.
10961
10962 @item -mfast-fix
10963 @itemx -mno-fast-fix
10964 @opindex mfast-fix
10965 @opindex mno-fast-fix
10966 The C3x/C4x FIX instruction to convert a floating point value to an
10967 integer value chooses the nearest integer less than or equal to the
10968 floating point value rather than to the nearest integer.  Thus if the
10969 floating point number is negative, the result will be incorrectly
10970 truncated an additional code is necessary to detect and correct this
10971 case.  This option can be used to disable generation of the additional
10972 code required to correct the result.
10973
10974 @item -mrptb
10975 @itemx -mno-rptb
10976 @opindex mrptb
10977 @opindex mno-rptb
10978 Enable (disable) generation of repeat block sequences using the RPTB
10979 instruction for zero overhead looping.  The RPTB construct is only used
10980 for innermost loops that do not call functions or jump across the loop
10981 boundaries.  There is no advantage having nested RPTB loops due to the
10982 overhead required to save and restore the RC, RS, and RE registers.
10983 This is enabled by default with @option{-O2}.
10984
10985 @item -mrpts=@var{count}
10986 @itemx -mno-rpts
10987 @opindex mrpts
10988 @opindex mno-rpts
10989 Enable (disable) the use of the single instruction repeat instruction
10990 RPTS@.  If a repeat block contains a single instruction, and the loop
10991 count can be guaranteed to be less than the value @var{count}, GCC will
10992 emit a RPTS instruction instead of a RPTB@.  If no value is specified,
10993 then a RPTS will be emitted even if the loop count cannot be determined
10994 at compile time.  Note that the repeated instruction following RPTS does
10995 not have to be reloaded from memory each iteration, thus freeing up the
10996 CPU buses for operands.  However, since interrupts are blocked by this
10997 instruction, it is disabled by default.
10998
10999 @item -mloop-unsigned
11000 @itemx -mno-loop-unsigned
11001 @opindex mloop-unsigned
11002 @opindex mno-loop-unsigned
11003 The maximum iteration count when using RPTS and RPTB (and DB on the C40)
11004 is @math{2^{31} + 1} since these instructions test if the iteration count is
11005 negative to terminate the loop.  If the iteration count is unsigned
11006 there is a possibility than the @math{2^{31} + 1} maximum iteration count may be
11007 exceeded.  This switch allows an unsigned iteration count.
11008
11009 @item -mti
11010 @opindex mti
11011 Try to emit an assembler syntax that the TI assembler (asm30) is happy
11012 with.  This also enforces compatibility with the API employed by the TI
11013 C3x C compiler.  For example, long doubles are passed as structures
11014 rather than in floating point registers.
11015
11016 @item -mregparm
11017 @itemx -mmemparm
11018 @opindex mregparm
11019 @opindex mmemparm
11020 Generate code that uses registers (stack) for passing arguments to functions.
11021 By default, arguments are passed in registers where possible rather
11022 than by pushing arguments on to the stack.
11023
11024 @item -mparallel-insns
11025 @itemx -mno-parallel-insns
11026 @opindex mparallel-insns
11027 @opindex mno-parallel-insns
11028 Allow the generation of parallel instructions.  This is enabled by
11029 default with @option{-O2}.
11030
11031 @item -mparallel-mpy
11032 @itemx -mno-parallel-mpy
11033 @opindex mparallel-mpy
11034 @opindex mno-parallel-mpy
11035 Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
11036 provided @option{-mparallel-insns} is also specified.  These instructions have
11037 tight register constraints which can pessimize the code generation
11038 of large functions.
11039
11040 @end table
11041
11042 @node V850 Options
11043 @subsection V850 Options
11044 @cindex V850 Options
11045
11046 These @samp{-m} options are defined for V850 implementations:
11047
11048 @table @gcctabopt
11049 @item -mlong-calls
11050 @itemx -mno-long-calls
11051 @opindex mlong-calls
11052 @opindex mno-long-calls
11053 Treat all calls as being far away (near).  If calls are assumed to be
11054 far away, the compiler will always load the functions address up into a
11055 register, and call indirect through the pointer.
11056
11057 @item -mno-ep
11058 @itemx -mep
11059 @opindex mno-ep
11060 @opindex mep
11061 Do not optimize (do optimize) basic blocks that use the same index
11062 pointer 4 or more times to copy pointer into the @code{ep} register, and
11063 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
11064 option is on by default if you optimize.
11065
11066 @item -mno-prolog-function
11067 @itemx -mprolog-function
11068 @opindex mno-prolog-function
11069 @opindex mprolog-function
11070 Do not use (do use) external functions to save and restore registers
11071 at the prologue and epilogue of a function.  The external functions
11072 are slower, but use less code space if more than one function saves
11073 the same number of registers.  The @option{-mprolog-function} option
11074 is on by default if you optimize.
11075
11076 @item -mspace
11077 @opindex mspace
11078 Try to make the code as small as possible.  At present, this just turns
11079 on the @option{-mep} and @option{-mprolog-function} options.
11080
11081 @item -mtda=@var{n}
11082 @opindex mtda
11083 Put static or global variables whose size is @var{n} bytes or less into
11084 the tiny data area that register @code{ep} points to.  The tiny data
11085 area can hold up to 256 bytes in total (128 bytes for byte references).
11086
11087 @item -msda=@var{n}
11088 @opindex msda
11089 Put static or global variables whose size is @var{n} bytes or less into
11090 the small data area that register @code{gp} points to.  The small data
11091 area can hold up to 64 kilobytes.
11092
11093 @item -mzda=@var{n}
11094 @opindex mzda
11095 Put static or global variables whose size is @var{n} bytes or less into
11096 the first 32 kilobytes of memory.
11097
11098 @item -mv850
11099 @opindex mv850
11100 Specify that the target processor is the V850.
11101
11102 @item -mbig-switch
11103 @opindex mbig-switch
11104 Generate code suitable for big switch tables.  Use this option only if
11105 the assembler/linker complain about out of range branches within a switch
11106 table.
11107
11108 @item -mapp-regs
11109 @opindex mapp-regs
11110 This option will cause r2 and r5 to be used in the code generated by
11111 the compiler.  This setting is the default.
11112
11113 @item -mno-app-regs
11114 @opindex mno-app-regs
11115 This option will cause r2 and r5 to be treated as fixed registers.
11116
11117 @item -mv850e1
11118 @opindex mv850e1
11119 Specify that the target processor is the V850E1.  The preprocessor
11120 constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
11121 this option is used.
11122
11123 @item -mv850e
11124 @opindex mv850e
11125 Specify that the target processor is the V850E.  The preprocessor
11126 constant @samp{__v850e__} will be defined if this option is used.
11127
11128 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
11129 are defined then a default target processor will be chosen and the
11130 relevant @samp{__v850*__} preprocessor constant will be defined.
11131
11132 The preprocessor constants @samp{__v850} and @samp{__v851__} are always
11133 defined, regardless of which processor variant is the target.
11134
11135 @item -mdisable-callt
11136 @opindex mdisable-callt
11137 This option will suppress generation of the CALLT instruction for the
11138 v850e and v850e1 flavors of the v850 architecture.  The default is
11139 @option{-mno-disable-callt} which allows the CALLT instruction to be used.
11140
11141 @end table
11142
11143 @node VAX Options
11144 @subsection VAX Options
11145 @cindex VAX options
11146
11147 These @samp{-m} options are defined for the VAX:
11148
11149 @table @gcctabopt
11150 @item -munix
11151 @opindex munix
11152 Do not output certain jump instructions (@code{aobleq} and so on)
11153 that the Unix assembler for the VAX cannot handle across long
11154 ranges.
11155
11156 @item -mgnu
11157 @opindex mgnu
11158 Do output those jump instructions, on the assumption that you
11159 will assemble with the GNU assembler.
11160
11161 @item -mg
11162 @opindex mg
11163 Output code for g-format floating point numbers instead of d-format.
11164 @end table
11165
11166 @node x86-64 Options
11167 @subsection x86-64 Options
11168 @cindex x86-64 options
11169
11170 These are listed under @xref{i386 and x86-64 Options}.
11171
11172 @node Xstormy16 Options
11173 @subsection Xstormy16 Options
11174 @cindex Xstormy16 Options
11175
11176 These options are defined for Xstormy16:
11177
11178 @table @gcctabopt
11179 @item -msim
11180 @opindex msim
11181 Choose startup files and linker script suitable for the simulator.
11182 @end table
11183
11184 @node Xtensa Options
11185 @subsection Xtensa Options
11186 @cindex Xtensa Options
11187
11188 These options are supported for Xtensa targets:
11189
11190 @table @gcctabopt
11191 @item -mconst16
11192 @itemx -mno-const16
11193 @opindex mconst16
11194 @opindex mno-const16
11195 Enable or disable use of @code{CONST16} instructions for loading
11196 constant values.  The @code{CONST16} instruction is currently not a
11197 standard option from Tensilica.  When enabled, @code{CONST16}
11198 instructions are always used in place of the standard @code{L32R}
11199 instructions.  The use of @code{CONST16} is enabled by default only if
11200 the @code{L32R} instruction is not available.
11201
11202 @item -mfused-madd
11203 @itemx -mno-fused-madd
11204 @opindex mfused-madd
11205 @opindex mno-fused-madd
11206 Enable or disable use of fused multiply/add and multiply/subtract
11207 instructions in the floating-point option.  This has no effect if the
11208 floating-point option is not also enabled.  Disabling fused multiply/add
11209 and multiply/subtract instructions forces the compiler to use separate
11210 instructions for the multiply and add/subtract operations.  This may be
11211 desirable in some cases where strict IEEE 754-compliant results are
11212 required: the fused multiply add/subtract instructions do not round the
11213 intermediate result, thereby producing results with @emph{more} bits of
11214 precision than specified by the IEEE standard.  Disabling fused multiply
11215 add/subtract instructions also ensures that the program output is not
11216 sensitive to the compiler's ability to combine multiply and add/subtract
11217 operations.
11218
11219 @item -mtext-section-literals
11220 @itemx -mno-text-section-literals
11221 @opindex mtext-section-literals
11222 @opindex mno-text-section-literals
11223 Control the treatment of literal pools.  The default is
11224 @option{-mno-text-section-literals}, which places literals in a separate
11225 section in the output file.  This allows the literal pool to be placed
11226 in a data RAM/ROM, and it also allows the linker to combine literal
11227 pools from separate object files to remove redundant literals and
11228 improve code size.  With @option{-mtext-section-literals}, the literals
11229 are interspersed in the text section in order to keep them as close as
11230 possible to their references.  This may be necessary for large assembly
11231 files.
11232
11233 @item -mtarget-align
11234 @itemx -mno-target-align
11235 @opindex mtarget-align
11236 @opindex mno-target-align
11237 When this option is enabled, GCC instructs the assembler to
11238 automatically align instructions to reduce branch penalties at the
11239 expense of some code density.  The assembler attempts to widen density
11240 instructions to align branch targets and the instructions following call
11241 instructions.  If there are not enough preceding safe density
11242 instructions to align a target, no widening will be performed.  The
11243 default is @option{-mtarget-align}.  These options do not affect the
11244 treatment of auto-aligned instructions like @code{LOOP}, which the
11245 assembler will always align, either by widening density instructions or
11246 by inserting no-op instructions.
11247
11248 @item -mlongcalls
11249 @itemx -mno-longcalls
11250 @opindex mlongcalls
11251 @opindex mno-longcalls
11252 When this option is enabled, GCC instructs the assembler to translate
11253 direct calls to indirect calls unless it can determine that the target
11254 of a direct call is in the range allowed by the call instruction.  This
11255 translation typically occurs for calls to functions in other source
11256 files.  Specifically, the assembler translates a direct @code{CALL}
11257 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
11258 The default is @option{-mno-longcalls}.  This option should be used in
11259 programs where the call target can potentially be out of range.  This
11260 option is implemented in the assembler, not the compiler, so the
11261 assembly code generated by GCC will still show direct call
11262 instructions---look at the disassembled object code to see the actual
11263 instructions.  Note that the assembler will use an indirect call for
11264 every cross-file call, not just those that really will be out of range.
11265 @end table
11266
11267 @node zSeries Options
11268 @subsection zSeries Options
11269 @cindex zSeries options
11270
11271 These are listed under @xref{S/390 and zSeries Options}.
11272
11273 @node Code Gen Options
11274 @section Options for Code Generation Conventions
11275 @cindex code generation conventions
11276 @cindex options, code generation
11277 @cindex run-time options
11278
11279 These machine-independent options control the interface conventions
11280 used in code generation.
11281
11282 Most of them have both positive and negative forms; the negative form
11283 of @option{-ffoo} would be @option{-fno-foo}.  In the table below, only
11284 one of the forms is listed---the one which is not the default.  You
11285 can figure out the other form by either removing @samp{no-} or adding
11286 it.
11287
11288 @table @gcctabopt
11289 @item -fbounds-check
11290 @opindex fbounds-check
11291 For front-ends that support it, generate additional code to check that
11292 indices used to access arrays are within the declared range.  This is
11293 currently only supported by the Java and Fortran 77 front-ends, where
11294 this option defaults to true and false respectively.
11295
11296 @item -ftrapv
11297 @opindex ftrapv
11298 This option generates traps for signed overflow on addition, subtraction,
11299 multiplication operations.
11300
11301 @item -fwrapv
11302 @opindex fwrapv
11303 This option instructs the compiler to assume that signed arithmetic
11304 overflow of addition, subtraction and multiplication wraps around
11305 using twos-complement representation.  This flag enables some optimizations
11306 and disables other.  This option is enabled by default for the Java
11307 front-end, as required by the Java language specification.
11308
11309 @item -fexceptions
11310 @opindex fexceptions
11311 Enable exception handling.  Generates extra code needed to propagate
11312 exceptions.  For some targets, this implies GCC will generate frame
11313 unwind information for all functions, which can produce significant data
11314 size overhead, although it does not affect execution.  If you do not
11315 specify this option, GCC will enable it by default for languages like
11316 C++ which normally require exception handling, and disable it for
11317 languages like C that do not normally require it.  However, you may need
11318 to enable this option when compiling C code that needs to interoperate
11319 properly with exception handlers written in C++.  You may also wish to
11320 disable this option if you are compiling older C++ programs that don't
11321 use exception handling.
11322
11323 @item -fnon-call-exceptions
11324 @opindex fnon-call-exceptions
11325 Generate code that allows trapping instructions to throw exceptions.
11326 Note that this requires platform-specific runtime support that does
11327 not exist everywhere.  Moreover, it only allows @emph{trapping}
11328 instructions to throw exceptions, i.e.@: memory references or floating
11329 point instructions.  It does not allow exceptions to be thrown from
11330 arbitrary signal handlers such as @code{SIGALRM}.
11331
11332 @item -funwind-tables
11333 @opindex funwind-tables
11334 Similar to @option{-fexceptions}, except that it will just generate any needed
11335 static data, but will not affect the generated code in any other way.
11336 You will normally not enable this option; instead, a language processor
11337 that needs this handling would enable it on your behalf.
11338
11339 @item -fasynchronous-unwind-tables
11340 @opindex fasynchronous-unwind-tables
11341 Generate unwind table in dwarf2 format, if supported by target machine.  The
11342 table is exact at each instruction boundary, so it can be used for stack
11343 unwinding from asynchronous events (such as debugger or garbage collector).
11344
11345 @item -fpcc-struct-return
11346 @opindex fpcc-struct-return
11347 Return ``short'' @code{struct} and @code{union} values in memory like
11348 longer ones, rather than in registers.  This convention is less
11349 efficient, but it has the advantage of allowing intercallability between
11350 GCC-compiled files and files compiled with other compilers, particularly
11351 the Portable C Compiler (pcc).
11352
11353 The precise convention for returning structures in memory depends
11354 on the target configuration macros.
11355
11356 Short structures and unions are those whose size and alignment match
11357 that of some integer type.
11358
11359 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
11360 switch is not binary compatible with code compiled with the
11361 @option{-freg-struct-return} switch.
11362 Use it to conform to a non-default application binary interface.
11363
11364 @item -freg-struct-return
11365 @opindex freg-struct-return
11366 Return @code{struct} and @code{union} values in registers when possible.
11367 This is more efficient for small structures than
11368 @option{-fpcc-struct-return}.
11369
11370 If you specify neither @option{-fpcc-struct-return} nor
11371 @option{-freg-struct-return}, GCC defaults to whichever convention is
11372 standard for the target.  If there is no standard convention, GCC
11373 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
11374 the principal compiler.  In those cases, we can choose the standard, and
11375 we chose the more efficient register return alternative.
11376
11377 @strong{Warning:} code compiled with the @option{-freg-struct-return}
11378 switch is not binary compatible with code compiled with the
11379 @option{-fpcc-struct-return} switch.
11380 Use it to conform to a non-default application binary interface.
11381
11382 @item -fshort-enums
11383 @opindex fshort-enums
11384 Allocate to an @code{enum} type only as many bytes as it needs for the
11385 declared range of possible values.  Specifically, the @code{enum} type
11386 will be equivalent to the smallest integer type which has enough room.
11387
11388 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
11389 code that is not binary compatible with code generated without that switch.
11390 Use it to conform to a non-default application binary interface.
11391
11392 @item -fshort-double
11393 @opindex fshort-double
11394 Use the same size for @code{double} as for @code{float}.
11395
11396 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
11397 code that is not binary compatible with code generated without that switch.
11398 Use it to conform to a non-default application binary interface.
11399
11400 @item -fshort-wchar
11401 @opindex fshort-wchar
11402 Override the underlying type for @samp{wchar_t} to be @samp{short
11403 unsigned int} instead of the default for the target.  This option is
11404 useful for building programs to run under WINE@.
11405
11406 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
11407 code that is not binary compatible with code generated without that switch.
11408 Use it to conform to a non-default application binary interface.
11409
11410 @item -fshared-data
11411 @opindex fshared-data
11412 Requests that the data and non-@code{const} variables of this
11413 compilation be shared data rather than private data.  The distinction
11414 makes sense only on certain operating systems, where shared data is
11415 shared between processes running the same program, while private data
11416 exists in one copy per process.
11417
11418 @item -fno-common
11419 @opindex fno-common
11420 In C, allocate even uninitialized global variables in the data section of the
11421 object file, rather than generating them as common blocks.  This has the
11422 effect that if the same variable is declared (without @code{extern}) in
11423 two different compilations, you will get an error when you link them.
11424 The only reason this might be useful is if you wish to verify that the
11425 program will work on other systems which always work this way.
11426
11427 @item -fno-ident
11428 @opindex fno-ident
11429 Ignore the @samp{#ident} directive.
11430
11431 @item -finhibit-size-directive
11432 @opindex finhibit-size-directive
11433 Don't output a @code{.size} assembler directive, or anything else that
11434 would cause trouble if the function is split in the middle, and the
11435 two halves are placed at locations far apart in memory.  This option is
11436 used when compiling @file{crtstuff.c}; you should not need to use it
11437 for anything else.
11438
11439 @item -fverbose-asm
11440 @opindex fverbose-asm
11441 Put extra commentary information in the generated assembly code to
11442 make it more readable.  This option is generally only of use to those
11443 who actually need to read the generated assembly code (perhaps while
11444 debugging the compiler itself).
11445
11446 @option{-fno-verbose-asm}, the default, causes the
11447 extra information to be omitted and is useful when comparing two assembler
11448 files.
11449
11450 @item -fpic
11451 @opindex fpic
11452 @cindex global offset table
11453 @cindex PIC
11454 Generate position-independent code (PIC) suitable for use in a shared
11455 library, if supported for the target machine.  Such code accesses all
11456 constant addresses through a global offset table (GOT)@.  The dynamic
11457 loader resolves the GOT entries when the program starts (the dynamic
11458 loader is not part of GCC; it is part of the operating system).  If
11459 the GOT size for the linked executable exceeds a machine-specific
11460 maximum size, you get an error message from the linker indicating that
11461 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
11462 instead.  (These maximums are 8k on the SPARC and 32k
11463 on the m68k and RS/6000.  The 386 has no such limit.)
11464
11465 Position-independent code requires special support, and therefore works
11466 only on certain machines.  For the 386, GCC supports PIC for System V
11467 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
11468 position-independent.
11469
11470 @item -fPIC
11471 @opindex fPIC
11472 If supported for the target machine, emit position-independent code,
11473 suitable for dynamic linking and avoiding any limit on the size of the
11474 global offset table.  This option makes a difference on the m68k
11475 and the SPARC.
11476
11477 Position-independent code requires special support, and therefore works
11478 only on certain machines.
11479
11480 @item -fpie
11481 @itemx -fPIE
11482 @opindex fpie
11483 @opindex fPIE
11484 These options are similar to @option{-fpic} and @option{-fPIC}, but
11485 generated position independent code can be only linked into executables.
11486 Usually these options are used when @option{-pie} GCC option will be
11487 used during linking.
11488
11489 @item -ffixed-@var{reg}
11490 @opindex ffixed
11491 Treat the register named @var{reg} as a fixed register; generated code
11492 should never refer to it (except perhaps as a stack pointer, frame
11493 pointer or in some other fixed role).
11494
11495 @var{reg} must be the name of a register.  The register names accepted
11496 are machine-specific and are defined in the @code{REGISTER_NAMES}
11497 macro in the machine description macro file.
11498
11499 This flag does not have a negative form, because it specifies a
11500 three-way choice.
11501
11502 @item -fcall-used-@var{reg}
11503 @opindex fcall-used
11504 Treat the register named @var{reg} as an allocable register that is
11505 clobbered by function calls.  It may be allocated for temporaries or
11506 variables that do not live across a call.  Functions compiled this way
11507 will not save and restore the register @var{reg}.
11508
11509 It is an error to used this flag with the frame pointer or stack pointer.
11510 Use of this flag for other registers that have fixed pervasive roles in
11511 the machine's execution model will produce disastrous results.
11512
11513 This flag does not have a negative form, because it specifies a
11514 three-way choice.
11515
11516 @item -fcall-saved-@var{reg}
11517 @opindex fcall-saved
11518 Treat the register named @var{reg} as an allocable register saved by
11519 functions.  It may be allocated even for temporaries or variables that
11520 live across a call.  Functions compiled this way will save and restore
11521 the register @var{reg} if they use it.
11522
11523 It is an error to used this flag with the frame pointer or stack pointer.
11524 Use of this flag for other registers that have fixed pervasive roles in
11525 the machine's execution model will produce disastrous results.
11526
11527 A different sort of disaster will result from the use of this flag for
11528 a register in which function values may be returned.
11529
11530 This flag does not have a negative form, because it specifies a
11531 three-way choice.
11532
11533 @item -fpack-struct
11534 @opindex fpack-struct
11535 Pack all structure members together without holes.
11536
11537 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
11538 code that is not binary compatible with code generated without that switch.
11539 Additionally, it makes the code suboptimal.
11540 Use it to conform to a non-default application binary interface.
11541
11542 @item -finstrument-functions
11543 @opindex finstrument-functions
11544 Generate instrumentation calls for entry and exit to functions.  Just
11545 after function entry and just before function exit, the following
11546 profiling functions will be called with the address of the current
11547 function and its call site.  (On some platforms,
11548 @code{__builtin_return_address} does not work beyond the current
11549 function, so the call site information may not be available to the
11550 profiling functions otherwise.)
11551
11552 @smallexample
11553 void __cyg_profile_func_enter (void *this_fn,
11554                                void *call_site);
11555 void __cyg_profile_func_exit  (void *this_fn,
11556                                void *call_site);
11557 @end smallexample
11558
11559 The first argument is the address of the start of the current function,
11560 which may be looked up exactly in the symbol table.
11561
11562 This instrumentation is also done for functions expanded inline in other
11563 functions.  The profiling calls will indicate where, conceptually, the
11564 inline function is entered and exited.  This means that addressable
11565 versions of such functions must be available.  If all your uses of a
11566 function are expanded inline, this may mean an additional expansion of
11567 code size.  If you use @samp{extern inline} in your C code, an
11568 addressable version of such functions must be provided.  (This is
11569 normally the case anyways, but if you get lucky and the optimizer always
11570 expands the functions inline, you might have gotten away without
11571 providing static copies.)
11572
11573 A function may be given the attribute @code{no_instrument_function}, in
11574 which case this instrumentation will not be done.  This can be used, for
11575 example, for the profiling functions listed above, high-priority
11576 interrupt routines, and any functions from which the profiling functions
11577 cannot safely be called (perhaps signal handlers, if the profiling
11578 routines generate output or allocate memory).
11579
11580 @item -fstack-check
11581 @opindex fstack-check
11582 Generate code to verify that you do not go beyond the boundary of the
11583 stack.  You should specify this flag if you are running in an
11584 environment with multiple threads, but only rarely need to specify it in
11585 a single-threaded environment since stack overflow is automatically
11586 detected on nearly all systems if there is only one stack.
11587
11588 Note that this switch does not actually cause checking to be done; the
11589 operating system must do that.  The switch causes generation of code
11590 to ensure that the operating system sees the stack being extended.
11591
11592 @item -fstack-limit-register=@var{reg}
11593 @itemx -fstack-limit-symbol=@var{sym}
11594 @itemx -fno-stack-limit
11595 @opindex fstack-limit-register
11596 @opindex fstack-limit-symbol
11597 @opindex fno-stack-limit
11598 Generate code to ensure that the stack does not grow beyond a certain value,
11599 either the value of a register or the address of a symbol.  If the stack
11600 would grow beyond the value, a signal is raised.  For most targets,
11601 the signal is raised before the stack overruns the boundary, so
11602 it is possible to catch the signal without taking special precautions.
11603
11604 For instance, if the stack starts at absolute address @samp{0x80000000}
11605 and grows downwards, you can use the flags
11606 @option{-fstack-limit-symbol=__stack_limit} and
11607 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
11608 of 128KB@.  Note that this may only work with the GNU linker.
11609
11610 @cindex aliasing of parameters
11611 @cindex parameters, aliased
11612 @item -fargument-alias
11613 @itemx -fargument-noalias
11614 @itemx -fargument-noalias-global
11615 @opindex fargument-alias
11616 @opindex fargument-noalias
11617 @opindex fargument-noalias-global
11618 Specify the possible relationships among parameters and between
11619 parameters and global data.
11620
11621 @option{-fargument-alias} specifies that arguments (parameters) may
11622 alias each other and may alias global storage.@*
11623 @option{-fargument-noalias} specifies that arguments do not alias
11624 each other, but may alias global storage.@*
11625 @option{-fargument-noalias-global} specifies that arguments do not
11626 alias each other and do not alias global storage.
11627
11628 Each language will automatically use whatever option is required by
11629 the language standard.  You should not need to use these options yourself.
11630
11631 @item -fleading-underscore
11632 @opindex fleading-underscore
11633 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
11634 change the way C symbols are represented in the object file.  One use
11635 is to help link with legacy assembly code.
11636
11637 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
11638 generate code that is not binary compatible with code generated without that
11639 switch.  Use it to conform to a non-default application binary interface.
11640 Not all targets provide complete support for this switch.
11641
11642 @item -ftls-model=@var{model}
11643 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
11644 The @var{model} argument should be one of @code{global-dynamic},
11645 @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
11646
11647 The default without @option{-fpic} is @code{initial-exec}; with
11648 @option{-fpic} the default is @code{global-dynamic}.
11649
11650 @item -fvisibility=@var{default|internal|hidden|protected}
11651 @opindex fvisibility
11652 Set the default ELF image symbol visibility to the specified option - all
11653 symbols will be marked with this unless overrided within the code.
11654 Using this feature can very substantially improve linking and
11655 load times of shared object libraries, produce more optimised
11656 code, provide near-perfect API export and prevent symbol clashes.
11657 It is @strong{strongly} recommended that you use this in any shared objects
11658 you distribute.
11659      
11660 Despite the nomenclature, @code{default} always means public ie;
11661 available to be linked against from outside the shared object.
11662 @code{protected} and @code{internal} are pretty useless in real-world
11663 usage so the only other commonly used option will be @code{hidden}.
11664 The default if -fvisibility isn't specified is @code{default} ie; make every
11665 symbol public - this causes the same behaviour as previous versions of
11666 GCC.
11667      
11668 A good explanation of the benefits offered by ensuring ELF
11669 symbols have the correct visibility is given by ``How To Write
11670 Shared Libraries'' by Ulrich Drepper (which can be found at
11671 @w{@uref{http://people.redhat.com/~drepper/}}) - however a superior
11672 solution made possible by this option to marking things hidden when
11673 the default is public is to make the default hidden and mark things
11674 public. This is the norm with DLL's on Windows and with @option{-fvisibility=hidden}
11675 and @code{__attribute__ ((visibility("default")))} instead of
11676 @code{__declspec(dllexport)} you get almost identical semantics with
11677 identical syntax. This is a great boon to those working with
11678 cross-platform projects.
11679
11680 For those adding visibility support to existing code, you may find
11681 @samp{#pragma GCC visibility} of use. This works by you enclosing
11682 the declarations you wish to set visibility for with (for example)
11683 @samp{#pragma GCC visibility push(hidden)} and
11684 @samp{#pragma GCC visibility pop}. These can be nested up to sixteen
11685 times. Bear in mind that symbol visibility should be viewed @strong{as
11686 part of the API interface contract} and thus all new code should
11687 always specify visibility when it is not the default ie; declarations
11688 only for use within the local DSO should @strong{always} be marked explicitly
11689 as hidden as so to avoid PLT indirection overheads - making this
11690 abundantly clear also aids readability and self-documentation of the code.
11691 Note that due to ISO C++ specification requirements, operator new and
11692 operator delete must always be of default visibility.
11693
11694 An overview of these techniques, their benefits and how to use them
11695 is at @w{@uref{http://www.nedprod.com/programs/gccvisibility.html}}.
11696
11697 @end table
11698
11699 @c man end
11700
11701 @node Environment Variables
11702 @section Environment Variables Affecting GCC
11703 @cindex environment variables
11704
11705 @c man begin ENVIRONMENT
11706 This section describes several environment variables that affect how GCC
11707 operates.  Some of them work by specifying directories or prefixes to use
11708 when searching for various kinds of files.  Some are used to specify other
11709 aspects of the compilation environment.
11710
11711 Note that you can also specify places to search using options such as
11712 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
11713 take precedence over places specified using environment variables, which
11714 in turn take precedence over those specified by the configuration of GCC@.
11715 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
11716 GNU Compiler Collection (GCC) Internals}.
11717
11718 @table @env
11719 @item LANG
11720 @itemx LC_CTYPE
11721 @c @itemx LC_COLLATE
11722 @itemx LC_MESSAGES
11723 @c @itemx LC_MONETARY
11724 @c @itemx LC_NUMERIC
11725 @c @itemx LC_TIME
11726 @itemx LC_ALL
11727 @findex LANG
11728 @findex LC_CTYPE
11729 @c @findex LC_COLLATE
11730 @findex LC_MESSAGES
11731 @c @findex LC_MONETARY
11732 @c @findex LC_NUMERIC
11733 @c @findex LC_TIME
11734 @findex LC_ALL
11735 @cindex locale
11736 These environment variables control the way that GCC uses
11737 localization information that allow GCC to work with different
11738 national conventions.  GCC inspects the locale categories
11739 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
11740 so.  These locale categories can be set to any value supported by your
11741 installation.  A typical value is @samp{en_UK} for English in the United
11742 Kingdom.
11743
11744 The @env{LC_CTYPE} environment variable specifies character
11745 classification.  GCC uses it to determine the character boundaries in
11746 a string; this is needed for some multibyte encodings that contain quote
11747 and escape characters that would otherwise be interpreted as a string
11748 end or escape.
11749
11750 The @env{LC_MESSAGES} environment variable specifies the language to
11751 use in diagnostic messages.
11752
11753 If the @env{LC_ALL} environment variable is set, it overrides the value
11754 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
11755 and @env{LC_MESSAGES} default to the value of the @env{LANG}
11756 environment variable.  If none of these variables are set, GCC
11757 defaults to traditional C English behavior.
11758
11759 @item TMPDIR
11760 @findex TMPDIR
11761 If @env{TMPDIR} is set, it specifies the directory to use for temporary
11762 files.  GCC uses temporary files to hold the output of one stage of
11763 compilation which is to be used as input to the next stage: for example,
11764 the output of the preprocessor, which is the input to the compiler
11765 proper.
11766
11767 @item GCC_EXEC_PREFIX
11768 @findex GCC_EXEC_PREFIX
11769 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
11770 names of the subprograms executed by the compiler.  No slash is added
11771 when this prefix is combined with the name of a subprogram, but you can
11772 specify a prefix that ends with a slash if you wish.
11773
11774 If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
11775 an appropriate prefix to use based on the pathname it was invoked with.
11776
11777 If GCC cannot find the subprogram using the specified prefix, it
11778 tries looking in the usual places for the subprogram.
11779
11780 The default value of @env{GCC_EXEC_PREFIX} is
11781 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the value
11782 of @code{prefix} when you ran the @file{configure} script.
11783
11784 Other prefixes specified with @option{-B} take precedence over this prefix.
11785
11786 This prefix is also used for finding files such as @file{crt0.o} that are
11787 used for linking.
11788
11789 In addition, the prefix is used in an unusual way in finding the
11790 directories to search for header files.  For each of the standard
11791 directories whose name normally begins with @samp{/usr/local/lib/gcc}
11792 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
11793 replacing that beginning with the specified prefix to produce an
11794 alternate directory name.  Thus, with @option{-Bfoo/}, GCC will search
11795 @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
11796 These alternate directories are searched first; the standard directories
11797 come next.
11798
11799 @item COMPILER_PATH
11800 @findex COMPILER_PATH
11801 The value of @env{COMPILER_PATH} is a colon-separated list of
11802 directories, much like @env{PATH}.  GCC tries the directories thus
11803 specified when searching for subprograms, if it can't find the
11804 subprograms using @env{GCC_EXEC_PREFIX}.
11805
11806 @item LIBRARY_PATH
11807 @findex LIBRARY_PATH
11808 The value of @env{LIBRARY_PATH} is a colon-separated list of
11809 directories, much like @env{PATH}.  When configured as a native compiler,
11810 GCC tries the directories thus specified when searching for special
11811 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}.  Linking
11812 using GCC also uses these directories when searching for ordinary
11813 libraries for the @option{-l} option (but directories specified with
11814 @option{-L} come first).
11815
11816 @item LANG
11817 @findex LANG
11818 @cindex locale definition
11819 This variable is used to pass locale information to the compiler.  One way in
11820 which this information is used is to determine the character set to be used
11821 when character literals, string literals and comments are parsed in C and C++.
11822 When the compiler is configured to allow multibyte characters,
11823 the following values for @env{LANG} are recognized:
11824
11825 @table @samp
11826 @item C-JIS
11827 Recognize JIS characters.
11828 @item C-SJIS
11829 Recognize SJIS characters.
11830 @item C-EUCJP
11831 Recognize EUCJP characters.
11832 @end table
11833
11834 If @env{LANG} is not defined, or if it has some other value, then the
11835 compiler will use mblen and mbtowc as defined by the default locale to
11836 recognize and translate multibyte characters.
11837 @end table
11838
11839 @noindent
11840 Some additional environments variables affect the behavior of the
11841 preprocessor.
11842
11843 @include cppenv.texi
11844
11845 @c man end
11846
11847 @node Precompiled Headers
11848 @section Using Precompiled Headers
11849 @cindex precompiled headers
11850 @cindex speed of compilation
11851
11852 Often large projects have many header files that are included in every
11853 source file.  The time the compiler takes to process these header files
11854 over and over again can account for nearly all of the time required to
11855 build the project.  To make builds faster, GCC allows users to
11856 `precompile' a header file; then, if builds can use the precompiled
11857 header file they will be much faster.
11858
11859 @strong{Caution:} There are a few known situations where GCC will
11860 crash when trying to use a precompiled header.  If you have trouble
11861 with a precompiled header, you should remove the precompiled header
11862 and compile without it.  In addition, please use GCC's on-line
11863 defect-tracking system to report any problems you encounter with
11864 precompiled headers.  @xref{Bugs}.
11865
11866 To create a precompiled header file, simply compile it as you would any
11867 other file, if necessary using the @option{-x} option to make the driver
11868 treat it as a C or C++ header file.  You will probably want to use a
11869 tool like @command{make} to keep the precompiled header up-to-date when
11870 the headers it contains change.
11871
11872 A precompiled header file will be searched for when @code{#include} is
11873 seen in the compilation.  As it searches for the included file
11874 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
11875 compiler looks for a precompiled header in each directory just before it
11876 looks for the include file in that directory.  The name searched for is
11877 the name specified in the @code{#include} with @samp{.gch} appended.  If
11878 the precompiled header file can't be used, it is ignored.
11879
11880 For instance, if you have @code{#include "all.h"}, and you have
11881 @file{all.h.gch} in the same directory as @file{all.h}, then the
11882 precompiled header file will be used if possible, and the original
11883 header will be used otherwise.
11884
11885 Alternatively, you might decide to put the precompiled header file in a
11886 directory and use @option{-I} to ensure that directory is searched
11887 before (or instead of) the directory containing the original header.
11888 Then, if you want to check that the precompiled header file is always
11889 used, you can put a file of the same name as the original header in this
11890 directory containing an @code{#error} command.
11891
11892 This also works with @option{-include}.  So yet another way to use
11893 precompiled headers, good for projects not designed with precompiled
11894 header files in mind, is to simply take most of the header files used by
11895 a project, include them from another header file, precompile that header
11896 file, and @option{-include} the precompiled header.  If the header files
11897 have guards against multiple inclusion, they will be skipped because
11898 they've already been included (in the precompiled header).
11899
11900 If you need to precompile the same header file for different
11901 languages, targets, or compiler options, you can instead make a
11902 @emph{directory} named like @file{all.h.gch}, and put each precompiled
11903 header in the directory, perhaps using @option{-o}.  It doesn't matter
11904 what you call the files in the directory, every precompiled header in
11905 the directory will be considered.  The first precompiled header
11906 encountered in the directory that is valid for this compilation will
11907 be used; they're searched in no particular order.
11908
11909 There are many other possibilities, limited only by your imagination,
11910 good sense, and the constraints of your build system.
11911
11912 A precompiled header file can be used only when these conditions apply:
11913
11914 @itemize
11915 @item
11916 Only one precompiled header can be used in a particular compilation.
11917
11918 @item
11919 A precompiled header can't be used once the first C token is seen.  You
11920 can have preprocessor directives before a precompiled header; you can
11921 even include a precompiled header from inside another header, so long as
11922 there are no C tokens before the @code{#include}.
11923
11924 @item
11925 The precompiled header file must be produced for the same language as
11926 the current compilation.  You can't use a C precompiled header for a C++
11927 compilation.
11928
11929 @item
11930 The precompiled header file must be produced by the same compiler
11931 version and configuration as the current compilation is using.
11932 The easiest way to guarantee this is to use the same compiler binary
11933 for creating and using precompiled headers.
11934
11935 @item
11936 Any macros defined before the precompiled header is included must
11937 either be defined in the same way as when the precompiled header was
11938 generated, or must not affect the precompiled header, which usually
11939 means that the they don't appear in the precompiled header at all.
11940
11941 The @option{-D} option is one way to define a macro before a
11942 precompiled header is included; using a @code{#define} can also do it.
11943 There are also some options that define macros implicitly, like
11944 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
11945 defined this way.
11946
11947 @item If debugging information is output when using the precompiled
11948 header, using @option{-g} or similar, the same kind of debugging information
11949 must have been output when building the precompiled header.  However,
11950 a precompiled header built using @option{-g} can be used in a compilation
11951 when no debugging information is being output.
11952
11953 @item The same @option{-m} options must generally be used when building
11954 and using the precompiled header.  @xref{Submodel Options},
11955 for any cases where this rule is relaxed.
11956
11957 @item Each of the following options must be the same when building and using
11958 the precompiled header:
11959
11960 @gccoptlist{-fexceptions -funit-at-a-time}
11961
11962 @item
11963 Some other command-line options starting with @option{-f},
11964 @option{-p}, or @option{-O} must be defined in the same way as when
11965 the precompiled header was generated.  At present, it's not clear
11966 which options are safe to change and which are not; the safest choice
11967 is to use exactly the same options when generating and using the
11968 precompiled header.  The following are known to be safe:
11969
11970 @gccoptlist{-fpreprocessed -pedantic-errors}
11971
11972 @end itemize
11973
11974 For all of these except the last, the compiler will automatically
11975 ignore the precompiled header if the conditions aren't met.  If you
11976 find an option combination that doesn't work and doesn't cause the
11977 precompiled header to be ignored, please consider filing a bug report,
11978 see @ref{Bugs}.
11979
11980 If you do use differing options when generating and using the
11981 precompiled header, the actual behaviour will be a mixture of the
11982 behaviour for the options.  For instance, if you use @option{-g} to
11983 generate the precompiled header but not when using it, you may or may
11984 not get debugging information for routines in the precompiled header.
11985
11986 @node Running Protoize
11987 @section Running Protoize
11988
11989 The program @code{protoize} is an optional part of GCC@.  You can use
11990 it to add prototypes to a program, thus converting the program to ISO
11991 C in one respect.  The companion program @code{unprotoize} does the
11992 reverse: it removes argument types from any prototypes that are found.
11993
11994 When you run these programs, you must specify a set of source files as
11995 command line arguments.  The conversion programs start out by compiling
11996 these files to see what functions they define.  The information gathered
11997 about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
11998
11999 After scanning comes actual conversion.  The specified files are all
12000 eligible to be converted; any files they include (whether sources or
12001 just headers) are eligible as well.
12002
12003 But not all the eligible files are converted.  By default,
12004 @code{protoize} and @code{unprotoize} convert only source and header
12005 files in the current directory.  You can specify additional directories
12006 whose files should be converted with the @option{-d @var{directory}}
12007 option.  You can also specify particular files to exclude with the
12008 @option{-x @var{file}} option.  A file is converted if it is eligible, its
12009 directory name matches one of the specified directory names, and its
12010 name within the directory has not been excluded.
12011
12012 Basic conversion with @code{protoize} consists of rewriting most
12013 function definitions and function declarations to specify the types of
12014 the arguments.  The only ones not rewritten are those for varargs
12015 functions.
12016
12017 @code{protoize} optionally inserts prototype declarations at the
12018 beginning of the source file, to make them available for any calls that
12019 precede the function's definition.  Or it can insert prototype
12020 declarations with block scope in the blocks where undeclared functions
12021 are called.
12022
12023 Basic conversion with @code{unprotoize} consists of rewriting most
12024 function declarations to remove any argument types, and rewriting
12025 function definitions to the old-style pre-ISO form.
12026
12027 Both conversion programs print a warning for any function declaration or
12028 definition that they can't convert.  You can suppress these warnings
12029 with @option{-q}.
12030
12031 The output from @code{protoize} or @code{unprotoize} replaces the
12032 original source file.  The original file is renamed to a name ending
12033 with @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
12034 without the original @samp{.c} suffix).  If the @samp{.save} (@samp{.sav}
12035 for DOS) file already exists, then the source file is simply discarded.
12036
12037 @code{protoize} and @code{unprotoize} both depend on GCC itself to
12038 scan the program and collect information about the functions it uses.
12039 So neither of these programs will work until GCC is installed.
12040
12041 Here is a table of the options you can use with @code{protoize} and
12042 @code{unprotoize}.  Each option works with both programs unless
12043 otherwise stated.
12044
12045 @table @code
12046 @item -B @var{directory}
12047 Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
12048 usual directory (normally @file{/usr/local/lib}).  This file contains
12049 prototype information about standard system functions.  This option
12050 applies only to @code{protoize}.
12051
12052 @item -c @var{compilation-options}
12053 Use @var{compilation-options} as the options when running @command{gcc} to
12054 produce the @samp{.X} files.  The special option @option{-aux-info} is
12055 always passed in addition, to tell @command{gcc} to write a @samp{.X} file.
12056
12057 Note that the compilation options must be given as a single argument to
12058 @code{protoize} or @code{unprotoize}.  If you want to specify several
12059 @command{gcc} options, you must quote the entire set of compilation options
12060 to make them a single word in the shell.
12061
12062 There are certain @command{gcc} arguments that you cannot use, because they
12063 would produce the wrong kind of output.  These include @option{-g},
12064 @option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
12065 the @var{compilation-options}, they are ignored.
12066
12067 @item -C
12068 Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file
12069 systems) instead of @samp{.c}.  This is convenient if you are converting
12070 a C program to C++.  This option applies only to @code{protoize}.
12071
12072 @item -g
12073 Add explicit global declarations.  This means inserting explicit
12074 declarations at the beginning of each source file for each function
12075 that is called in the file and was not declared.  These declarations
12076 precede the first function definition that contains a call to an
12077 undeclared function.  This option applies only to @code{protoize}.
12078
12079 @item -i @var{string}
12080 Indent old-style parameter declarations with the string @var{string}.
12081 This option applies only to @code{protoize}.
12082
12083 @code{unprotoize} converts prototyped function definitions to old-style
12084 function definitions, where the arguments are declared between the
12085 argument list and the initial @samp{@{}.  By default, @code{unprotoize}
12086 uses five spaces as the indentation.  If you want to indent with just
12087 one space instead, use @option{-i " "}.
12088
12089 @item -k
12090 Keep the @samp{.X} files.  Normally, they are deleted after conversion
12091 is finished.
12092
12093 @item -l
12094 Add explicit local declarations.  @code{protoize} with @option{-l} inserts
12095 a prototype declaration for each function in each block which calls the
12096 function without any declaration.  This option applies only to
12097 @code{protoize}.
12098
12099 @item -n
12100 Make no real changes.  This mode just prints information about the conversions
12101 that would have been done without @option{-n}.
12102
12103 @item -N
12104 Make no @samp{.save} files.  The original files are simply deleted.
12105 Use this option with caution.
12106
12107 @item -p @var{program}
12108 Use the program @var{program} as the compiler.  Normally, the name
12109 @file{gcc} is used.
12110
12111 @item -q
12112 Work quietly.  Most warnings are suppressed.
12113
12114 @item -v
12115 Print the version number, just like @option{-v} for @command{gcc}.
12116 @end table
12117
12118 If you need special compiler options to compile one of your program's
12119 source files, then you should generate that file's @samp{.X} file
12120 specially, by running @command{gcc} on that source file with the
12121 appropriate options and the option @option{-aux-info}.  Then run
12122 @code{protoize} on the entire set of files.  @code{protoize} will use
12123 the existing @samp{.X} file because it is newer than the source file.
12124 For example:
12125
12126 @smallexample
12127 gcc -Dfoo=bar file1.c -aux-info file1.X
12128 protoize *.c
12129 @end smallexample
12130
12131 @noindent
12132 You need to include the special files along with the rest in the
12133 @code{protoize} command, even though their @samp{.X} files already
12134 exist, because otherwise they won't get converted.
12135
12136 @xref{Protoize Caveats}, for more information on how to use
12137 @code{protoize} successfully.