* gcc.c (option_map): Add --sysroot.
[official-gcc.git] / gcc / doc / invoke.texi
blobf24505562a7e510d7dbc89b0df9145193ecc6d67
1 @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2 @c 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
3 @c This is part of the GCC manual.
4 @c For copying conditions, see the file gcc.texi.
6 @ignore
7 @c man begin COPYRIGHT
8 Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
9 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
11 Permission is granted to copy, distribute and/or modify this document
12 under the terms of the GNU Free Documentation License, Version 1.2 or
13 any later version published by the Free Software Foundation; with the
14 Invariant Sections being ``GNU General Public License'' and ``Funding
15 Free Software'', the Front-Cover texts being (a) (see below), and with
16 the Back-Cover Texts being (b) (see below).  A copy of the license is
17 included in the gfdl(7) man page.
19 (a) The FSF's Front-Cover Text is:
21      A GNU Manual
23 (b) The FSF's Back-Cover Text is:
25      You have freedom to copy and modify this GNU Manual, like GNU
26      software.  Copies published by the Free Software Foundation raise
27      funds for GNU development.
28 @c man end
29 @c Set file name and title for the man page.
30 @setfilename gcc
31 @settitle GNU project C and C++ compiler
32 @c man begin SYNOPSIS
33 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
34     [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
35     [@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
36     [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
37     [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
38     [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
39     [@option{-o} @var{outfile}] @var{infile}@dots{}
41 Only the most useful options are listed here; see below for the
42 remainder.  @samp{g++} accepts mostly the same options as @samp{gcc}.
43 @c man end
44 @c man begin SEEALSO
45 gpl(7), gfdl(7), fsf-funding(7),
46 cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
47 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
48 @file{ld}, @file{binutils} and @file{gdb}.
49 @c man end
50 @c man begin BUGS
51 For instructions on reporting bugs, see
52 @w{@uref{http://gcc.gnu.org/bugs.html}}.
53 @c man end
54 @c man begin AUTHOR
55 See the Info entry for @command{gcc}, or
56 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
57 for contributors to GCC@.
58 @c man end
59 @end ignore
61 @node Invoking GCC
62 @chapter GCC Command Options
63 @cindex GCC command options
64 @cindex command options
65 @cindex options, GCC command
67 @c man begin DESCRIPTION
68 When you invoke GCC, it normally does preprocessing, compilation,
69 assembly and linking.  The ``overall options'' allow you to stop this
70 process at an intermediate stage.  For example, the @option{-c} option
71 says not to run the linker.  Then the output consists of object files
72 output by the assembler.
74 Other options are passed on to one stage of processing.  Some options
75 control the preprocessor and others the compiler itself.  Yet other
76 options control the assembler and linker; most of these are not
77 documented here, since you rarely need to use any of them.
79 @cindex C compilation options
80 Most of the command line options that you can use with GCC are useful
81 for C programs; when an option is only useful with another language
82 (usually C++), the explanation says so explicitly.  If the description
83 for a particular option does not mention a source language, you can use
84 that option with all supported languages.
86 @cindex C++ compilation options
87 @xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
88 options for compiling C++ programs.
90 @cindex grouping options
91 @cindex options, grouping
92 The @command{gcc} program accepts options and file names as operands.  Many
93 options have multi-letter names; therefore multiple single-letter options
94 may @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d
95 -r}}.
97 @cindex order of options
98 @cindex options, order
99 You can mix options and other arguments.  For the most part, the order
100 you use doesn't matter.  Order does matter when you use several options
101 of the same kind; for example, if you specify @option{-L} more than once,
102 the directories are searched in the order specified.
104 Many options have long names starting with @samp{-f} or with
105 @samp{-W}---for example, 
106 @option{-fstrength-reduce}, @option{-Wformat} and so on.  Most of
107 these have both positive and negative forms; the negative form of
108 @option{-ffoo} would be @option{-fno-foo}.  This manual documents
109 only one of these two forms, whichever one is not the default.
111 @c man end
113 @xref{Option Index}, for an index to GCC's options.
115 @menu
116 * Option Summary::      Brief list of all options, without explanations.
117 * Overall Options::     Controlling the kind of output:
118                         an executable, object files, assembler files,
119                         or preprocessed source.
120 * Invoking G++::        Compiling C++ programs.
121 * C Dialect Options::   Controlling the variant of C language compiled.
122 * C++ Dialect Options:: Variations on C++.
123 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
124                         and Objective-C++.
125 * Language Independent Options:: Controlling how diagnostics should be
126                         formatted.
127 * Warning Options::     How picky should the compiler be?
128 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
129 * Optimize Options::    How much optimization?
130 * Preprocessor Options:: Controlling header files and macro definitions.
131                          Also, getting dependency information for Make.
132 * Assembler Options::   Passing options to the assembler.
133 * Link Options::        Specifying libraries and so on.
134 * Directory Options::   Where to find header files and libraries.
135                         Where to find the compiler executable files.
136 * Spec Files::          How to pass switches to sub-processes.
137 * Target Options::      Running a cross-compiler, or an old version of GCC.
138 * Submodel Options::    Specifying minor hardware or convention variations,
139                         such as 68010 vs 68020.
140 * Code Gen Options::    Specifying conventions for function calls, data layout
141                         and register usage.
142 * Environment Variables:: Env vars that affect GCC.
143 * Precompiled Headers:: Compiling a header once, and using it many times.
144 * Running Protoize::    Automatically adding or removing function prototypes.
145 @end menu
147 @c man begin OPTIONS
149 @node Option Summary
150 @section Option Summary
152 Here is a summary of all the options, grouped by type.  Explanations are
153 in the following sections.
155 @table @emph
156 @item Overall Options
157 @xref{Overall Options,,Options Controlling the Kind of Output}.
158 @gccoptlist{-c  -S  -E  -o @var{file}  -combine -pipe  -pass-exit-codes  @gol
159 -x @var{language}  -v  -###  --help  --target-help  --version}
161 @item C Language Options
162 @xref{C Dialect Options,,Options Controlling C Dialect}.
163 @gccoptlist{-ansi  -std=@var{standard}  -aux-info @var{filename} @gol
164 -fno-asm  -fno-builtin  -fno-builtin-@var{function} @gol
165 -fhosted  -ffreestanding  -fms-extensions @gol
166 -trigraphs  -no-integrated-cpp  -traditional  -traditional-cpp @gol
167 -fallow-single-precision  -fcond-mismatch @gol
168 -fsigned-bitfields  -fsigned-char @gol
169 -funsigned-bitfields  -funsigned-char}
171 @item C++ Language Options
172 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
173 @gccoptlist{-fabi-version=@var{n}  -fno-access-control  -fcheck-new @gol
174 -fconserve-space  -fno-const-strings @gol
175 -fno-elide-constructors @gol
176 -fno-enforce-eh-specs @gol
177 -ffor-scope  -fno-for-scope  -fno-gnu-keywords @gol
178 -fno-implicit-templates @gol
179 -fno-implicit-inline-templates @gol
180 -fno-implement-inlines  -fms-extensions @gol
181 -fno-nonansi-builtins  -fno-operator-names @gol
182 -fno-optional-diags  -fpermissive @gol
183 -frepo  -fno-rtti  -fstats  -ftemplate-depth-@var{n} @gol
184 -fno-threadsafe-statics -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  -Wstrict-null-sentinel @gol
189 -Wno-non-template-friend  -Wold-style-cast @gol
190 -Woverloaded-virtual  -Wno-pmf-conversions @gol
191 -Wsign-promo}
193 @item Objective-C and Objective-C++ Language Options
194 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
195 Objective-C and Objective-C++ Dialects}.
196 @gccoptlist{
197 -fconstant-string-class=@var{class-name} @gol
198 -fgnu-runtime  -fnext-runtime @gol
199 -fno-nil-receivers @gol
200 -fobjc-call-cxx-cdtors @gol
201 -fobjc-direct-dispatch @gol
202 -fobjc-exceptions @gol
203 -fobjc-gc @gol
204 -freplace-objc-classes @gol
205 -fzero-link @gol
206 -gen-decls @gol
207 -Wassign-intercept @gol
208 -Wno-protocol  -Wselector @gol
209 -Wstrict-selector-match @gol
210 -Wundeclared-selector}
212 @item Language Independent Options
213 @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
214 @gccoptlist{-fmessage-length=@var{n}  @gol
215 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}} @gol
216 -fdiagnostics-show-options
218 @item Warning Options
219 @xref{Warning Options,,Options to Request or Suppress Warnings}.
220 @gccoptlist{-fsyntax-only  -pedantic  -pedantic-errors @gol
221 -w  -Wextra  -Wall  -Waggregate-return -Wno-attributes @gol
222 -Wc++-compat -Wcast-align  -Wcast-qual  -Wchar-subscripts  -Wcomment @gol
223 -Wconversion  -Wno-deprecated-declarations @gol
224 -Wdisabled-optimization  -Wno-div-by-zero  -Wno-endif-labels @gol
225 -Werror  -Werror-implicit-function-declaration @gol
226 -Wfatal-errors  -Wfloat-equal  -Wformat  -Wformat=2 @gol
227 -Wno-format-extra-args -Wformat-nonliteral @gol
228 -Wformat-security  -Wformat-y2k @gol
229 -Wimplicit  -Wimplicit-function-declaration  -Wimplicit-int @gol
230 -Wimport  -Wno-import  -Winit-self  -Winline @gol
231 -Wno-int-to-pointer-cast @gol
232 -Wno-invalid-offsetof  -Winvalid-pch @gol
233 -Wlarger-than-@var{len}  -Wunsafe-loop-optimizations  -Wlong-long @gol
234 -Wmain  -Wmissing-braces  -Wmissing-field-initializers @gol
235 -Wmissing-format-attribute  -Wmissing-include-dirs @gol
236 -Wmissing-noreturn @gol
237 -Wno-multichar  -Wnonnull  -Wpacked  -Wpadded @gol
238 -Wparentheses  -Wpointer-arith  -Wno-pointer-to-int-cast @gol
239 -Wredundant-decls @gol
240 -Wreturn-type  -Wsequence-point  -Wshadow @gol
241 -Wsign-compare  -Wstrict-aliasing -Wstrict-aliasing=2 @gol
242 -Wswitch  -Wswitch-default  -Wswitch-enum @gol
243 -Wsystem-headers  -Wtrigraphs  -Wundef  -Wuninitialized @gol
244 -Wunknown-pragmas  -Wno-pragmas -Wunreachable-code @gol
245 -Wunused  -Wunused-function  -Wunused-label  -Wunused-parameter @gol
246 -Wunused-value  -Wunused-variable  -Wwrite-strings @gol
247 -Wvariadic-macros}
249 @item C-only Warning Options
250 @gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
251 -Wmissing-prototypes  -Wnested-externs  -Wold-style-definition @gol
252 -Wstrict-prototypes  -Wtraditional @gol
253 -Wdeclaration-after-statement -Wno-pointer-sign}
255 @item Debugging Options
256 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
257 @gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
258 -fdump-unnumbered  -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
259 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
260 -fdump-ipa-all -fdump-ipa-cgraph @gol
261 -fdump-tree-all @gol
262 -fdump-tree-original@r{[}-@var{n}@r{]}  @gol
263 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
264 -fdump-tree-inlined@r{[}-@var{n}@r{]} @gol
265 -fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol
266 -fdump-tree-ch @gol
267 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
268 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
269 -fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
270 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
271 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
272 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
273 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
274 -fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
275 -fdump-tree-nrv -fdump-tree-vect @gol
276 -fdump-tree-sink @gol
277 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
278 -fdump-tree-salias @gol
279 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
280 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
281 -ftree-vectorizer-verbose=@var{n} @gol
282 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
283 -feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
284 -feliminate-unused-debug-symbols -fmem-report -fprofile-arcs -ftree-based-profiling @gol
285 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
286 -ftest-coverage  -ftime-report -fvar-tracking @gol
287 -g  -g@var{level}  -gcoff -gdwarf-2 @gol
288 -ggdb  -gstabs  -gstabs+  -gvms  -gxcoff  -gxcoff+ @gol
289 -p  -pg  -print-file-name=@var{library}  -print-libgcc-file-name @gol
290 -print-multi-directory  -print-multi-lib @gol
291 -print-prog-name=@var{program}  -print-search-dirs  -Q @gol
292 -save-temps  -time}
294 @item Optimization Options
295 @xref{Optimize Options,,Options that Control Optimization}.
296 @gccoptlist{-falign-functions=@var{n}  -falign-jumps=@var{n} @gol
297 -falign-labels=@var{n}  -falign-loops=@var{n}  @gol
298 -fbounds-check -fmudflap -fmudflapth -fmudflapir @gol
299 -fbranch-probabilities -fprofile-values -fvpt -fbranch-target-load-optimize @gol
300 -fbranch-target-load-optimize2 -fbtr-bb-exclusive @gol
301 -fcaller-saves  -fcprop-registers  -fcse-follow-jumps @gol
302 -fcse-skip-blocks  -fcx-limited-range  -fdata-sections @gol
303 -fdelayed-branch  -fdelete-null-pointer-checks -fearly-inlining @gol
304 -fexpensive-optimizations  -ffast-math  -ffloat-store @gol
305 -fforce-addr  -ffunction-sections @gol
306 -fgcse  -fgcse-lm  -fgcse-sm  -fgcse-las  -fgcse-after-reload @gol
307 -floop-optimize -fcrossjumping  -fif-conversion  -fif-conversion2 @gol
308 -finline-functions  -finline-limit=@var{n}  -fkeep-inline-functions @gol
309 -fkeep-static-consts  -fmerge-constants  -fmerge-all-constants @gol
310 -fmodulo-sched -fno-branch-count-reg @gol
311 -fno-default-inline  -fno-defer-pop -floop-optimize2 -fmove-loop-invariants @gol
312 -fno-function-cse  -fno-guess-branch-probability @gol
313 -fno-inline  -fno-math-errno  -fno-peephole  -fno-peephole2 @gol
314 -funsafe-math-optimizations  -funsafe-loop-optimizations  -ffinite-math-only @gol
315 -fno-trapping-math  -fno-zero-initialized-in-bss @gol
316 -fomit-frame-pointer  -foptimize-register-move @gol
317 -foptimize-sibling-calls  -fprefetch-loop-arrays @gol
318 -fprofile-generate -fprofile-use @gol
319 -fregmove  -frename-registers @gol
320 -freorder-blocks  -freorder-blocks-and-partition -freorder-functions @gol
321 -frerun-cse-after-loop  -frerun-loop-opt @gol
322 -frounding-math -fschedule-insns  -fschedule-insns2 @gol
323 -fno-sched-interblock  -fno-sched-spec  -fsched-spec-load @gol
324 -fsched-spec-load-dangerous  @gol
325 -fsched-stalled-insns=@var{n} -sched-stalled-insns-dep=@var{n} @gol
326 -fsched2-use-superblocks @gol
327 -fsched2-use-traces -freschedule-modulo-scheduled-loops @gol
328 -fsignaling-nans -fsingle-precision-constant  -fspeculative-prefetching @gol
329 -fstrength-reduce  -fstrict-aliasing  -ftracer  -fthread-jumps @gol
330 -funroll-all-loops  -funroll-loops  -fpeel-loops @gol
331 -fsplit-ivs-in-unroller -funswitch-loops @gol
332 -fvariable-expansion-in-unroller @gol
333 -ftree-pre  -ftree-ccp  -ftree-dce -ftree-loop-optimize @gol
334 -ftree-loop-linear -ftree-loop-im -ftree-loop-ivcanon -fivopts @gol
335 -ftree-dominator-opts -ftree-dse -ftree-copyrename -ftree-sink @gol
336 -ftree-ch -ftree-sra -ftree-ter -ftree-lrs -ftree-fre -ftree-vectorize @gol
337 -ftree-salias -fweb @gol
338 -ftree-copy-prop -ftree-store-ccp -ftree-store-copy-prop -fwhole-program @gol
339 --param @var{name}=@var{value}
340 -O  -O0  -O1  -O2  -O3  -Os}
342 @item Preprocessor Options
343 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
344 @gccoptlist{-A@var{question}=@var{answer} @gol
345 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
346 -C  -dD  -dI  -dM  -dN @gol
347 -D@var{macro}@r{[}=@var{defn}@r{]}  -E  -H @gol
348 -idirafter @var{dir} @gol
349 -include @var{file}  -imacros @var{file} @gol
350 -iprefix @var{file}  -iwithprefix @var{dir} @gol
351 -iwithprefixbefore @var{dir}  -isystem @var{dir} @gol
352 -isysroot @var{dir} @gol
353 -M  -MM  -MF  -MG  -MP  -MQ  -MT  -nostdinc  @gol
354 -P  -fworking-directory  -remap @gol
355 -trigraphs  -undef  -U@var{macro}  -Wp,@var{option} @gol
356 -Xpreprocessor @var{option}}
358 @item Assembler Option
359 @xref{Assembler Options,,Passing Options to the Assembler}.
360 @gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
362 @item Linker Options
363 @xref{Link Options,,Options for Linking}.
364 @gccoptlist{@var{object-file-name}  -l@var{library} @gol
365 -nostartfiles  -nodefaultlibs  -nostdlib -pie @gol
366 -s  -static  -static-libgcc  -shared  -shared-libgcc  -symbolic @gol
367 -Wl,@var{option}  -Xlinker @var{option} @gol
368 -u @var{symbol}}
370 @item Directory Options
371 @xref{Directory Options,,Options for Directory Search}.
372 @gccoptlist{-B@var{prefix}  -I@var{dir}  -iquote@var{dir}  -L@var{dir}
373 -specs=@var{file}  -I- --sysroot=@var{dir}}
375 @item Target Options
376 @c I wrote this xref this way to avoid overfull hbox. -- rms
377 @xref{Target Options}.
378 @gccoptlist{-V @var{version}  -b @var{machine}}
380 @item Machine Dependent Options
381 @xref{Submodel Options,,Hardware Models and Configurations}.
382 @c This list is ordered alphanumerically by subsection name.
383 @c Try and put the significant identifier (CPU or system) first,
384 @c so users have a clue at guessing where the ones they want will be.
386 @emph{ARC Options}
387 @gccoptlist{-EB  -EL @gol
388 -mmangle-cpu  -mcpu=@var{cpu}  -mtext=@var{text-section} @gol
389 -mdata=@var{data-section}  -mrodata=@var{readonly-data-section}}
391 @emph{ARM Options}
392 @gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
393 -mabi=@var{name} @gol
394 -mapcs-stack-check  -mno-apcs-stack-check @gol
395 -mapcs-float  -mno-apcs-float @gol
396 -mapcs-reentrant  -mno-apcs-reentrant @gol
397 -msched-prolog  -mno-sched-prolog @gol
398 -mlittle-endian  -mbig-endian  -mwords-little-endian @gol
399 -mfloat-abi=@var{name}  -msoft-float  -mhard-float  -mfpe @gol
400 -mthumb-interwork  -mno-thumb-interwork @gol
401 -mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
402 -mstructure-size-boundary=@var{n} @gol
403 -mabort-on-noreturn @gol
404 -mlong-calls  -mno-long-calls @gol
405 -msingle-pic-base  -mno-single-pic-base @gol
406 -mpic-register=@var{reg} @gol
407 -mnop-fun-dllimport @gol
408 -mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
409 -mpoke-function-name @gol
410 -mthumb  -marm @gol
411 -mtpcs-frame  -mtpcs-leaf-frame @gol
412 -mcaller-super-interworking  -mcallee-super-interworking}
414 @emph{AVR Options}
415 @gccoptlist{-mmcu=@var{mcu}  -msize  -minit-stack=@var{n}  -mno-interrupts @gol
416 -mcall-prologues  -mno-tablejump  -mtiny-stack  -mint8}
418 @emph{Blackfin Options}
419 @gccoptlist{-momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
420 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
421 -mlow-64k -mno-low64k -mid-shared-library @gol
422 -mno-id-shared-library -mshared-library-id=@var{n} @gol
423 -mlong-calls  -mno-long-calls}
425 @emph{CRIS Options}
426 @gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}  -mtune=@var{cpu} @gol
427 -mmax-stack-frame=@var{n}  -melinux-stacksize=@var{n} @gol
428 -metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
429 -mstack-align  -mdata-align  -mconst-align @gol
430 -m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue  -mno-gotplt @gol
431 -melf  -maout  -melinux  -mlinux  -sim  -sim2 @gol
432 -mmul-bug-workaround  -mno-mul-bug-workaround}
434 @emph{Darwin Options}
435 @gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal @gol
436 -arch_only  -bind_at_load  -bundle  -bundle_loader @gol
437 -client_name  -compatibility_version  -current_version @gol
438 -dead_strip @gol
439 -dependency-file  -dylib_file  -dylinker_install_name @gol
440 -dynamic  -dynamiclib  -exported_symbols_list @gol
441 -filelist  -flat_namespace  -force_cpusubtype_ALL @gol
442 -force_flat_namespace  -headerpad_max_install_names @gol
443 -image_base  -init  -install_name  -keep_private_externs @gol
444 -multi_module  -multiply_defined  -multiply_defined_unused @gol
445 -noall_load   -no_dead_strip_inits_and_terms @gol
446 -nofixprebinding -nomultidefs  -noprebind  -noseglinkedit @gol
447 -pagezero_size  -prebind  -prebind_all_twolevel_modules @gol
448 -private_bundle  -read_only_relocs  -sectalign @gol
449 -sectobjectsymbols  -whyload  -seg1addr @gol
450 -sectcreate  -sectobjectsymbols  -sectorder @gol
451 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
452 -seg_addr_table  -seg_addr_table_filename  -seglinkedit @gol
453 -segprot  -segs_read_only_addr  -segs_read_write_addr @gol
454 -single_module  -static  -sub_library  -sub_umbrella @gol
455 -twolevel_namespace  -umbrella  -undefined @gol
456 -unexported_symbols_list  -weak_reference_mismatches @gol
457 -whatsloaded -F -gused -gfull -mmacosx-min-version=@var{version} @gol
458 -mone-byte-bool}
460 @emph{DEC Alpha Options}
461 @gccoptlist{-mno-fp-regs  -msoft-float  -malpha-as  -mgas @gol
462 -mieee  -mieee-with-inexact  -mieee-conformant @gol
463 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
464 -mtrap-precision=@var{mode}  -mbuild-constants @gol
465 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
466 -mbwx  -mmax  -mfix  -mcix @gol
467 -mfloat-vax  -mfloat-ieee @gol
468 -mexplicit-relocs  -msmall-data  -mlarge-data @gol
469 -msmall-text  -mlarge-text @gol
470 -mmemory-latency=@var{time}}
472 @emph{DEC Alpha/VMS Options}
473 @gccoptlist{-mvms-return-codes}
475 @emph{FRV Options}
476 @gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
477 -mhard-float  -msoft-float @gol
478 -malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
479 -mdouble  -mno-double @gol
480 -mmedia  -mno-media  -mmuladd  -mno-muladd @gol
481 -mfdpic  -minline-plt -mgprel-ro  -multilib-library-pic @gol
482 -mlinked-fp  -mlong-calls  -malign-labels @gol
483 -mlibrary-pic  -macc-4  -macc-8 @gol
484 -mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
485 -mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
486 -mvliw-branch  -mno-vliw-branch @gol
487 -mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
488 -mno-nested-cond-exec  -mtomcat-stats @gol
489 -mTLS -mtls @gol
490 -mcpu=@var{cpu}}
492 @emph{H8/300 Options}
493 @gccoptlist{-mrelax  -mh  -ms  -mn  -mint32  -malign-300}
495 @emph{HPPA Options}
496 @gccoptlist{-march=@var{architecture-type} @gol
497 -mbig-switch  -mdisable-fpregs  -mdisable-indexing @gol
498 -mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
499 -mfixed-range=@var{register-range} @gol
500 -mjump-in-delay -mlinker-opt -mlong-calls @gol
501 -mlong-load-store  -mno-big-switch  -mno-disable-fpregs @gol
502 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
503 -mno-jump-in-delay  -mno-long-load-store @gol
504 -mno-portable-runtime  -mno-soft-float @gol
505 -mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
506 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
507 -mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
508 -munix=@var{unix-std}  -nolibdld  -static  -threads}
510 @emph{i386 and x86-64 Options}
511 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
512 -mfpmath=@var{unit} @gol
513 -masm=@var{dialect}  -mno-fancy-math-387 @gol
514 -mno-fp-ret-in-387  -msoft-float  -msvr3-shlib @gol
515 -mno-wide-multiply  -mrtd  -malign-double @gol
516 -mpreferred-stack-boundary=@var{num} @gol
517 -mmmx  -msse  -msse2 -msse3 -m3dnow @gol
518 -mthreads  -mno-align-stringops  -minline-all-stringops @gol
519 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
520 -m96bit-long-double  -mregparm=@var{num}  -msseregparm @gol
521 -momit-leaf-frame-pointer  -mno-red-zone -mno-tls-direct-seg-refs @gol
522 -mcmodel=@var{code-model} @gol
523 -m32  -m64}
525 @emph{IA-64 Options}
526 @gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
527 -mvolatile-asm-stop  -mregister-names  -mno-sdata @gol
528 -mconstant-gp  -mauto-pic  -minline-float-divide-min-latency @gol
529 -minline-float-divide-max-throughput @gol
530 -minline-int-divide-min-latency @gol
531 -minline-int-divide-max-throughput  @gol
532 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
533 -mno-dwarf2-asm -mearly-stop-bits @gol
534 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
535 -mtune=@var{cpu-type} -mt -pthread -milp32 -mlp64}
537 @emph{M32R/D Options}
538 @gccoptlist{-m32r2 -m32rx -m32r @gol
539 -mdebug @gol
540 -malign-loops -mno-align-loops @gol
541 -missue-rate=@var{number} @gol
542 -mbranch-cost=@var{number} @gol
543 -mmodel=@var{code-size-model-type} @gol
544 -msdata=@var{sdata-type} @gol
545 -mno-flush-func -mflush-func=@var{name} @gol
546 -mno-flush-trap -mflush-trap=@var{number} @gol
547 -G @var{num}}
549 @emph{M32C Options}
550 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
552 @emph{M680x0 Options}
553 @gccoptlist{-m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
554 -m68060  -mcpu32  -m5200  -m68881  -mbitfield  -mc68000  -mc68020   @gol
555 -mnobitfield  -mrtd  -mshort  -msoft-float  -mpcrel @gol
556 -malign-int  -mstrict-align  -msep-data  -mno-sep-data @gol
557 -mshared-library-id=n  -mid-shared-library  -mno-id-shared-library}
559 @emph{M68hc1x Options}
560 @gccoptlist{-m6811  -m6812  -m68hc11  -m68hc12   -m68hcs12 @gol
561 -mauto-incdec  -minmax  -mlong-calls  -mshort @gol
562 -msoft-reg-count=@var{count}}
564 @emph{MCore Options}
565 @gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
566 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
567 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
568 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
569 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
571 @emph{MIPS Options}
572 @gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
573 -mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips64 @gol
574 -mips16  -mno-mips16  -mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
575 -mxgot  -mno-xgot  -mgp32  -mgp64  -mfp32  -mfp64 @gol
576 -mhard-float  -msoft-float  -msingle-float  -mdouble-float @gol
577 -mdsp  -mpaired-single  -mips3d @gol
578 -mlong64  -mlong32  -msym32  -mno-sym32 @gol
579 -G@var{num}  -membedded-data  -mno-embedded-data @gol
580 -muninit-const-in-rodata  -mno-uninit-const-in-rodata @gol
581 -msplit-addresses  -mno-split-addresses  @gol
582 -mexplicit-relocs  -mno-explicit-relocs  @gol
583 -mcheck-zero-division  -mno-check-zero-division @gol
584 -mdivide-traps  -mdivide-breaks @gol
585 -mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls @gol
586 -mmad  -mno-mad  -mfused-madd  -mno-fused-madd  -nocpp @gol
587 -mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400 @gol
588 -mfix-vr4120  -mno-fix-vr4120  -mfix-vr4130 @gol
589 -mfix-sb1  -mno-fix-sb1 @gol
590 -mflush-func=@var{func}  -mno-flush-func @gol
591 -mbranch-likely  -mno-branch-likely @gol
592 -mfp-exceptions -mno-fp-exceptions @gol
593 -mvr4130-align -mno-vr4130-align}
595 @emph{MMIX Options}
596 @gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
597 -mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
598 -melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
599 -mno-base-addresses  -msingle-exit  -mno-single-exit}
601 @emph{MN10300 Options}
602 @gccoptlist{-mmult-bug  -mno-mult-bug @gol
603 -mam33  -mno-am33 @gol
604 -mam33-2  -mno-am33-2 @gol
605 -mno-crt0  -mrelax}
607 @emph{PDP-11 Options}
608 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
609 -mbcopy  -mbcopy-builtin  -mint32  -mno-int16 @gol
610 -mint16  -mno-int32  -mfloat32  -mno-float64 @gol
611 -mfloat64  -mno-float32  -mabshi  -mno-abshi @gol
612 -mbranch-expensive  -mbranch-cheap @gol
613 -msplit  -mno-split  -munix-asm  -mdec-asm}
615 @emph{PowerPC Options}
616 See RS/6000 and PowerPC Options.
618 @emph{RS/6000 and PowerPC Options}
619 @gccoptlist{-mcpu=@var{cpu-type} @gol
620 -mtune=@var{cpu-type} @gol
621 -mpower  -mno-power  -mpower2  -mno-power2 @gol
622 -mpowerpc  -mpowerpc64  -mno-powerpc @gol
623 -maltivec  -mno-altivec @gol
624 -mpowerpc-gpopt  -mno-powerpc-gpopt @gol
625 -mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
626 -mnew-mnemonics  -mold-mnemonics @gol
627 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
628 -m64  -m32  -mxl-compat  -mno-xl-compat  -mpe @gol
629 -malign-power  -malign-natural @gol
630 -msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
631 -mstring  -mno-string  -mupdate  -mno-update @gol
632 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
633 -mstrict-align  -mno-strict-align  -mrelocatable @gol
634 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
635 -mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
636 -mdynamic-no-pic  -maltivec  -mswdiv @gol
637 -mprioritize-restricted-insns=@var{priority} @gol
638 -msched-costly-dep=@var{dependence_type} @gol
639 -minsert-sched-nops=@var{scheme} @gol
640 -mcall-sysv  -mcall-netbsd @gol
641 -maix-struct-return  -msvr4-struct-return @gol
642 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
643 -misel -mno-isel @gol
644 -misel=yes  -misel=no @gol
645 -mspe -mno-spe @gol
646 -mspe=yes  -mspe=no @gol
647 -mvrsave -mno-vrsave @gol
648 -mfloat-gprs=yes  -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
649 -mprototype  -mno-prototype @gol
650 -msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
651 -msdata=@var{opt}  -mvxworks  -mwindiss  -G @var{num}  -pthread}
653 @emph{S/390 and zSeries Options}
654 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
655 -mhard-float  -msoft-float  -mbackchain  -mno-backchain @gol
656 -mpacked-stack  -mno-packed-stack @gol
657 -msmall-exec  -mno-small-exec  -mmvcle -mno-mvcle @gol
658 -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch @gol
659 -mtpf-trace -mno-tpf-trace  -mfused-madd  -mno-fused-madd @gol
660 -mwarn-framesize  -mwarn-dynamicstack  -mstack-size -mstack-guard}
662 @emph{SH Options}
663 @gccoptlist{-m1  -m2  -m2e  -m3  -m3e @gol
664 -m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
665 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
666 -m5-64media  -m5-64media-nofpu @gol
667 -m5-32media  -m5-32media-nofpu @gol
668 -m5-compact  -m5-compact-nofpu @gol
669 -mb  -ml  -mdalign  -mrelax @gol
670 -mbigtable  -mfmovd  -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
671 -mieee  -misize  -mpadstruct  -mspace @gol
672 -mprefergot  -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
673 -mdivsi3_libfunc=@var{name}  @gol
674 -madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
675  -minvalid-symbols}
677 @emph{SPARC Options}
678 @gccoptlist{-mcpu=@var{cpu-type} @gol
679 -mtune=@var{cpu-type} @gol
680 -mcmodel=@var{code-model} @gol
681 -m32  -m64  -mapp-regs  -mno-app-regs @gol
682 -mfaster-structs  -mno-faster-structs @gol
683 -mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
684 -mhard-quad-float  -msoft-quad-float @gol
685 -mimpure-text  -mno-impure-text  -mlittle-endian @gol
686 -mstack-bias  -mno-stack-bias @gol
687 -munaligned-doubles  -mno-unaligned-doubles @gol
688 -mv8plus  -mno-v8plus  -mvis  -mno-vis
689 -threads -pthreads}
691 @emph{System V Options}
692 @gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
694 @emph{TMS320C3x/C4x Options}
695 @gccoptlist{-mcpu=@var{cpu}  -mbig  -msmall  -mregparm  -mmemparm @gol
696 -mfast-fix  -mmpyi  -mbk  -mti  -mdp-isr-reload @gol
697 -mrpts=@var{count}  -mrptb  -mdb  -mloop-unsigned @gol
698 -mparallel-insns  -mparallel-mpy  -mpreserve-float}
700 @emph{V850 Options}
701 @gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
702 -mprolog-function  -mno-prolog-function  -mspace @gol
703 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
704 -mapp-regs  -mno-app-regs @gol
705 -mdisable-callt  -mno-disable-callt @gol
706 -mv850e1 @gol
707 -mv850e @gol
708 -mv850  -mbig-switch}
710 @emph{VAX Options}
711 @gccoptlist{-mg  -mgnu  -munix}
713 @emph{x86-64 Options}
714 See i386 and x86-64 Options.
716 @emph{Xstormy16 Options}
717 @gccoptlist{-msim}
719 @emph{Xtensa Options}
720 @gccoptlist{-mconst16 -mno-const16 @gol
721 -mfused-madd  -mno-fused-madd @gol
722 -mtext-section-literals  -mno-text-section-literals @gol
723 -mtarget-align  -mno-target-align @gol
724 -mlongcalls  -mno-longcalls}
726 @emph{zSeries Options}
727 See S/390 and zSeries Options.
729 @item Code Generation Options
730 @xref{Code Gen Options,,Options for Code Generation Conventions}.
731 @gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
732 -ffixed-@var{reg}  -fexceptions @gol
733 -fnon-call-exceptions  -funwind-tables @gol
734 -fasynchronous-unwind-tables @gol
735 -finhibit-size-directive  -finstrument-functions @gol
736 -fno-common  -fno-ident @gol
737 -fpcc-struct-return  -fpic  -fPIC -fpie -fPIE @gol
738 -fno-jump-tables @gol
739 -freg-struct-return  -fshared-data  -fshort-enums @gol
740 -fshort-double  -fshort-wchar @gol
741 -fverbose-asm  -fpack-struct[=@var{n}]  -fstack-check @gol
742 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
743 -fargument-alias  -fargument-noalias @gol
744 -fargument-noalias-global  -fleading-underscore @gol
745 -ftls-model=@var{model} @gol
746 -ftrapv  -fwrapv  -fbounds-check @gol
747 -fvisibility}
748 @end table
750 @menu
751 * Overall Options::     Controlling the kind of output:
752                         an executable, object files, assembler files,
753                         or preprocessed source.
754 * C Dialect Options::   Controlling the variant of C language compiled.
755 * C++ Dialect Options:: Variations on C++.
756 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
757                         and Objective-C++.
758 * Language Independent Options:: Controlling how diagnostics should be
759                         formatted.
760 * Warning Options::     How picky should the compiler be?
761 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
762 * Optimize Options::    How much optimization?
763 * Preprocessor Options:: Controlling header files and macro definitions.
764                          Also, getting dependency information for Make.
765 * Assembler Options::   Passing options to the assembler.
766 * Link Options::        Specifying libraries and so on.
767 * Directory Options::   Where to find header files and libraries.
768                         Where to find the compiler executable files.
769 * Spec Files::          How to pass switches to sub-processes.
770 * Target Options::      Running a cross-compiler, or an old version of GCC.
771 @end menu
773 @node Overall Options
774 @section Options Controlling the Kind of Output
776 Compilation can involve up to four stages: preprocessing, compilation
777 proper, assembly and linking, always in that order.  GCC is capable of
778 preprocessing and compiling several files either into several
779 assembler input files, or into one assembler input file; then each
780 assembler input file produces an object file, and linking combines all
781 the object files (those newly compiled, and those specified as input)
782 into an executable file.
784 @cindex file name suffix
785 For any given input file, the file name suffix determines what kind of
786 compilation is done:
788 @table @gcctabopt
789 @item @var{file}.c
790 C source code which must be preprocessed.
792 @item @var{file}.i
793 C source code which should not be preprocessed.
795 @item @var{file}.ii
796 C++ source code which should not be preprocessed.
798 @item @var{file}.m
799 Objective-C source code.  Note that you must link with the @file{libobjc}
800 library to make an Objective-C program work.
802 @item @var{file}.mi
803 Objective-C source code which should not be preprocessed.
805 @item @var{file}.mm
806 @itemx @var{file}.M
807 Objective-C++ source code.  Note that you must link with the @file{libobjc}
808 library to make an Objective-C++ program work.  Note that @samp{.M} refers
809 to a literal capital M@.
811 @item @var{file}.mii
812 Objective-C++ source code which should not be preprocessed.
814 @item @var{file}.h
815 C, C++, Objective-C or Objective-C++ header file to be turned into a
816 precompiled header.
818 @item @var{file}.cc
819 @itemx @var{file}.cp
820 @itemx @var{file}.cxx
821 @itemx @var{file}.cpp
822 @itemx @var{file}.CPP
823 @itemx @var{file}.c++
824 @itemx @var{file}.C
825 C++ source code which must be preprocessed.  Note that in @samp{.cxx},
826 the last two letters must both be literally @samp{x}.  Likewise,
827 @samp{.C} refers to a literal capital C@.
829 @item @var{file}.mm
830 @itemx @var{file}.M
831 Objective-C++ source code which must be preprocessed.
833 @item @var{file}.mii
834 Objective-C++ source code which should not be preprocessed.
836 @item @var{file}.hh
837 @itemx @var{file}.H
838 C++ header file to be turned into a precompiled header.
840 @item @var{file}.f
841 @itemx @var{file}.for
842 @itemx @var{file}.FOR
843 Fortran source code which should not be preprocessed.
845 @item @var{file}.F
846 @itemx @var{file}.fpp
847 @itemx @var{file}.FPP
848 Fortran source code which must be preprocessed (with the traditional
849 preprocessor).
851 @item @var{file}.r
852 Fortran source code which must be preprocessed with a RATFOR
853 preprocessor (not included with GCC)@.
855 @item @var{file}.f90
856 @itemx @var{file}.f95
857 Fortran 90/95 source code which should not be preprocessed.
859 @c FIXME: Descriptions of Java file types.
860 @c @var{file}.java
861 @c @var{file}.class
862 @c @var{file}.zip
863 @c @var{file}.jar
865 @item @var{file}.ads
866 Ada source code file which contains a library unit declaration (a
867 declaration of a package, subprogram, or generic, or a generic
868 instantiation), or a library unit renaming declaration (a package,
869 generic, or subprogram renaming declaration).  Such files are also
870 called @dfn{specs}.
872 @itemx @var{file}.adb
873 Ada source code file containing a library unit body (a subprogram or
874 package body).  Such files are also called @dfn{bodies}.
876 @c GCC also knows about some suffixes for languages not yet included:
877 @c Pascal:
878 @c @var{file}.p
879 @c @var{file}.pas
881 @item @var{file}.s
882 Assembler code.
884 @item @var{file}.S
885 Assembler code which must be preprocessed.
887 @item @var{other}
888 An object file to be fed straight into linking.
889 Any file name with no recognized suffix is treated this way.
890 @end table
892 @opindex x
893 You can specify the input language explicitly with the @option{-x} option:
895 @table @gcctabopt
896 @item -x @var{language}
897 Specify explicitly the @var{language} for the following input files
898 (rather than letting the compiler choose a default based on the file
899 name suffix).  This option applies to all following input files until
900 the next @option{-x} option.  Possible values for @var{language} are:
901 @smallexample
902 c  c-header  c-cpp-output
903 c++  c++-header  c++-cpp-output
904 objective-c  objective-c-header  objective-c-cpp-output
905 objective-c++ objective-c++-header objective-c++-cpp-output
906 assembler  assembler-with-cpp
908 f77  f77-cpp-input  ratfor
910 java
911 treelang
912 @end smallexample
914 @item -x none
915 Turn off any specification of a language, so that subsequent files are
916 handled according to their file name suffixes (as they are if @option{-x}
917 has not been used at all).
919 @item -pass-exit-codes
920 @opindex pass-exit-codes
921 Normally the @command{gcc} program will exit with the code of 1 if any
922 phase of the compiler returns a non-success return code.  If you specify
923 @option{-pass-exit-codes}, the @command{gcc} program will instead return with
924 numerically highest error produced by any phase that returned an error
925 indication.
926 @end table
928 If you only want some of the stages of compilation, you can use
929 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
930 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
931 @command{gcc} is to stop.  Note that some combinations (for example,
932 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
934 @table @gcctabopt
935 @item -c
936 @opindex c
937 Compile or assemble the source files, but do not link.  The linking
938 stage simply is not done.  The ultimate output is in the form of an
939 object file for each source file.
941 By default, the object file name for a source file is made by replacing
942 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
944 Unrecognized input files, not requiring compilation or assembly, are
945 ignored.
947 @item -S
948 @opindex S
949 Stop after the stage of compilation proper; do not assemble.  The output
950 is in the form of an assembler code file for each non-assembler input
951 file specified.
953 By default, the assembler file name for a source file is made by
954 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
956 Input files that don't require compilation are ignored.
958 @item -E
959 @opindex E
960 Stop after the preprocessing stage; do not run the compiler proper.  The
961 output is in the form of preprocessed source code, which is sent to the
962 standard output.
964 Input files which don't require preprocessing are ignored.
966 @cindex output file option
967 @item -o @var{file}
968 @opindex o
969 Place output in file @var{file}.  This applies regardless to whatever
970 sort of output is being produced, whether it be an executable file,
971 an object file, an assembler file or preprocessed C code.
973 If @option{-o} is not specified, the default is to put an executable
974 file in @file{a.out}, the object file for
975 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
976 assembler file in @file{@var{source}.s}, a precompiled header file in
977 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
978 standard output.
980 @item -v
981 @opindex v
982 Print (on standard error output) the commands executed to run the stages
983 of compilation.  Also print the version number of the compiler driver
984 program and of the preprocessor and the compiler proper.
986 @item -###
987 @opindex ###
988 Like @option{-v} except the commands are not executed and all command
989 arguments are quoted.  This is useful for shell scripts to capture the
990 driver-generated command lines.
992 @item -pipe
993 @opindex pipe
994 Use pipes rather than temporary files for communication between the
995 various stages of compilation.  This fails to work on some systems where
996 the assembler is unable to read from a pipe; but the GNU assembler has
997 no trouble.
999 @item -combine
1000 @opindex combine
1001 If you are compiling multiple source files, this option tells the driver
1002 to pass all the source files to the compiler at once (for those
1003 languages for which the compiler can handle this).  This will allow
1004 intermodule analysis (IMA) to be performed by the compiler.  Currently the only
1005 language for which this is supported is C@.  If you pass source files for
1006 multiple languages to the driver, using this option, the driver will invoke
1007 the compiler(s) that support IMA once each, passing each compiler all the
1008 source files appropriate for it.  For those languages that do not support
1009 IMA this option will be ignored, and the compiler will be invoked once for
1010 each source file in that language.  If you use this option in conjunction
1011 with @option{-save-temps}, the compiler will generate multiple
1012 pre-processed files
1013 (one for each source file), but only one (combined) @file{.o} or
1014 @file{.s} file.
1016 @item --help
1017 @opindex help
1018 Print (on the standard output) a description of the command line options
1019 understood by @command{gcc}.  If the @option{-v} option is also specified
1020 then @option{--help} will also be passed on to the various processes
1021 invoked by @command{gcc}, so that they can display the command line options
1022 they accept.  If the @option{-Wextra} option is also specified then command
1023 line options which have no documentation associated with them will also
1024 be displayed.
1026 @item --target-help
1027 @opindex target-help
1028 Print (on the standard output) a description of target specific command
1029 line options for each tool.
1031 @item --version
1032 @opindex version
1033 Display the version number and copyrights of the invoked GCC@.
1034 @end table
1036 @node Invoking G++
1037 @section Compiling C++ Programs
1039 @cindex suffixes for C++ source
1040 @cindex C++ source file suffixes
1041 C++ source files conventionally use one of the suffixes @samp{.C},
1042 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1043 @samp{.cxx}; C++ header files often use @samp{.hh} or @samp{.H}; and
1044 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
1045 files with these names and compiles them as C++ programs even if you
1046 call the compiler the same way as for compiling C programs (usually
1047 with the name @command{gcc}).
1049 @findex g++
1050 @findex c++
1051 However, C++ programs often require class libraries as well as a
1052 compiler that understands the C++ language---and under some
1053 circumstances, you might want to compile programs or header files from
1054 standard input, or otherwise without a suffix that flags them as C++
1055 programs.  You might also like to precompile a C header file with a
1056 @samp{.h} extension to be used in C++ compilations.  @command{g++} is a
1057 program that calls GCC with the default language set to C++, and
1058 automatically specifies linking against the C++ library.  On many
1059 systems, @command{g++} is also installed with the name @command{c++}.
1061 @cindex invoking @command{g++}
1062 When you compile C++ programs, you may specify many of the same
1063 command-line options that you use for compiling programs in any
1064 language; or command-line options meaningful for C and related
1065 languages; or options that are meaningful only for C++ programs.
1066 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1067 explanations of options for languages related to C@.
1068 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1069 explanations of options that are meaningful only for C++ programs.
1071 @node C Dialect Options
1072 @section Options Controlling C Dialect
1073 @cindex dialect options
1074 @cindex language dialect options
1075 @cindex options, dialect
1077 The following options control the dialect of C (or languages derived
1078 from C, such as C++, Objective-C and Objective-C++) that the compiler
1079 accepts:
1081 @table @gcctabopt
1082 @cindex ANSI support
1083 @cindex ISO support
1084 @item -ansi
1085 @opindex ansi
1086 In C mode, support all ISO C90 programs.  In C++ mode,
1087 remove GNU extensions that conflict with ISO C++.
1089 This turns off certain features of GCC that are incompatible with ISO
1090 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1091 such as the @code{asm} and @code{typeof} keywords, and
1092 predefined macros such as @code{unix} and @code{vax} that identify the
1093 type of system you are using.  It also enables the undesirable and
1094 rarely used ISO trigraph feature.  For the C compiler,
1095 it disables recognition of C++ style @samp{//} comments as well as
1096 the @code{inline} keyword.
1098 The alternate keywords @code{__asm__}, @code{__extension__},
1099 @code{__inline__} and @code{__typeof__} continue to work despite
1100 @option{-ansi}.  You would not want to use them in an ISO C program, of
1101 course, but it is useful to put them in header files that might be included
1102 in compilations done with @option{-ansi}.  Alternate predefined macros
1103 such as @code{__unix__} and @code{__vax__} are also available, with or
1104 without @option{-ansi}.
1106 The @option{-ansi} option does not cause non-ISO programs to be
1107 rejected gratuitously.  For that, @option{-pedantic} is required in
1108 addition to @option{-ansi}.  @xref{Warning Options}.
1110 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1111 option is used.  Some header files may notice this macro and refrain
1112 from declaring certain functions or defining certain macros that the
1113 ISO standard doesn't call for; this is to avoid interfering with any
1114 programs that might use these names for other things.
1116 Functions which would normally be built in but do not have semantics
1117 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1118 functions with @option{-ansi} is used.  @xref{Other Builtins,,Other
1119 built-in functions provided by GCC}, for details of the functions
1120 affected.
1122 @item -std=
1123 @opindex std
1124 Determine the language standard.  This option is currently only
1125 supported when compiling C or C++.  A value for this option must be
1126 provided; possible values are
1128 @table @samp
1129 @item c89
1130 @itemx iso9899:1990
1131 ISO C90 (same as @option{-ansi}).
1133 @item iso9899:199409
1134 ISO C90 as modified in amendment 1.
1136 @item c99
1137 @itemx c9x
1138 @itemx iso9899:1999
1139 @itemx iso9899:199x
1140 ISO C99.  Note that this standard is not yet fully supported; see
1141 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information.  The
1142 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1144 @item gnu89
1145 Default, ISO C90 plus GNU extensions (including some C99 features).
1147 @item gnu99
1148 @itemx gnu9x
1149 ISO C99 plus GNU extensions.  When ISO C99 is fully implemented in GCC,
1150 this will become the default.  The name @samp{gnu9x} is deprecated.
1152 @item c++98
1153 The 1998 ISO C++ standard plus amendments.
1155 @item gnu++98
1156 The same as @option{-std=c++98} plus GNU extensions.  This is the
1157 default for C++ code.
1158 @end table
1160 Even when this option is not specified, you can still use some of the
1161 features of newer standards in so far as they do not conflict with
1162 previous C standards.  For example, you may use @code{__restrict__} even
1163 when @option{-std=c99} is not specified.
1165 The @option{-std} options specifying some version of ISO C have the same
1166 effects as @option{-ansi}, except that features that were not in ISO C90
1167 but are in the specified version (for example, @samp{//} comments and
1168 the @code{inline} keyword in ISO C99) are not disabled.
1170 @xref{Standards,,Language Standards Supported by GCC}, for details of
1171 these standard versions.
1173 @item -aux-info @var{filename}
1174 @opindex aux-info
1175 Output to the given filename prototyped declarations for all functions
1176 declared and/or defined in a translation unit, including those in header
1177 files.  This option is silently ignored in any language other than C@.
1179 Besides declarations, the file indicates, in comments, the origin of
1180 each declaration (source file and line), whether the declaration was
1181 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1182 @samp{O} for old, respectively, in the first character after the line
1183 number and the colon), and whether it came from a declaration or a
1184 definition (@samp{C} or @samp{F}, respectively, in the following
1185 character).  In the case of function definitions, a K&R-style list of
1186 arguments followed by their declarations is also provided, inside
1187 comments, after the declaration.
1189 @item -fno-asm
1190 @opindex fno-asm
1191 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1192 keyword, so that code can use these words as identifiers.  You can use
1193 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1194 instead.  @option{-ansi} implies @option{-fno-asm}.
1196 In C++, this switch only affects the @code{typeof} keyword, since
1197 @code{asm} and @code{inline} are standard keywords.  You may want to
1198 use the @option{-fno-gnu-keywords} flag instead, which has the same
1199 effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1200 switch only affects the @code{asm} and @code{typeof} keywords, since
1201 @code{inline} is a standard keyword in ISO C99.
1203 @item -fno-builtin
1204 @itemx -fno-builtin-@var{function}
1205 @opindex fno-builtin
1206 @cindex built-in functions
1207 Don't recognize built-in functions that do not begin with
1208 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
1209 functions provided by GCC}, for details of the functions affected,
1210 including those which are not built-in functions when @option{-ansi} or
1211 @option{-std} options for strict ISO C conformance are used because they
1212 do not have an ISO standard meaning.
1214 GCC normally generates special code to handle certain built-in functions
1215 more efficiently; for instance, calls to @code{alloca} may become single
1216 instructions that adjust the stack directly, and calls to @code{memcpy}
1217 may become inline copy loops.  The resulting code is often both smaller
1218 and faster, but since the function calls no longer appear as such, you
1219 cannot set a breakpoint on those calls, nor can you change the behavior
1220 of the functions by linking with a different library.  In addition,
1221 when a function is recognized as a built-in function, GCC may use
1222 information about that function to warn about problems with calls to
1223 that function, or to generate more efficient code, even if the
1224 resulting code still contains calls to that function.  For example,
1225 warnings are given with @option{-Wformat} for bad calls to
1226 @code{printf}, when @code{printf} is built in, and @code{strlen} is
1227 known not to modify global memory.
1229 With the @option{-fno-builtin-@var{function}} option
1230 only the built-in function @var{function} is
1231 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
1232 function is named this is not built-in in this version of GCC, this
1233 option is ignored.  There is no corresponding
1234 @option{-fbuiltin-@var{function}} option; if you wish to enable
1235 built-in functions selectively when using @option{-fno-builtin} or
1236 @option{-ffreestanding}, you may define macros such as:
1238 @smallexample
1239 #define abs(n)          __builtin_abs ((n))
1240 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
1241 @end smallexample
1243 @item -fhosted
1244 @opindex fhosted
1245 @cindex hosted environment
1247 Assert that compilation takes place in a hosted environment.  This implies
1248 @option{-fbuiltin}.  A hosted environment is one in which the
1249 entire standard library is available, and in which @code{main} has a return
1250 type of @code{int}.  Examples are nearly everything except a kernel.
1251 This is equivalent to @option{-fno-freestanding}.
1253 @item -ffreestanding
1254 @opindex ffreestanding
1255 @cindex hosted environment
1257 Assert that compilation takes place in a freestanding environment.  This
1258 implies @option{-fno-builtin}.  A freestanding environment
1259 is one in which the standard library may not exist, and program startup may
1260 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
1261 This is equivalent to @option{-fno-hosted}.
1263 @xref{Standards,,Language Standards Supported by GCC}, for details of
1264 freestanding and hosted environments.
1266 @item -fms-extensions
1267 @opindex fms-extensions
1268 Accept some non-standard constructs used in Microsoft header files.
1270 Some cases of unnamed fields in structures and unions are only
1271 accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
1272 fields within structs/unions}, for details.
1274 @item -trigraphs
1275 @opindex trigraphs
1276 Support ISO C trigraphs.  The @option{-ansi} option (and @option{-std}
1277 options for strict ISO C conformance) implies @option{-trigraphs}.
1279 @item -no-integrated-cpp
1280 @opindex no-integrated-cpp
1281 Performs a compilation in two passes: preprocessing and compiling.  This
1282 option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1283 @option{-B} option.  The user supplied compilation step can then add in
1284 an additional preprocessing step after normal preprocessing but before
1285 compiling.  The default is to use the integrated cpp (internal cpp)
1287 The semantics of this option will change if "cc1", "cc1plus", and
1288 "cc1obj" are merged.
1290 @cindex traditional C language
1291 @cindex C language, traditional
1292 @item -traditional
1293 @itemx -traditional-cpp
1294 @opindex traditional-cpp
1295 @opindex traditional
1296 Formerly, these options caused GCC to attempt to emulate a pre-standard
1297 C compiler.  They are now only supported with the @option{-E} switch.
1298 The preprocessor continues to support a pre-standard mode.  See the GNU
1299 CPP manual for details.
1301 @item -fcond-mismatch
1302 @opindex fcond-mismatch
1303 Allow conditional expressions with mismatched types in the second and
1304 third arguments.  The value of such an expression is void.  This option
1305 is not supported for C++.
1307 @item -funsigned-char
1308 @opindex funsigned-char
1309 Let the type @code{char} be unsigned, like @code{unsigned char}.
1311 Each kind of machine has a default for what @code{char} should
1312 be.  It is either like @code{unsigned char} by default or like
1313 @code{signed char} by default.
1315 Ideally, a portable program should always use @code{signed char} or
1316 @code{unsigned char} when it depends on the signedness of an object.
1317 But many programs have been written to use plain @code{char} and
1318 expect it to be signed, or expect it to be unsigned, depending on the
1319 machines they were written for.  This option, and its inverse, let you
1320 make such a program work with the opposite default.
1322 The type @code{char} is always a distinct type from each of
1323 @code{signed char} or @code{unsigned char}, even though its behavior
1324 is always just like one of those two.
1326 @item -fsigned-char
1327 @opindex fsigned-char
1328 Let the type @code{char} be signed, like @code{signed char}.
1330 Note that this is equivalent to @option{-fno-unsigned-char}, which is
1331 the negative form of @option{-funsigned-char}.  Likewise, the option
1332 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1334 @item -fsigned-bitfields
1335 @itemx -funsigned-bitfields
1336 @itemx -fno-signed-bitfields
1337 @itemx -fno-unsigned-bitfields
1338 @opindex fsigned-bitfields
1339 @opindex funsigned-bitfields
1340 @opindex fno-signed-bitfields
1341 @opindex fno-unsigned-bitfields
1342 These options control whether a bit-field is signed or unsigned, when the
1343 declaration does not use either @code{signed} or @code{unsigned}.  By
1344 default, such a bit-field is signed, because this is consistent: the
1345 basic integer types such as @code{int} are signed types.
1346 @end table
1348 @node C++ Dialect Options
1349 @section Options Controlling C++ Dialect
1351 @cindex compiler options, C++
1352 @cindex C++ options, command line
1353 @cindex options, C++
1354 This section describes the command-line options that are only meaningful
1355 for C++ programs; but you can also use most of the GNU compiler options
1356 regardless of what language your program is in.  For example, you
1357 might compile a file @code{firstClass.C} like this:
1359 @smallexample
1360 g++ -g -frepo -O -c firstClass.C
1361 @end smallexample
1363 @noindent
1364 In this example, only @option{-frepo} is an option meant
1365 only for C++ programs; you can use the other options with any
1366 language supported by GCC@.
1368 Here is a list of options that are @emph{only} for compiling C++ programs:
1370 @table @gcctabopt
1372 @item -fabi-version=@var{n}
1373 @opindex fabi-version
1374 Use version @var{n} of the C++ ABI@.  Version 2 is the version of the
1375 C++ ABI that first appeared in G++ 3.4.  Version 1 is the version of
1376 the C++ ABI that first appeared in G++ 3.2.  Version 0 will always be
1377 the version that conforms most closely to the C++ ABI specification.
1378 Therefore, the ABI obtained using version 0 will change as ABI bugs
1379 are fixed.
1381 The default is version 2.
1383 @item -fno-access-control
1384 @opindex fno-access-control
1385 Turn off all access checking.  This switch is mainly useful for working
1386 around bugs in the access control code.
1388 @item -fcheck-new
1389 @opindex fcheck-new
1390 Check that the pointer returned by @code{operator new} is non-null
1391 before attempting to modify the storage allocated.  This check is
1392 normally unnecessary because the C++ standard specifies that
1393 @code{operator new} will only return @code{0} if it is declared
1394 @samp{throw()}, in which case the compiler will always check the
1395 return value even without this option.  In all other cases, when
1396 @code{operator new} has a non-empty exception specification, memory
1397 exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
1398 @samp{new (nothrow)}.
1400 @item -fconserve-space
1401 @opindex fconserve-space
1402 Put uninitialized or runtime-initialized global variables into the
1403 common segment, as C does.  This saves space in the executable at the
1404 cost of not diagnosing duplicate definitions.  If you compile with this
1405 flag and your program mysteriously crashes after @code{main()} has
1406 completed, you may have an object that is being destroyed twice because
1407 two definitions were merged.
1409 This option is no longer useful on most targets, now that support has
1410 been added for putting variables into BSS without making them common.
1412 @item -fno-const-strings
1413 @opindex fno-const-strings
1414 Give string constants type @code{char *} instead of type @code{const
1415 char *}.  By default, G++ uses type @code{const char *} as required by
1416 the standard.  Even if you use @option{-fno-const-strings}, you cannot
1417 actually modify the value of a string constant.
1419 This option might be removed in a future release of G++.  For maximum
1420 portability, you should structure your code so that it works with
1421 string constants that have type @code{const char *}.
1423 @item -fno-elide-constructors
1424 @opindex fno-elide-constructors
1425 The C++ standard allows an implementation to omit creating a temporary
1426 which is only used to initialize another object of the same type.
1427 Specifying this option disables that optimization, and forces G++ to
1428 call the copy constructor in all cases.
1430 @item -fno-enforce-eh-specs
1431 @opindex fno-enforce-eh-specs
1432 Don't check for violation of exception specifications at runtime.  This
1433 option violates the C++ standard, but may be useful for reducing code
1434 size in production builds, much like defining @samp{NDEBUG}.  The compiler
1435 will still optimize based on the exception specifications.
1437 @item -ffor-scope
1438 @itemx -fno-for-scope
1439 @opindex ffor-scope
1440 @opindex fno-for-scope
1441 If @option{-ffor-scope} is specified, the scope of variables declared in
1442 a @i{for-init-statement} is limited to the @samp{for} loop itself,
1443 as specified by the C++ standard.
1444 If @option{-fno-for-scope} is specified, the scope of variables declared in
1445 a @i{for-init-statement} extends to the end of the enclosing scope,
1446 as was the case in old versions of G++, and other (traditional)
1447 implementations of C++.
1449 The default if neither flag is given to follow the standard,
1450 but to allow and give a warning for old-style code that would
1451 otherwise be invalid, or have different behavior.
1453 @item -fno-gnu-keywords
1454 @opindex fno-gnu-keywords
1455 Do not recognize @code{typeof} as a keyword, so that code can use this
1456 word as an identifier.  You can use the keyword @code{__typeof__} instead.
1457 @option{-ansi} implies @option{-fno-gnu-keywords}.
1459 @item -fno-implicit-templates
1460 @opindex fno-implicit-templates
1461 Never emit code for non-inline templates which are instantiated
1462 implicitly (i.e.@: by use); only emit code for explicit instantiations.
1463 @xref{Template Instantiation}, for more information.
1465 @item -fno-implicit-inline-templates
1466 @opindex fno-implicit-inline-templates
1467 Don't emit code for implicit instantiations of inline templates, either.
1468 The default is to handle inlines differently so that compiles with and
1469 without optimization will need the same set of explicit instantiations.
1471 @item -fno-implement-inlines
1472 @opindex fno-implement-inlines
1473 To save space, do not emit out-of-line copies of inline functions
1474 controlled by @samp{#pragma implementation}.  This will cause linker
1475 errors if these functions are not inlined everywhere they are called.
1477 @item -fms-extensions
1478 @opindex fms-extensions
1479 Disable pedantic warnings about constructs used in MFC, such as implicit
1480 int and getting a pointer to member function via non-standard syntax.
1482 @item -fno-nonansi-builtins
1483 @opindex fno-nonansi-builtins
1484 Disable built-in declarations of functions that are not mandated by
1485 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
1486 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
1488 @item -fno-operator-names
1489 @opindex fno-operator-names
1490 Do not treat the operator name keywords @code{and}, @code{bitand},
1491 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1492 synonyms as keywords.
1494 @item -fno-optional-diags
1495 @opindex fno-optional-diags
1496 Disable diagnostics that the standard says a compiler does not need to
1497 issue.  Currently, the only such diagnostic issued by G++ is the one for
1498 a name having multiple meanings within a class.
1500 @item -fpermissive
1501 @opindex fpermissive
1502 Downgrade some diagnostics about nonconformant code from errors to
1503 warnings.  Thus, using @option{-fpermissive} will allow some
1504 nonconforming code to compile.
1506 @item -frepo
1507 @opindex frepo
1508 Enable automatic template instantiation at link time.  This option also
1509 implies @option{-fno-implicit-templates}.  @xref{Template
1510 Instantiation}, for more information.
1512 @item -fno-rtti
1513 @opindex fno-rtti
1514 Disable generation of information about every class with virtual
1515 functions for use by the C++ runtime type identification features
1516 (@samp{dynamic_cast} and @samp{typeid}).  If you don't use those parts
1517 of the language, you can save some space by using this flag.  Note that
1518 exception handling uses the same information, but it will generate it as
1519 needed.
1521 @item -fstats
1522 @opindex fstats
1523 Emit statistics about front-end processing at the end of the compilation.
1524 This information is generally only useful to the G++ development team.
1526 @item -ftemplate-depth-@var{n}
1527 @opindex ftemplate-depth
1528 Set the maximum instantiation depth for template classes to @var{n}.
1529 A limit on the template instantiation depth is needed to detect
1530 endless recursions during template class instantiation.  ANSI/ISO C++
1531 conforming programs must not rely on a maximum depth greater than 17.
1533 @item -fno-threadsafe-statics
1534 @opindex fno-threadsafe-statics
1535 Do not emit the extra code to use the routines specified in the C++
1536 ABI for thread-safe initialization of local statics.  You can use this
1537 option to reduce code size slightly in code that doesn't need to be
1538 thread-safe.
1540 @item -fuse-cxa-atexit
1541 @opindex fuse-cxa-atexit
1542 Register destructors for objects with static storage duration with the
1543 @code{__cxa_atexit} function rather than the @code{atexit} function.
1544 This option is required for fully standards-compliant handling of static
1545 destructors, but will only work if your C library supports
1546 @code{__cxa_atexit}.
1548 @item -fvisibility-inlines-hidden
1549 @opindex fvisibility-inlines-hidden
1550 Causes all inlined methods to be marked with
1551 @code{__attribute__ ((visibility ("hidden")))} so that they do not
1552 appear in the export table of a DSO and do not require a PLT indirection
1553 when used within the DSO@.  Enabling this option can have a dramatic effect
1554 on load and link times of a DSO as it massively reduces the size of the
1555 dynamic export table when the library makes heavy use of templates.  While
1556 it can cause bloating through duplication of code within each DSO where
1557 it is used, often the wastage is less than the considerable space occupied
1558 by a long symbol name in the export table which is typical when using
1559 templates and namespaces.  For even more savings, combine with the
1560 @option{-fvisibility=hidden} switch.
1562 @item -fno-weak
1563 @opindex fno-weak
1564 Do not use weak symbol support, even if it is provided by the linker.
1565 By default, G++ will use weak symbols if they are available.  This
1566 option exists only for testing, and should not be used by end-users;
1567 it will result in inferior code and has no benefits.  This option may
1568 be removed in a future release of G++.
1570 @item -nostdinc++
1571 @opindex nostdinc++
1572 Do not search for header files in the standard directories specific to
1573 C++, but do still search the other standard directories.  (This option
1574 is used when building the C++ library.)
1575 @end table
1577 In addition, these optimization, warning, and code generation options
1578 have meanings only for C++ programs:
1580 @table @gcctabopt
1581 @item -fno-default-inline
1582 @opindex fno-default-inline
1583 Do not assume @samp{inline} for functions defined inside a class scope.
1584 @xref{Optimize Options,,Options That Control Optimization}.  Note that these
1585 functions will have linkage like inline functions; they just won't be
1586 inlined by default.
1588 @item -Wabi @r{(C++ only)}
1589 @opindex Wabi
1590 Warn when G++ generates code that is probably not compatible with the
1591 vendor-neutral C++ ABI@.  Although an effort has been made to warn about
1592 all such cases, there are probably some cases that are not warned about,
1593 even though G++ is generating incompatible code.  There may also be
1594 cases where warnings are emitted even though the code that is generated
1595 will be compatible.
1597 You should rewrite your code to avoid these warnings if you are
1598 concerned about the fact that code generated by G++ may not be binary
1599 compatible with code generated by other compilers.
1601 The known incompatibilities at this point include:
1603 @itemize @bullet
1605 @item
1606 Incorrect handling of tail-padding for bit-fields.  G++ may attempt to
1607 pack data into the same byte as a base class.  For example:
1609 @smallexample
1610 struct A @{ virtual void f(); int f1 : 1; @};
1611 struct B : public A @{ int f2 : 1; @};
1612 @end smallexample
1614 @noindent
1615 In this case, G++ will place @code{B::f2} into the same byte
1616 as@code{A::f1}; other compilers will not.  You can avoid this problem
1617 by explicitly padding @code{A} so that its size is a multiple of the
1618 byte size on your platform; that will cause G++ and other compilers to
1619 layout @code{B} identically.
1621 @item
1622 Incorrect handling of tail-padding for virtual bases.  G++ does not use
1623 tail padding when laying out virtual bases.  For example:
1625 @smallexample
1626 struct A @{ virtual void f(); char c1; @};
1627 struct B @{ B(); char c2; @};
1628 struct C : public A, public virtual B @{@};
1629 @end smallexample
1631 @noindent
1632 In this case, G++ will not place @code{B} into the tail-padding for
1633 @code{A}; other compilers will.  You can avoid this problem by
1634 explicitly padding @code{A} so that its size is a multiple of its
1635 alignment (ignoring virtual base classes); that will cause G++ and other
1636 compilers to layout @code{C} identically.
1638 @item
1639 Incorrect handling of bit-fields with declared widths greater than that
1640 of their underlying types, when the bit-fields appear in a union.  For
1641 example:
1643 @smallexample
1644 union U @{ int i : 4096; @};
1645 @end smallexample
1647 @noindent
1648 Assuming that an @code{int} does not have 4096 bits, G++ will make the
1649 union too small by the number of bits in an @code{int}.
1651 @item
1652 Empty classes can be placed at incorrect offsets.  For example:
1654 @smallexample
1655 struct A @{@};
1657 struct B @{
1658   A a;
1659   virtual void f ();
1662 struct C : public B, public A @{@};
1663 @end smallexample
1665 @noindent
1666 G++ will place the @code{A} base class of @code{C} at a nonzero offset;
1667 it should be placed at offset zero.  G++ mistakenly believes that the
1668 @code{A} data member of @code{B} is already at offset zero.
1670 @item
1671 Names of template functions whose types involve @code{typename} or
1672 template template parameters can be mangled incorrectly.
1674 @smallexample
1675 template <typename Q>
1676 void f(typename Q::X) @{@}
1678 template <template <typename> class Q>
1679 void f(typename Q<int>::X) @{@}
1680 @end smallexample
1682 @noindent
1683 Instantiations of these templates may be mangled incorrectly.
1685 @end itemize
1687 @item -Wctor-dtor-privacy @r{(C++ only)}
1688 @opindex Wctor-dtor-privacy
1689 Warn when a class seems unusable because all the constructors or
1690 destructors in that class are private, and it has neither friends nor
1691 public static member functions.
1693 @item -Wnon-virtual-dtor @r{(C++ only)}
1694 @opindex Wnon-virtual-dtor
1695 Warn when a class appears to be polymorphic, thereby requiring a virtual
1696 destructor, yet it declares a non-virtual one.
1697 This warning is enabled by @option{-Wall}.
1699 @item -Wreorder @r{(C++ only)}
1700 @opindex Wreorder
1701 @cindex reordering, warning
1702 @cindex warning for reordering of member initializers
1703 Warn when the order of member initializers given in the code does not
1704 match the order in which they must be executed.  For instance:
1706 @smallexample
1707 struct A @{
1708   int i;
1709   int j;
1710   A(): j (0), i (1) @{ @}
1712 @end smallexample
1714 The compiler will rearrange the member initializers for @samp{i}
1715 and @samp{j} to match the declaration order of the members, emitting
1716 a warning to that effect.  This warning is enabled by @option{-Wall}.
1717 @end table
1719 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
1721 @table @gcctabopt
1722 @item -Weffc++ @r{(C++ only)}
1723 @opindex Weffc++
1724 Warn about violations of the following style guidelines from Scott Meyers'
1725 @cite{Effective C++} book:
1727 @itemize @bullet
1728 @item
1729 Item 11:  Define a copy constructor and an assignment operator for classes
1730 with dynamically allocated memory.
1732 @item
1733 Item 12:  Prefer initialization to assignment in constructors.
1735 @item
1736 Item 14:  Make destructors virtual in base classes.
1738 @item
1739 Item 15:  Have @code{operator=} return a reference to @code{*this}.
1741 @item
1742 Item 23:  Don't try to return a reference when you must return an object.
1744 @end itemize
1746 Also warn about violations of the following style guidelines from
1747 Scott Meyers' @cite{More Effective C++} book:
1749 @itemize @bullet
1750 @item
1751 Item 6:  Distinguish between prefix and postfix forms of increment and
1752 decrement operators.
1754 @item
1755 Item 7:  Never overload @code{&&}, @code{||}, or @code{,}.
1757 @end itemize
1759 When selecting this option, be aware that the standard library
1760 headers do not obey all of these guidelines; use @samp{grep -v}
1761 to filter out those warnings.
1763 @item -Wno-deprecated @r{(C++ only)}
1764 @opindex Wno-deprecated
1765 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
1767 @item -Wstrict-null-sentinel @r{(C++ only)}
1768 @opindex Wstrict-null-sentinel
1769 Warn also about the use of an uncasted @code{NULL} as sentinel.  When
1770 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
1771 to @code{__null}.  Although it is a null pointer constant not a null pointer,
1772 it is guaranteed to of the same size as a pointer.  But this use is
1773 not portable across different compilers.
1775 @item -Wno-non-template-friend @r{(C++ only)}
1776 @opindex Wno-non-template-friend
1777 Disable warnings when non-templatized friend functions are declared
1778 within a template.  Since the advent of explicit template specification
1779 support in G++, if the name of the friend is an unqualified-id (i.e.,
1780 @samp{friend foo(int)}), the C++ language specification demands that the
1781 friend declare or define an ordinary, nontemplate function.  (Section
1782 14.5.3).  Before G++ implemented explicit specification, unqualified-ids
1783 could be interpreted as a particular specialization of a templatized
1784 function.  Because this non-conforming behavior is no longer the default
1785 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
1786 check existing code for potential trouble spots and is on by default.
1787 This new compiler behavior can be turned off with
1788 @option{-Wno-non-template-friend} which keeps the conformant compiler code
1789 but disables the helpful warning.
1791 @item -Wold-style-cast @r{(C++ only)}
1792 @opindex Wold-style-cast
1793 Warn if an old-style (C-style) cast to a non-void type is used within
1794 a C++ program.  The new-style casts (@samp{static_cast},
1795 @samp{reinterpret_cast}, and @samp{const_cast}) are less vulnerable to
1796 unintended effects and much easier to search for.
1798 @item -Woverloaded-virtual @r{(C++ only)}
1799 @opindex Woverloaded-virtual
1800 @cindex overloaded virtual fn, warning
1801 @cindex warning for overloaded virtual fn
1802 Warn when a function declaration hides virtual functions from a
1803 base class.  For example, in:
1805 @smallexample
1806 struct A @{
1807   virtual void f();
1810 struct B: public A @{
1811   void f(int);
1813 @end smallexample
1815 the @code{A} class version of @code{f} is hidden in @code{B}, and code
1816 like:
1818 @smallexample
1819 B* b;
1820 b->f();
1821 @end smallexample
1823 will fail to compile.
1825 @item -Wno-pmf-conversions @r{(C++ only)}
1826 @opindex Wno-pmf-conversions
1827 Disable the diagnostic for converting a bound pointer to member function
1828 to a plain pointer.
1830 @item -Wsign-promo @r{(C++ only)}
1831 @opindex Wsign-promo
1832 Warn when overload resolution chooses a promotion from unsigned or
1833 enumerated type to a signed type, over a conversion to an unsigned type of
1834 the same size.  Previous versions of G++ would try to preserve
1835 unsignedness, but the standard mandates the current behavior.
1837 @smallexample
1838 struct A @{
1839   operator int ();
1840   A& operator = (int);
1843 main ()
1845   A a,b;
1846   a = b;
1848 @end smallexample
1850 In this example, G++ will synthesize a default @samp{A& operator =
1851 (const A&);}, while cfront will use the user-defined @samp{operator =}.
1852 @end table
1854 @node Objective-C and Objective-C++ Dialect Options
1855 @section Options Controlling Objective-C and Objective-C++ Dialects
1857 @cindex compiler options, Objective-C and Objective-C++
1858 @cindex Objective-C and Objective-C++ options, command line
1859 @cindex options, Objective-C and Objective-C++
1860 (NOTE: This manual does not describe the Objective-C and Objective-C++
1861 languages themselves.  See @xref{Standards,,Language Standards
1862 Supported by GCC}, for references.)
1864 This section describes the command-line options that are only meaningful
1865 for Objective-C and Objective-C++ programs, but you can also use most of
1866 the language-independent GNU compiler options.
1867 For example, you might compile a file @code{some_class.m} like this:
1869 @smallexample
1870 gcc -g -fgnu-runtime -O -c some_class.m
1871 @end smallexample
1873 @noindent
1874 In this example, @option{-fgnu-runtime} is an option meant only for
1875 Objective-C and Objective-C++ programs; you can use the other options with
1876 any language supported by GCC@.
1878 Note that since Objective-C is an extension of the C language, Objective-C
1879 compilations may also use options specific to the C front-end (e.g.,
1880 @option{-Wtraditional}).  Similarly, Objective-C++ compilations may use
1881 C++-specific options (e.g., @option{-Wabi}).
1883 Here is a list of options that are @emph{only} for compiling Objective-C
1884 and Objective-C++ programs:
1886 @table @gcctabopt
1887 @item -fconstant-string-class=@var{class-name}
1888 @opindex fconstant-string-class
1889 Use @var{class-name} as the name of the class to instantiate for each
1890 literal string specified with the syntax @code{@@"@dots{}"}.  The default
1891 class name is @code{NXConstantString} if the GNU runtime is being used, and
1892 @code{NSConstantString} if the NeXT runtime is being used (see below).  The
1893 @option{-fconstant-cfstrings} option, if also present, will override the
1894 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
1895 to be laid out as constant CoreFoundation strings.
1897 @item -fgnu-runtime
1898 @opindex fgnu-runtime
1899 Generate object code compatible with the standard GNU Objective-C
1900 runtime.  This is the default for most types of systems.
1902 @item -fnext-runtime
1903 @opindex fnext-runtime
1904 Generate output compatible with the NeXT runtime.  This is the default
1905 for NeXT-based systems, including Darwin and Mac OS X@.  The macro
1906 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
1907 used.
1909 @item -fno-nil-receivers
1910 @opindex fno-nil-receivers
1911 Assume that all Objective-C message dispatches (e.g.,
1912 @code{[receiver message:arg]}) in this translation unit ensure that the receiver
1913 is not @code{nil}.  This allows for more efficient entry points in the runtime
1914 to be used.  Currently, this option is only available in conjunction with
1915 the NeXT runtime on Mac OS X 10.3 and later.
1917 @item -fobjc-call-cxx-cdtors
1918 @opindex fobjc-call-cxx-cdtors
1919 For each Objective-C class, check if any of its instance variables is a
1920 C++ object with a non-trivial default constructor.  If so, synthesize a
1921 special @code{- (id) .cxx_construct} instance method that will run
1922 non-trivial default constructors on any such instance variables, in order,
1923 and then return @code{self}.  Similarly, check if any instance variable
1924 is a C++ object with a non-trivial destructor, and if so, synthesize a
1925 special @code{- (void) .cxx_destruct} method that will run
1926 all such default destructors, in reverse order.
1928 The @code{- (id) .cxx_construct} and/or @code{- (void) .cxx_destruct} methods
1929 thusly generated will only operate on instance variables declared in the
1930 current Objective-C class, and not those inherited from superclasses.  It
1931 is the responsibility of the Objective-C runtime to invoke all such methods
1932 in an object's inheritance hierarchy.  The @code{- (id) .cxx_construct} methods
1933 will be invoked by the runtime immediately after a new object
1934 instance is allocated; the @code{- (void) .cxx_destruct} methods will
1935 be invoked immediately before the runtime deallocates an object instance.
1937 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
1938 support for invoking the @code{- (id) .cxx_construct} and
1939 @code{- (void) .cxx_destruct} methods.
1941 @item -fobjc-direct-dispatch
1942 @opindex fobjc-direct-dispatch
1943 Allow fast jumps to the message dispatcher.  On Darwin this is
1944 accomplished via the comm page.
1946 @item -fobjc-exceptions
1947 @opindex fobjc-exceptions
1948 Enable syntactic support for structured exception handling in Objective-C,
1949 similar to what is offered by C++ and Java.  Currently, this option is only
1950 available in conjunction with the NeXT runtime on Mac OS X 10.3 and later.
1952 @smallexample
1953   @@try @{
1954     @dots{}
1955        @@throw expr;
1956     @dots{}
1957   @}
1958   @@catch (AnObjCClass *exc) @{
1959     @dots{}
1960       @@throw expr;
1961     @dots{}
1962       @@throw;
1963     @dots{}
1964   @}
1965   @@catch (AnotherClass *exc) @{
1966     @dots{}
1967   @}
1968   @@catch (id allOthers) @{
1969     @dots{}
1970   @}
1971   @@finally @{
1972     @dots{}
1973       @@throw expr;
1974     @dots{}
1975   @}
1976 @end smallexample
1978 The @code{@@throw} statement may appear anywhere in an Objective-C or
1979 Objective-C++ program; when used inside of a @code{@@catch} block, the
1980 @code{@@throw} may appear without an argument (as shown above), in which case
1981 the object caught by the @code{@@catch} will be rethrown.
1983 Note that only (pointers to) Objective-C objects may be thrown and
1984 caught using this scheme.  When an object is thrown, it will be caught
1985 by the nearest @code{@@catch} clause capable of handling objects of that type,
1986 analogously to how @code{catch} blocks work in C++ and Java.  A
1987 @code{@@catch(id @dots{})} clause (as shown above) may also be provided to catch
1988 any and all Objective-C exceptions not caught by previous @code{@@catch}
1989 clauses (if any).
1991 The @code{@@finally} clause, if present, will be executed upon exit from the
1992 immediately preceding @code{@@try @dots{} @@catch} section.  This will happen
1993 regardless of whether any exceptions are thrown, caught or rethrown
1994 inside the @code{@@try @dots{} @@catch} section, analogously to the behavior
1995 of the @code{finally} clause in Java.
1997 There are several caveats to using the new exception mechanism:
1999 @itemize @bullet
2000 @item
2001 Although currently designed to be binary compatible with @code{NS_HANDLER}-style
2002 idioms provided by the @code{NSException} class, the new
2003 exceptions can only be used on Mac OS X 10.3 (Panther) and later
2004 systems, due to additional functionality needed in the (NeXT) Objective-C
2005 runtime.
2007 @item
2008 As mentioned above, the new exceptions do not support handling
2009 types other than Objective-C objects.   Furthermore, when used from
2010 Objective-C++, the Objective-C exception model does not interoperate with C++
2011 exceptions at this time.  This means you cannot @code{@@throw} an exception
2012 from Objective-C and @code{catch} it in C++, or vice versa
2013 (i.e., @code{throw @dots{} @@catch}).
2014 @end itemize
2016 The @option{-fobjc-exceptions} switch also enables the use of synchronization
2017 blocks for thread-safe execution:
2019 @smallexample
2020   @@synchronized (ObjCClass *guard) @{
2021     @dots{}
2022   @}
2023 @end smallexample
2025 Upon entering the @code{@@synchronized} block, a thread of execution shall
2026 first check whether a lock has been placed on the corresponding @code{guard}
2027 object by another thread.  If it has, the current thread shall wait until
2028 the other thread relinquishes its lock.  Once @code{guard} becomes available,
2029 the current thread will place its own lock on it, execute the code contained in
2030 the @code{@@synchronized} block, and finally relinquish the lock (thereby
2031 making @code{guard} available to other threads).
2033 Unlike Java, Objective-C does not allow for entire methods to be marked
2034 @code{@@synchronized}.  Note that throwing exceptions out of
2035 @code{@@synchronized} blocks is allowed, and will cause the guarding object
2036 to be unlocked properly.
2038 @item -fobjc-gc
2039 @opindex fobjc-gc
2040 Enable garbage collection (GC) in Objective-C and Objective-C++ programs.
2042 @item -freplace-objc-classes
2043 @opindex freplace-objc-classes
2044 Emit a special marker instructing @command{ld(1)} not to statically link in
2045 the resulting object file, and allow @command{dyld(1)} to load it in at
2046 run time instead.  This is used in conjunction with the Fix-and-Continue
2047 debugging mode, where the object file in question may be recompiled and
2048 dynamically reloaded in the course of program execution, without the need
2049 to restart the program itself.  Currently, Fix-and-Continue functionality
2050 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
2051 and later.
2053 @item -fzero-link
2054 @opindex fzero-link
2055 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
2056 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
2057 compile time) with static class references that get initialized at load time,
2058 which improves run-time performance.  Specifying the @option{-fzero-link} flag
2059 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
2060 to be retained.  This is useful in Zero-Link debugging mode, since it allows
2061 for individual class implementations to be modified during program execution.
2063 @item -gen-decls
2064 @opindex gen-decls
2065 Dump interface declarations for all classes seen in the source file to a
2066 file named @file{@var{sourcename}.decl}.
2068 @item -Wassign-intercept
2069 @opindex Wassign-intercept
2070 Warn whenever an Objective-C assignment is being intercepted by the
2071 garbage collector.
2073 @item -Wno-protocol
2074 @opindex Wno-protocol
2075 If a class is declared to implement a protocol, a warning is issued for
2076 every method in the protocol that is not implemented by the class.  The
2077 default behavior is to issue a warning for every method not explicitly
2078 implemented in the class, even if a method implementation is inherited
2079 from the superclass.  If you use the @option{-Wno-protocol} option, then
2080 methods inherited from the superclass are considered to be implemented,
2081 and no warning is issued for them.
2083 @item -Wselector
2084 @opindex Wselector
2085 Warn if multiple methods of different types for the same selector are
2086 found during compilation.  The check is performed on the list of methods
2087 in the final stage of compilation.  Additionally, a check is performed
2088 for each selector appearing in a @code{@@selector(@dots{})}
2089 expression, and a corresponding method for that selector has been found
2090 during compilation.  Because these checks scan the method table only at
2091 the end of compilation, these warnings are not produced if the final
2092 stage of compilation is not reached, for example because an error is
2093 found during compilation, or because the @option{-fsyntax-only} option is
2094 being used.
2096 @item -Wstrict-selector-match
2097 @opindex Wstrict-selector-match
2098 Warn if multiple methods with differing argument and/or return types are
2099 found for a given selector when attempting to send a message using this
2100 selector to a receiver of type @code{id} or @code{Class}.  When this flag
2101 is off (which is the default behavior), the compiler will omit such warnings
2102 if any differences found are confined to types which share the same size
2103 and alignment.
2105 @item -Wundeclared-selector
2106 @opindex Wundeclared-selector
2107 Warn if a @code{@@selector(@dots{})} expression referring to an
2108 undeclared selector is found.  A selector is considered undeclared if no
2109 method with that name has been declared before the
2110 @code{@@selector(@dots{})} expression, either explicitly in an
2111 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
2112 an @code{@@implementation} section.  This option always performs its
2113 checks as soon as a @code{@@selector(@dots{})} expression is found,
2114 while @option{-Wselector} only performs its checks in the final stage of
2115 compilation.  This also enforces the coding style convention
2116 that methods and selectors must be declared before being used.
2118 @item -print-objc-runtime-info
2119 @opindex print-objc-runtime-info
2120 Generate C header describing the largest structure that is passed by
2121 value, if any.
2123 @end table
2125 @node Language Independent Options
2126 @section Options to Control Diagnostic Messages Formatting
2127 @cindex options to control diagnostics formatting
2128 @cindex diagnostic messages
2129 @cindex message formatting
2131 Traditionally, diagnostic messages have been formatted irrespective of
2132 the output device's aspect (e.g.@: its width, @dots{}).  The options described
2133 below can be used to control the diagnostic messages formatting
2134 algorithm, e.g.@: how many characters per line, how often source location
2135 information should be reported.  Right now, only the C++ front end can
2136 honor these options.  However it is expected, in the near future, that
2137 the remaining front ends would be able to digest them correctly.
2139 @table @gcctabopt
2140 @item -fmessage-length=@var{n}
2141 @opindex fmessage-length
2142 Try to format error messages so that they fit on lines of about @var{n}
2143 characters.  The default is 72 characters for @command{g++} and 0 for the rest of
2144 the front ends supported by GCC@.  If @var{n} is zero, then no
2145 line-wrapping will be done; each error message will appear on a single
2146 line.
2148 @opindex fdiagnostics-show-location
2149 @item -fdiagnostics-show-location=once
2150 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
2151 reporter to emit @emph{once} source location information; that is, in
2152 case the message is too long to fit on a single physical line and has to
2153 be wrapped, the source location won't be emitted (as prefix) again,
2154 over and over, in subsequent continuation lines.  This is the default
2155 behavior.
2157 @item -fdiagnostics-show-location=every-line
2158 Only meaningful in line-wrapping mode.  Instructs the diagnostic
2159 messages reporter to emit the same source location information (as
2160 prefix) for physical lines that result from the process of breaking
2161 a message which is too long to fit on a single line.
2163 @item -fdiagnostics-show-options
2164 @opindex fdiagnostics-show-options
2165 This option instructs the diagnostic machinery to add text to each
2166 diagnostic emitted, which indicates which command line option directly
2167 controls that diagnostic, when such an option is known to the
2168 diagnostic machinery.
2170 @end table
2172 @node Warning Options
2173 @section Options to Request or Suppress Warnings
2174 @cindex options to control warnings
2175 @cindex warning messages
2176 @cindex messages, warning
2177 @cindex suppressing warnings
2179 Warnings are diagnostic messages that report constructions which
2180 are not inherently erroneous but which are risky or suggest there
2181 may have been an error.
2183 You can request many specific warnings with options beginning @samp{-W},
2184 for example @option{-Wimplicit} to request warnings on implicit
2185 declarations.  Each of these specific warning options also has a
2186 negative form beginning @samp{-Wno-} to turn off warnings;
2187 for example, @option{-Wno-implicit}.  This manual lists only one of the
2188 two forms, whichever is not the default.
2190 The following options control the amount and kinds of warnings produced
2191 by GCC; for further, language-specific options also refer to
2192 @ref{C++ Dialect Options} and @ref{Objective-C and Objective-C++ Dialect
2193 Options}.
2195 @table @gcctabopt
2196 @cindex syntax checking
2197 @item -fsyntax-only
2198 @opindex fsyntax-only
2199 Check the code for syntax errors, but don't do anything beyond that.
2201 @item -pedantic
2202 @opindex pedantic
2203 Issue all the warnings demanded by strict ISO C and ISO C++;
2204 reject all programs that use forbidden extensions, and some other
2205 programs that do not follow ISO C and ISO C++.  For ISO C, follows the
2206 version of the ISO C standard specified by any @option{-std} option used.
2208 Valid ISO C and ISO C++ programs should compile properly with or without
2209 this option (though a rare few will require @option{-ansi} or a
2210 @option{-std} option specifying the required version of ISO C)@.  However,
2211 without this option, certain GNU extensions and traditional C and C++
2212 features are supported as well.  With this option, they are rejected.
2214 @option{-pedantic} does not cause warning messages for use of the
2215 alternate keywords whose names begin and end with @samp{__}.  Pedantic
2216 warnings are also disabled in the expression that follows
2217 @code{__extension__}.  However, only system header files should use
2218 these escape routes; application programs should avoid them.
2219 @xref{Alternate Keywords}.
2221 Some users try to use @option{-pedantic} to check programs for strict ISO
2222 C conformance.  They soon find that it does not do quite what they want:
2223 it finds some non-ISO practices, but not all---only those for which
2224 ISO C @emph{requires} a diagnostic, and some others for which
2225 diagnostics have been added.
2227 A feature to report any failure to conform to ISO C might be useful in
2228 some instances, but would require considerable additional work and would
2229 be quite different from @option{-pedantic}.  We don't have plans to
2230 support such a feature in the near future.
2232 Where the standard specified with @option{-std} represents a GNU
2233 extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
2234 corresponding @dfn{base standard}, the version of ISO C on which the GNU
2235 extended dialect is based.  Warnings from @option{-pedantic} are given
2236 where they are required by the base standard.  (It would not make sense
2237 for such warnings to be given only for features not in the specified GNU
2238 C dialect, since by definition the GNU dialects of C include all
2239 features the compiler supports with the given option, and there would be
2240 nothing to warn about.)
2242 @item -pedantic-errors
2243 @opindex pedantic-errors
2244 Like @option{-pedantic}, except that errors are produced rather than
2245 warnings.
2247 @item -w
2248 @opindex w
2249 Inhibit all warning messages.
2251 @item -Wno-import
2252 @opindex Wno-import
2253 Inhibit warning messages about the use of @samp{#import}.
2255 @item -Wchar-subscripts
2256 @opindex Wchar-subscripts
2257 Warn if an array subscript has type @code{char}.  This is a common cause
2258 of error, as programmers often forget that this type is signed on some
2259 machines.
2260 This warning is enabled by @option{-Wall}.
2262 @item -Wcomment
2263 @opindex Wcomment
2264 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
2265 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
2266 This warning is enabled by @option{-Wall}.
2268 @item -Wfatal-errors
2269 @opindex Wfatal-errors
2270 This option causes the compiler to abort compilation on the first error
2271 occurred rather than trying to keep going and printing further error
2272 messages.
2274 @item -Wformat
2275 @opindex Wformat
2276 @opindex ffreestanding
2277 @opindex fno-builtin
2278 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
2279 the arguments supplied have types appropriate to the format string
2280 specified, and that the conversions specified in the format string make
2281 sense.  This includes standard functions, and others specified by format
2282 attributes (@pxref{Function Attributes}), in the @code{printf},
2283 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
2284 not in the C standard) families (or other target-specific families).
2285 Which functions are checked without format attributes having been
2286 specified depends on the standard version selected, and such checks of
2287 functions without the attribute specified are disabled by
2288 @option{-ffreestanding} or @option{-fno-builtin}.
2290 The formats are checked against the format features supported by GNU
2291 libc version 2.2.  These include all ISO C90 and C99 features, as well
2292 as features from the Single Unix Specification and some BSD and GNU
2293 extensions.  Other library implementations may not support all these
2294 features; GCC does not support warning about features that go beyond a
2295 particular library's limitations.  However, if @option{-pedantic} is used
2296 with @option{-Wformat}, warnings will be given about format features not
2297 in the selected standard version (but not for @code{strfmon} formats,
2298 since those are not in any version of the C standard).  @xref{C Dialect
2299 Options,,Options Controlling C Dialect}.
2301 Since @option{-Wformat} also checks for null format arguments for
2302 several functions, @option{-Wformat} also implies @option{-Wnonnull}.
2304 @option{-Wformat} is included in @option{-Wall}.  For more control over some
2305 aspects of format checking, the options @option{-Wformat-y2k},
2306 @option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
2307 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
2308 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
2310 @item -Wformat-y2k
2311 @opindex Wformat-y2k
2312 If @option{-Wformat} is specified, also warn about @code{strftime}
2313 formats which may yield only a two-digit year.
2315 @item -Wno-format-extra-args
2316 @opindex Wno-format-extra-args
2317 If @option{-Wformat} is specified, do not warn about excess arguments to a
2318 @code{printf} or @code{scanf} format function.  The C standard specifies
2319 that such arguments are ignored.
2321 Where the unused arguments lie between used arguments that are
2322 specified with @samp{$} operand number specifications, normally
2323 warnings are still given, since the implementation could not know what
2324 type to pass to @code{va_arg} to skip the unused arguments.  However,
2325 in the case of @code{scanf} formats, this option will suppress the
2326 warning if the unused arguments are all pointers, since the Single
2327 Unix Specification says that such unused arguments are allowed.
2329 @item -Wno-format-zero-length
2330 @opindex Wno-format-zero-length
2331 If @option{-Wformat} is specified, do not warn about zero-length formats.
2332 The C standard specifies that zero-length formats are allowed.
2334 @item -Wformat-nonliteral
2335 @opindex Wformat-nonliteral
2336 If @option{-Wformat} is specified, also warn if the format string is not a
2337 string literal and so cannot be checked, unless the format function
2338 takes its format arguments as a @code{va_list}.
2340 @item -Wformat-security
2341 @opindex Wformat-security
2342 If @option{-Wformat} is specified, also warn about uses of format
2343 functions that represent possible security problems.  At present, this
2344 warns about calls to @code{printf} and @code{scanf} functions where the
2345 format string is not a string literal and there are no format arguments,
2346 as in @code{printf (foo);}.  This may be a security hole if the format
2347 string came from untrusted input and contains @samp{%n}.  (This is
2348 currently a subset of what @option{-Wformat-nonliteral} warns about, but
2349 in future warnings may be added to @option{-Wformat-security} that are not
2350 included in @option{-Wformat-nonliteral}.)
2352 @item -Wformat=2
2353 @opindex Wformat=2
2354 Enable @option{-Wformat} plus format checks not included in
2355 @option{-Wformat}.  Currently equivalent to @samp{-Wformat
2356 -Wformat-nonliteral -Wformat-security -Wformat-y2k}.
2358 @item -Wnonnull
2359 @opindex Wnonnull
2360 Warn about passing a null pointer for arguments marked as
2361 requiring a non-null value by the @code{nonnull} function attribute.
2363 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
2364 can be disabled with the @option{-Wno-nonnull} option.
2366 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
2367 @opindex Winit-self
2368 Warn about uninitialized variables which are initialized with themselves.
2369 Note this option can only be used with the @option{-Wuninitialized} option,
2370 which in turn only works with @option{-O1} and above.
2372 For example, GCC will warn about @code{i} being uninitialized in the
2373 following snippet only when @option{-Winit-self} has been specified:
2374 @smallexample
2375 @group
2376 int f()
2378   int i = i;
2379   return i;
2381 @end group
2382 @end smallexample
2384 @item -Wimplicit-int
2385 @opindex Wimplicit-int
2386 Warn when a declaration does not specify a type.
2387 This warning is enabled by @option{-Wall}.
2389 @item -Wimplicit-function-declaration
2390 @itemx -Werror-implicit-function-declaration
2391 @opindex Wimplicit-function-declaration
2392 @opindex Werror-implicit-function-declaration
2393 Give a warning (or error) whenever a function is used before being
2394 declared.  The form @option{-Wno-error-implicit-function-declaration}
2395 is not supported.
2396 This warning is enabled by @option{-Wall} (as a warning, not an error).
2398 @item -Wimplicit
2399 @opindex Wimplicit
2400 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
2401 This warning is enabled by @option{-Wall}.
2403 @item -Wmain
2404 @opindex Wmain
2405 Warn if the type of @samp{main} is suspicious.  @samp{main} should be a
2406 function with external linkage, returning int, taking either zero
2407 arguments, two, or three arguments of appropriate types.
2408 This warning is enabled by @option{-Wall}.
2410 @item -Wmissing-braces
2411 @opindex Wmissing-braces
2412 Warn if an aggregate or union initializer is not fully bracketed.  In
2413 the following example, the initializer for @samp{a} is not fully
2414 bracketed, but that for @samp{b} is fully bracketed.
2416 @smallexample
2417 int a[2][2] = @{ 0, 1, 2, 3 @};
2418 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
2419 @end smallexample
2421 This warning is enabled by @option{-Wall}.
2423 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
2424 @opindex Wmissing-include-dirs
2425 Warn if a user-supplied include directory does not exist.
2427 @item -Wparentheses
2428 @opindex Wparentheses
2429 Warn if parentheses are omitted in certain contexts, such
2430 as when there is an assignment in a context where a truth value
2431 is expected, or when operators are nested whose precedence people
2432 often get confused about.  Only the warning for an assignment used as
2433 a truth value is supported when compiling C++; the other warnings are
2434 only supported when compiling C@.
2436 Also warn if a comparison like @samp{x<=y<=z} appears; this is
2437 equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
2438 interpretation from that of ordinary mathematical notation.
2440 Also warn about constructions where there may be confusion to which
2441 @code{if} statement an @code{else} branch belongs.  Here is an example of
2442 such a case:
2444 @smallexample
2445 @group
2447   if (a)
2448     if (b)
2449       foo ();
2450   else
2451     bar ();
2453 @end group
2454 @end smallexample
2456 In C, every @code{else} branch belongs to the innermost possible @code{if}
2457 statement, which in this example is @code{if (b)}.  This is often not
2458 what the programmer expected, as illustrated in the above example by
2459 indentation the programmer chose.  When there is the potential for this
2460 confusion, GCC will issue a warning when this flag is specified.
2461 To eliminate the warning, add explicit braces around the innermost
2462 @code{if} statement so there is no way the @code{else} could belong to
2463 the enclosing @code{if}.  The resulting code would look like this:
2465 @smallexample
2466 @group
2468   if (a)
2469     @{
2470       if (b)
2471         foo ();
2472       else
2473         bar ();
2474     @}
2476 @end group
2477 @end smallexample
2479 This warning is enabled by @option{-Wall}.
2481 @item -Wsequence-point
2482 @opindex Wsequence-point
2483 Warn about code that may have undefined semantics because of violations
2484 of sequence point rules in the C standard.
2486 The C standard defines the order in which expressions in a C program are
2487 evaluated in terms of @dfn{sequence points}, which represent a partial
2488 ordering between the execution of parts of the program: those executed
2489 before the sequence point, and those executed after it.  These occur
2490 after the evaluation of a full expression (one which is not part of a
2491 larger expression), after the evaluation of the first operand of a
2492 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
2493 function is called (but after the evaluation of its arguments and the
2494 expression denoting the called function), and in certain other places.
2495 Other than as expressed by the sequence point rules, the order of
2496 evaluation of subexpressions of an expression is not specified.  All
2497 these rules describe only a partial order rather than a total order,
2498 since, for example, if two functions are called within one expression
2499 with no sequence point between them, the order in which the functions
2500 are called is not specified.  However, the standards committee have
2501 ruled that function calls do not overlap.
2503 It is not specified when between sequence points modifications to the
2504 values of objects take effect.  Programs whose behavior depends on this
2505 have undefined behavior; the C standard specifies that ``Between the
2506 previous and next sequence point an object shall have its stored value
2507 modified at most once by the evaluation of an expression.  Furthermore,
2508 the prior value shall be read only to determine the value to be
2509 stored.''.  If a program breaks these rules, the results on any
2510 particular implementation are entirely unpredictable.
2512 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
2513 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
2514 diagnosed by this option, and it may give an occasional false positive
2515 result, but in general it has been found fairly effective at detecting
2516 this sort of problem in programs.
2518 The present implementation of this option only works for C programs.  A
2519 future implementation may also work for C++ programs.
2521 The C standard is worded confusingly, therefore there is some debate
2522 over the precise meaning of the sequence point rules in subtle cases.
2523 Links to discussions of the problem, including proposed formal
2524 definitions, may be found on the GCC readings page, at
2525 @w{@uref{http://gcc.gnu.org/readings.html}}.
2527 This warning is enabled by @option{-Wall}.
2529 @item -Wreturn-type
2530 @opindex Wreturn-type
2531 Warn whenever a function is defined with a return-type that defaults to
2532 @code{int}.  Also warn about any @code{return} statement with no
2533 return-value in a function whose return-type is not @code{void}.
2535 For C, also warn if the return type of a function has a type qualifier
2536 such as @code{const}.  Such a type qualifier has no effect, since the
2537 value returned by a function is not an lvalue.  ISO C prohibits
2538 qualified @code{void} return types on function definitions, so such
2539 return types always receive a warning even without this option.
2541 For C++, a function without return type always produces a diagnostic
2542 message, even when @option{-Wno-return-type} is specified.  The only
2543 exceptions are @samp{main} and functions defined in system headers.
2545 This warning is enabled by @option{-Wall}.
2547 @item -Wswitch
2548 @opindex Wswitch
2549 Warn whenever a @code{switch} statement has an index of enumerated type
2550 and lacks a @code{case} for one or more of the named codes of that
2551 enumeration.  (The presence of a @code{default} label prevents this
2552 warning.)  @code{case} labels outside the enumeration range also
2553 provoke warnings when this option is used.
2554 This warning is enabled by @option{-Wall}.
2556 @item -Wswitch-default
2557 @opindex Wswitch-switch
2558 Warn whenever a @code{switch} statement does not have a @code{default}
2559 case.
2561 @item -Wswitch-enum
2562 @opindex Wswitch-enum
2563 Warn whenever a @code{switch} statement has an index of enumerated type
2564 and lacks a @code{case} for one or more of the named codes of that
2565 enumeration.  @code{case} labels outside the enumeration range also
2566 provoke warnings when this option is used.
2568 @item -Wtrigraphs
2569 @opindex Wtrigraphs
2570 Warn if any trigraphs are encountered that might change the meaning of
2571 the program (trigraphs within comments are not warned about).
2572 This warning is enabled by @option{-Wall}.
2574 @item -Wunused-function
2575 @opindex Wunused-function
2576 Warn whenever a static function is declared but not defined or a
2577 non\-inline static function is unused.
2578 This warning is enabled by @option{-Wall}.
2580 @item -Wunused-label
2581 @opindex Wunused-label
2582 Warn whenever a label is declared but not used.
2583 This warning is enabled by @option{-Wall}.
2585 To suppress this warning use the @samp{unused} attribute
2586 (@pxref{Variable Attributes}).
2588 @item -Wunused-parameter
2589 @opindex Wunused-parameter
2590 Warn whenever a function parameter is unused aside from its declaration.
2592 To suppress this warning use the @samp{unused} attribute
2593 (@pxref{Variable Attributes}).
2595 @item -Wunused-variable
2596 @opindex Wunused-variable
2597 Warn whenever a local variable or non-constant static variable is unused
2598 aside from its declaration
2599 This warning is enabled by @option{-Wall}.
2601 To suppress this warning use the @samp{unused} attribute
2602 (@pxref{Variable Attributes}).
2604 @item -Wunused-value
2605 @opindex Wunused-value
2606 Warn whenever a statement computes a result that is explicitly not used.
2607 This warning is enabled by @option{-Wall}.
2609 To suppress this warning cast the expression to @samp{void}.
2611 @item -Wunused
2612 @opindex Wunused
2613 All the above @option{-Wunused} options combined.
2615 In order to get a warning about an unused function parameter, you must
2616 either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
2617 @samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
2619 @item -Wuninitialized
2620 @opindex Wuninitialized
2621 Warn if an automatic variable is used without first being initialized or
2622 if a variable may be clobbered by a @code{setjmp} call.
2624 These warnings are possible only in optimizing compilation,
2625 because they require data flow information that is computed only
2626 when optimizing.  If you don't specify @option{-O}, you simply won't
2627 get these warnings.
2629 If you want to warn about code which uses the uninitialized value of the
2630 variable in its own initializer, use the @option{-Winit-self} option.
2632 These warnings occur for individual uninitialized or clobbered
2633 elements of structure, union or array variables as well as for
2634 variables which are uninitialized or clobbered as a whole.  They do
2635 not occur for variables or elements declared @code{volatile}.  Because
2636 these warnings depend on optimization, the exact variables or elements
2637 for which there are warnings will depend on the precise optimization
2638 options and version of GCC used.
2640 Note that there may be no warning about a variable that is used only
2641 to compute a value that itself is never used, because such
2642 computations may be deleted by data flow analysis before the warnings
2643 are printed.
2645 These warnings are made optional because GCC is not smart
2646 enough to see all the reasons why the code might be correct
2647 despite appearing to have an error.  Here is one example of how
2648 this can happen:
2650 @smallexample
2651 @group
2653   int x;
2654   switch (y)
2655     @{
2656     case 1: x = 1;
2657       break;
2658     case 2: x = 4;
2659       break;
2660     case 3: x = 5;
2661     @}
2662   foo (x);
2664 @end group
2665 @end smallexample
2667 @noindent
2668 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
2669 always initialized, but GCC doesn't know this.  Here is
2670 another common case:
2672 @smallexample
2674   int save_y;
2675   if (change_y) save_y = y, y = new_y;
2676   @dots{}
2677   if (change_y) y = save_y;
2679 @end smallexample
2681 @noindent
2682 This has no bug because @code{save_y} is used only if it is set.
2684 @cindex @code{longjmp} warnings
2685 This option also warns when a non-volatile automatic variable might be
2686 changed by a call to @code{longjmp}.  These warnings as well are possible
2687 only in optimizing compilation.
2689 The compiler sees only the calls to @code{setjmp}.  It cannot know
2690 where @code{longjmp} will be called; in fact, a signal handler could
2691 call it at any point in the code.  As a result, you may get a warning
2692 even when there is in fact no problem because @code{longjmp} cannot
2693 in fact be called at the place which would cause a problem.
2695 Some spurious warnings can be avoided if you declare all the functions
2696 you use that never return as @code{noreturn}.  @xref{Function
2697 Attributes}.
2699 This warning is enabled by @option{-Wall}.
2701 @item -Wunknown-pragmas
2702 @opindex Wunknown-pragmas
2703 @cindex warning for unknown pragmas
2704 @cindex unknown pragmas, warning
2705 @cindex pragmas, warning of unknown
2706 Warn when a #pragma directive is encountered which is not understood by
2707 GCC@.  If this command line option is used, warnings will even be issued
2708 for unknown pragmas in system header files.  This is not the case if
2709 the warnings were only enabled by the @option{-Wall} command line option.
2711 @item -Wno-pragmas
2712 @opindex Wno-pragmas
2713 @opindex Wpragmas
2714 Do not warn about misuses of pragmas, such as incorrect parameters,
2715 invalid syntax, or conflicts between pragmas.  See also
2716 @samp{-Wunknown-pragmas}.
2718 @item -Wstrict-aliasing
2719 @opindex Wstrict-aliasing
2720 This option is only active when @option{-fstrict-aliasing} is active.
2721 It warns about code which might break the strict aliasing rules that the
2722 compiler is using for optimization.  The warning does not catch all
2723 cases, but does attempt to catch the more common pitfalls.  It is
2724 included in @option{-Wall}.
2726 @item -Wstrict-aliasing=2
2727 @opindex Wstrict-aliasing=2
2728 This option is only active when @option{-fstrict-aliasing} is active.
2729 It warns about all code which might break the strict aliasing rules that the
2730 compiler is using for optimization.  This warning catches all cases, but
2731 it will also give a warning for some ambiguous cases that are safe.
2733 @item -Wall
2734 @opindex Wall
2735 All of the above @samp{-W} options combined.  This enables all the
2736 warnings about constructions that some users consider questionable, and
2737 that are easy to avoid (or modify to prevent the warning), even in
2738 conjunction with macros.  This also enables some language-specific
2739 warnings described in @ref{C++ Dialect Options} and
2740 @ref{Objective-C and Objective-C++ Dialect Options}.
2741 @end table
2743 The following @option{-W@dots{}} options are not implied by @option{-Wall}.
2744 Some of them warn about constructions that users generally do not
2745 consider questionable, but which occasionally you might wish to check
2746 for; others warn about constructions that are necessary or hard to avoid
2747 in some cases, and there is no simple way to modify the code to suppress
2748 the warning.
2750 @table @gcctabopt
2751 @item -Wextra
2752 @opindex W
2753 @opindex Wextra
2754 (This option used to be called @option{-W}.  The older name is still
2755 supported, but the newer name is more descriptive.)  Print extra warning
2756 messages for these events:
2758 @itemize @bullet
2759 @item
2760 A function can return either with or without a value.  (Falling
2761 off the end of the function body is considered returning without
2762 a value.)  For example, this function would evoke such a
2763 warning:
2765 @smallexample
2766 @group
2767 foo (a)
2769   if (a > 0)
2770     return a;
2772 @end group
2773 @end smallexample
2775 @item
2776 An expression-statement or the left-hand side of a comma expression
2777 contains no side effects.
2778 To suppress the warning, cast the unused expression to void.
2779 For example, an expression such as @samp{x[i,j]} will cause a warning,
2780 but @samp{x[(void)i,j]} will not.
2782 @item
2783 An unsigned value is compared against zero with @samp{<} or @samp{>=}.
2785 @item
2786 Storage-class specifiers like @code{static} are not the first things in
2787 a declaration.  According to the C Standard, this usage is obsolescent.
2789 @item
2790 If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
2791 arguments.
2793 @item
2794 A comparison between signed and unsigned values could produce an
2795 incorrect result when the signed value is converted to unsigned.
2796 (But don't warn if @option{-Wno-sign-compare} is also specified.)
2798 @item
2799 An aggregate has an initializer which does not initialize all members.
2800 This warning can be independently controlled by
2801 @option{-Wmissing-field-initializers}.
2803 @item
2804 A function parameter is declared without a type specifier in K&R-style
2805 functions:
2807 @smallexample
2808 void foo(bar) @{ @}
2809 @end smallexample
2811 @item
2812 An empty body occurs in an @samp{if} or @samp{else} statement.
2814 @item
2815 A pointer is compared against integer zero with @samp{<}, @samp{<=},
2816 @samp{>}, or @samp{>=}.
2818 @item
2819 A variable might be changed by @samp{longjmp} or @samp{vfork}.
2821 @item
2822 Any of several floating-point events that often indicate errors, such as
2823 overflow, underflow, loss of precision, etc.
2825 @item @r{(C++ only)}
2826 An enumerator and a non-enumerator both appear in a conditional expression.
2828 @item @r{(C++ only)}
2829 A non-static reference or non-static @samp{const} member appears in a
2830 class without constructors.
2832 @item @r{(C++ only)}
2833 Ambiguous virtual bases.
2835 @item @r{(C++ only)}
2836 Subscripting an array which has been declared @samp{register}.
2838 @item @r{(C++ only)}
2839 Taking the address of a variable which has been declared @samp{register}.
2841 @item @r{(C++ only)}
2842 A base class is not initialized in a derived class' copy constructor.
2843 @end itemize
2845 @item -Wno-div-by-zero
2846 @opindex Wno-div-by-zero
2847 @opindex Wdiv-by-zero
2848 Do not warn about compile-time integer division by zero.  Floating point
2849 division by zero is not warned about, as it can be a legitimate way of
2850 obtaining infinities and NaNs.
2852 @item -Wsystem-headers
2853 @opindex Wsystem-headers
2854 @cindex warnings from system headers
2855 @cindex system headers, warnings from
2856 Print warning messages for constructs found in system header files.
2857 Warnings from system headers are normally suppressed, on the assumption
2858 that they usually do not indicate real problems and would only make the
2859 compiler output harder to read.  Using this command line option tells
2860 GCC to emit warnings from system headers as if they occurred in user
2861 code.  However, note that using @option{-Wall} in conjunction with this
2862 option will @emph{not} warn about unknown pragmas in system
2863 headers---for that, @option{-Wunknown-pragmas} must also be used.
2865 @item -Wfloat-equal
2866 @opindex Wfloat-equal
2867 Warn if floating point values are used in equality comparisons.
2869 The idea behind this is that sometimes it is convenient (for the
2870 programmer) to consider floating-point values as approximations to
2871 infinitely precise real numbers.  If you are doing this, then you need
2872 to compute (by analyzing the code, or in some other way) the maximum or
2873 likely maximum error that the computation introduces, and allow for it
2874 when performing comparisons (and when producing output, but that's a
2875 different problem).  In particular, instead of testing for equality, you
2876 would check to see whether the two values have ranges that overlap; and
2877 this is done with the relational operators, so equality comparisons are
2878 probably mistaken.
2880 @item -Wtraditional @r{(C only)}
2881 @opindex Wtraditional
2882 Warn about certain constructs that behave differently in traditional and
2883 ISO C@.  Also warn about ISO C constructs that have no traditional C
2884 equivalent, and/or problematic constructs which should be avoided.
2886 @itemize @bullet
2887 @item
2888 Macro parameters that appear within string literals in the macro body.
2889 In traditional C macro replacement takes place within string literals,
2890 but does not in ISO C@.
2892 @item
2893 In traditional C, some preprocessor directives did not exist.
2894 Traditional preprocessors would only consider a line to be a directive
2895 if the @samp{#} appeared in column 1 on the line.  Therefore
2896 @option{-Wtraditional} warns about directives that traditional C
2897 understands but would ignore because the @samp{#} does not appear as the
2898 first character on the line.  It also suggests you hide directives like
2899 @samp{#pragma} not understood by traditional C by indenting them.  Some
2900 traditional implementations would not recognize @samp{#elif}, so it
2901 suggests avoiding it altogether.
2903 @item
2904 A function-like macro that appears without arguments.
2906 @item
2907 The unary plus operator.
2909 @item
2910 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
2911 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
2912 constants.)  Note, these suffixes appear in macros defined in the system
2913 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
2914 Use of these macros in user code might normally lead to spurious
2915 warnings, however GCC's integrated preprocessor has enough context to
2916 avoid warning in these cases.
2918 @item
2919 A function declared external in one block and then used after the end of
2920 the block.
2922 @item
2923 A @code{switch} statement has an operand of type @code{long}.
2925 @item
2926 A non-@code{static} function declaration follows a @code{static} one.
2927 This construct is not accepted by some traditional C compilers.
2929 @item
2930 The ISO type of an integer constant has a different width or
2931 signedness from its traditional type.  This warning is only issued if
2932 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
2933 typically represent bit patterns, are not warned about.
2935 @item
2936 Usage of ISO string concatenation is detected.
2938 @item
2939 Initialization of automatic aggregates.
2941 @item
2942 Identifier conflicts with labels.  Traditional C lacks a separate
2943 namespace for labels.
2945 @item
2946 Initialization of unions.  If the initializer is zero, the warning is
2947 omitted.  This is done under the assumption that the zero initializer in
2948 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
2949 initializer warnings and relies on default initialization to zero in the
2950 traditional C case.
2952 @item
2953 Conversions by prototypes between fixed/floating point values and vice
2954 versa.  The absence of these prototypes when compiling with traditional
2955 C would cause serious problems.  This is a subset of the possible
2956 conversion warnings, for the full set use @option{-Wconversion}.
2958 @item
2959 Use of ISO C style function definitions.  This warning intentionally is
2960 @emph{not} issued for prototype declarations or variadic functions
2961 because these ISO C features will appear in your code when using
2962 libiberty's traditional C compatibility macros, @code{PARAMS} and
2963 @code{VPARAMS}.  This warning is also bypassed for nested functions
2964 because that feature is already a GCC extension and thus not relevant to
2965 traditional C compatibility.
2966 @end itemize
2968 @item -Wdeclaration-after-statement @r{(C only)}
2969 @opindex Wdeclaration-after-statement
2970 Warn when a declaration is found after a statement in a block.  This
2971 construct, known from C++, was introduced with ISO C99 and is by default
2972 allowed in GCC@.  It is not supported by ISO C90 and was not supported by
2973 GCC versions before GCC 3.0.  @xref{Mixed Declarations}.
2975 @item -Wundef
2976 @opindex Wundef
2977 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
2979 @item -Wno-endif-labels
2980 @opindex Wno-endif-labels
2981 @opindex Wendif-labels
2982 Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
2984 @item -Wshadow
2985 @opindex Wshadow
2986 Warn whenever a local variable shadows another local variable, parameter or
2987 global variable or whenever a built-in function is shadowed.
2989 @item -Wlarger-than-@var{len}
2990 @opindex Wlarger-than
2991 Warn whenever an object of larger than @var{len} bytes is defined.
2993 @item -Wunsafe-loop-optimizations
2994 @opindex Wunsafe-loop-optimizations
2995 Warn if the loop cannot be optimized because the compiler could not
2996 assume anything on the bounds of the loop indices.  With
2997 @option{-funsafe-loop-optimizations} warn if the compiler made
2998 such assumptions.
3000 @item -Wpointer-arith
3001 @opindex Wpointer-arith
3002 Warn about anything that depends on the ``size of'' a function type or
3003 of @code{void}.  GNU C assigns these types a size of 1, for
3004 convenience in calculations with @code{void *} pointers and pointers
3005 to functions.
3007 @item -Wbad-function-cast @r{(C only)}
3008 @opindex Wbad-function-cast
3009 Warn whenever a function call is cast to a non-matching type.
3010 For example, warn if @code{int malloc()} is cast to @code{anything *}.
3012 @item -Wc++-compat
3013 Warn about ISO C constructs that are outside of the common subset of
3014 ISO C and ISO C++, e.g.@: request for implicit conversion from
3015 @code{void *} to a pointer to non-@code{void} type.
3017 @item -Wcast-qual
3018 @opindex Wcast-qual
3019 Warn whenever a pointer is cast so as to remove a type qualifier from
3020 the target type.  For example, warn if a @code{const char *} is cast
3021 to an ordinary @code{char *}.
3023 @item -Wcast-align
3024 @opindex Wcast-align
3025 Warn whenever a pointer is cast such that the required alignment of the
3026 target is increased.  For example, warn if a @code{char *} is cast to
3027 an @code{int *} on machines where integers can only be accessed at
3028 two- or four-byte boundaries.
3030 @item -Wwrite-strings
3031 @opindex Wwrite-strings
3032 When compiling C, give string constants the type @code{const
3033 char[@var{length}]} so that
3034 copying the address of one into a non-@code{const} @code{char *}
3035 pointer will get a warning; when compiling C++, warn about the
3036 deprecated conversion from string constants to @code{char *}.
3037 These warnings will help you find at
3038 compile time code that can try to write into a string constant, but
3039 only if you have been very careful about using @code{const} in
3040 declarations and prototypes.  Otherwise, it will just be a nuisance;
3041 this is why we did not make @option{-Wall} request these warnings.
3043 @item -Wconversion
3044 @opindex Wconversion
3045 Warn if a prototype causes a type conversion that is different from what
3046 would happen to the same argument in the absence of a prototype.  This
3047 includes conversions of fixed point to floating and vice versa, and
3048 conversions changing the width or signedness of a fixed point argument
3049 except when the same as the default promotion.
3051 Also, warn if a negative integer constant expression is implicitly
3052 converted to an unsigned type.  For example, warn about the assignment
3053 @code{x = -1} if @code{x} is unsigned.  But do not warn about explicit
3054 casts like @code{(unsigned) -1}.
3056 @item -Wsign-compare
3057 @opindex Wsign-compare
3058 @cindex warning for comparison of signed and unsigned values
3059 @cindex comparison of signed and unsigned values, warning
3060 @cindex signed and unsigned values, comparison warning
3061 Warn when a comparison between signed and unsigned values could produce
3062 an incorrect result when the signed value is converted to unsigned.
3063 This warning is also enabled by @option{-Wextra}; to get the other warnings
3064 of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
3066 @item -Waggregate-return
3067 @opindex Waggregate-return
3068 Warn if any functions that return structures or unions are defined or
3069 called.  (In languages where you can return an array, this also elicits
3070 a warning.)
3072 @item -Wno-attributes
3073 @opindex Wno-attributes
3074 @opindex Wattributes
3075 Do not warn if an unexpected @code{__attribute__} is used, such as
3076 unrecognized attributes, function attributes applied to variables,
3077 etc.  This will not stop errors for incorrect use of supported
3078 attributes.
3080 @item -Wstrict-prototypes @r{(C only)}
3081 @opindex Wstrict-prototypes
3082 Warn if a function is declared or defined without specifying the
3083 argument types.  (An old-style function definition is permitted without
3084 a warning if preceded by a declaration which specifies the argument
3085 types.)
3087 @item -Wold-style-definition @r{(C only)}
3088 @opindex Wold-style-definition
3089 Warn if an old-style function definition is used.  A warning is given
3090 even if there is a previous prototype.
3092 @item -Wmissing-prototypes @r{(C only)}
3093 @opindex Wmissing-prototypes
3094 Warn if a global function is defined without a previous prototype
3095 declaration.  This warning is issued even if the definition itself
3096 provides a prototype.  The aim is to detect global functions that fail
3097 to be declared in header files.
3099 @item -Wmissing-declarations @r{(C only)}
3100 @opindex Wmissing-declarations
3101 Warn if a global function is defined without a previous declaration.
3102 Do so even if the definition itself provides a prototype.
3103 Use this option to detect global functions that are not declared in
3104 header files.
3106 @item -Wmissing-field-initializers
3107 @opindex Wmissing-field-initializers
3108 @opindex W
3109 @opindex Wextra
3110 Warn if a structure's initializer has some fields missing.  For
3111 example, the following code would cause such a warning, because
3112 @code{x.h} is implicitly zero:
3114 @smallexample
3115 struct s @{ int f, g, h; @};
3116 struct s x = @{ 3, 4 @};
3117 @end smallexample
3119 This option does not warn about designated initializers, so the following
3120 modification would not trigger a warning:
3122 @smallexample
3123 struct s @{ int f, g, h; @};
3124 struct s x = @{ .f = 3, .g = 4 @};
3125 @end smallexample
3127 This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
3128 warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}.
3130 @item -Wmissing-noreturn
3131 @opindex Wmissing-noreturn
3132 Warn about functions which might be candidates for attribute @code{noreturn}.
3133 Note these are only possible candidates, not absolute ones.  Care should
3134 be taken to manually verify functions actually do not ever return before
3135 adding the @code{noreturn} attribute, otherwise subtle code generation
3136 bugs could be introduced.  You will not get a warning for @code{main} in
3137 hosted C environments.
3139 @item -Wmissing-format-attribute
3140 @opindex Wmissing-format-attribute
3141 @opindex Wformat
3142 Warn about function pointers which might be candidates for @code{format}
3143 attributes.  Note these are only possible candidates, not absolute ones.
3144 GCC will guess that function pointers with @code{format} attributes that
3145 are used in assignment, initialization, parameter passing or return
3146 statements should have a corresponding @code{format} attribute in the
3147 resulting type.  I.e.@: the left-hand side of the assignment or
3148 initialization, the type of the parameter variable, or the return type
3149 of the containing function respectively should also have a @code{format}
3150 attribute to avoid the warning.
3152 GCC will also warn about function definitions which might be
3153 candidates for @code{format} attributes.  Again, these are only
3154 possible candidates.  GCC will guess that @code{format} attributes
3155 might be appropriate for any function that calls a function like
3156 @code{vprintf} or @code{vscanf}, but this might not always be the
3157 case, and some functions for which @code{format} attributes are
3158 appropriate may not be detected.
3160 @item -Wno-multichar
3161 @opindex Wno-multichar
3162 @opindex Wmultichar
3163 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
3164 Usually they indicate a typo in the user's code, as they have
3165 implementation-defined values, and should not be used in portable code.
3167 @item -Wnormalized=<none|id|nfc|nfkc>
3168 @opindex Wnormalized
3169 @cindex NFC
3170 @cindex NFKC
3171 @cindex character set, input normalization
3172 In ISO C and ISO C++, two identifiers are different if they are
3173 different sequences of characters.  However, sometimes when characters
3174 outside the basic ASCII character set are used, you can have two
3175 different character sequences that look the same.  To avoid confusion,
3176 the ISO 10646 standard sets out some @dfn{normalization rules} which
3177 when applied ensure that two sequences that look the same are turned into
3178 the same sequence.  GCC can warn you if you are using identifiers which
3179 have not been normalized; this option controls that warning.
3181 There are four levels of warning that GCC supports.  The default is
3182 @option{-Wnormalized=nfc}, which warns about any identifier which is
3183 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
3184 recommended form for most uses.
3186 Unfortunately, there are some characters which ISO C and ISO C++ allow
3187 in identifiers that when turned into NFC aren't allowable as
3188 identifiers.  That is, there's no way to use these symbols in portable
3189 ISO C or C++ and have all your identifiers in NFC.
3190 @option{-Wnormalized=id} suppresses the warning for these characters.
3191 It is hoped that future versions of the standards involved will correct
3192 this, which is why this option is not the default.
3194 You can switch the warning off for all characters by writing
3195 @option{-Wnormalized=none}.  You would only want to do this if you
3196 were using some other normalization scheme (like ``D''), because
3197 otherwise you can easily create bugs that are literally impossible to see.
3199 Some characters in ISO 10646 have distinct meanings but look identical
3200 in some fonts or display methodologies, especially once formatting has
3201 been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
3202 LETTER N'', will display just like a regular @code{n} which has been
3203 placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
3204 normalisation scheme to convert all these into a standard form as
3205 well, and GCC will warn if your code is not in NFKC if you use
3206 @option{-Wnormalized=nfkc}.  This warning is comparable to warning
3207 about every identifier that contains the letter O because it might be
3208 confused with the digit 0, and so is not the default, but may be
3209 useful as a local coding convention if the programming environment is
3210 unable to be fixed to display these characters distinctly.
3212 @item -Wno-deprecated-declarations
3213 @opindex Wno-deprecated-declarations
3214 Do not warn about uses of functions, variables, and types marked as
3215 deprecated by using the @code{deprecated} attribute.
3216 (@pxref{Function Attributes}, @pxref{Variable Attributes},
3217 @pxref{Type Attributes}.)
3219 @item -Wpacked
3220 @opindex Wpacked
3221 Warn if a structure is given the packed attribute, but the packed
3222 attribute has no effect on the layout or size of the structure.
3223 Such structures may be mis-aligned for little benefit.  For
3224 instance, in this code, the variable @code{f.x} in @code{struct bar}
3225 will be misaligned even though @code{struct bar} does not itself
3226 have the packed attribute:
3228 @smallexample
3229 @group
3230 struct foo @{
3231   int x;
3232   char a, b, c, d;
3233 @} __attribute__((packed));
3234 struct bar @{
3235   char z;
3236   struct foo f;
3238 @end group
3239 @end smallexample
3241 @item -Wpadded
3242 @opindex Wpadded
3243 Warn if padding is included in a structure, either to align an element
3244 of the structure or to align the whole structure.  Sometimes when this
3245 happens it is possible to rearrange the fields of the structure to
3246 reduce the padding and so make the structure smaller.
3248 @item -Wredundant-decls
3249 @opindex Wredundant-decls
3250 Warn if anything is declared more than once in the same scope, even in
3251 cases where multiple declaration is valid and changes nothing.
3253 @item -Wnested-externs @r{(C only)}
3254 @opindex Wnested-externs
3255 Warn if an @code{extern} declaration is encountered within a function.
3257 @item -Wunreachable-code
3258 @opindex Wunreachable-code
3259 Warn if the compiler detects that code will never be executed.
3261 This option is intended to warn when the compiler detects that at
3262 least a whole line of source code will never be executed, because
3263 some condition is never satisfied or because it is after a
3264 procedure that never returns.
3266 It is possible for this option to produce a warning even though there
3267 are circumstances under which part of the affected line can be executed,
3268 so care should be taken when removing apparently-unreachable code.
3270 For instance, when a function is inlined, a warning may mean that the
3271 line is unreachable in only one inlined copy of the function.
3273 This option is not made part of @option{-Wall} because in a debugging
3274 version of a program there is often substantial code which checks
3275 correct functioning of the program and is, hopefully, unreachable
3276 because the program does work.  Another common use of unreachable
3277 code is to provide behavior which is selectable at compile-time.
3279 @item -Winline
3280 @opindex Winline
3281 Warn if a function can not be inlined and it was declared as inline.
3282 Even with this option, the compiler will not warn about failures to
3283 inline functions declared in system headers.
3285 The compiler uses a variety of heuristics to determine whether or not
3286 to inline a function.  For example, the compiler takes into account
3287 the size of the function being inlined and the amount of inlining
3288 that has already been done in the current function.  Therefore,
3289 seemingly insignificant changes in the source program can cause the
3290 warnings produced by @option{-Winline} to appear or disappear.
3292 @item -Wno-invalid-offsetof @r{(C++ only)}
3293 @opindex Wno-invalid-offsetof
3294 Suppress warnings from applying the @samp{offsetof} macro to a non-POD
3295 type.  According to the 1998 ISO C++ standard, applying @samp{offsetof}
3296 to a non-POD type is undefined.  In existing C++ implementations,
3297 however, @samp{offsetof} typically gives meaningful results even when
3298 applied to certain kinds of non-POD types. (Such as a simple
3299 @samp{struct} that fails to be a POD type only by virtue of having a
3300 constructor.)  This flag is for users who are aware that they are
3301 writing nonportable code and who have deliberately chosen to ignore the
3302 warning about it.
3304 The restrictions on @samp{offsetof} may be relaxed in a future version
3305 of the C++ standard.
3307 @item -Wno-int-to-pointer-cast @r{(C only)}
3308 @opindex Wno-int-to-pointer-cast
3309 Suppress warnings from casts to pointer type of an integer of a
3310 different size.
3312 @item -Wno-pointer-to-int-cast @r{(C only)}
3313 @opindex Wno-pointer-to-int-cast
3314 Suppress warnings from casts from a pointer to an integer type of a
3315 different size.
3317 @item -Winvalid-pch
3318 @opindex Winvalid-pch
3319 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
3320 the search path but can't be used.
3322 @item -Wlong-long
3323 @opindex Wlong-long
3324 @opindex Wno-long-long
3325 Warn if @samp{long long} type is used.  This is default.  To inhibit
3326 the warning messages, use @option{-Wno-long-long}.  Flags
3327 @option{-Wlong-long} and @option{-Wno-long-long} are taken into account
3328 only when @option{-pedantic} flag is used.
3330 @item -Wvariadic-macros
3331 @opindex Wvariadic-macros
3332 @opindex Wno-variadic-macros
3333 Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
3334 alternate syntax when in pedantic ISO C99 mode.  This is default.
3335 To inhibit the warning messages, use @option{-Wno-variadic-macros}.
3337 @item -Wdisabled-optimization
3338 @opindex Wdisabled-optimization
3339 Warn if a requested optimization pass is disabled.  This warning does
3340 not generally indicate that there is anything wrong with your code; it
3341 merely indicates that GCC's optimizers were unable to handle the code
3342 effectively.  Often, the problem is that your code is too big or too
3343 complex; GCC will refuse to optimize programs when the optimization
3344 itself is likely to take inordinate amounts of time.
3346 @item -Wno-pointer-sign
3347 @opindex Wno-pointer-sign
3348 Don't warn for pointer argument passing or assignment with different signedness.
3349 Only useful in the negative form since this warning is enabled by default.
3350 This option is only supported for C and Objective-C@.
3352 @item -Werror
3353 @opindex Werror
3354 Make all warnings into errors.
3355 @end table
3357 @node Debugging Options
3358 @section Options for Debugging Your Program or GCC
3359 @cindex options, debugging
3360 @cindex debugging information options
3362 GCC has various special options that are used for debugging
3363 either your program or GCC:
3365 @table @gcctabopt
3366 @item -g
3367 @opindex g
3368 Produce debugging information in the operating system's native format
3369 (stabs, COFF, XCOFF, or DWARF 2)@.  GDB can work with this debugging
3370 information.
3372 On most systems that use stabs format, @option{-g} enables use of extra
3373 debugging information that only GDB can use; this extra information
3374 makes debugging work better in GDB but will probably make other debuggers
3375 crash or
3376 refuse to read the program.  If you want to control for certain whether
3377 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
3378 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
3380 GCC allows you to use @option{-g} with
3381 @option{-O}.  The shortcuts taken by optimized code may occasionally
3382 produce surprising results: some variables you declared may not exist
3383 at all; flow of control may briefly move where you did not expect it;
3384 some statements may not be executed because they compute constant
3385 results or their values were already at hand; some statements may
3386 execute in different places because they were moved out of loops.
3388 Nevertheless it proves possible to debug optimized output.  This makes
3389 it reasonable to use the optimizer for programs that might have bugs.
3391 The following options are useful when GCC is generated with the
3392 capability for more than one debugging format.
3394 @item -ggdb
3395 @opindex ggdb
3396 Produce debugging information for use by GDB@.  This means to use the
3397 most expressive format available (DWARF 2, stabs, or the native format
3398 if neither of those are supported), including GDB extensions if at all
3399 possible.
3401 @item -gstabs
3402 @opindex gstabs
3403 Produce debugging information in stabs format (if that is supported),
3404 without GDB extensions.  This is the format used by DBX on most BSD
3405 systems.  On MIPS, Alpha and System V Release 4 systems this option
3406 produces stabs debugging output which is not understood by DBX or SDB@.
3407 On System V Release 4 systems this option requires the GNU assembler.
3409 @item -feliminate-unused-debug-symbols
3410 @opindex feliminate-unused-debug-symbols
3411 Produce debugging information in stabs format (if that is supported),
3412 for only symbols that are actually used.
3414 @item -gstabs+
3415 @opindex gstabs+
3416 Produce debugging information in stabs format (if that is supported),
3417 using GNU extensions understood only by the GNU debugger (GDB)@.  The
3418 use of these extensions is likely to make other debuggers crash or
3419 refuse to read the program.
3421 @item -gcoff
3422 @opindex gcoff
3423 Produce debugging information in COFF format (if that is supported).
3424 This is the format used by SDB on most System V systems prior to
3425 System V Release 4.
3427 @item -gxcoff
3428 @opindex gxcoff
3429 Produce debugging information in XCOFF format (if that is supported).
3430 This is the format used by the DBX debugger on IBM RS/6000 systems.
3432 @item -gxcoff+
3433 @opindex gxcoff+
3434 Produce debugging information in XCOFF format (if that is supported),
3435 using GNU extensions understood only by the GNU debugger (GDB)@.  The
3436 use of these extensions is likely to make other debuggers crash or
3437 refuse to read the program, and may cause assemblers other than the GNU
3438 assembler (GAS) to fail with an error.
3440 @item -gdwarf-2
3441 @opindex gdwarf-2
3442 Produce debugging information in DWARF version 2 format (if that is
3443 supported).  This is the format used by DBX on IRIX 6.  With this
3444 option, GCC uses features of DWARF version 3 when they are useful;
3445 version 3 is upward compatible with version 2, but may still cause
3446 problems for older debuggers.
3448 @item -gvms
3449 @opindex gvms
3450 Produce debugging information in VMS debug format (if that is
3451 supported).  This is the format used by DEBUG on VMS systems.
3453 @item -g@var{level}
3454 @itemx -ggdb@var{level}
3455 @itemx -gstabs@var{level}
3456 @itemx -gcoff@var{level}
3457 @itemx -gxcoff@var{level}
3458 @itemx -gvms@var{level}
3459 Request debugging information and also use @var{level} to specify how
3460 much information.  The default level is 2.
3462 Level 1 produces minimal information, enough for making backtraces in
3463 parts of the program that you don't plan to debug.  This includes
3464 descriptions of functions and external variables, but no information
3465 about local variables and no line numbers.
3467 Level 3 includes extra information, such as all the macro definitions
3468 present in the program.  Some debuggers support macro expansion when
3469 you use @option{-g3}.
3471 @option{-gdwarf-2} does not accept a concatenated debug level, because
3472 GCC used to support an option @option{-gdwarf} that meant to generate
3473 debug information in version 1 of the DWARF format (which is very
3474 different from version 2), and it would have been too confusing.  That
3475 debug format is long obsolete, but the option cannot be changed now.
3476 Instead use an additional @option{-g@var{level}} option to change the
3477 debug level for DWARF2.
3479 @item -feliminate-dwarf2-dups
3480 @opindex feliminate-dwarf2-dups
3481 Compress DWARF2 debugging information by eliminating duplicated
3482 information about each symbol.  This option only makes sense when
3483 generating DWARF2 debugging information with @option{-gdwarf-2}.
3485 @cindex @command{prof}
3486 @item -p
3487 @opindex p
3488 Generate extra code to write profile information suitable for the
3489 analysis program @command{prof}.  You must use this option when compiling
3490 the source files you want data about, and you must also use it when
3491 linking.
3493 @cindex @command{gprof}
3494 @item -pg
3495 @opindex pg
3496 Generate extra code to write profile information suitable for the
3497 analysis program @command{gprof}.  You must use this option when compiling
3498 the source files you want data about, and you must also use it when
3499 linking.
3501 @item -Q
3502 @opindex Q
3503 Makes the compiler print out each function name as it is compiled, and
3504 print some statistics about each pass when it finishes.
3506 @item -ftime-report
3507 @opindex ftime-report
3508 Makes the compiler print some statistics about the time consumed by each
3509 pass when it finishes.
3511 @item -fmem-report
3512 @opindex fmem-report
3513 Makes the compiler print some statistics about permanent memory
3514 allocation when it finishes.
3516 @item -fprofile-arcs
3517 @opindex fprofile-arcs
3518 Add code so that program flow @dfn{arcs} are instrumented.  During
3519 execution the program records how many times each branch and call is
3520 executed and how many times it is taken or returns.  When the compiled
3521 program exits it saves this data to a file called
3522 @file{@var{auxname}.gcda} for each source file.  The data may be used for
3523 profile-directed optimizations (@option{-fbranch-probabilities}), or for
3524 test coverage analysis (@option{-ftest-coverage}).  Each object file's
3525 @var{auxname} is generated from the name of the output file, if
3526 explicitly specified and it is not the final executable, otherwise it is
3527 the basename of the source file.  In both cases any suffix is removed
3528 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
3529 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
3530 @xref{Cross-profiling}.
3532 @cindex @command{gcov}
3533 @item --coverage
3534 @opindex coverage
3536 This option is used to compile and link code instrumented for coverage
3537 analysis.  The option is a synonym for @option{-fprofile-arcs}
3538 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
3539 linking).  See the documentation for those options for more details.
3541 @itemize
3543 @item
3544 Compile the source files with @option{-fprofile-arcs} plus optimization
3545 and code generation options.  For test coverage analysis, use the
3546 additional @option{-ftest-coverage} option.  You do not need to profile
3547 every source file in a program.
3549 @item
3550 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
3551 (the latter implies the former).
3553 @item
3554 Run the program on a representative workload to generate the arc profile
3555 information.  This may be repeated any number of times.  You can run
3556 concurrent instances of your program, and provided that the file system
3557 supports locking, the data files will be correctly updated.  Also
3558 @code{fork} calls are detected and correctly handled (double counting
3559 will not happen).
3561 @item
3562 For profile-directed optimizations, compile the source files again with
3563 the same optimization and code generation options plus
3564 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
3565 Control Optimization}).
3567 @item
3568 For test coverage analysis, use @command{gcov} to produce human readable
3569 information from the @file{.gcno} and @file{.gcda} files.  Refer to the
3570 @command{gcov} documentation for further information.
3572 @end itemize
3574 With @option{-fprofile-arcs}, for each function of your program GCC
3575 creates a program flow graph, then finds a spanning tree for the graph.
3576 Only arcs that are not on the spanning tree have to be instrumented: the
3577 compiler adds code to count the number of times that these arcs are
3578 executed.  When an arc is the only exit or only entrance to a block, the
3579 instrumentation code can be added to the block; otherwise, a new basic
3580 block must be created to hold the instrumentation code.
3582 @item -ftree-based-profiling
3583 @opindex ftree-based-profiling
3584 This option is used in addition to @option{-fprofile-arcs} or
3585 @option{-fbranch-probabilities} to control whether those optimizations
3586 are performed on a tree-based or rtl-based internal representation.
3587 If you use this option when compiling with @option{-fprofile-arcs},
3588 you must also use it when compiling later with @option{-fbranch-probabilities}.
3589 Currently the tree-based optimization is in an early stage of
3590 development, and this option is recommended only for those people
3591 working on improving it.
3593 @need 2000
3594 @item -ftest-coverage
3595 @opindex ftest-coverage
3596 Produce a notes file that the @command{gcov} code-coverage utility
3597 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
3598 show program coverage.  Each source file's note file is called
3599 @file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
3600 above for a description of @var{auxname} and instructions on how to
3601 generate test coverage data.  Coverage data will match the source files
3602 more closely, if you do not optimize.
3604 @item -d@var{letters}
3605 @item -fdump-rtl-@var{pass}
3606 @opindex d
3607 Says to make debugging dumps during compilation at times specified by
3608 @var{letters}.    This is used for debugging the RTL-based passes of the
3609 compiler.  The file names for most of the dumps are made by appending a
3610 pass number and a word to the @var{dumpname}.  @var{dumpname} is generated
3611 from the name of the output file, if explicitly specified and it is not
3612 an executable, otherwise it is the basename of the source file.
3614 Most debug dumps can be enabled either passing a letter to the @option{-d}
3615 option, or with a long @option{-fdump-rtl} switch; here are the possible
3616 letters for use in @var{letters} and @var{pass}, and their meanings:
3618 @table @gcctabopt
3619 @item -dA
3620 @opindex dA
3621 Annotate the assembler output with miscellaneous debugging information.
3623 @item -db
3624 @itemx -fdump-rtl-bp
3625 @opindex db
3626 @opindex fdump-rtl-bp
3627 Dump after computing branch probabilities, to @file{@var{file}.09.bp}.
3629 @item -dB
3630 @itemx -fdump-rtl-bbro
3631 @opindex dB
3632 @opindex fdump-rtl-bbro
3633 Dump after block reordering, to @file{@var{file}.30.bbro}.
3635 @item -dc
3636 @itemx -fdump-rtl-combine
3637 @opindex dc
3638 @opindex fdump-rtl-combine
3639 Dump after instruction combination, to the file @file{@var{file}.17.combine}.
3641 @item -dC
3642 @itemx -fdump-rtl-ce1
3643 @itemx -fdump-rtl-ce2
3644 @opindex dC
3645 @opindex fdump-rtl-ce1
3646 @opindex fdump-rtl-ce2
3647 @option{-dC} and @option{-fdump-rtl-ce1} enable dumping after the
3648 first if conversion, to the file @file{@var{file}.11.ce1}.  @option{-dC}
3649 and @option{-fdump-rtl-ce2} enable dumping after the second if
3650 conversion, to the file @file{@var{file}.18.ce2}.
3652 @item -dd
3653 @itemx -fdump-rtl-btl
3654 @itemx -fdump-rtl-dbr
3655 @opindex dd
3656 @opindex fdump-rtl-btl
3657 @opindex fdump-rtl-dbr
3658 @option{-dd} and @option{-fdump-rtl-btl} enable dumping after branch
3659 target load optimization, to @file{@var{file}.31.btl}.  @option{-dd}
3660 and @option{-fdump-rtl-dbr} enable dumping after delayed branch
3661 scheduling, to @file{@var{file}.36.dbr}.
3663 @item -dD
3664 @opindex dD
3665 Dump all macro definitions, at the end of preprocessing, in addition to
3666 normal output.
3668 @item -dE
3669 @itemx -fdump-rtl-ce3
3670 @opindex dE
3671 @opindex fdump-rtl-ce3
3672 Dump after the third if conversion, to @file{@var{file}.28.ce3}.
3674 @item -df
3675 @itemx -fdump-rtl-cfg
3676 @itemx -fdump-rtl-life
3677 @opindex df
3678 @opindex fdump-rtl-cfg
3679 @opindex fdump-rtl-life
3680 @option{-df} and @option{-fdump-rtl-cfg} enable dumping after control
3681 and data flow analysis, to @file{@var{file}.08.cfg}.  @option{-df}
3682 and @option{-fdump-rtl-cfg} enable dumping dump after life analysis,
3683 to @file{@var{file}.16.life}.
3685 @item -dg
3686 @itemx -fdump-rtl-greg
3687 @opindex dg
3688 @opindex fdump-rtl-greg
3689 Dump after global register allocation, to @file{@var{file}.23.greg}.
3691 @item -dG
3692 @itemx -fdump-rtl-gcse
3693 @itemx -fdump-rtl-bypass
3694 @opindex dG
3695 @opindex fdump-rtl-gcse
3696 @opindex fdump-rtl-bypass
3697 @option{-dG} and @option{-fdump-rtl-gcse} enable dumping after GCSE, to
3698 @file{@var{file}.05.gcse}.  @option{-dG} and @option{-fdump-rtl-bypass}
3699 enable dumping after jump bypassing and control flow optimizations, to
3700 @file{@var{file}.07.bypass}.
3702 @item -dh
3703 @itemx -fdump-rtl-eh
3704 @opindex dh
3705 @opindex fdump-rtl-eh
3706 Dump after finalization of EH handling code, to @file{@var{file}.02.eh}.
3708 @item -di
3709 @itemx -fdump-rtl-sibling
3710 @opindex di
3711 @opindex fdump-rtl-sibling
3712 Dump after sibling call optimizations, to @file{@var{file}.01.sibling}.
3714 @item -dj
3715 @itemx -fdump-rtl-jump
3716 @opindex dj
3717 @opindex fdump-rtl-jump
3718 Dump after the first jump optimization, to @file{@var{file}.03.jump}.
3720 @item -dk
3721 @itemx -fdump-rtl-stack
3722 @opindex dk
3723 @opindex fdump-rtl-stack
3724 Dump after conversion from registers to stack, to @file{@var{file}.33.stack}.
3726 @item -dl
3727 @itemx -fdump-rtl-lreg
3728 @opindex dl
3729 @opindex fdump-rtl-lreg
3730 Dump after local register allocation, to @file{@var{file}.22.lreg}.
3732 @item -dL
3733 @itemx -fdump-rtl-loop
3734 @itemx -fdump-rtl-loop2
3735 @opindex dL
3736 @opindex fdump-rtl-loop
3737 @opindex fdump-rtl-loop2
3738 @option{-dL} and @option{-fdump-rtl-loop} enable dumping after the first
3739 loop optimization pass, to @file{@var{file}.06.loop}.  @option{-dL} and
3740 @option{-fdump-rtl-loop2} enable dumping after the second pass, to
3741 @file{@var{file}.13.loop2}.
3743 @item -dm
3744 @itemx -fdump-rtl-sms
3745 @opindex dm
3746 @opindex fdump-rtl-sms
3747 Dump after modulo scheduling, to @file{@var{file}.20.sms}.
3749 @item -dM
3750 @itemx -fdump-rtl-mach
3751 @opindex dM
3752 @opindex fdump-rtl-mach
3753 Dump after performing the machine dependent reorganization pass, to
3754 @file{@var{file}.35.mach}.
3756 @item -dn
3757 @itemx -fdump-rtl-rnreg
3758 @opindex dn
3759 @opindex fdump-rtl-rnreg
3760 Dump after register renumbering, to @file{@var{file}.29.rnreg}.
3762 @item -dN
3763 @itemx -fdump-rtl-regmove
3764 @opindex dN
3765 @opindex fdump-rtl-regmove
3766 Dump after the register move pass, to @file{@var{file}.19.regmove}.
3768 @item -do
3769 @itemx -fdump-rtl-postreload
3770 @opindex do
3771 @opindex fdump-rtl-postreload
3772 Dump after post-reload optimizations, to @file{@var{file}.24.postreload}.
3774 @item -dr
3775 @itemx -fdump-rtl-expand
3776 @opindex dr
3777 @opindex fdump-rtl-expand
3778 Dump after RTL generation, to @file{@var{file}.00.expand}.
3780 @item -dR
3781 @itemx -fdump-rtl-sched2
3782 @opindex dR
3783 @opindex fdump-rtl-sched2
3784 Dump after the second scheduling pass, to @file{@var{file}.32.sched2}.
3786 @item -ds
3787 @itemx -fdump-rtl-cse
3788 @opindex ds
3789 @opindex fdump-rtl-cse
3790 Dump after CSE (including the jump optimization that sometimes follows
3791 CSE), to @file{@var{file}.04.cse}.
3793 @item -dS
3794 @itemx -fdump-rtl-sched
3795 @opindex dS
3796 @opindex fdump-rtl-sched
3797 Dump after the first scheduling pass, to @file{@var{file}.21.sched}.
3799 @item -dt
3800 @itemx -fdump-rtl-cse2
3801 @opindex dt
3802 @opindex fdump-rtl-cse2
3803 Dump after the second CSE pass (including the jump optimization that
3804 sometimes follows CSE), to @file{@var{file}.15.cse2}.
3806 @item -dT
3807 @itemx -fdump-rtl-tracer
3808 @opindex dT
3809 @opindex fdump-rtl-tracer
3810 Dump after running tracer, to @file{@var{file}.12.tracer}.
3812 @item -dV
3813 @itemx -fdump-rtl-vpt
3814 @itemx -fdump-rtl-vartrack
3815 @opindex dV
3816 @opindex fdump-rtl-vpt
3817 @opindex fdump-rtl-vartrack
3818 @option{-dV} and @option{-fdump-rtl-vpt} enable dumping after the value
3819 profile transformations, to @file{@var{file}.10.vpt}.  @option{-dV}
3820 and @option{-fdump-rtl-vartrack} enable dumping after variable tracking,
3821 to @file{@var{file}.34.vartrack}.
3823 @item -dw
3824 @itemx -fdump-rtl-flow2
3825 @opindex dw
3826 @opindex fdump-rtl-flow2
3827 Dump after the second flow pass, to @file{@var{file}.26.flow2}.
3829 @item -dz
3830 @itemx -fdump-rtl-peephole2
3831 @opindex dz
3832 @opindex fdump-rtl-peephole2
3833 Dump after the peephole pass, to @file{@var{file}.27.peephole2}.
3835 @item -dZ
3836 @itemx -fdump-rtl-web
3837 @opindex dZ
3838 @opindex fdump-rtl-web
3839 Dump after live range splitting, to @file{@var{file}.14.web}.
3841 @item -da
3842 @itemx -fdump-rtl-all
3843 @opindex da
3844 @opindex fdump-rtl-all
3845 Produce all the dumps listed above.
3847 @item -dH
3848 @opindex dH
3849 Produce a core dump whenever an error occurs.
3851 @item -dm
3852 @opindex dm
3853 Print statistics on memory usage, at the end of the run, to
3854 standard error.
3856 @item -dp
3857 @opindex dp
3858 Annotate the assembler output with a comment indicating which
3859 pattern and alternative was used.  The length of each instruction is
3860 also printed.
3862 @item -dP
3863 @opindex dP
3864 Dump the RTL in the assembler output as a comment before each instruction.
3865 Also turns on @option{-dp} annotation.
3867 @item -dv
3868 @opindex dv
3869 For each of the other indicated dump files (either with @option{-d} or
3870 @option{-fdump-rtl-@var{pass}}), dump a representation of the control flow
3871 graph suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
3873 @item -dx
3874 @opindex dx
3875 Just generate RTL for a function instead of compiling it.  Usually used
3876 with @samp{r} (@option{-fdump-rtl-expand}).
3878 @item -dy
3879 @opindex dy
3880 Dump debugging information during parsing, to standard error.
3881 @end table
3883 @item -fdump-unnumbered
3884 @opindex fdump-unnumbered
3885 When doing debugging dumps (see @option{-d} option above), suppress instruction
3886 numbers and line number note output.  This makes it more feasible to
3887 use diff on debugging dumps for compiler invocations with different
3888 options, in particular with and without @option{-g}.
3890 @item -fdump-translation-unit @r{(C++ only)}
3891 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
3892 @opindex fdump-translation-unit
3893 Dump a representation of the tree structure for the entire translation
3894 unit to a file.  The file name is made by appending @file{.tu} to the
3895 source file name.  If the @samp{-@var{options}} form is used, @var{options}
3896 controls the details of the dump as described for the
3897 @option{-fdump-tree} options.
3899 @item -fdump-class-hierarchy @r{(C++ only)}
3900 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
3901 @opindex fdump-class-hierarchy
3902 Dump a representation of each class's hierarchy and virtual function
3903 table layout to a file.  The file name is made by appending @file{.class}
3904 to the source file name.  If the @samp{-@var{options}} form is used,
3905 @var{options} controls the details of the dump as described for the
3906 @option{-fdump-tree} options.
3908 @item -fdump-ipa-@var{switch}
3909 @opindex fdump-ipa
3910 Control the dumping at various stages of inter-procedural analysis
3911 language tree to a file.  The file name is generated by appending a switch
3912 specific suffix to the source file name.  The following dumps are possible:
3914 @table @samp
3915 @item all
3916 Enables all inter-procedural analysis dumps; currently the only produced
3917 dump is the @samp{cgraph} dump.
3919 @item cgraph
3920 Dumps information about call-graph optimization, unused function removal,
3921 and inlining decisions.
3922 @end table
3924 @item -fdump-tree-@var{switch} @r{(C and C++ only)}
3925 @itemx -fdump-tree-@var{switch}-@var{options} @r{(C and C++ only)}
3926 @opindex fdump-tree
3927 Control the dumping at various stages of processing the intermediate
3928 language tree to a file.  The file name is generated by appending a switch
3929 specific suffix to the source file name.  If the @samp{-@var{options}}
3930 form is used, @var{options} is a list of @samp{-} separated options that
3931 control the details of the dump.  Not all options are applicable to all
3932 dumps, those which are not meaningful will be ignored.  The following
3933 options are available
3935 @table @samp
3936 @item address
3937 Print the address of each node.  Usually this is not meaningful as it
3938 changes according to the environment and source file.  Its primary use
3939 is for tying up a dump file with a debug environment.
3940 @item slim
3941 Inhibit dumping of members of a scope or body of a function merely
3942 because that scope has been reached.  Only dump such items when they
3943 are directly reachable by some other path.  When dumping pretty-printed
3944 trees, this option inhibits dumping the bodies of control structures.
3945 @item raw
3946 Print a raw representation of the tree.  By default, trees are
3947 pretty-printed into a C-like representation.
3948 @item details
3949 Enable more detailed dumps (not honored by every dump option).
3950 @item stats
3951 Enable dumping various statistics about the pass (not honored by every dump
3952 option).
3953 @item blocks
3954 Enable showing basic block boundaries (disabled in raw dumps).
3955 @item vops
3956 Enable showing virtual operands for every statement.
3957 @item lineno
3958 Enable showing line numbers for statements.
3959 @item uid
3960 Enable showing the unique ID (@code{DECL_UID}) for each variable.
3961 @item all
3962 Turn on all options, except @option{raw}, @option{slim} and @option{lineno}.
3963 @end table
3965 The following tree dumps are possible:
3966 @table @samp
3968 @item original
3969 Dump before any tree based optimization, to @file{@var{file}.original}.
3971 @item optimized
3972 Dump after all tree based optimization, to @file{@var{file}.optimized}.
3974 @item inlined
3975 Dump after function inlining, to @file{@var{file}.inlined}.
3977 @item gimple
3978 @opindex fdump-tree-gimple
3979 Dump each function before and after the gimplification pass to a file.  The
3980 file name is made by appending @file{.gimple} to the source file name.
3982 @item cfg
3983 @opindex fdump-tree-cfg
3984 Dump the control flow graph of each function to a file.  The file name is
3985 made by appending @file{.cfg} to the source file name.
3987 @item vcg
3988 @opindex fdump-tree-vcg
3989 Dump the control flow graph of each function to a file in VCG format.  The
3990 file name is made by appending @file{.vcg} to the source file name.  Note
3991 that if the file contains more than one function, the generated file cannot
3992 be used directly by VCG@.  You will need to cut and paste each function's
3993 graph into its own separate file first.
3995 @item ch
3996 @opindex fdump-tree-ch
3997 Dump each function after copying loop headers.  The file name is made by
3998 appending @file{.ch} to the source file name.
4000 @item ssa
4001 @opindex fdump-tree-ssa
4002 Dump SSA related information to a file.  The file name is made by appending
4003 @file{.ssa} to the source file name.
4005 @item salias
4006 @opindex fdump-tree-salias
4007 Dump structure aliasing variable information to a file.  This file name
4008 is made by appending @file{.salias} to the source file name.
4010 @item alias
4011 @opindex fdump-tree-alias
4012 Dump aliasing information for each function.  The file name is made by
4013 appending @file{.alias} to the source file name.
4015 @item ccp
4016 @opindex fdump-tree-ccp
4017 Dump each function after CCP@.  The file name is made by appending
4018 @file{.ccp} to the source file name.
4020 @item storeccp
4021 @opindex fdump-tree-storeccp
4022 Dump each function after STORE-CCP.  The file name is made by appending
4023 @file{.storeccp} to the source file name.
4025 @item pre
4026 @opindex fdump-tree-pre
4027 Dump trees after partial redundancy elimination.  The file name is made
4028 by appending @file{.pre} to the source file name.
4030 @item fre
4031 @opindex fdump-tree-fre
4032 Dump trees after full redundancy elimination.  The file name is made
4033 by appending @file{.fre} to the source file name.
4035 @item copyprop
4036 @opindex fdump-tree-copyprop
4037 Dump trees after copy propagation.  The file name is made
4038 by appending @file{.copyprop} to the source file name.
4040 @item store_copyprop
4041 @opindex fdump-tree-store_copyprop
4042 Dump trees after store copy-propagation.  The file name is made
4043 by appending @file{.store_copyprop} to the source file name.
4045 @item dce
4046 @opindex fdump-tree-dce
4047 Dump each function after dead code elimination.  The file name is made by
4048 appending @file{.dce} to the source file name.
4050 @item mudflap
4051 @opindex fdump-tree-mudflap
4052 Dump each function after adding mudflap instrumentation.  The file name is
4053 made by appending @file{.mudflap} to the source file name.
4055 @item sra
4056 @opindex fdump-tree-sra
4057 Dump each function after performing scalar replacement of aggregates.  The
4058 file name is made by appending @file{.sra} to the source file name.
4060 @item sink
4061 @opindex fdump-tree-sink
4062 Dump each function after performing code sinking.  The file name is made
4063 by appending @file{.sink} to the source file name. 
4065 @item dom
4066 @opindex fdump-tree-dom
4067 Dump each function after applying dominator tree optimizations.  The file
4068 name is made by appending @file{.dom} to the source file name.
4070 @item dse
4071 @opindex fdump-tree-dse
4072 Dump each function after applying dead store elimination.  The file
4073 name is made by appending @file{.dse} to the source file name.
4075 @item phiopt
4076 @opindex fdump-tree-phiopt
4077 Dump each function after optimizing PHI nodes into straightline code.  The file
4078 name is made by appending @file{.phiopt} to the source file name.
4080 @item forwprop
4081 @opindex fdump-tree-forwprop
4082 Dump each function after forward propagating single use variables.  The file
4083 name is made by appending @file{.forwprop} to the source file name.
4085 @item copyrename
4086 @opindex fdump-tree-copyrename
4087 Dump each function after applying the copy rename optimization.  The file
4088 name is made by appending @file{.copyrename} to the source file name.
4090 @item nrv
4091 @opindex fdump-tree-nrv
4092 Dump each function after applying the named return value optimization on
4093 generic trees.  The file name is made by appending @file{.nrv} to the source
4094 file name.
4096 @item vect
4097 @opindex fdump-tree-vect
4098 Dump each function after applying vectorization of loops.  The file name is
4099 made by appending @file{.vect} to the source file name.
4101 @item vrp
4102 @opindex fdump-tree-vrp
4103 Dump each function after Value Range Propagation (VRP).  The file name
4104 is made by appending @file{.vrp} to the source file name.
4106 @item all
4107 @opindex fdump-tree-all
4108 Enable all the available tree dumps with the flags provided in this option.
4109 @end table
4111 @item -ftree-vectorizer-verbose=@var{n}
4112 @opindex ftree-vectorizer-verbose
4113 This option controls the amount of debugging output the vectorizer prints.
4114 This information is written to standard error, unless @option{-fdump-tree-all}
4115 or @option{-fdump-tree-vect} is specified, in which case it is output to the
4116 usual dump listing file, @file{.vect}.
4118 @item -frandom-seed=@var{string}
4119 @opindex frandom-string
4120 This option provides a seed that GCC uses when it would otherwise use
4121 random numbers.  It is used to generate certain symbol names
4122 that have to be different in every compiled file.  It is also used to
4123 place unique stamps in coverage data files and the object files that
4124 produce them.  You can use the @option{-frandom-seed} option to produce
4125 reproducibly identical object files.
4127 The @var{string} should be different for every file you compile.
4129 @item -fsched-verbose=@var{n}
4130 @opindex fsched-verbose
4131 On targets that use instruction scheduling, this option controls the
4132 amount of debugging output the scheduler prints.  This information is
4133 written to standard error, unless @option{-dS} or @option{-dR} is
4134 specified, in which case it is output to the usual dump
4135 listing file, @file{.sched} or @file{.sched2} respectively.  However
4136 for @var{n} greater than nine, the output is always printed to standard
4137 error.
4139 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
4140 same information as @option{-dRS}.  For @var{n} greater than one, it
4141 also output basic block probabilities, detailed ready list information
4142 and unit/insn info.  For @var{n} greater than two, it includes RTL
4143 at abort point, control-flow and regions info.  And for @var{n} over
4144 four, @option{-fsched-verbose} also includes dependence info.
4146 @item -save-temps
4147 @opindex save-temps
4148 Store the usual ``temporary'' intermediate files permanently; place them
4149 in the current directory and name them based on the source file.  Thus,
4150 compiling @file{foo.c} with @samp{-c -save-temps} would produce files
4151 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
4152 preprocessed @file{foo.i} output file even though the compiler now
4153 normally uses an integrated preprocessor.
4155 When used in combination with the @option{-x} command line option,
4156 @option{-save-temps} is sensible enough to avoid over writing an
4157 input source file with the same extension as an intermediate file.
4158 The corresponding intermediate file may be obtained by renaming the
4159 source file before using @option{-save-temps}.
4161 @item -time
4162 @opindex time
4163 Report the CPU time taken by each subprocess in the compilation
4164 sequence.  For C source files, this is the compiler proper and assembler
4165 (plus the linker if linking is done).  The output looks like this:
4167 @smallexample
4168 # cc1 0.12 0.01
4169 # as 0.00 0.01
4170 @end smallexample
4172 The first number on each line is the ``user time'', that is time spent
4173 executing the program itself.  The second number is ``system time'',
4174 time spent executing operating system routines on behalf of the program.
4175 Both numbers are in seconds.
4177 @item -fvar-tracking
4178 @opindex fvar-tracking
4179 Run variable tracking pass.  It computes where variables are stored at each
4180 position in code.  Better debugging information is then generated
4181 (if the debugging information format supports this information).
4183 It is enabled by default when compiling with optimization (@option{-Os},
4184 @option{-O}, @option{-O2}, ...), debugging information (@option{-g}) and
4185 the debug info format supports it.
4187 @item -print-file-name=@var{library}
4188 @opindex print-file-name
4189 Print the full absolute name of the library file @var{library} that
4190 would be used when linking---and don't do anything else.  With this
4191 option, GCC does not compile or link anything; it just prints the
4192 file name.
4194 @item -print-multi-directory
4195 @opindex print-multi-directory
4196 Print the directory name corresponding to the multilib selected by any
4197 other switches present in the command line.  This directory is supposed
4198 to exist in @env{GCC_EXEC_PREFIX}.
4200 @item -print-multi-lib
4201 @opindex print-multi-lib
4202 Print the mapping from multilib directory names to compiler switches
4203 that enable them.  The directory name is separated from the switches by
4204 @samp{;}, and each switch starts with an @samp{@@} instead of the
4205 @samp{-}, without spaces between multiple switches.  This is supposed to
4206 ease shell-processing.
4208 @item -print-prog-name=@var{program}
4209 @opindex print-prog-name
4210 Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
4212 @item -print-libgcc-file-name
4213 @opindex print-libgcc-file-name
4214 Same as @option{-print-file-name=libgcc.a}.
4216 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
4217 but you do want to link with @file{libgcc.a}.  You can do
4219 @smallexample
4220 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
4221 @end smallexample
4223 @item -print-search-dirs
4224 @opindex print-search-dirs
4225 Print the name of the configured installation directory and a list of
4226 program and library directories @command{gcc} will search---and don't do anything else.
4228 This is useful when @command{gcc} prints the error message
4229 @samp{installation problem, cannot exec cpp0: No such file or directory}.
4230 To resolve this you either need to put @file{cpp0} and the other compiler
4231 components where @command{gcc} expects to find them, or you can set the environment
4232 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
4233 Don't forget the trailing @samp{/}.
4234 @xref{Environment Variables}.
4236 @item -dumpmachine
4237 @opindex dumpmachine
4238 Print the compiler's target machine (for example,
4239 @samp{i686-pc-linux-gnu})---and don't do anything else.
4241 @item -dumpversion
4242 @opindex dumpversion
4243 Print the compiler version (for example, @samp{3.0})---and don't do
4244 anything else.
4246 @item -dumpspecs
4247 @opindex dumpspecs
4248 Print the compiler's built-in specs---and don't do anything else.  (This
4249 is used when GCC itself is being built.)  @xref{Spec Files}.
4251 @item -feliminate-unused-debug-types
4252 @opindex feliminate-unused-debug-types
4253 Normally, when producing DWARF2 output, GCC will emit debugging
4254 information for all types declared in a compilation
4255 unit, regardless of whether or not they are actually used
4256 in that compilation unit.  Sometimes this is useful, such as
4257 if, in the debugger, you want to cast a value to a type that is
4258 not actually used in your program (but is declared).  More often,
4259 however, this results in a significant amount of wasted space.
4260 With this option, GCC will avoid producing debug symbol output
4261 for types that are nowhere used in the source file being compiled.
4262 @end table
4264 @node Optimize Options
4265 @section Options That Control Optimization
4266 @cindex optimize options
4267 @cindex options, optimization
4269 These options control various sorts of optimizations.
4271 Without any optimization option, the compiler's goal is to reduce the
4272 cost of compilation and to make debugging produce the expected
4273 results.  Statements are independent: if you stop the program with a
4274 breakpoint between statements, you can then assign a new value to any
4275 variable or change the program counter to any other statement in the
4276 function and get exactly the results you would expect from the source
4277 code.
4279 Turning on optimization flags makes the compiler attempt to improve
4280 the performance and/or code size at the expense of compilation time
4281 and possibly the ability to debug the program.
4283 The compiler performs optimization based on the knowledge it has of
4284 the program.  Optimization levels @option{-O2} and above, in
4285 particular, enable @emph{unit-at-a-time} mode, which allows the
4286 compiler to consider information gained from later functions in
4287 the file when compiling a function.  Compiling multiple files at
4288 once to a single output file in @emph{unit-at-a-time} mode allows
4289 the compiler to use information gained from all of the files when
4290 compiling each of them.
4292 Not all optimizations are controlled directly by a flag.  Only
4293 optimizations that have a flag are listed.
4295 @table @gcctabopt
4296 @item -O
4297 @itemx -O1
4298 @opindex O
4299 @opindex O1
4300 Optimize.  Optimizing compilation takes somewhat more time, and a lot
4301 more memory for a large function.
4303 With @option{-O}, the compiler tries to reduce code size and execution
4304 time, without performing any optimizations that take a great deal of
4305 compilation time.
4307 @option{-O} turns on the following optimization flags:
4308 @gccoptlist{-fdefer-pop @gol
4309 -fdelayed-branch @gol
4310 -fguess-branch-probability @gol
4311 -fcprop-registers @gol
4312 -floop-optimize @gol
4313 -fif-conversion @gol
4314 -fif-conversion2 @gol
4315 -ftree-ccp @gol
4316 -ftree-dce @gol
4317 -ftree-dominator-opts @gol
4318 -ftree-dse @gol
4319 -ftree-ter @gol
4320 -ftree-lrs @gol
4321 -ftree-sra @gol
4322 -ftree-copyrename @gol
4323 -ftree-fre @gol
4324 -ftree-ch @gol
4325 -fmerge-constants}
4327 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
4328 where doing so does not interfere with debugging.
4330 @item -O2
4331 @opindex O2
4332 Optimize even more.  GCC performs nearly all supported optimizations
4333 that do not involve a space-speed tradeoff.  The compiler does not
4334 perform loop unrolling or function inlining when you specify @option{-O2}.
4335 As compared to @option{-O}, this option increases both compilation time
4336 and the performance of the generated code.
4338 @option{-O2} turns on all optimization flags specified by @option{-O}.  It
4339 also turns on the following optimization flags:
4340 @gccoptlist{-fthread-jumps @gol
4341 -fcrossjumping @gol
4342 -foptimize-sibling-calls @gol
4343 -fcse-follow-jumps  -fcse-skip-blocks @gol
4344 -fgcse  -fgcse-lm  @gol
4345 -fexpensive-optimizations @gol
4346 -fstrength-reduce @gol
4347 -frerun-cse-after-loop  -frerun-loop-opt @gol
4348 -fcaller-saves @gol
4349 -fpeephole2 @gol
4350 -fschedule-insns  -fschedule-insns2 @gol
4351 -fsched-interblock  -fsched-spec @gol
4352 -fregmove @gol
4353 -fstrict-aliasing @gol
4354 -fdelete-null-pointer-checks @gol
4355 -freorder-blocks  -freorder-functions @gol
4356 -funit-at-a-time @gol
4357 -falign-functions  -falign-jumps @gol
4358 -falign-loops  -falign-labels @gol
4359 -ftree-vrp @gol
4360 -ftree-pre}
4362 Please note the warning under @option{-fgcse} about
4363 invoking @option{-O2} on programs that use computed gotos.
4365 @item -O3
4366 @opindex O3
4367 Optimize yet more.  @option{-O3} turns on all optimizations specified by
4368 @option{-O2} and also turns on the @option{-finline-functions},
4369 @option{-funswitch-loops} and @option{-fgcse-after-reload} options.
4371 @item -O0
4372 @opindex O0
4373 Do not optimize.  This is the default.
4375 @item -Os
4376 @opindex Os
4377 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations that
4378 do not typically increase code size.  It also performs further
4379 optimizations designed to reduce code size.
4381 @option{-Os} disables the following optimization flags:
4382 @gccoptlist{-falign-functions  -falign-jumps  -falign-loops @gol
4383 -falign-labels  -freorder-blocks  -freorder-blocks-and-partition -fprefetch-loop-arrays}
4385 If you use multiple @option{-O} options, with or without level numbers,
4386 the last such option is the one that is effective.
4387 @end table
4389 Options of the form @option{-f@var{flag}} specify machine-independent
4390 flags.  Most flags have both positive and negative forms; the negative
4391 form of @option{-ffoo} would be @option{-fno-foo}.  In the table
4392 below, only one of the forms is listed---the one you typically will
4393 use.  You can figure out the other form by either removing @samp{no-}
4394 or adding it.
4396 The following options control specific optimizations.  They are either
4397 activated by @option{-O} options or are related to ones that are.  You
4398 can use the following flags in the rare cases when ``fine-tuning'' of
4399 optimizations to be performed is desired.
4401 @table @gcctabopt
4402 @item -fno-default-inline
4403 @opindex fno-default-inline
4404 Do not make member functions inline by default merely because they are
4405 defined inside the class scope (C++ only).  Otherwise, when you specify
4406 @w{@option{-O}}, member functions defined inside class scope are compiled
4407 inline by default; i.e., you don't need to add @samp{inline} in front of
4408 the member function name.
4410 @item -fno-defer-pop
4411 @opindex fno-defer-pop
4412 Always pop the arguments to each function call as soon as that function
4413 returns.  For machines which must pop arguments after a function call,
4414 the compiler normally lets arguments accumulate on the stack for several
4415 function calls and pops them all at once.
4417 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4419 @item -fforce-mem
4420 @opindex fforce-mem
4421 Force memory operands to be copied into registers before doing
4422 arithmetic on them.  This produces better code by making all memory
4423 references potential common subexpressions.  When they are not common
4424 subexpressions, instruction combination should eliminate the separate
4425 register-load. This option is now a nop and will be removed in 4.2.
4427 @item -fforce-addr
4428 @opindex fforce-addr
4429 Force memory address constants to be copied into registers before
4430 doing arithmetic on them.
4432 @item -fomit-frame-pointer
4433 @opindex fomit-frame-pointer
4434 Don't keep the frame pointer in a register for functions that
4435 don't need one.  This avoids the instructions to save, set up and
4436 restore frame pointers; it also makes an extra register available
4437 in many functions.  @strong{It also makes debugging impossible on
4438 some machines.}
4440 On some machines, such as the VAX, this flag has no effect, because
4441 the standard calling sequence automatically handles the frame pointer
4442 and nothing is saved by pretending it doesn't exist.  The
4443 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
4444 whether a target machine supports this flag.  @xref{Registers,,Register
4445 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
4447 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4449 @item -foptimize-sibling-calls
4450 @opindex foptimize-sibling-calls
4451 Optimize sibling and tail recursive calls.
4453 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4455 @item -fno-inline
4456 @opindex fno-inline
4457 Don't pay attention to the @code{inline} keyword.  Normally this option
4458 is used to keep the compiler from expanding any functions inline.
4459 Note that if you are not optimizing, no functions can be expanded inline.
4461 @item -finline-functions
4462 @opindex finline-functions
4463 Integrate all simple functions into their callers.  The compiler
4464 heuristically decides which functions are simple enough to be worth
4465 integrating in this way.
4467 If all calls to a given function are integrated, and the function is
4468 declared @code{static}, then the function is normally not output as
4469 assembler code in its own right.
4471 Enabled at level @option{-O3}.
4473 @item -fearly-inlining
4474 @opindex fearly-inlining
4475 Inline functions marked by @code{always_inline} and functions whose body seems
4476 smaller than the function call overhead early before doing
4477 @option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
4478 makes profiling significantly cheaper and usually inlining faster on programs
4479 having large chains of nested wrapper functions.
4481 Enabled by default.
4483 @item -finline-limit=@var{n}
4484 @opindex finline-limit
4485 By default, GCC limits the size of functions that can be inlined.  This flag
4486 allows the control of this limit for functions that are explicitly marked as
4487 inline (i.e., marked with the inline keyword or defined within the class
4488 definition in c++).  @var{n} is the size of functions that can be inlined in
4489 number of pseudo instructions (not counting parameter handling).  The default
4490 value of @var{n} is 600.
4491 Increasing this value can result in more inlined code at
4492 the cost of compilation time and memory consumption.  Decreasing usually makes
4493 the compilation faster and less code will be inlined (which presumably
4494 means slower programs).  This option is particularly useful for programs that
4495 use inlining heavily such as those based on recursive templates with C++.
4497 Inlining is actually controlled by a number of parameters, which may be
4498 specified individually by using @option{--param @var{name}=@var{value}}.
4499 The @option{-finline-limit=@var{n}} option sets some of these parameters
4500 as follows:
4502 @table @gcctabopt
4503  @item max-inline-insns-single
4504   is set to @var{n}/2.
4505  @item max-inline-insns-auto
4506   is set to @var{n}/2.
4507  @item min-inline-insns
4508   is set to 130 or @var{n}/4, whichever is smaller.
4509  @item max-inline-insns-rtl
4510   is set to @var{n}.
4511 @end table
4513 See below for a documentation of the individual
4514 parameters controlling inlining.
4516 @emph{Note:} pseudo instruction represents, in this particular context, an
4517 abstract measurement of function's size.  In no way does it represent a count
4518 of assembly instructions and as such its exact meaning might change from one
4519 release to an another.
4521 @item -fkeep-inline-functions
4522 @opindex fkeep-inline-functions
4523 In C, emit @code{static} functions that are declared @code{inline}
4524 into the object file, even if the function has been inlined into all
4525 of its callers.  This switch does not affect functions using the
4526 @code{extern inline} extension in GNU C@.  In C++, emit any and all
4527 inline functions into the object file.
4529 @item -fkeep-static-consts
4530 @opindex fkeep-static-consts
4531 Emit variables declared @code{static const} when optimization isn't turned
4532 on, even if the variables aren't referenced.
4534 GCC enables this option by default.  If you want to force the compiler to
4535 check if the variable was referenced, regardless of whether or not
4536 optimization is turned on, use the @option{-fno-keep-static-consts} option.
4538 @item -fmerge-constants
4539 Attempt to merge identical constants (string constants and floating point
4540 constants) across compilation units.
4542 This option is the default for optimized compilation if the assembler and
4543 linker support it.  Use @option{-fno-merge-constants} to inhibit this
4544 behavior.
4546 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4548 @item -fmerge-all-constants
4549 Attempt to merge identical constants and identical variables.
4551 This option implies @option{-fmerge-constants}.  In addition to
4552 @option{-fmerge-constants} this considers e.g.@: even constant initialized
4553 arrays or initialized constant variables with integral or floating point
4554 types.  Languages like C or C++ require each non-automatic variable to
4555 have distinct location, so using this option will result in non-conforming
4556 behavior.
4558 @item -fmodulo-sched
4559 @opindex fmodulo-sched
4560 Perform swing modulo scheduling immediately before the first scheduling
4561 pass.  This pass looks at innermost loops and reorders their
4562 instructions by overlapping different iterations.
4564 @item -fno-branch-count-reg
4565 @opindex fno-branch-count-reg
4566 Do not use ``decrement and branch'' instructions on a count register,
4567 but instead generate a sequence of instructions that decrement a
4568 register, compare it against zero, then branch based upon the result.
4569 This option is only meaningful on architectures that support such
4570 instructions, which include x86, PowerPC, IA-64 and S/390.
4572 The default is @option{-fbranch-count-reg}, enabled when
4573 @option{-fstrength-reduce} is enabled.
4575 @item -fno-function-cse
4576 @opindex fno-function-cse
4577 Do not put function addresses in registers; make each instruction that
4578 calls a constant function contain the function's address explicitly.
4580 This option results in less efficient code, but some strange hacks
4581 that alter the assembler output may be confused by the optimizations
4582 performed when this option is not used.
4584 The default is @option{-ffunction-cse}
4586 @item -fno-zero-initialized-in-bss
4587 @opindex fno-zero-initialized-in-bss
4588 If the target supports a BSS section, GCC by default puts variables that
4589 are initialized to zero into BSS@.  This can save space in the resulting
4590 code.
4592 This option turns off this behavior because some programs explicitly
4593 rely on variables going to the data section.  E.g., so that the
4594 resulting executable can find the beginning of that section and/or make
4595 assumptions based on that.
4597 The default is @option{-fzero-initialized-in-bss}.
4599 @item -fbounds-check
4600 @opindex fbounds-check
4601 For front-ends that support it, generate additional code to check that
4602 indices used to access arrays are within the declared range.  This is
4603 currently only supported by the Java and Fortran front-ends, where
4604 this option defaults to true and false respectively.
4606 @item -fmudflap -fmudflapth -fmudflapir
4607 @opindex fmudflap
4608 @opindex fmudflapth
4609 @opindex fmudflapir
4610 @cindex bounds checking
4611 @cindex mudflap
4612 For front-ends that support it (C and C++), instrument all risky
4613 pointer/array dereferencing operations, some standard library
4614 string/heap functions, and some other associated constructs with
4615 range/validity tests.  Modules so instrumented should be immune to
4616 buffer overflows, invalid heap use, and some other classes of C/C++
4617 programming errors.  The instrumentation relies on a separate runtime
4618 library (@file{libmudflap}), which will be linked into a program if
4619 @option{-fmudflap} is given at link time.  Run-time behavior of the
4620 instrumented program is controlled by the @env{MUDFLAP_OPTIONS}
4621 environment variable.  See @code{env MUDFLAP_OPTIONS=-help a.out}
4622 for its options.
4624 Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to
4625 link if your program is multi-threaded.  Use @option{-fmudflapir}, in
4626 addition to @option{-fmudflap} or @option{-fmudflapth}, if
4627 instrumentation should ignore pointer reads.  This produces less
4628 instrumentation (and therefore faster execution) and still provides
4629 some protection against outright memory corrupting writes, but allows
4630 erroneously read data to propagate within a program.
4632 @item -fstrength-reduce
4633 @opindex fstrength-reduce
4634 Perform the optimizations of loop strength reduction and
4635 elimination of iteration variables.
4637 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4639 @item -fthread-jumps
4640 @opindex fthread-jumps
4641 Perform optimizations where we check to see if a jump branches to a
4642 location where another comparison subsumed by the first is found.  If
4643 so, the first branch is redirected to either the destination of the
4644 second branch or a point immediately following it, depending on whether
4645 the condition is known to be true or false.
4647 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4649 @item -fcse-follow-jumps
4650 @opindex fcse-follow-jumps
4651 In common subexpression elimination, scan through jump instructions
4652 when the target of the jump is not reached by any other path.  For
4653 example, when CSE encounters an @code{if} statement with an
4654 @code{else} clause, CSE will follow the jump when the condition
4655 tested is false.
4657 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4659 @item -fcse-skip-blocks
4660 @opindex fcse-skip-blocks
4661 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
4662 follow jumps which conditionally skip over blocks.  When CSE
4663 encounters a simple @code{if} statement with no else clause,
4664 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
4665 body of the @code{if}.
4667 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4669 @item -frerun-cse-after-loop
4670 @opindex frerun-cse-after-loop
4671 Re-run common subexpression elimination after loop optimizations has been
4672 performed.
4674 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4676 @item -frerun-loop-opt
4677 @opindex frerun-loop-opt
4678 Run the loop optimizer twice.
4680 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4682 @item -fgcse
4683 @opindex fgcse
4684 Perform a global common subexpression elimination pass.
4685 This pass also performs global constant and copy propagation.
4687 @emph{Note:} When compiling a program using computed gotos, a GCC
4688 extension, you may get better runtime performance if you disable
4689 the global common subexpression elimination pass by adding
4690 @option{-fno-gcse} to the command line.
4692 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4694 @item -fgcse-lm
4695 @opindex fgcse-lm
4696 When @option{-fgcse-lm} is enabled, global common subexpression elimination will
4697 attempt to move loads which are only killed by stores into themselves.  This
4698 allows a loop containing a load/store sequence to be changed to a load outside
4699 the loop, and a copy/store within the loop.
4701 Enabled by default when gcse is enabled.
4703 @item -fgcse-sm
4704 @opindex fgcse-sm
4705 When @option{-fgcse-sm} is enabled, a store motion pass is run after
4706 global common subexpression elimination.  This pass will attempt to move
4707 stores out of loops.  When used in conjunction with @option{-fgcse-lm},
4708 loops containing a load/store sequence can be changed to a load before
4709 the loop and a store after the loop.
4711 Not enabled at any optimization level.
4713 @item -fgcse-las
4714 @opindex fgcse-las
4715 When @option{-fgcse-las} is enabled, the global common subexpression
4716 elimination pass eliminates redundant loads that come after stores to the
4717 same memory location (both partial and full redundancies).
4719 Not enabled at any optimization level.
4721 @item -fgcse-after-reload
4722 @opindex fgcse-after-reload
4723 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
4724 pass is performed after reload.  The purpose of this pass is to cleanup
4725 redundant spilling.
4727 @item -floop-optimize
4728 @opindex floop-optimize
4729 Perform loop optimizations: move constant expressions out of loops, simplify
4730 exit test conditions and optionally do strength-reduction as well.
4732 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4734 @item -floop-optimize2
4735 @opindex floop-optimize2
4736 Perform loop optimizations using the new loop optimizer.  The optimizations
4737 (loop unrolling, peeling and unswitching, loop invariant motion) are enabled
4738 by separate flags.
4740 @item -funsafe-loop-optimizations
4741 @opindex funsafe-loop-optimizations
4742 If given, the loop optimizer will assume that loop indices do not
4743 overflow, and that the loops with nontrivial exit condition are not
4744 infinite.  This enables a wider range of loop optimizations even if
4745 the loop optimizer itself cannot prove that these assumptions are valid.
4746 Using @option{-Wunsafe-loop-optimizations}, the compiler will warn you
4747 if it finds this kind of loop.
4749 @item -fcrossjumping
4750 @opindex crossjumping
4751 Perform cross-jumping transformation.  This transformation unifies equivalent code and save code size.  The
4752 resulting code may or may not perform better than without cross-jumping.
4754 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4756 @item -fif-conversion
4757 @opindex if-conversion
4758 Attempt to transform conditional jumps into branch-less equivalents.  This
4759 include use of conditional moves, min, max, set flags and abs instructions, and
4760 some tricks doable by standard arithmetics.  The use of conditional execution
4761 on chips where it is available is controlled by @code{if-conversion2}.
4763 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4765 @item -fif-conversion2
4766 @opindex if-conversion2
4767 Use conditional execution (where available) to transform conditional jumps into
4768 branch-less equivalents.
4770 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4772 @item -fdelete-null-pointer-checks
4773 @opindex fdelete-null-pointer-checks
4774 Use global dataflow analysis to identify and eliminate useless checks
4775 for null pointers.  The compiler assumes that dereferencing a null
4776 pointer would have halted the program.  If a pointer is checked after
4777 it has already been dereferenced, it cannot be null.
4779 In some environments, this assumption is not true, and programs can
4780 safely dereference null pointers.  Use
4781 @option{-fno-delete-null-pointer-checks} to disable this optimization
4782 for programs which depend on that behavior.
4784 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4786 @item -fexpensive-optimizations
4787 @opindex fexpensive-optimizations
4788 Perform a number of minor optimizations that are relatively expensive.
4790 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4792 @item -foptimize-register-move
4793 @itemx -fregmove
4794 @opindex foptimize-register-move
4795 @opindex fregmove
4796 Attempt to reassign register numbers in move instructions and as
4797 operands of other simple instructions in order to maximize the amount of
4798 register tying.  This is especially helpful on machines with two-operand
4799 instructions.
4801 Note @option{-fregmove} and @option{-foptimize-register-move} are the same
4802 optimization.
4804 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4806 @item -fdelayed-branch
4807 @opindex fdelayed-branch
4808 If supported for the target machine, attempt to reorder instructions
4809 to exploit instruction slots available after delayed branch
4810 instructions.
4812 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4814 @item -fschedule-insns
4815 @opindex fschedule-insns
4816 If supported for the target machine, attempt to reorder instructions to
4817 eliminate execution stalls due to required data being unavailable.  This
4818 helps machines that have slow floating point or memory load instructions
4819 by allowing other instructions to be issued until the result of the load
4820 or floating point instruction is required.
4822 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4824 @item -fschedule-insns2
4825 @opindex fschedule-insns2
4826 Similar to @option{-fschedule-insns}, but requests an additional pass of
4827 instruction scheduling after register allocation has been done.  This is
4828 especially useful on machines with a relatively small number of
4829 registers and where memory load instructions take more than one cycle.
4831 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4833 @item -fno-sched-interblock
4834 @opindex fno-sched-interblock
4835 Don't schedule instructions across basic blocks.  This is normally
4836 enabled by default when scheduling before register allocation, i.e.@:
4837 with @option{-fschedule-insns} or at @option{-O2} or higher.
4839 @item -fno-sched-spec
4840 @opindex fno-sched-spec
4841 Don't allow speculative motion of non-load instructions.  This is normally
4842 enabled by default when scheduling before register allocation, i.e.@:
4843 with @option{-fschedule-insns} or at @option{-O2} or higher.
4845 @item -fsched-spec-load
4846 @opindex fsched-spec-load
4847 Allow speculative motion of some load instructions.  This only makes
4848 sense when scheduling before register allocation, i.e.@: with
4849 @option{-fschedule-insns} or at @option{-O2} or higher.
4851 @item -fsched-spec-load-dangerous
4852 @opindex fsched-spec-load-dangerous
4853 Allow speculative motion of more load instructions.  This only makes
4854 sense when scheduling before register allocation, i.e.@: with
4855 @option{-fschedule-insns} or at @option{-O2} or higher.
4857 @item -fsched-stalled-insns=@var{n}
4858 @opindex fsched-stalled-insns
4859 Define how many insns (if any) can be moved prematurely from the queue
4860 of stalled insns into the ready list, during the second scheduling pass.
4862 @item -fsched-stalled-insns-dep=@var{n}
4863 @opindex fsched-stalled-insns-dep
4864 Define how many insn groups (cycles) will be examined for a dependency
4865 on a stalled insn that is candidate for premature removal from the queue
4866 of stalled insns.  Has an effect only during the second scheduling pass,
4867 and only if @option{-fsched-stalled-insns} is used and its value is not zero.
4869 @item -fsched2-use-superblocks
4870 @opindex fsched2-use-superblocks
4871 When scheduling after register allocation, do use superblock scheduling
4872 algorithm.  Superblock scheduling allows motion across basic block boundaries
4873 resulting on faster schedules.  This option is experimental, as not all machine
4874 descriptions used by GCC model the CPU closely enough to avoid unreliable
4875 results from the algorithm.
4877 This only makes sense when scheduling after register allocation, i.e.@: with
4878 @option{-fschedule-insns2} or at @option{-O2} or higher.
4880 @item -fsched2-use-traces
4881 @opindex fsched2-use-traces
4882 Use @option{-fsched2-use-superblocks} algorithm when scheduling after register
4883 allocation and additionally perform code duplication in order to increase the
4884 size of superblocks using tracer pass.  See @option{-ftracer} for details on
4885 trace formation.
4887 This mode should produce faster but significantly longer programs.  Also
4888 without @option{-fbranch-probabilities} the traces constructed may not
4889 match the reality and hurt the performance.  This only makes
4890 sense when scheduling after register allocation, i.e.@: with
4891 @option{-fschedule-insns2} or at @option{-O2} or higher.
4893 @item -freschedule-modulo-scheduled-loops
4894 @opindex fscheduling-in-modulo-scheduled-loops
4895 The modulo scheduling comes before the traditional scheduling, if a loop was modulo scheduled
4896 we may want to prevent the later scheduling passes from changing its schedule, we use this
4897 option to control that.
4899 @item -fcaller-saves
4900 @opindex fcaller-saves
4901 Enable values to be allocated in registers that will be clobbered by
4902 function calls, by emitting extra instructions to save and restore the
4903 registers around such calls.  Such allocation is done only when it
4904 seems to result in better code than would otherwise be produced.
4906 This option is always enabled by default on certain machines, usually
4907 those which have no call-preserved registers to use instead.
4909 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4911 @item -ftree-pre
4912 Perform Partial Redundancy Elimination (PRE) on trees.  This flag is
4913 enabled by default at @option{-O2} and @option{-O3}.
4915 @item -ftree-fre
4916 Perform Full Redundancy Elimination (FRE) on trees.  The difference
4917 between FRE and PRE is that FRE only considers expressions
4918 that are computed on all paths leading to the redundant computation.
4919 This analysis faster than PRE, though it exposes fewer redundancies.
4920 This flag is enabled by default at @option{-O} and higher.
4922 @item -ftree-copy-prop
4923 Perform copy propagation on trees.  This pass eliminates unnecessary
4924 copy operations.  This flag is enabled by default at @option{-O} and
4925 higher.
4927 @item -ftree-store-copy-prop
4928 Perform copy propagation of memory loads and stores.  This pass
4929 eliminates unnecessary copy operations in memory references
4930 (structures, global variables, arrays, etc).  This flag is enabled by
4931 default at @option{-O2} and higher.
4933 @item -ftree-salias
4934 Perform structural alias analysis on trees.  This flag
4935 is enabled by default at @option{-O} and higher.
4937 @item -ftree-sink
4938 Perform forward store motion  on trees.  This flag is
4939 enabled by default at @option{-O} and higher.
4941 @item -ftree-ccp
4942 Perform sparse conditional constant propagation (CCP) on trees.  This
4943 pass only operates on local scalar variables and is enabled by default
4944 at @option{-O} and higher.
4946 @item -ftree-store-ccp
4947 Perform sparse conditional constant propagation (CCP) on trees.  This
4948 pass operates on both local scalar variables and memory stores and
4949 loads (global variables, structures, arrays, etc).  This flag is
4950 enabled by default at @option{-O2} and higher.
4952 @item -ftree-dce
4953 Perform dead code elimination (DCE) on trees.  This flag is enabled by
4954 default at @option{-O} and higher.
4956 @item -ftree-dominator-opts
4957 Perform dead code elimination (DCE) on trees.  This flag is enabled by
4958 default at @option{-O} and higher.
4960 @item -ftree-ch
4961 Perform loop header copying on trees.  This is beneficial since it increases
4962 effectiveness of code motion optimizations.  It also saves one jump.  This flag
4963 is enabled by default at @option{-O} and higher.  It is not enabled
4964 for @option{-Os}, since it usually increases code size.
4966 @item -ftree-loop-optimize
4967 Perform loop optimizations on trees.  This flag is enabled by default
4968 at @option{-O} and higher.
4970 @item -ftree-loop-linear
4971 Perform linear loop transformations on tree.  This flag can improve cache
4972 performance and allow further loop optimizations to take place.
4974 @item -ftree-loop-im
4975 Perform loop invariant motion on trees.  This pass moves only invariants that
4976 would be hard to handle at RTL level (function calls, operations that expand to
4977 nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
4978 operands of conditions that are invariant out of the loop, so that we can use
4979 just trivial invariantness analysis in loop unswitching.  The pass also includes
4980 store motion.
4982 @item -ftree-loop-ivcanon
4983 Create a canonical counter for number of iterations in the loop for that
4984 determining number of iterations requires complicated analysis.  Later
4985 optimizations then may determine the number easily.  Useful especially
4986 in connection with unrolling.
4988 @item -fivopts
4989 Perform induction variable optimizations (strength reduction, induction
4990 variable merging and induction variable elimination) on trees.
4992 @item -ftree-sra
4993 Perform scalar replacement of aggregates.  This pass replaces structure
4994 references with scalars to prevent committing structures to memory too
4995 early.  This flag is enabled by default at @option{-O} and higher.
4997 @item -ftree-copyrename
4998 Perform copy renaming on trees.  This pass attempts to rename compiler
4999 temporaries to other variables at copy locations, usually resulting in
5000 variable names which more closely resemble the original variables.  This flag
5001 is enabled by default at @option{-O} and higher.
5003 @item -ftree-ter
5004 Perform temporary expression replacement during the SSA->normal phase.  Single
5005 use/single def temporaries are replaced at their use location with their
5006 defining expression.  This results in non-GIMPLE code, but gives the expanders
5007 much more complex trees to work on resulting in better RTL generation.  This is
5008 enabled by default at @option{-O} and higher.
5010 @item -ftree-lrs
5011 Perform live range splitting during the SSA->normal phase.  Distinct live
5012 ranges of a variable are split into unique variables, allowing for better
5013 optimization later.  This is enabled by default at @option{-O} and higher.
5015 @item -ftree-vectorize
5016 Perform loop vectorization on trees.
5018 @item -ftree-vrp
5019 Perform Value Range Propagation on trees.  This is similar to the
5020 constant propagation pass, but instead of values, ranges of values are
5021 propagated.  This allows the optimizers to remove unnecessary range
5022 checks like array bound checks and null pointer checks.  This is
5023 enabled by default at @option{-O2} and higher.  Null pointer check
5024 elimination is only done if @option{-fdelete-null-pointer-checks} is
5025 enabled.
5027 @item -ftracer
5028 @opindex ftracer
5029 Perform tail duplication to enlarge superblock size.  This transformation
5030 simplifies the control flow of the function allowing other optimizations to do
5031 better job.
5033 @item -funroll-loops
5034 @opindex funroll-loops
5035 Unroll loops whose number of iterations can be determined at compile
5036 time or upon entry to the loop.  @option{-funroll-loops} implies both
5037 @option{-fstrength-reduce} and @option{-frerun-cse-after-loop}.  This
5038 option makes code larger, and may or may not make it run faster.
5040 @item -funroll-all-loops
5041 @opindex funroll-all-loops
5042 Unroll all loops, even if their number of iterations is uncertain when
5043 the loop is entered.  This usually makes programs run more slowly.
5044 @option{-funroll-all-loops} implies the same options as
5045 @option{-funroll-loops},
5047 @item -fsplit-ivs-in-unroller
5048 @opindex -fsplit-ivs-in-unroller
5049 Enables expressing of values of induction variables in later iterations
5050 of the unrolled loop using the value in the first iteration.  This breaks
5051 long dependency chains, thus improving efficiency of the scheduling passes.
5053 Combination of @option{-fweb} and CSE is often sufficient to obtain the
5054 same effect.  However in cases the loop body is more complicated than
5055 a single basic block, this is not reliable.  It also does not work at all
5056 on some of the architectures due to restrictions in the CSE pass.
5058 This optimization is enabled by default.
5060 @item -fvariable-expansion-in-unroller
5061 @opindex -fvariable-expansion-in-unroller
5062 With this option, the compiler will create multiple copies of some
5063 local variables when unrolling a loop which can result in superior code.
5065 @item -fprefetch-loop-arrays
5066 @opindex fprefetch-loop-arrays
5067 If supported by the target machine, generate instructions to prefetch
5068 memory to improve the performance of loops that access large arrays.
5070 These options may generate better or worse code; results are highly
5071 dependent on the structure of loops within the source code.
5073 @item -fno-peephole
5074 @itemx -fno-peephole2
5075 @opindex fno-peephole
5076 @opindex fno-peephole2
5077 Disable any machine-specific peephole optimizations.  The difference
5078 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
5079 are implemented in the compiler; some targets use one, some use the
5080 other, a few use both.
5082 @option{-fpeephole} is enabled by default.
5083 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5085 @item -fno-guess-branch-probability
5086 @opindex fno-guess-branch-probability
5087 Do not guess branch probabilities using heuristics.
5089 GCC will use heuristics to guess branch probabilities if they are
5090 not provided by profiling feedback (@option{-fprofile-arcs}).  These
5091 heuristics are based on the control flow graph.  If some branch probabilities
5092 are specified by @samp{__builtin_expect}, then the heuristics will be
5093 used to guess branch probabilities for the rest of the control flow graph,
5094 taking the @samp{__builtin_expect} info into account.  The interactions
5095 between the heuristics and @samp{__builtin_expect} can be complex, and in
5096 some cases, it may be useful to disable the heuristics so that the effects
5097 of @samp{__builtin_expect} are easier to understand.
5099 The default is @option{-fguess-branch-probability} at levels
5100 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5102 @item -freorder-blocks
5103 @opindex freorder-blocks
5104 Reorder basic blocks in the compiled function in order to reduce number of
5105 taken branches and improve code locality.
5107 Enabled at levels @option{-O2}, @option{-O3}.
5109 @item -freorder-blocks-and-partition
5110 @opindex freorder-blocks-and-partition
5111 In addition to reordering basic blocks in the compiled function, in order
5112 to reduce number of taken branches, partitions hot and cold basic blocks
5113 into separate sections of the assembly and .o files, to improve
5114 paging and cache locality performance.
5116 This optimization is automatically turned off in the presence of
5117 exception handling, for linkonce sections, for functions with a user-defined
5118 section attribute and on any architecture that does not support named
5119 sections.
5121 @item -freorder-functions
5122 @opindex freorder-functions
5123 Reorder functions in the object file in order to
5124 improve code locality.  This is implemented by using special
5125 subsections @code{.text.hot} for most frequently executed functions and
5126 @code{.text.unlikely} for unlikely executed functions.  Reordering is done by
5127 the linker so object file format must support named sections and linker must
5128 place them in a reasonable way.
5130 Also profile feedback must be available in to make this option effective.  See
5131 @option{-fprofile-arcs} for details.
5133 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5135 @item -fstrict-aliasing
5136 @opindex fstrict-aliasing
5137 Allows the compiler to assume the strictest aliasing rules applicable to
5138 the language being compiled.  For C (and C++), this activates
5139 optimizations based on the type of expressions.  In particular, an
5140 object of one type is assumed never to reside at the same address as an
5141 object of a different type, unless the types are almost the same.  For
5142 example, an @code{unsigned int} can alias an @code{int}, but not a
5143 @code{void*} or a @code{double}.  A character type may alias any other
5144 type.
5146 Pay special attention to code like this:
5147 @smallexample
5148 union a_union @{
5149   int i;
5150   double d;
5153 int f() @{
5154   a_union t;
5155   t.d = 3.0;
5156   return t.i;
5158 @end smallexample
5159 The practice of reading from a different union member than the one most
5160 recently written to (called ``type-punning'') is common.  Even with
5161 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
5162 is accessed through the union type.  So, the code above will work as
5163 expected.  However, this code might not:
5164 @smallexample
5165 int f() @{
5166   a_union t;
5167   int* ip;
5168   t.d = 3.0;
5169   ip = &t.i;
5170   return *ip;
5172 @end smallexample
5174 Every language that wishes to perform language-specific alias analysis
5175 should define a function that computes, given an @code{tree}
5176 node, an alias set for the node.  Nodes in different alias sets are not
5177 allowed to alias.  For an example, see the C front-end function
5178 @code{c_get_alias_set}.
5180 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5182 @item -falign-functions
5183 @itemx -falign-functions=@var{n}
5184 @opindex falign-functions
5185 Align the start of functions to the next power-of-two greater than
5186 @var{n}, skipping up to @var{n} bytes.  For instance,
5187 @option{-falign-functions=32} aligns functions to the next 32-byte
5188 boundary, but @option{-falign-functions=24} would align to the next
5189 32-byte boundary only if this can be done by skipping 23 bytes or less.
5191 @option{-fno-align-functions} and @option{-falign-functions=1} are
5192 equivalent and mean that functions will not be aligned.
5194 Some assemblers only support this flag when @var{n} is a power of two;
5195 in that case, it is rounded up.
5197 If @var{n} is not specified or is zero, use a machine-dependent default.
5199 Enabled at levels @option{-O2}, @option{-O3}.
5201 @item -falign-labels
5202 @itemx -falign-labels=@var{n}
5203 @opindex falign-labels
5204 Align all branch targets to a power-of-two boundary, skipping up to
5205 @var{n} bytes like @option{-falign-functions}.  This option can easily
5206 make code slower, because it must insert dummy operations for when the
5207 branch target is reached in the usual flow of the code.
5209 @option{-fno-align-labels} and @option{-falign-labels=1} are
5210 equivalent and mean that labels will not be aligned.
5212 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
5213 are greater than this value, then their values are used instead.
5215 If @var{n} is not specified or is zero, use a machine-dependent default
5216 which is very likely to be @samp{1}, meaning no alignment.
5218 Enabled at levels @option{-O2}, @option{-O3}.
5220 @item -falign-loops
5221 @itemx -falign-loops=@var{n}
5222 @opindex falign-loops
5223 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
5224 like @option{-falign-functions}.  The hope is that the loop will be
5225 executed many times, which will make up for any execution of the dummy
5226 operations.
5228 @option{-fno-align-loops} and @option{-falign-loops=1} are
5229 equivalent and mean that loops will not be aligned.
5231 If @var{n} is not specified or is zero, use a machine-dependent default.
5233 Enabled at levels @option{-O2}, @option{-O3}.
5235 @item -falign-jumps
5236 @itemx -falign-jumps=@var{n}
5237 @opindex falign-jumps
5238 Align branch targets to a power-of-two boundary, for branch targets
5239 where the targets can only be reached by jumping, skipping up to @var{n}
5240 bytes like @option{-falign-functions}.  In this case, no dummy operations
5241 need be executed.
5243 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
5244 equivalent and mean that loops will not be aligned.
5246 If @var{n} is not specified or is zero, use a machine-dependent default.
5248 Enabled at levels @option{-O2}, @option{-O3}.
5250 @item -funit-at-a-time
5251 @opindex funit-at-a-time
5252 Parse the whole compilation unit before starting to produce code.
5253 This allows some extra optimizations to take place but consumes
5254 more memory (in general).  There are some compatibility issues
5255 with @emph{unit-at-at-time} mode:
5256 @itemize @bullet
5257 @item
5258 enabling @emph{unit-at-a-time} mode may change the order
5259 in which functions, variables, and top-level @code{asm} statements
5260 are emitted, and will likely break code relying on some particular
5261 ordering.  The majority of such top-level @code{asm} statements,
5262 though, can be replaced by @code{section} attributes.
5264 @item
5265 @emph{unit-at-a-time} mode removes unreferenced static variables
5266 and functions.  This may result in undefined references
5267 when an @code{asm} statement refers directly to variables or functions
5268 that are otherwise unused.  In that case either the variable/function
5269 shall be listed as an operand of the @code{asm} statement operand or,
5270 in the case of top-level @code{asm} statements the attribute @code{used}
5271 shall be used on the declaration.
5273 @item
5274 Static functions now can use non-standard passing conventions that
5275 may break @code{asm} statements calling functions directly.  Again,
5276 attribute @code{used} will prevent this behavior.
5277 @end itemize
5279 As a temporary workaround, @option{-fno-unit-at-a-time} can be used,
5280 but this scheme may not be supported by future releases of GCC@.
5282 Enabled at levels @option{-O2}, @option{-O3}.
5284 @item -fweb
5285 @opindex fweb
5286 Constructs webs as commonly used for register allocation purposes and assign
5287 each web individual pseudo register.  This allows the register allocation pass
5288 to operate on pseudos directly, but also strengthens several other optimization
5289 passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
5290 however, make debugging impossible, since variables will no longer stay in a
5291 ``home register''.
5293 Enabled by default with @option{-funroll-loops}.
5295 @item -fwhole-program
5296 @opindex fwhole-program
5297 Assume that the current compilation unit represents whole program being
5298 compiled.  All public functions and variables with the exception of @code{main}
5299 and those merged by attribute @code{externally_visible} become static functions
5300 and in a affect gets more aggressively optimized by interprocedural optimizers.
5301 While this option is equivalent to proper use of @code{static} keyword for
5302 programs consisting of single file, in combination with option
5303 @option{--combine} this flag can be used to compile most of smaller scale C
5304 programs since the functions and variables become local for the whole combined
5305 compilation unit, not for the single source file itself.
5308 @item -fno-cprop-registers
5309 @opindex fno-cprop-registers
5310 After register allocation and post-register allocation instruction splitting,
5311 we perform a copy-propagation pass to try to reduce scheduling dependencies
5312 and occasionally eliminate the copy.
5314 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5316 @item -fprofile-generate
5317 @opindex fprofile-generate
5319 Enable options usually used for instrumenting application to produce
5320 profile useful for later recompilation with profile feedback based
5321 optimization.  You must use @option{-fprofile-generate} both when
5322 compiling and when linking your program.
5324 The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
5326 @item -fprofile-use
5327 @opindex fprofile-use
5328 Enable profile feedback directed optimizations, and optimizations
5329 generally profitable only with profile feedback available.
5331 The following options are enabled: @code{-fbranch-probabilities},
5332 @code{-fvpt}, @code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}.
5334 @end table
5336 The following options control compiler behavior regarding floating
5337 point arithmetic.  These options trade off between speed and
5338 correctness.  All must be specifically enabled.
5340 @table @gcctabopt
5341 @item -ffloat-store
5342 @opindex ffloat-store
5343 Do not store floating point variables in registers, and inhibit other
5344 options that might change whether a floating point value is taken from a
5345 register or memory.
5347 @cindex floating point precision
5348 This option prevents undesirable excess precision on machines such as
5349 the 68000 where the floating registers (of the 68881) keep more
5350 precision than a @code{double} is supposed to have.  Similarly for the
5351 x86 architecture.  For most programs, the excess precision does only
5352 good, but a few programs rely on the precise definition of IEEE floating
5353 point.  Use @option{-ffloat-store} for such programs, after modifying
5354 them to store all pertinent intermediate computations into variables.
5356 @item -ffast-math
5357 @opindex ffast-math
5358 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @*
5359 @option{-fno-trapping-math}, @option{-ffinite-math-only},
5360 @option{-fno-rounding-math}, @option{-fno-signaling-nans}
5361 and @option{fcx-limited-range}.
5363 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
5365 This option should never be turned on by any @option{-O} option since
5366 it can result in incorrect output for programs which depend on
5367 an exact implementation of IEEE or ISO rules/specifications for
5368 math functions.
5370 @item -fno-math-errno
5371 @opindex fno-math-errno
5372 Do not set ERRNO after calling math functions that are executed
5373 with a single instruction, e.g., sqrt.  A program that relies on
5374 IEEE exceptions for math error handling may want to use this flag
5375 for speed while maintaining IEEE arithmetic compatibility.
5377 This option should never be turned on by any @option{-O} option since
5378 it can result in incorrect output for programs which depend on
5379 an exact implementation of IEEE or ISO rules/specifications for
5380 math functions.
5382 The default is @option{-fmath-errno}.
5384 On Darwin systems, the math library never sets @code{errno}.  There is therefore
5385 no reason for the compiler to consider the possibility that it might,
5386 and @option{-fno-math-errno} is the default.
5388 @item -funsafe-math-optimizations
5389 @opindex funsafe-math-optimizations
5390 Allow optimizations for floating-point arithmetic that (a) assume
5391 that arguments and results are valid and (b) may violate IEEE or
5392 ANSI standards.  When used at link-time, it may include libraries
5393 or startup files that change the default FPU control word or other
5394 similar optimizations.
5396 This option should never be turned on by any @option{-O} option since
5397 it can result in incorrect output for programs which depend on
5398 an exact implementation of IEEE or ISO rules/specifications for
5399 math functions.
5401 The default is @option{-fno-unsafe-math-optimizations}.
5403 @item -ffinite-math-only
5404 @opindex ffinite-math-only
5405 Allow optimizations for floating-point arithmetic that assume
5406 that arguments and results are not NaNs or +-Infs.
5408 This option should never be turned on by any @option{-O} option since
5409 it can result in incorrect output for programs which depend on
5410 an exact implementation of IEEE or ISO rules/specifications.
5412 The default is @option{-fno-finite-math-only}.
5414 @item -fno-trapping-math
5415 @opindex fno-trapping-math
5416 Compile code assuming that floating-point operations cannot generate
5417 user-visible traps.  These traps include division by zero, overflow,
5418 underflow, inexact result and invalid operation.  This option implies
5419 @option{-fno-signaling-nans}.  Setting this option may allow faster
5420 code if one relies on ``non-stop'' IEEE arithmetic, for example.
5422 This option should never be turned on by any @option{-O} option since
5423 it can result in incorrect output for programs which depend on
5424 an exact implementation of IEEE or ISO rules/specifications for
5425 math functions.
5427 The default is @option{-ftrapping-math}.
5429 @item -frounding-math
5430 @opindex frounding-math
5431 Disable transformations and optimizations that assume default floating
5432 point rounding behavior.  This is round-to-zero for all floating point
5433 to integer conversions, and round-to-nearest for all other arithmetic
5434 truncations.  This option should be specified for programs that change
5435 the FP rounding mode dynamically, or that may be executed with a
5436 non-default rounding mode.  This option disables constant folding of
5437 floating point expressions at compile-time (which may be affected by
5438 rounding mode) and arithmetic transformations that are unsafe in the
5439 presence of sign-dependent rounding modes.
5441 The default is @option{-fno-rounding-math}.
5443 This option is experimental and does not currently guarantee to
5444 disable all GCC optimizations that are affected by rounding mode.
5445 Future versions of GCC may provide finer control of this setting
5446 using C99's @code{FENV_ACCESS} pragma.  This command line option
5447 will be used to specify the default state for @code{FENV_ACCESS}.
5449 @item -fsignaling-nans
5450 @opindex fsignaling-nans
5451 Compile code assuming that IEEE signaling NaNs may generate user-visible
5452 traps during floating-point operations.  Setting this option disables
5453 optimizations that may change the number of exceptions visible with
5454 signaling NaNs.  This option implies @option{-ftrapping-math}.
5456 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
5457 be defined.
5459 The default is @option{-fno-signaling-nans}.
5461 This option is experimental and does not currently guarantee to
5462 disable all GCC optimizations that affect signaling NaN behavior.
5464 @item -fsingle-precision-constant
5465 @opindex fsingle-precision-constant
5466 Treat floating point constant as single precision constant instead of
5467 implicitly converting it to double precision constant.
5469 @item -fcx-limited-range
5470 @itemx -fno-cx-limited-range
5471 @opindex fcx-limited-range
5472 @opindex fno-cx-limited-range
5473 When enabled, this option states that a range reduction step is not
5474 needed when performing complex division.  The default is
5475 @option{-fno-cx-limited-range}, but is enabled by @option{-ffast-math}.
5477 This option controls the default setting of the ISO C99 
5478 @code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
5479 all languages.
5481 @end table
5483 The following options control optimizations that may improve
5484 performance, but are not enabled by any @option{-O} options.  This
5485 section includes experimental options that may produce broken code.
5487 @table @gcctabopt
5488 @item -fbranch-probabilities
5489 @opindex fbranch-probabilities
5490 After running a program compiled with @option{-fprofile-arcs}
5491 (@pxref{Debugging Options,, Options for Debugging Your Program or
5492 @command{gcc}}), you can compile it a second time using
5493 @option{-fbranch-probabilities}, to improve optimizations based on
5494 the number of times each branch was taken.  When the program
5495 compiled with @option{-fprofile-arcs} exits it saves arc execution
5496 counts to a file called @file{@var{sourcename}.gcda} for each source
5497 file  The information in this data file is very dependent on the
5498 structure of the generated code, so you must use the same source code
5499 and the same optimization options for both compilations.
5501 With @option{-fbranch-probabilities}, GCC puts a
5502 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
5503 These can be used to improve optimization.  Currently, they are only
5504 used in one place: in @file{reorg.c}, instead of guessing which path a
5505 branch is mostly to take, the @samp{REG_BR_PROB} values are used to
5506 exactly determine which path is taken more often.
5508 @item -fprofile-values
5509 @opindex fprofile-values
5510 If combined with @option{-fprofile-arcs}, it adds code so that some
5511 data about values of expressions in the program is gathered.
5513 With @option{-fbranch-probabilities}, it reads back the data gathered
5514 from profiling values of expressions and adds @samp{REG_VALUE_PROFILE}
5515 notes to instructions for their later usage in optimizations.
5517 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
5519 @item -fvpt
5520 @opindex fvpt
5521 If combined with @option{-fprofile-arcs}, it instructs the compiler to add
5522 a code to gather information about values of expressions.
5524 With @option{-fbranch-probabilities}, it reads back the data gathered
5525 and actually performs the optimizations based on them.
5526 Currently the optimizations include specialization of division operation
5527 using the knowledge about the value of the denominator.
5529 @item -fspeculative-prefetching
5530 @opindex fspeculative-prefetching
5531 If combined with @option{-fprofile-arcs}, it instructs the compiler to add
5532 a code to gather information about addresses of memory references in the
5533 program.
5535 With @option{-fbranch-probabilities}, it reads back the data gathered
5536 and issues prefetch instructions according to them.  In addition to the opportunities
5537 noticed by @option{-fprefetch-loop-arrays}, it also notices more complicated
5538 memory access patterns---for example accesses to the data stored in linked
5539 list whose elements are usually allocated sequentially.
5541 In order to prevent issuing double prefetches, usage of
5542 @option{-fspeculative-prefetching} implies @option{-fno-prefetch-loop-arrays}.
5544 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
5546 @item -frename-registers
5547 @opindex frename-registers
5548 Attempt to avoid false dependencies in scheduled code by making use
5549 of registers left over after register allocation.  This optimization
5550 will most benefit processors with lots of registers.  Depending on the
5551 debug information format adopted by the target, however, it can
5552 make debugging impossible, since variables will no longer stay in
5553 a ``home register''.
5555 Enabled by default with @option{-funroll-loops}.
5557 @item -ftracer
5558 @opindex ftracer
5559 Perform tail duplication to enlarge superblock size.  This transformation
5560 simplifies the control flow of the function allowing other optimizations to do
5561 better job.
5563 Enabled with @option{-fprofile-use}.
5565 @item -funroll-loops
5566 @opindex funroll-loops
5567 Unroll loops whose number of iterations can be determined at compile time or
5568 upon entry to the loop.  @option{-funroll-loops} implies
5569 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}. 
5570 It also turns on complete loop peeling (i.e.@: complete removal of loops with
5571 small constant number of iterations).  This option makes code larger, and may
5572 or may not make it run faster.
5574 Enabled with @option{-fprofile-use}.
5576 @item -funroll-all-loops
5577 @opindex funroll-all-loops
5578 Unroll all loops, even if their number of iterations is uncertain when
5579 the loop is entered.  This usually makes programs run more slowly.
5580 @option{-funroll-all-loops} implies the same options as
5581 @option{-funroll-loops}.
5583 @item -fpeel-loops
5584 @opindex fpeel-loops
5585 Peels the loops for that there is enough information that they do not
5586 roll much (from profile feedback).  It also turns on complete loop peeling
5587 (i.e.@: complete removal of loops with small constant number of iterations).
5589 Enabled with @option{-fprofile-use}.
5591 @item -fmove-loop-invariants
5592 @opindex fmove-loop-invariants
5593 Enables the loop invariant motion pass in the new loop optimizer.  Enabled
5594 at level @option{-O1}
5596 @item -funswitch-loops
5597 @opindex funswitch-loops
5598 Move branches with loop invariant conditions out of the loop, with duplicates
5599 of the loop on both branches (modified according to result of the condition).
5601 @item -fprefetch-loop-arrays
5602 @opindex fprefetch-loop-arrays
5603 If supported by the target machine, generate instructions to prefetch
5604 memory to improve the performance of loops that access large arrays.
5606 Disabled at level @option{-Os}.
5608 @item -ffunction-sections
5609 @itemx -fdata-sections
5610 @opindex ffunction-sections
5611 @opindex fdata-sections
5612 Place each function or data item into its own section in the output
5613 file if the target supports arbitrary sections.  The name of the
5614 function or the name of the data item determines the section's name
5615 in the output file.
5617 Use these options on systems where the linker can perform optimizations
5618 to improve locality of reference in the instruction space.  Most systems
5619 using the ELF object format and SPARC processors running Solaris 2 have
5620 linkers with such optimizations.  AIX may have these optimizations in
5621 the future.
5623 Only use these options when there are significant benefits from doing
5624 so.  When you specify these options, the assembler and linker will
5625 create larger object and executable files and will also be slower.
5626 You will not be able to use @code{gprof} on all systems if you
5627 specify this option and you may have problems with debugging if
5628 you specify both this option and @option{-g}.
5630 @item -fbranch-target-load-optimize
5631 @opindex fbranch-target-load-optimize
5632 Perform branch target register load optimization before prologue / epilogue
5633 threading.
5634 The use of target registers can typically be exposed only during reload,
5635 thus hoisting loads out of loops and doing inter-block scheduling needs
5636 a separate optimization pass.
5638 @item -fbranch-target-load-optimize2
5639 @opindex fbranch-target-load-optimize2
5640 Perform branch target register load optimization after prologue / epilogue
5641 threading.
5643 @item -fbtr-bb-exclusive
5644 @opindex fbtr-bb-exclusive
5645 When performing branch target register load optimization, don't reuse
5646 branch target registers in within any basic block.
5648 @item --param @var{name}=@var{value}
5649 @opindex param
5650 In some places, GCC uses various constants to control the amount of
5651 optimization that is done.  For example, GCC will not inline functions
5652 that contain more that a certain number of instructions.  You can
5653 control some of these constants on the command-line using the
5654 @option{--param} option.
5656 The names of specific parameters, and the meaning of the values, are
5657 tied to the internals of the compiler, and are subject to change
5658 without notice in future releases.
5660 In each case, the @var{value} is an integer.  The allowable choices for
5661 @var{name} are given in the following table:
5663 @table @gcctabopt
5664 @item salias-max-implicit-fields
5665 The maximum number of fields in a variable without direct
5666 structure accesses for which structure aliasing will consider trying 
5667 to track each field.  The default is 5
5669 @item sra-max-structure-size
5670 The maximum structure size, in bytes, at which the scalar replacement
5671 of aggregates (SRA) optimization will perform block copies.  The
5672 default value, 0, implies that GCC will select the most appropriate
5673 size itself.
5675 @item sra-field-structure-ratio
5676 The threshold ratio (as a percentage) between instantiated fields and
5677 the complete structure size.  We say that if the ratio of the number
5678 of bytes in instantiated fields to the number of bytes in the complete
5679 structure exceeds this parameter, then block copies are not used.  The
5680 default is 75.
5682 @item max-crossjump-edges
5683 The maximum number of incoming edges to consider for crossjumping.
5684 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
5685 the number of edges incoming to each block.  Increasing values mean
5686 more aggressive optimization, making the compile time increase with
5687 probably small improvement in executable size.
5689 @item min-crossjump-insns
5690 The minimum number of instructions which must be matched at the end
5691 of two blocks before crossjumping will be performed on them.  This
5692 value is ignored in the case where all instructions in the block being
5693 crossjumped from are matched.  The default value is 5.
5695 @item max-goto-duplication-insns
5696 The maximum number of instructions to duplicate to a block that jumps
5697 to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
5698 passes, GCC factors computed gotos early in the compilation process,
5699 and unfactors them as late as possible.  Only computed jumps at the
5700 end of a basic blocks with no more than max-goto-duplication-insns are
5701 unfactored.  The default value is 8.
5703 @item max-delay-slot-insn-search
5704 The maximum number of instructions to consider when looking for an
5705 instruction to fill a delay slot.  If more than this arbitrary number of
5706 instructions is searched, the time savings from filling the delay slot
5707 will be minimal so stop searching.  Increasing values mean more
5708 aggressive optimization, making the compile time increase with probably
5709 small improvement in executable run time.
5711 @item max-delay-slot-live-search
5712 When trying to fill delay slots, the maximum number of instructions to
5713 consider when searching for a block with valid live register
5714 information.  Increasing this arbitrarily chosen value means more
5715 aggressive optimization, increasing the compile time.  This parameter
5716 should be removed when the delay slot code is rewritten to maintain the
5717 control-flow graph.
5719 @item max-gcse-memory
5720 The approximate maximum amount of memory that will be allocated in
5721 order to perform the global common subexpression elimination
5722 optimization.  If more memory than specified is required, the
5723 optimization will not be done.
5725 @item max-gcse-passes
5726 The maximum number of passes of GCSE to run.  The default is 1.
5728 @item max-pending-list-length
5729 The maximum number of pending dependencies scheduling will allow
5730 before flushing the current state and starting over.  Large functions
5731 with few branches or calls can create excessively large lists which
5732 needlessly consume memory and resources.
5734 @item max-inline-insns-single
5735 Several parameters control the tree inliner used in gcc.
5736 This number sets the maximum number of instructions (counted in GCC's
5737 internal representation) in a single function that the tree inliner
5738 will consider for inlining.  This only affects functions declared
5739 inline and methods implemented in a class declaration (C++).
5740 The default value is 450.
5742 @item max-inline-insns-auto
5743 When you use @option{-finline-functions} (included in @option{-O3}),
5744 a lot of functions that would otherwise not be considered for inlining
5745 by the compiler will be investigated.  To those functions, a different
5746 (more restrictive) limit compared to functions declared inline can
5747 be applied.
5748 The default value is 90.
5750 @item large-function-insns
5751 The limit specifying really large functions.  For functions larger than this
5752 limit after inlining inlining is constrained by
5753 @option{--param large-function-growth}.  This parameter is useful primarily
5754 to avoid extreme compilation time caused by non-linear algorithms used by the
5755 backend.
5756 This parameter is ignored when @option{-funit-at-a-time} is not used.
5757 The default value is 2700.
5759 @item large-function-growth
5760 Specifies maximal growth of large function caused by inlining in percents.
5761 This parameter is ignored when @option{-funit-at-a-time} is not used.
5762 The default value is 100 which limits large function growth to 2.0 times
5763 the original size.
5765 @item inline-unit-growth
5766 Specifies maximal overall growth of the compilation unit caused by inlining.
5767 This parameter is ignored when @option{-funit-at-a-time} is not used.
5768 The default value is 50 which limits unit growth to 1.5 times the original
5769 size.
5771 @item max-inline-insns-recursive
5772 @itemx max-inline-insns-recursive-auto
5773 Specifies maximum number of instructions out-of-line copy of self recursive inline
5774 function can grow into by performing recursive inlining.
5776 For functions declared inline @option{--param max-inline-insns-recursive} is
5777 taken into acount.  For function not declared inline, recursive inlining
5778 happens only when @option{-finline-functions} (included in @option{-O3}) is
5779 enabled and @option{--param max-inline-insns-recursive-auto} is used.  The
5780 default value is 450.
5782 @item max-inline-recursive-depth
5783 @itemx max-inline-recursive-depth-auto
5784 Specifies maximum recursion depth used by the recursive inlining.
5786 For functions declared inline @option{--param max-inline-recursive-depth} is
5787 taken into acount.  For function not declared inline, recursive inlining
5788 happens only when @option{-finline-functions} (included in @option{-O3}) is
5789 enabled and @option{--param max-inline-recursive-depth-auto} is used.  The
5790 default value is 450.
5792 @item inline-call-cost
5793 Specify cost of call instruction relative to simple arithmetics operations
5794 (having cost of 1).  Increasing this cost disqualifies inlining of non-leaf
5795 functions and at the same time increases size of leaf function that is believed to
5796 reduce function size by being inlined.  In effect it increases amount of
5797 inlining for code having large abstraction penalty (many functions that just
5798 pass the arguments to other functions) and decrease inlining for code with low
5799 abstraction penalty.  The default value is 16.
5801 @item max-unrolled-insns
5802 The maximum number of instructions that a loop should have if that loop
5803 is unrolled, and if the loop is unrolled, it determines how many times
5804 the loop code is unrolled.
5806 @item max-average-unrolled-insns
5807 The maximum number of instructions biased by probabilities of their execution
5808 that a loop should have if that loop is unrolled, and if the loop is unrolled,
5809 it determines how many times the loop code is unrolled.
5811 @item max-unroll-times
5812 The maximum number of unrollings of a single loop.
5814 @item max-peeled-insns
5815 The maximum number of instructions that a loop should have if that loop
5816 is peeled, and if the loop is peeled, it determines how many times
5817 the loop code is peeled.
5819 @item max-peel-times
5820 The maximum number of peelings of a single loop.
5822 @item max-completely-peeled-insns
5823 The maximum number of insns of a completely peeled loop.
5825 @item max-completely-peel-times
5826 The maximum number of iterations of a loop to be suitable for complete peeling.
5828 @item max-unswitch-insns
5829 The maximum number of insns of an unswitched loop.
5831 @item max-unswitch-level
5832 The maximum number of branches unswitched in a single loop.
5834 @item lim-expensive
5835 The minimum cost of an expensive expression in the loop invariant motion.
5837 @item iv-consider-all-candidates-bound
5838 Bound on number of candidates for induction variables below that
5839 all candidates are considered for each use in induction variable
5840 optimizations.  Only the most relevant candidates are considered
5841 if there are more candidates, to avoid quadratic time complexity.
5843 @item iv-max-considered-uses
5844 The induction variable optimizations give up on loops that contain more
5845 induction variable uses.
5847 @item iv-always-prune-cand-set-bound
5848 If number of candidates in the set is smaller than this value,
5849 we always try to remove unnecessary ivs from the set during its
5850 optimization when a new iv is added to the set.
5852 @item scev-max-expr-size
5853 Bound on size of expressions used in the scalar evolutions analyzer.
5854 Large expressions slow the analyzer.
5856 @item max-iterations-to-track
5858 The maximum number of iterations of a loop the brute force algorithm
5859 for analysis of # of iterations of the loop tries to evaluate.
5861 @item hot-bb-count-fraction
5862 Select fraction of the maximal count of repetitions of basic block in program
5863 given basic block needs to have to be considered hot.
5865 @item hot-bb-frequency-fraction
5866 Select fraction of the maximal frequency of executions of basic block in
5867 function given basic block needs to have to be considered hot
5869 @item tracer-dynamic-coverage
5870 @itemx tracer-dynamic-coverage-feedback
5872 This value is used to limit superblock formation once the given percentage of
5873 executed instructions is covered.  This limits unnecessary code size
5874 expansion.
5876 The @option{tracer-dynamic-coverage-feedback} is used only when profile
5877 feedback is available.  The real profiles (as opposed to statically estimated
5878 ones) are much less balanced allowing the threshold to be larger value.
5880 @item tracer-max-code-growth
5881 Stop tail duplication once code growth has reached given percentage.  This is
5882 rather hokey argument, as most of the duplicates will be eliminated later in
5883 cross jumping, so it may be set to much higher values than is the desired code
5884 growth.
5886 @item tracer-min-branch-ratio
5888 Stop reverse growth when the reverse probability of best edge is less than this
5889 threshold (in percent).
5891 @item tracer-min-branch-ratio
5892 @itemx tracer-min-branch-ratio-feedback
5894 Stop forward growth if the best edge do have probability lower than this
5895 threshold.
5897 Similarly to @option{tracer-dynamic-coverage} two values are present, one for
5898 compilation for profile feedback and one for compilation without.  The value
5899 for compilation with profile feedback needs to be more conservative (higher) in
5900 order to make tracer effective.
5902 @item max-cse-path-length
5904 Maximum number of basic blocks on path that cse considers.  The default is 10.
5906 @item global-var-threshold
5908 Counts the number of function calls (@var{n}) and the number of
5909 call-clobbered variables (@var{v}).  If @var{n}x@var{v} is larger than this limit, a
5910 single artificial variable will be created to represent all the
5911 call-clobbered variables at function call sites.  This artificial
5912 variable will then be made to alias every call-clobbered variable.
5913 (done as @code{int * size_t} on the host machine; beware overflow).
5915 @item max-aliased-vops
5917 Maximum number of virtual operands allowed to represent aliases
5918 before triggering the alias grouping heuristic.  Alias grouping
5919 reduces compile times and memory consumption needed for aliasing at
5920 the expense of precision loss in alias information.
5922 @item ggc-min-expand
5924 GCC uses a garbage collector to manage its own memory allocation.  This
5925 parameter specifies the minimum percentage by which the garbage
5926 collector's heap should be allowed to expand between collections.
5927 Tuning this may improve compilation speed; it has no effect on code
5928 generation.
5930 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
5931 RAM >= 1GB@.  If @code{getrlimit} is available, the notion of "RAM" is
5932 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
5933 GCC is not able to calculate RAM on a particular platform, the lower
5934 bound of 30% is used.  Setting this parameter and
5935 @option{ggc-min-heapsize} to zero causes a full collection to occur at
5936 every opportunity.  This is extremely slow, but can be useful for
5937 debugging.
5939 @item ggc-min-heapsize
5941 Minimum size of the garbage collector's heap before it begins bothering
5942 to collect garbage.  The first collection occurs after the heap expands
5943 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
5944 tuning this may improve compilation speed, and has no effect on code
5945 generation.
5947 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit which
5948 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
5949 with a lower bound of 4096 (four megabytes) and an upper bound of
5950 131072 (128 megabytes).  If GCC is not able to calculate RAM on a
5951 particular platform, the lower bound is used.  Setting this parameter
5952 very large effectively disables garbage collection.  Setting this
5953 parameter and @option{ggc-min-expand} to zero causes a full collection
5954 to occur at every opportunity.
5956 @item max-reload-search-insns
5957 The maximum number of instruction reload should look backward for equivalent
5958 register.  Increasing values mean more aggressive optimization, making the
5959 compile time increase with probably slightly better performance.  The default
5960 value is 100.
5962 @item max-cselib-memory-location
5963 The maximum number of memory locations cselib should take into acount.
5964 Increasing values mean more aggressive optimization, making the compile time
5965 increase with probably slightly better performance.  The default value is 500.
5967 @item reorder-blocks-duplicate
5968 @itemx reorder-blocks-duplicate-feedback
5970 Used by basic block reordering pass to decide whether to use unconditional
5971 branch or duplicate the code on its destination.  Code is duplicated when its
5972 estimated size is smaller than this value multiplied by the estimated size of
5973 unconditional jump in the hot spots of the program.
5975 The @option{reorder-block-duplicate-feedback} is used only when profile
5976 feedback is available and may be set to higher values than
5977 @option{reorder-block-duplicate} since information about the hot spots is more
5978 accurate.
5980 @item max-sched-region-blocks
5981 The maximum number of blocks in a region to be considered for
5982 interblock scheduling.  The default value is 10.
5984 @item max-sched-region-insns
5985 The maximum number of insns in a region to be considered for
5986 interblock scheduling.  The default value is 100.
5988 @item max-last-value-rtl
5990 The maximum size measured as number of RTLs that can be recorded in an expression
5991 in combiner for a pseudo register as last known value of that register.  The default
5992 is 10000.
5994 @item integer-share-limit
5995 Small integer constants can use a shared data structure, reducing the
5996 compiler's memory usage and increasing its speed.  This sets the maximum
5997 value of a shared integer constant's.  The default value is 256.
5999 @item min-virtual-mappings
6000 Specifies the minimum number of virtual mappings in the incremental
6001 SSA updater that should be registered to trigger the virtual mappings
6002 heuristic defined by virtual-mappings-ratio.  The default value is
6003 100.
6005 @item virtual-mappings-ratio
6006 If the number of virtual mappings is virtual-mappings-ratio bigger
6007 than the number of virtual symbols to be updated, then the incremental
6008 SSA updater switches to a full update for those symbols.  The default
6009 ratio is 3.
6011 @end table
6012 @end table
6014 @node Preprocessor Options
6015 @section Options Controlling the Preprocessor
6016 @cindex preprocessor options
6017 @cindex options, preprocessor
6019 These options control the C preprocessor, which is run on each C source
6020 file before actual compilation.
6022 If you use the @option{-E} option, nothing is done except preprocessing.
6023 Some of these options make sense only together with @option{-E} because
6024 they cause the preprocessor output to be unsuitable for actual
6025 compilation.
6027 @table @gcctabopt
6028 @opindex Wp
6029 You can use @option{-Wp,@var{option}} to bypass the compiler driver
6030 and pass @var{option} directly through to the preprocessor.  If
6031 @var{option} contains commas, it is split into multiple options at the
6032 commas.  However, many options are modified, translated or interpreted
6033 by the compiler driver before being passed to the preprocessor, and
6034 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
6035 interface is undocumented and subject to change, so whenever possible
6036 you should avoid using @option{-Wp} and let the driver handle the
6037 options instead.
6039 @item -Xpreprocessor @var{option}
6040 @opindex preprocessor
6041 Pass @var{option} as an option to the preprocessor.  You can use this to
6042 supply system-specific preprocessor options which GCC does not know how to
6043 recognize.
6045 If you want to pass an option that takes an argument, you must use
6046 @option{-Xpreprocessor} twice, once for the option and once for the argument.
6047 @end table
6049 @include cppopts.texi
6051 @node Assembler Options
6052 @section Passing Options to the Assembler
6054 @c prevent bad page break with this line
6055 You can pass options to the assembler.
6057 @table @gcctabopt
6058 @item -Wa,@var{option}
6059 @opindex Wa
6060 Pass @var{option} as an option to the assembler.  If @var{option}
6061 contains commas, it is split into multiple options at the commas.
6063 @item -Xassembler @var{option}
6064 @opindex Xassembler
6065 Pass @var{option} as an option to the assembler.  You can use this to
6066 supply system-specific assembler options which GCC does not know how to
6067 recognize.
6069 If you want to pass an option that takes an argument, you must use
6070 @option{-Xassembler} twice, once for the option and once for the argument.
6072 @end table
6074 @node Link Options
6075 @section Options for Linking
6076 @cindex link options
6077 @cindex options, linking
6079 These options come into play when the compiler links object files into
6080 an executable output file.  They are meaningless if the compiler is
6081 not doing a link step.
6083 @table @gcctabopt
6084 @cindex file names
6085 @item @var{object-file-name}
6086 A file name that does not end in a special recognized suffix is
6087 considered to name an object file or library.  (Object files are
6088 distinguished from libraries by the linker according to the file
6089 contents.)  If linking is done, these object files are used as input
6090 to the linker.
6092 @item -c
6093 @itemx -S
6094 @itemx -E
6095 @opindex c
6096 @opindex S
6097 @opindex E
6098 If any of these options is used, then the linker is not run, and
6099 object file names should not be used as arguments.  @xref{Overall
6100 Options}.
6102 @cindex Libraries
6103 @item -l@var{library}
6104 @itemx -l @var{library}
6105 @opindex l
6106 Search the library named @var{library} when linking.  (The second
6107 alternative with the library as a separate argument is only for
6108 POSIX compliance and is not recommended.)
6110 It makes a difference where in the command you write this option; the
6111 linker searches and processes libraries and object files in the order they
6112 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
6113 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
6114 to functions in @samp{z}, those functions may not be loaded.
6116 The linker searches a standard list of directories for the library,
6117 which is actually a file named @file{lib@var{library}.a}.  The linker
6118 then uses this file as if it had been specified precisely by name.
6120 The directories searched include several standard system directories
6121 plus any that you specify with @option{-L}.
6123 Normally the files found this way are library files---archive files
6124 whose members are object files.  The linker handles an archive file by
6125 scanning through it for members which define symbols that have so far
6126 been referenced but not defined.  But if the file that is found is an
6127 ordinary object file, it is linked in the usual fashion.  The only
6128 difference between using an @option{-l} option and specifying a file name
6129 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
6130 and searches several directories.
6132 @item -lobjc
6133 @opindex lobjc
6134 You need this special case of the @option{-l} option in order to
6135 link an Objective-C or Objective-C++ program.
6137 @item -nostartfiles
6138 @opindex nostartfiles
6139 Do not use the standard system startup files when linking.
6140 The standard system libraries are used normally, unless @option{-nostdlib}
6141 or @option{-nodefaultlibs} is used.
6143 @item -nodefaultlibs
6144 @opindex nodefaultlibs
6145 Do not use the standard system libraries when linking.
6146 Only the libraries you specify will be passed to the linker.
6147 The standard startup files are used normally, unless @option{-nostartfiles}
6148 is used.  The compiler may generate calls to @code{memcmp},
6149 @code{memset}, @code{memcpy} and @code{memmove}.
6150 These entries are usually resolved by entries in
6151 libc.  These entry points should be supplied through some other
6152 mechanism when this option is specified.
6154 @item -nostdlib
6155 @opindex nostdlib
6156 Do not use the standard system startup files or libraries when linking.
6157 No startup files and only the libraries you specify will be passed to
6158 the linker.  The compiler may generate calls to @code{memcmp}, @code{memset},
6159 @code{memcpy} and @code{memmove}.
6160 These entries are usually resolved by entries in
6161 libc.  These entry points should be supplied through some other
6162 mechanism when this option is specified.
6164 @cindex @option{-lgcc}, use with @option{-nostdlib}
6165 @cindex @option{-nostdlib} and unresolved references
6166 @cindex unresolved references and @option{-nostdlib}
6167 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
6168 @cindex @option{-nodefaultlibs} and unresolved references
6169 @cindex unresolved references and @option{-nodefaultlibs}
6170 One of the standard libraries bypassed by @option{-nostdlib} and
6171 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
6172 that GCC uses to overcome shortcomings of particular machines, or special
6173 needs for some languages.
6174 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
6175 Collection (GCC) Internals},
6176 for more discussion of @file{libgcc.a}.)
6177 In most cases, you need @file{libgcc.a} even when you want to avoid
6178 other standard libraries.  In other words, when you specify @option{-nostdlib}
6179 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
6180 This ensures that you have no unresolved references to internal GCC
6181 library subroutines.  (For example, @samp{__main}, used to ensure C++
6182 constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
6183 GNU Compiler Collection (GCC) Internals}.)
6185 @item -pie
6186 @opindex pie
6187 Produce a position independent executable on targets which support it.
6188 For predictable results, you must also specify the same set of options
6189 that were used to generate code (@option{-fpie}, @option{-fPIE},
6190 or model suboptions) when you specify this option.
6192 @item -s
6193 @opindex s
6194 Remove all symbol table and relocation information from the executable.
6196 @item -static
6197 @opindex static
6198 On systems that support dynamic linking, this prevents linking with the shared
6199 libraries.  On other systems, this option has no effect.
6201 @item -shared
6202 @opindex shared
6203 Produce a shared object which can then be linked with other objects to
6204 form an executable.  Not all systems support this option.  For predictable
6205 results, you must also specify the same set of options that were used to
6206 generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
6207 when you specify this option.@footnote{On some systems, @samp{gcc -shared}
6208 needs to build supplementary stub code for constructors to work.  On
6209 multi-libbed systems, @samp{gcc -shared} must select the correct support
6210 libraries to link against.  Failing to supply the correct flags may lead
6211 to subtle defects.  Supplying them in cases where they are not necessary
6212 is innocuous.}
6214 @item -shared-libgcc
6215 @itemx -static-libgcc
6216 @opindex shared-libgcc
6217 @opindex static-libgcc
6218 On systems that provide @file{libgcc} as a shared library, these options
6219 force the use of either the shared or static version respectively.
6220 If no shared version of @file{libgcc} was built when the compiler was
6221 configured, these options have no effect.
6223 There are several situations in which an application should use the
6224 shared @file{libgcc} instead of the static version.  The most common
6225 of these is when the application wishes to throw and catch exceptions
6226 across different shared libraries.  In that case, each of the libraries
6227 as well as the application itself should use the shared @file{libgcc}.
6229 Therefore, the G++ and GCJ drivers automatically add
6230 @option{-shared-libgcc} whenever you build a shared library or a main
6231 executable, because C++ and Java programs typically use exceptions, so
6232 this is the right thing to do.
6234 If, instead, you use the GCC driver to create shared libraries, you may
6235 find that they will not always be linked with the shared @file{libgcc}.
6236 If GCC finds, at its configuration time, that you have a non-GNU linker
6237 or a GNU linker that does not support option @option{--eh-frame-hdr},
6238 it will link the shared version of @file{libgcc} into shared libraries
6239 by default.  Otherwise, it will take advantage of the linker and optimize
6240 away the linking with the shared version of @file{libgcc}, linking with
6241 the static version of libgcc by default.  This allows exceptions to
6242 propagate through such shared libraries, without incurring relocation
6243 costs at library load time.
6245 However, if a library or main executable is supposed to throw or catch
6246 exceptions, you must link it using the G++ or GCJ driver, as appropriate
6247 for the languages used in the program, or using the option
6248 @option{-shared-libgcc}, such that it is linked with the shared
6249 @file{libgcc}.
6251 @item -symbolic
6252 @opindex symbolic
6253 Bind references to global symbols when building a shared object.  Warn
6254 about any unresolved references (unless overridden by the link editor
6255 option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
6256 this option.
6258 @item -Xlinker @var{option}
6259 @opindex Xlinker
6260 Pass @var{option} as an option to the linker.  You can use this to
6261 supply system-specific linker options which GCC does not know how to
6262 recognize.
6264 If you want to pass an option that takes an argument, you must use
6265 @option{-Xlinker} twice, once for the option and once for the argument.
6266 For example, to pass @option{-assert definitions}, you must write
6267 @samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
6268 @option{-Xlinker "-assert definitions"}, because this passes the entire
6269 string as a single argument, which is not what the linker expects.
6271 @item -Wl,@var{option}
6272 @opindex Wl
6273 Pass @var{option} as an option to the linker.  If @var{option} contains
6274 commas, it is split into multiple options at the commas.
6276 @item -u @var{symbol}
6277 @opindex u
6278 Pretend the symbol @var{symbol} is undefined, to force linking of
6279 library modules to define it.  You can use @option{-u} multiple times with
6280 different symbols to force loading of additional library modules.
6281 @end table
6283 @node Directory Options
6284 @section Options for Directory Search
6285 @cindex directory options
6286 @cindex options, directory search
6287 @cindex search path
6289 These options specify directories to search for header files, for
6290 libraries and for parts of the compiler:
6292 @table @gcctabopt
6293 @item -I@var{dir}
6294 @opindex I
6295 Add the directory @var{dir} to the head of the list of directories to be
6296 searched for header files.  This can be used to override a system header
6297 file, substituting your own version, since these directories are
6298 searched before the system header file directories.  However, you should
6299 not use this option to add directories that contain vendor-supplied
6300 system header files (use @option{-isystem} for that).  If you use more than
6301 one @option{-I} option, the directories are scanned in left-to-right
6302 order; the standard system directories come after.
6304 If a standard system include directory, or a directory specified with
6305 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
6306 option will be ignored.  The directory will still be searched but as a
6307 system directory at its normal position in the system include chain.
6308 This is to ensure that GCC's procedure to fix buggy system headers and
6309 the ordering for the include_next directive are not inadvertently changed.
6310 If you really need to change the search order for system directories,
6311 use the @option{-nostdinc} and/or @option{-isystem} options.
6313 @item -iquote@var{dir}
6314 @opindex iquote
6315 Add the directory @var{dir} to the head of the list of directories to
6316 be searched for header files only for the case of @samp{#include
6317 "@var{file}"}; they are not searched for @samp{#include <@var{file}>},
6318 otherwise just like @option{-I}.
6320 @item -L@var{dir}
6321 @opindex L
6322 Add directory @var{dir} to the list of directories to be searched
6323 for @option{-l}.
6325 @item -B@var{prefix}
6326 @opindex B
6327 This option specifies where to find the executables, libraries,
6328 include files, and data files of the compiler itself.
6330 The compiler driver program runs one or more of the subprograms
6331 @file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
6332 @var{prefix} as a prefix for each program it tries to run, both with and
6333 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
6335 For each subprogram to be run, the compiler driver first tries the
6336 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
6337 was not specified, the driver tries two standard prefixes, which are
6338 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
6339 those results in a file name that is found, the unmodified program
6340 name is searched for using the directories specified in your
6341 @env{PATH} environment variable.
6343 The compiler will check to see if the path provided by the @option{-B}
6344 refers to a directory, and if necessary it will add a directory
6345 separator character at the end of the path.
6347 @option{-B} prefixes that effectively specify directory names also apply
6348 to libraries in the linker, because the compiler translates these
6349 options into @option{-L} options for the linker.  They also apply to
6350 includes files in the preprocessor, because the compiler translates these
6351 options into @option{-isystem} options for the preprocessor.  In this case,
6352 the compiler appends @samp{include} to the prefix.
6354 The run-time support file @file{libgcc.a} can also be searched for using
6355 the @option{-B} prefix, if needed.  If it is not found there, the two
6356 standard prefixes above are tried, and that is all.  The file is left
6357 out of the link if it is not found by those means.
6359 Another way to specify a prefix much like the @option{-B} prefix is to use
6360 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
6361 Variables}.
6363 As a special kludge, if the path provided by @option{-B} is
6364 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
6365 9, then it will be replaced by @file{[dir/]include}.  This is to help
6366 with boot-strapping the compiler.
6368 @item -specs=@var{file}
6369 @opindex specs
6370 Process @var{file} after the compiler reads in the standard @file{specs}
6371 file, in order to override the defaults that the @file{gcc} driver
6372 program uses when determining what switches to pass to @file{cc1},
6373 @file{cc1plus}, @file{as}, @file{ld}, etc.  More than one
6374 @option{-specs=@var{file}} can be specified on the command line, and they
6375 are processed in order, from left to right.
6377 @item --sysroot=@var{dir}
6378 @opindex sysroot
6379 Use @var{dir} as the logical root directory for headers and libraries.
6380 For example, if the compiler would normally search for headers in
6381 @file{/usr/include} and libraries in @file{/usr/lib}, it will instead
6382 search @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.  
6384 If you use both this option and the @option{-isysroot} option, then
6385 the @option{--sysroot} option will apply to libraries, but the
6386 @option{-isysroot} option will apply to header files.
6388 The GNU linker (beginning with version 2.16) has the necessary support
6389 for this option.  If your linker does not support this option, the
6390 header file aspect of @option{--sysroot} will still work, but the
6391 library aspect will not.
6393 @item -I-
6394 @opindex I-
6395 This option has been deprecated.  Please use @option{-iquote} instead for
6396 @option{-I} directories before the @option{-I-} and remove the @option{-I-}.
6397 Any directories you specify with @option{-I} options before the @option{-I-}
6398 option are searched only for the case of @samp{#include "@var{file}"};
6399 they are not searched for @samp{#include <@var{file}>}.
6401 If additional directories are specified with @option{-I} options after
6402 the @option{-I-}, these directories are searched for all @samp{#include}
6403 directives.  (Ordinarily @emph{all} @option{-I} directories are used
6404 this way.)
6406 In addition, the @option{-I-} option inhibits the use of the current
6407 directory (where the current input file came from) as the first search
6408 directory for @samp{#include "@var{file}"}.  There is no way to
6409 override this effect of @option{-I-}.  With @option{-I.} you can specify
6410 searching the directory which was current when the compiler was
6411 invoked.  That is not exactly the same as what the preprocessor does
6412 by default, but it is often satisfactory.
6414 @option{-I-} does not inhibit the use of the standard system directories
6415 for header files.  Thus, @option{-I-} and @option{-nostdinc} are
6416 independent.
6417 @end table
6419 @c man end
6421 @node Spec Files
6422 @section Specifying subprocesses and the switches to pass to them
6423 @cindex Spec Files
6425 @command{gcc} is a driver program.  It performs its job by invoking a
6426 sequence of other programs to do the work of compiling, assembling and
6427 linking.  GCC interprets its command-line parameters and uses these to
6428 deduce which programs it should invoke, and which command-line options
6429 it ought to place on their command lines.  This behavior is controlled
6430 by @dfn{spec strings}.  In most cases there is one spec string for each
6431 program that GCC can invoke, but a few programs have multiple spec
6432 strings to control their behavior.  The spec strings built into GCC can
6433 be overridden by using the @option{-specs=} command-line switch to specify
6434 a spec file.
6436 @dfn{Spec files} are plaintext files that are used to construct spec
6437 strings.  They consist of a sequence of directives separated by blank
6438 lines.  The type of directive is determined by the first non-whitespace
6439 character on the line and it can be one of the following:
6441 @table @code
6442 @item %@var{command}
6443 Issues a @var{command} to the spec file processor.  The commands that can
6444 appear here are:
6446 @table @code
6447 @item %include <@var{file}>
6448 @cindex %include
6449 Search for @var{file} and insert its text at the current point in the
6450 specs file.
6452 @item %include_noerr <@var{file}>
6453 @cindex %include_noerr
6454 Just like @samp{%include}, but do not generate an error message if the include
6455 file cannot be found.
6457 @item %rename @var{old_name} @var{new_name}
6458 @cindex %rename
6459 Rename the spec string @var{old_name} to @var{new_name}.
6461 @end table
6463 @item *[@var{spec_name}]:
6464 This tells the compiler to create, override or delete the named spec
6465 string.  All lines after this directive up to the next directive or
6466 blank line are considered to be the text for the spec string.  If this
6467 results in an empty string then the spec will be deleted.  (Or, if the
6468 spec did not exist, then nothing will happened.)  Otherwise, if the spec
6469 does not currently exist a new spec will be created.  If the spec does
6470 exist then its contents will be overridden by the text of this
6471 directive, unless the first character of that text is the @samp{+}
6472 character, in which case the text will be appended to the spec.
6474 @item [@var{suffix}]:
6475 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
6476 and up to the next directive or blank line are considered to make up the
6477 spec string for the indicated suffix.  When the compiler encounters an
6478 input file with the named suffix, it will processes the spec string in
6479 order to work out how to compile that file.  For example:
6481 @smallexample
6482 .ZZ:
6483 z-compile -input %i
6484 @end smallexample
6486 This says that any input file whose name ends in @samp{.ZZ} should be
6487 passed to the program @samp{z-compile}, which should be invoked with the
6488 command-line switch @option{-input} and with the result of performing the
6489 @samp{%i} substitution.  (See below.)
6491 As an alternative to providing a spec string, the text that follows a
6492 suffix directive can be one of the following:
6494 @table @code
6495 @item @@@var{language}
6496 This says that the suffix is an alias for a known @var{language}.  This is
6497 similar to using the @option{-x} command-line switch to GCC to specify a
6498 language explicitly.  For example:
6500 @smallexample
6501 .ZZ:
6502 @@c++
6503 @end smallexample
6505 Says that .ZZ files are, in fact, C++ source files.
6507 @item #@var{name}
6508 This causes an error messages saying:
6510 @smallexample
6511 @var{name} compiler not installed on this system.
6512 @end smallexample
6513 @end table
6515 GCC already has an extensive list of suffixes built into it.
6516 This directive will add an entry to the end of the list of suffixes, but
6517 since the list is searched from the end backwards, it is effectively
6518 possible to override earlier entries using this technique.
6520 @end table
6522 GCC has the following spec strings built into it.  Spec files can
6523 override these strings or create their own.  Note that individual
6524 targets can also add their own spec strings to this list.
6526 @smallexample
6527 asm          Options to pass to the assembler
6528 asm_final    Options to pass to the assembler post-processor
6529 cpp          Options to pass to the C preprocessor
6530 cc1          Options to pass to the C compiler
6531 cc1plus      Options to pass to the C++ compiler
6532 endfile      Object files to include at the end of the link
6533 link         Options to pass to the linker
6534 lib          Libraries to include on the command line to the linker
6535 libgcc       Decides which GCC support library to pass to the linker
6536 linker       Sets the name of the linker
6537 predefines   Defines to be passed to the C preprocessor
6538 signed_char  Defines to pass to CPP to say whether @code{char} is signed
6539              by default
6540 startfile    Object files to include at the start of the link
6541 @end smallexample
6543 Here is a small example of a spec file:
6545 @smallexample
6546 %rename lib                 old_lib
6548 *lib:
6549 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
6550 @end smallexample
6552 This example renames the spec called @samp{lib} to @samp{old_lib} and
6553 then overrides the previous definition of @samp{lib} with a new one.
6554 The new definition adds in some extra command-line options before
6555 including the text of the old definition.
6557 @dfn{Spec strings} are a list of command-line options to be passed to their
6558 corresponding program.  In addition, the spec strings can contain
6559 @samp{%}-prefixed sequences to substitute variable text or to
6560 conditionally insert text into the command line.  Using these constructs
6561 it is possible to generate quite complex command lines.
6563 Here is a table of all defined @samp{%}-sequences for spec
6564 strings.  Note that spaces are not generated automatically around the
6565 results of expanding these sequences.  Therefore you can concatenate them
6566 together or combine them with constant text in a single argument.
6568 @table @code
6569 @item %%
6570 Substitute one @samp{%} into the program name or argument.
6572 @item %i
6573 Substitute the name of the input file being processed.
6575 @item %b
6576 Substitute the basename of the input file being processed.
6577 This is the substring up to (and not including) the last period
6578 and not including the directory.
6580 @item %B
6581 This is the same as @samp{%b}, but include the file suffix (text after
6582 the last period).
6584 @item %d
6585 Marks the argument containing or following the @samp{%d} as a
6586 temporary file name, so that that file will be deleted if GCC exits
6587 successfully.  Unlike @samp{%g}, this contributes no text to the
6588 argument.
6590 @item %g@var{suffix}
6591 Substitute a file name that has suffix @var{suffix} and is chosen
6592 once per compilation, and mark the argument in the same way as
6593 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
6594 name is now chosen in a way that is hard to predict even when previously
6595 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
6596 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
6597 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
6598 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
6599 was simply substituted with a file name chosen once per compilation,
6600 without regard to any appended suffix (which was therefore treated
6601 just like ordinary text), making such attacks more likely to succeed.
6603 @item %u@var{suffix}
6604 Like @samp{%g}, but generates a new temporary file name even if
6605 @samp{%u@var{suffix}} was already seen.
6607 @item %U@var{suffix}
6608 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
6609 new one if there is no such last file name.  In the absence of any
6610 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
6611 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
6612 would involve the generation of two distinct file names, one
6613 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
6614 simply substituted with a file name chosen for the previous @samp{%u},
6615 without regard to any appended suffix.
6617 @item %j@var{suffix}
6618 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
6619 writable, and if save-temps is off; otherwise, substitute the name
6620 of a temporary file, just like @samp{%u}.  This temporary file is not
6621 meant for communication between processes, but rather as a junk
6622 disposal mechanism.
6624 @item %|@var{suffix}
6625 @itemx %m@var{suffix}
6626 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
6627 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
6628 all.  These are the two most common ways to instruct a program that it
6629 should read from standard input or write to standard output.  If you
6630 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
6631 construct: see for example @file{f/lang-specs.h}.
6633 @item %.@var{SUFFIX}
6634 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
6635 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
6636 terminated by the next space or %.
6638 @item %w
6639 Marks the argument containing or following the @samp{%w} as the
6640 designated output file of this compilation.  This puts the argument
6641 into the sequence of arguments that @samp{%o} will substitute later.
6643 @item %o
6644 Substitutes the names of all the output files, with spaces
6645 automatically placed around them.  You should write spaces
6646 around the @samp{%o} as well or the results are undefined.
6647 @samp{%o} is for use in the specs for running the linker.
6648 Input files whose names have no recognized suffix are not compiled
6649 at all, but they are included among the output files, so they will
6650 be linked.
6652 @item %O
6653 Substitutes the suffix for object files.  Note that this is
6654 handled specially when it immediately follows @samp{%g, %u, or %U},
6655 because of the need for those to form complete file names.  The
6656 handling is such that @samp{%O} is treated exactly as if it had already
6657 been substituted, except that @samp{%g, %u, and %U} do not currently
6658 support additional @var{suffix} characters following @samp{%O} as they would
6659 following, for example, @samp{.o}.
6661 @item %p
6662 Substitutes the standard macro predefinitions for the
6663 current target machine.  Use this when running @code{cpp}.
6665 @item %P
6666 Like @samp{%p}, but puts @samp{__} before and after the name of each
6667 predefined macro, except for macros that start with @samp{__} or with
6668 @samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
6671 @item %I
6672 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
6673 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), and
6674 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
6675 as necessary.
6677 @item %s
6678 Current argument is the name of a library or startup file of some sort.
6679 Search for that file in a standard list of directories and substitute
6680 the full name found.
6682 @item %e@var{str}
6683 Print @var{str} as an error message.  @var{str} is terminated by a newline.
6684 Use this when inconsistent options are detected.
6686 @item %(@var{name})
6687 Substitute the contents of spec string @var{name} at this point.
6689 @item %[@var{name}]
6690 Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
6692 @item %x@{@var{option}@}
6693 Accumulate an option for @samp{%X}.
6695 @item %X
6696 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
6697 spec string.
6699 @item %Y
6700 Output the accumulated assembler options specified by @option{-Wa}.
6702 @item %Z
6703 Output the accumulated preprocessor options specified by @option{-Wp}.
6705 @item %a
6706 Process the @code{asm} spec.  This is used to compute the
6707 switches to be passed to the assembler.
6709 @item %A
6710 Process the @code{asm_final} spec.  This is a spec string for
6711 passing switches to an assembler post-processor, if such a program is
6712 needed.
6714 @item %l
6715 Process the @code{link} spec.  This is the spec for computing the
6716 command line passed to the linker.  Typically it will make use of the
6717 @samp{%L %G %S %D and %E} sequences.
6719 @item %D
6720 Dump out a @option{-L} option for each directory that GCC believes might
6721 contain startup files.  If the target supports multilibs then the
6722 current multilib directory will be prepended to each of these paths.
6724 @item %L
6725 Process the @code{lib} spec.  This is a spec string for deciding which
6726 libraries should be included on the command line to the linker.
6728 @item %G
6729 Process the @code{libgcc} spec.  This is a spec string for deciding
6730 which GCC support library should be included on the command line to the linker.
6732 @item %S
6733 Process the @code{startfile} spec.  This is a spec for deciding which
6734 object files should be the first ones passed to the linker.  Typically
6735 this might be a file named @file{crt0.o}.
6737 @item %E
6738 Process the @code{endfile} spec.  This is a spec string that specifies
6739 the last object files that will be passed to the linker.
6741 @item %C
6742 Process the @code{cpp} spec.  This is used to construct the arguments
6743 to be passed to the C preprocessor.
6745 @item %1
6746 Process the @code{cc1} spec.  This is used to construct the options to be
6747 passed to the actual C compiler (@samp{cc1}).
6749 @item %2
6750 Process the @code{cc1plus} spec.  This is used to construct the options to be
6751 passed to the actual C++ compiler (@samp{cc1plus}).
6753 @item %*
6754 Substitute the variable part of a matched option.  See below.
6755 Note that each comma in the substituted string is replaced by
6756 a single space.
6758 @item %<@code{S}
6759 Remove all occurrences of @code{-S} from the command line.  Note---this
6760 command is position dependent.  @samp{%} commands in the spec string
6761 before this one will see @code{-S}, @samp{%} commands in the spec string
6762 after this one will not.
6764 @item %:@var{function}(@var{args})
6765 Call the named function @var{function}, passing it @var{args}.
6766 @var{args} is first processed as a nested spec string, then split
6767 into an argument vector in the usual fashion.  The function returns
6768 a string which is processed as if it had appeared literally as part
6769 of the current spec.
6771 The following built-in spec functions are provided:
6773 @table @code
6774 @item @code{if-exists}
6775 The @code{if-exists} spec function takes one argument, an absolute
6776 pathname to a file.  If the file exists, @code{if-exists} returns the
6777 pathname.  Here is a small example of its usage:
6779 @smallexample
6780 *startfile:
6781 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
6782 @end smallexample
6784 @item @code{if-exists-else}
6785 The @code{if-exists-else} spec function is similar to the @code{if-exists}
6786 spec function, except that it takes two arguments.  The first argument is
6787 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
6788 returns the pathname.  If it does not exist, it returns the second argument.
6789 This way, @code{if-exists-else} can be used to select one file or another,
6790 based on the existence of the first.  Here is a small example of its usage:
6792 @smallexample
6793 *startfile:
6794 crt0%O%s %:if-exists(crti%O%s) \
6795 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
6796 @end smallexample
6798 @item @code{replace-outfile}
6799 The @code{replace-outfile} spec function takes two arguments.  It looks for the
6800 first argument in the outfiles array and replaces it with the second argument.  Here
6801 is a small example of its usage:
6803 @smallexample
6804 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
6805 @end smallexample
6807 @end table
6809 @item %@{@code{S}@}
6810 Substitutes the @code{-S} switch, if that switch was given to GCC@.
6811 If that switch was not specified, this substitutes nothing.  Note that
6812 the leading dash is omitted when specifying this option, and it is
6813 automatically inserted if the substitution is performed.  Thus the spec
6814 string @samp{%@{foo@}} would match the command-line option @option{-foo}
6815 and would output the command line option @option{-foo}.
6817 @item %W@{@code{S}@}
6818 Like %@{@code{S}@} but mark last argument supplied within as a file to be
6819 deleted on failure.
6821 @item %@{@code{S}*@}
6822 Substitutes all the switches specified to GCC whose names start
6823 with @code{-S}, but which also take an argument.  This is used for
6824 switches like @option{-o}, @option{-D}, @option{-I}, etc.
6825 GCC considers @option{-o foo} as being
6826 one switch whose names starts with @samp{o}.  %@{o*@} would substitute this
6827 text, including the space.  Thus two arguments would be generated.
6829 @item %@{@code{S}*&@code{T}*@}
6830 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
6831 (the order of @code{S} and @code{T} in the spec is not significant).
6832 There can be any number of ampersand-separated variables; for each the
6833 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
6835 @item %@{@code{S}:@code{X}@}
6836 Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
6838 @item %@{!@code{S}:@code{X}@}
6839 Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
6841 @item %@{@code{S}*:@code{X}@}
6842 Substitutes @code{X} if one or more switches whose names start with
6843 @code{-S} are specified to GCC@.  Normally @code{X} is substituted only
6844 once, no matter how many such switches appeared.  However, if @code{%*}
6845 appears somewhere in @code{X}, then @code{X} will be substituted once
6846 for each matching switch, with the @code{%*} replaced by the part of
6847 that switch that matched the @code{*}.
6849 @item %@{.@code{S}:@code{X}@}
6850 Substitutes @code{X}, if processing a file with suffix @code{S}.
6852 @item %@{!.@code{S}:@code{X}@}
6853 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
6855 @item %@{@code{S}|@code{P}:@code{X}@}
6856 Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@.
6857 This may be combined with @samp{!}, @samp{.}, and @code{*} sequences as well,
6858 although they have a stronger binding than the @samp{|}.  If @code{%*}
6859 appears in @code{X}, all of the alternatives must be starred, and only
6860 the first matching alternative is substituted.
6862 For example, a spec string like this:
6864 @smallexample
6865 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
6866 @end smallexample
6868 will output the following command-line options from the following input
6869 command-line options:
6871 @smallexample
6872 fred.c        -foo -baz
6873 jim.d         -bar -boggle
6874 -d fred.c     -foo -baz -boggle
6875 -d jim.d      -bar -baz -boggle
6876 @end smallexample
6878 @item %@{S:X; T:Y; :D@}
6880 If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
6881 given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
6882 be as many clauses as you need.  This may be combined with @code{.},
6883 @code{!}, @code{|}, and @code{*} as needed.
6886 @end table
6888 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
6889 construct may contain other nested @samp{%} constructs or spaces, or
6890 even newlines.  They are processed as usual, as described above.
6891 Trailing white space in @code{X} is ignored.  White space may also
6892 appear anywhere on the left side of the colon in these constructs,
6893 except between @code{.} or @code{*} and the corresponding word.
6895 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
6896 handled specifically in these constructs.  If another value of
6897 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
6898 @option{-W} switch is found later in the command line, the earlier
6899 switch value is ignored, except with @{@code{S}*@} where @code{S} is
6900 just one letter, which passes all matching options.
6902 The character @samp{|} at the beginning of the predicate text is used to
6903 indicate that a command should be piped to the following command, but
6904 only if @option{-pipe} is specified.
6906 It is built into GCC which switches take arguments and which do not.
6907 (You might think it would be useful to generalize this to allow each
6908 compiler's spec to say which switches take arguments.  But this cannot
6909 be done in a consistent fashion.  GCC cannot even decide which input
6910 files have been specified without knowing which switches take arguments,
6911 and it must know which input files to compile in order to tell which
6912 compilers to run).
6914 GCC also knows implicitly that arguments starting in @option{-l} are to be
6915 treated as compiler output files, and passed to the linker in their
6916 proper position among the other output files.
6918 @c man begin OPTIONS
6920 @node Target Options
6921 @section Specifying Target Machine and Compiler Version
6922 @cindex target options
6923 @cindex cross compiling
6924 @cindex specifying machine version
6925 @cindex specifying compiler version and target machine
6926 @cindex compiler version, specifying
6927 @cindex target machine, specifying
6929 The usual way to run GCC is to run the executable called @file{gcc}, or
6930 @file{<machine>-gcc} when cross-compiling, or
6931 @file{<machine>-gcc-<version>} to run a version other than the one that
6932 was installed last.  Sometimes this is inconvenient, so GCC provides
6933 options that will switch to another cross-compiler or version.
6935 @table @gcctabopt
6936 @item -b @var{machine}
6937 @opindex b
6938 The argument @var{machine} specifies the target machine for compilation.
6940 The value to use for @var{machine} is the same as was specified as the
6941 machine type when configuring GCC as a cross-compiler.  For
6942 example, if a cross-compiler was configured with @samp{configure
6943 i386v}, meaning to compile for an 80386 running System V, then you
6944 would specify @option{-b i386v} to run that cross compiler.
6946 @item -V @var{version}
6947 @opindex V
6948 The argument @var{version} specifies which version of GCC to run.
6949 This is useful when multiple versions are installed.  For example,
6950 @var{version} might be @samp{2.0}, meaning to run GCC version 2.0.
6951 @end table
6953 The @option{-V} and @option{-b} options work by running the
6954 @file{<machine>-gcc-<version>} executable, so there's no real reason to
6955 use them if you can just run that directly.
6957 @node Submodel Options
6958 @section Hardware Models and Configurations
6959 @cindex submodel options
6960 @cindex specifying hardware config
6961 @cindex hardware models and configurations, specifying
6962 @cindex machine dependent options
6964 Earlier we discussed the standard option @option{-b} which chooses among
6965 different installed compilers for completely different target
6966 machines, such as VAX vs.@: 68000 vs.@: 80386.
6968 In addition, each of these target machine types can have its own
6969 special options, starting with @samp{-m}, to choose among various
6970 hardware models or configurations---for example, 68010 vs 68020,
6971 floating coprocessor or none.  A single installed version of the
6972 compiler can compile for any model or configuration, according to the
6973 options specified.
6975 Some configurations of the compiler also support additional special
6976 options, usually for compatibility with other compilers on the same
6977 platform.
6979 @c This list is ordered alphanumerically by subsection name.
6980 @c It should be the same order and spelling as these options are listed
6981 @c in Machine Dependent Options
6983 @menu
6984 * ARC Options::
6985 * ARM Options::
6986 * AVR Options::
6987 * Blackfin Options::
6988 * CRIS Options::
6989 * Darwin Options::
6990 * DEC Alpha Options::
6991 * DEC Alpha/VMS Options::
6992 * FRV Options::
6993 * H8/300 Options::
6994 * HPPA Options::
6995 * i386 and x86-64 Options::
6996 * IA-64 Options::
6997 * M32C Options::
6998 * M32R/D Options::
6999 * M680x0 Options::
7000 * M68hc1x Options::
7001 * MCore Options::
7002 * MIPS Options::
7003 * MMIX Options::
7004 * MN10300 Options::
7005 * PDP-11 Options::
7006 * PowerPC Options::
7007 * RS/6000 and PowerPC Options::
7008 * S/390 and zSeries Options::
7009 * SH Options::
7010 * SPARC Options::
7011 * System V Options::
7012 * TMS320C3x/C4x Options::
7013 * V850 Options::
7014 * VAX Options::
7015 * x86-64 Options::
7016 * Xstormy16 Options::
7017 * Xtensa Options::
7018 * zSeries Options::
7019 @end menu
7021 @node ARC Options
7022 @subsection ARC Options
7023 @cindex ARC Options
7025 These options are defined for ARC implementations:
7027 @table @gcctabopt
7028 @item -EL
7029 @opindex EL
7030 Compile code for little endian mode.  This is the default.
7032 @item -EB
7033 @opindex EB
7034 Compile code for big endian mode.
7036 @item -mmangle-cpu
7037 @opindex mmangle-cpu
7038 Prepend the name of the cpu to all public symbol names.
7039 In multiple-processor systems, there are many ARC variants with different
7040 instruction and register set characteristics.  This flag prevents code
7041 compiled for one cpu to be linked with code compiled for another.
7042 No facility exists for handling variants that are ``almost identical''.
7043 This is an all or nothing option.
7045 @item -mcpu=@var{cpu}
7046 @opindex mcpu
7047 Compile code for ARC variant @var{cpu}.
7048 Which variants are supported depend on the configuration.
7049 All variants support @option{-mcpu=base}, this is the default.
7051 @item -mtext=@var{text-section}
7052 @itemx -mdata=@var{data-section}
7053 @itemx -mrodata=@var{readonly-data-section}
7054 @opindex mtext
7055 @opindex mdata
7056 @opindex mrodata
7057 Put functions, data, and readonly data in @var{text-section},
7058 @var{data-section}, and @var{readonly-data-section} respectively
7059 by default.  This can be overridden with the @code{section} attribute.
7060 @xref{Variable Attributes}.
7062 @end table
7064 @node ARM Options
7065 @subsection ARM Options
7066 @cindex ARM options
7068 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
7069 architectures:
7071 @table @gcctabopt
7072 @item -mabi=@var{name}
7073 @opindex mabi
7074 Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
7075 @samp{atpcs}, @samp{aapcs} and @samp{iwmmxt}.
7077 @item -mapcs-frame
7078 @opindex mapcs-frame
7079 Generate a stack frame that is compliant with the ARM Procedure Call
7080 Standard for all functions, even if this is not strictly necessary for
7081 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
7082 with this option will cause the stack frames not to be generated for
7083 leaf functions.  The default is @option{-mno-apcs-frame}.
7085 @item -mapcs
7086 @opindex mapcs
7087 This is a synonym for @option{-mapcs-frame}.
7089 @ignore
7090 @c not currently implemented
7091 @item -mapcs-stack-check
7092 @opindex mapcs-stack-check
7093 Generate code to check the amount of stack space available upon entry to
7094 every function (that actually uses some stack space).  If there is
7095 insufficient space available then either the function
7096 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
7097 called, depending upon the amount of stack space required.  The run time
7098 system is required to provide these functions.  The default is
7099 @option{-mno-apcs-stack-check}, since this produces smaller code.
7101 @c not currently implemented
7102 @item -mapcs-float
7103 @opindex mapcs-float
7104 Pass floating point arguments using the float point registers.  This is
7105 one of the variants of the APCS@.  This option is recommended if the
7106 target hardware has a floating point unit or if a lot of floating point
7107 arithmetic is going to be performed by the code.  The default is
7108 @option{-mno-apcs-float}, since integer only code is slightly increased in
7109 size if @option{-mapcs-float} is used.
7111 @c not currently implemented
7112 @item -mapcs-reentrant
7113 @opindex mapcs-reentrant
7114 Generate reentrant, position independent code.  The default is
7115 @option{-mno-apcs-reentrant}.
7116 @end ignore
7118 @item -mthumb-interwork
7119 @opindex mthumb-interwork
7120 Generate code which supports calling between the ARM and Thumb
7121 instruction sets.  Without this option the two instruction sets cannot
7122 be reliably used inside one program.  The default is
7123 @option{-mno-thumb-interwork}, since slightly larger code is generated
7124 when @option{-mthumb-interwork} is specified.
7126 @item -mno-sched-prolog
7127 @opindex mno-sched-prolog
7128 Prevent the reordering of instructions in the function prolog, or the
7129 merging of those instruction with the instructions in the function's
7130 body.  This means that all functions will start with a recognizable set
7131 of instructions (or in fact one of a choice from a small set of
7132 different function prologues), and this information can be used to
7133 locate the start if functions inside an executable piece of code.  The
7134 default is @option{-msched-prolog}.
7136 @item -mhard-float
7137 @opindex mhard-float
7138 Generate output containing floating point instructions.  This is the
7139 default.
7141 @item -msoft-float
7142 @opindex msoft-float
7143 Generate output containing library calls for floating point.
7144 @strong{Warning:} the requisite libraries are not available for all ARM
7145 targets.  Normally the facilities of the machine's usual C compiler are
7146 used, but this cannot be done directly in cross-compilation.  You must make
7147 your own arrangements to provide suitable library functions for
7148 cross-compilation.
7150 @option{-msoft-float} changes the calling convention in the output file;
7151 therefore, it is only useful if you compile @emph{all} of a program with
7152 this option.  In particular, you need to compile @file{libgcc.a}, the
7153 library that comes with GCC, with @option{-msoft-float} in order for
7154 this to work.
7156 @item -mfloat-abi=@var{name}
7157 @opindex mfloat-abi
7158 Specifies which ABI to use for floating point values.  Permissible values
7159 are: @samp{soft}, @samp{softfp} and @samp{hard}.
7161 @samp{soft} and @samp{hard} are equivalent to @option{-msoft-float}
7162 and @option{-mhard-float} respectively.  @samp{softfp} allows the generation
7163 of floating point instructions, but still uses the soft-float calling
7164 conventions.
7166 @item -mlittle-endian
7167 @opindex mlittle-endian
7168 Generate code for a processor running in little-endian mode.  This is
7169 the default for all standard configurations.
7171 @item -mbig-endian
7172 @opindex mbig-endian
7173 Generate code for a processor running in big-endian mode; the default is
7174 to compile code for a little-endian processor.
7176 @item -mwords-little-endian
7177 @opindex mwords-little-endian
7178 This option only applies when generating code for big-endian processors.
7179 Generate code for a little-endian word order but a big-endian byte
7180 order.  That is, a byte order of the form @samp{32107654}.  Note: this
7181 option should only be used if you require compatibility with code for
7182 big-endian ARM processors generated by versions of the compiler prior to
7183 2.8.
7185 @item -mcpu=@var{name}
7186 @opindex mcpu
7187 This specifies the name of the target ARM processor.  GCC uses this name
7188 to determine what kind of instructions it can emit when generating
7189 assembly code.  Permissible names are: @samp{arm2}, @samp{arm250},
7190 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
7191 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
7192 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
7193 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
7194 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
7195 @samp{arm8}, @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
7196 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
7197 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
7198 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
7199 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
7200 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
7201 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
7202 @samp{arm1176jz-s}, @samp{arm1176jzf-s}, @samp{xscale}, @samp{iwmmxt},
7203 @samp{ep9312}.
7205 @itemx -mtune=@var{name}
7206 @opindex mtune
7207 This option is very similar to the @option{-mcpu=} option, except that
7208 instead of specifying the actual target processor type, and hence
7209 restricting which instructions can be used, it specifies that GCC should
7210 tune the performance of the code as if the target were of the type
7211 specified in this option, but still choosing the instructions that it
7212 will generate based on the cpu specified by a @option{-mcpu=} option.
7213 For some ARM implementations better performance can be obtained by using
7214 this option.
7216 @item -march=@var{name}
7217 @opindex march
7218 This specifies the name of the target ARM architecture.  GCC uses this
7219 name to determine what kind of instructions it can emit when generating
7220 assembly code.  This option can be used in conjunction with or instead
7221 of the @option{-mcpu=} option.  Permissible names are: @samp{armv2},
7222 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
7223 @samp{armv5}, @samp{armv5t}, @samp{armv5te}, @samp{armv6}, @samp{armv6j},
7224 @samp{iwmmxt}, @samp{ep9312}.
7226 @item -mfpu=@var{name}
7227 @itemx -mfpe=@var{number}
7228 @itemx -mfp=@var{number}
7229 @opindex mfpu
7230 @opindex mfpe
7231 @opindex mfp
7232 This specifies what floating point hardware (or hardware emulation) is
7233 available on the target.  Permissible names are: @samp{fpa}, @samp{fpe2},
7234 @samp{fpe3}, @samp{maverick}, @samp{vfp}.  @option{-mfp} and @option{-mfpe}
7235 are synonyms for @option{-mfpu}=@samp{fpe}@var{number}, for compatibility
7236 with older versions of GCC@.
7238 If @option{-msoft-float} is specified this specifies the format of
7239 floating point values.
7241 @item -mstructure-size-boundary=@var{n}
7242 @opindex mstructure-size-boundary
7243 The size of all structures and unions will be rounded up to a multiple
7244 of the number of bits set by this option.  Permissible values are 8, 32
7245 and 64.  The default value varies for different toolchains.  For the COFF
7246 targeted toolchain the default value is 8.  A value of 64 is only allowed
7247 if the underlying ABI supports it.
7249 Specifying the larger number can produce faster, more efficient code, but
7250 can also increase the size of the program.  Different values are potentially
7251 incompatible.  Code compiled with one value cannot necessarily expect to
7252 work with code or libraries compiled with another value, if they exchange
7253 information using structures or unions.
7255 @item -mabort-on-noreturn
7256 @opindex mabort-on-noreturn
7257 Generate a call to the function @code{abort} at the end of a
7258 @code{noreturn} function.  It will be executed if the function tries to
7259 return.
7261 @item -mlong-calls
7262 @itemx -mno-long-calls
7263 @opindex mlong-calls
7264 @opindex mno-long-calls
7265 Tells the compiler to perform function calls by first loading the
7266 address of the function into a register and then performing a subroutine
7267 call on this register.  This switch is needed if the target function
7268 will lie outside of the 64 megabyte addressing range of the offset based
7269 version of subroutine call instruction.
7271 Even if this switch is enabled, not all function calls will be turned
7272 into long calls.  The heuristic is that static functions, functions
7273 which have the @samp{short-call} attribute, functions that are inside
7274 the scope of a @samp{#pragma no_long_calls} directive and functions whose
7275 definitions have already been compiled within the current compilation
7276 unit, will not be turned into long calls.  The exception to this rule is
7277 that weak function definitions, functions with the @samp{long-call}
7278 attribute or the @samp{section} attribute, and functions that are within
7279 the scope of a @samp{#pragma long_calls} directive, will always be
7280 turned into long calls.
7282 This feature is not enabled by default.  Specifying
7283 @option{-mno-long-calls} will restore the default behavior, as will
7284 placing the function calls within the scope of a @samp{#pragma
7285 long_calls_off} directive.  Note these switches have no effect on how
7286 the compiler generates code to handle function calls via function
7287 pointers.
7289 @item -mnop-fun-dllimport
7290 @opindex mnop-fun-dllimport
7291 Disable support for the @code{dllimport} attribute.
7293 @item -msingle-pic-base
7294 @opindex msingle-pic-base
7295 Treat the register used for PIC addressing as read-only, rather than
7296 loading it in the prologue for each function.  The run-time system is
7297 responsible for initializing this register with an appropriate value
7298 before execution begins.
7300 @item -mpic-register=@var{reg}
7301 @opindex mpic-register
7302 Specify the register to be used for PIC addressing.  The default is R10
7303 unless stack-checking is enabled, when R9 is used.
7305 @item -mcirrus-fix-invalid-insns
7306 @opindex mcirrus-fix-invalid-insns
7307 @opindex mno-cirrus-fix-invalid-insns
7308 Insert NOPs into the instruction stream to in order to work around
7309 problems with invalid Maverick instruction combinations.  This option
7310 is only valid if the @option{-mcpu=ep9312} option has been used to
7311 enable generation of instructions for the Cirrus Maverick floating
7312 point co-processor.  This option is not enabled by default, since the
7313 problem is only present in older Maverick implementations.  The default
7314 can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
7315 switch.
7317 @item -mpoke-function-name
7318 @opindex mpoke-function-name
7319 Write the name of each function into the text section, directly
7320 preceding the function prologue.  The generated code is similar to this:
7322 @smallexample
7323      t0
7324          .ascii "arm_poke_function_name", 0
7325          .align
7326      t1
7327          .word 0xff000000 + (t1 - t0)
7328      arm_poke_function_name
7329          mov     ip, sp
7330          stmfd   sp!, @{fp, ip, lr, pc@}
7331          sub     fp, ip, #4
7332 @end smallexample
7334 When performing a stack backtrace, code can inspect the value of
7335 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
7336 location @code{pc - 12} and the top 8 bits are set, then we know that
7337 there is a function name embedded immediately preceding this location
7338 and has length @code{((pc[-3]) & 0xff000000)}.
7340 @item -mthumb
7341 @opindex mthumb
7342 Generate code for the 16-bit Thumb instruction set.  The default is to
7343 use the 32-bit ARM instruction set.
7345 @item -mtpcs-frame
7346 @opindex mtpcs-frame
7347 Generate a stack frame that is compliant with the Thumb Procedure Call
7348 Standard for all non-leaf functions.  (A leaf function is one that does
7349 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
7351 @item -mtpcs-leaf-frame
7352 @opindex mtpcs-leaf-frame
7353 Generate a stack frame that is compliant with the Thumb Procedure Call
7354 Standard for all leaf functions.  (A leaf function is one that does
7355 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
7357 @item -mcallee-super-interworking
7358 @opindex mcallee-super-interworking
7359 Gives all externally visible functions in the file being compiled an ARM
7360 instruction set header which switches to Thumb mode before executing the
7361 rest of the function.  This allows these functions to be called from
7362 non-interworking code.
7364 @item -mcaller-super-interworking
7365 @opindex mcaller-super-interworking
7366 Allows calls via function pointers (including virtual functions) to
7367 execute correctly regardless of whether the target code has been
7368 compiled for interworking or not.  There is a small overhead in the cost
7369 of executing a function pointer if this option is enabled.
7371 @end table
7373 @node AVR Options
7374 @subsection AVR Options
7375 @cindex AVR Options
7377 These options are defined for AVR implementations:
7379 @table @gcctabopt
7380 @item -mmcu=@var{mcu}
7381 @opindex mmcu
7382 Specify ATMEL AVR instruction set or MCU type.
7384 Instruction set avr1 is for the minimal AVR core, not supported by the C
7385 compiler, only for assembler programs (MCU types: at90s1200, attiny10,
7386 attiny11, attiny12, attiny15, attiny28).
7388 Instruction set avr2 (default) is for the classic AVR core with up to
7389 8K program memory space (MCU types: at90s2313, at90s2323, attiny22,
7390 at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
7391 at90c8534, at90s8535).
7393 Instruction set avr3 is for the classic AVR core with up to 128K program
7394 memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
7396 Instruction set avr4 is for the enhanced AVR core with up to 8K program
7397 memory space (MCU types: atmega8, atmega83, atmega85).
7399 Instruction set avr5 is for the enhanced AVR core with up to 128K program
7400 memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
7401 atmega64, atmega128, at43usb355, at94k).
7403 @item -msize
7404 @opindex msize
7405 Output instruction sizes to the asm file.
7407 @item -minit-stack=@var{N}
7408 @opindex minit-stack
7409 Specify the initial stack address, which may be a symbol or numeric value,
7410 @samp{__stack} is the default.
7412 @item -mno-interrupts
7413 @opindex mno-interrupts
7414 Generated code is not compatible with hardware interrupts.
7415 Code size will be smaller.
7417 @item -mcall-prologues
7418 @opindex mcall-prologues
7419 Functions prologues/epilogues expanded as call to appropriate
7420 subroutines.  Code size will be smaller.
7422 @item -mno-tablejump
7423 @opindex mno-tablejump
7424 Do not generate tablejump insns which sometimes increase code size.
7426 @item -mtiny-stack
7427 @opindex mtiny-stack
7428 Change only the low 8 bits of the stack pointer.
7430 @item -mint8
7431 @opindex mint8
7432 Assume int to be 8 bit integer.  This affects the sizes of all types: A
7433 char will be 1 byte, an int will be 1 byte, an long will be 2 bytes
7434 and long long will be 4 bytes.  Please note that this option does not
7435 comply to the C standards, but it will provide you with smaller code
7436 size.
7437 @end table
7439 @node Blackfin Options
7440 @subsection Blackfin Options
7441 @cindex Blackfin Options
7443 @table @gcctabopt
7444 @item -momit-leaf-frame-pointer
7445 @opindex momit-leaf-frame-pointer
7446 Don't keep the frame pointer in a register for leaf functions.  This
7447 avoids the instructions to save, set up and restore frame pointers and
7448 makes an extra register available in leaf functions.  The option
7449 @option{-fomit-frame-pointer} removes the frame pointer for all functions
7450 which might make debugging harder.
7452 @item -mspecld-anomaly
7453 @opindex mspecld-anomaly
7454 When enabled, the compiler will ensure that the generated code does not
7455 contain speculative loads after jump instructions.  This option is enabled
7456 by default.
7458 @item -mno-specld-anomaly
7459 @opindex mno-specld-anomaly
7460 Don't generate extra code to prevent speculative loads from occurring.
7462 @item -mcsync-anomaly
7463 @opindex mcsync-anomaly
7464 When enabled, the compiler will ensure that the generated code does not
7465 contain CSYNC or SSYNC instructions too soon after conditional branches.
7466 This option is enabled by default.
7468 @item -mno-csync-anomaly
7469 @opindex mno-csync-anomaly
7470 Don't generate extra code to prevent CSYNC or SSYNC instructions from
7471 occurring too soon after a conditional branch.
7473 @item -mlow-64k
7474 @opindex mlow-64k
7475 When enabled, the compiler is free to take advantage of the knowledge that
7476 the entire program fits into the low 64k of memory.
7478 @item -mno-low-64k
7479 @opindex mno-low-64k
7480 Assume that the program is arbitrarily large.  This is the default.
7482 @item -mid-shared-library
7483 @opindex mid-shared-library
7484 Generate code that supports shared libraries via the library ID method.
7485 This allows for execute in place and shared libraries in an environment
7486 without virtual memory management.  This option implies @option{-fPIC}.
7488 @item -mno-id-shared-library
7489 @opindex mno-id-shared-library
7490 Generate code that doesn't assume ID based shared libraries are being used.
7491 This is the default.
7493 @item -mshared-library-id=n
7494 @opindex mshared-library-id
7495 Specified the identification number of the ID based shared library being
7496 compiled.  Specifying a value of 0 will generate more compact code, specifying
7497 other values will force the allocation of that number to the current
7498 library but is no more space or time efficient than omitting this option.
7500 @item -mlong-calls
7501 @itemx -mno-long-calls
7502 @opindex mlong-calls
7503 @opindex mno-long-calls
7504 Tells the compiler to perform function calls by first loading the
7505 address of the function into a register and then performing a subroutine
7506 call on this register.  This switch is needed if the target function
7507 will lie outside of the 24 bit addressing range of the offset based
7508 version of subroutine call instruction.
7510 This feature is not enabled by default.  Specifying
7511 @option{-mno-long-calls} will restore the default behavior.  Note these
7512 switches have no effect on how the compiler generates code to handle
7513 function calls via function pointers.
7514 @end table
7516 @node CRIS Options
7517 @subsection CRIS Options
7518 @cindex CRIS Options
7520 These options are defined specifically for the CRIS ports.
7522 @table @gcctabopt
7523 @item -march=@var{architecture-type}
7524 @itemx -mcpu=@var{architecture-type}
7525 @opindex march
7526 @opindex mcpu
7527 Generate code for the specified architecture.  The choices for
7528 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
7529 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
7530 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
7531 @samp{v10}.
7533 @item -mtune=@var{architecture-type}
7534 @opindex mtune
7535 Tune to @var{architecture-type} everything applicable about the generated
7536 code, except for the ABI and the set of available instructions.  The
7537 choices for @var{architecture-type} are the same as for
7538 @option{-march=@var{architecture-type}}.
7540 @item -mmax-stack-frame=@var{n}
7541 @opindex mmax-stack-frame
7542 Warn when the stack frame of a function exceeds @var{n} bytes.
7544 @item -melinux-stacksize=@var{n}
7545 @opindex melinux-stacksize
7546 Only available with the @samp{cris-axis-aout} target.  Arranges for
7547 indications in the program to the kernel loader that the stack of the
7548 program should be set to @var{n} bytes.
7550 @item -metrax4
7551 @itemx -metrax100
7552 @opindex metrax4
7553 @opindex metrax100
7554 The options @option{-metrax4} and @option{-metrax100} are synonyms for
7555 @option{-march=v3} and @option{-march=v8} respectively.
7557 @item -mmul-bug-workaround
7558 @itemx -mno-mul-bug-workaround
7559 @opindex mmul-bug-workaround
7560 @opindex mno-mul-bug-workaround
7561 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
7562 models where it applies.  This option is active by default.
7564 @item -mpdebug
7565 @opindex mpdebug
7566 Enable CRIS-specific verbose debug-related information in the assembly
7567 code.  This option also has the effect to turn off the @samp{#NO_APP}
7568 formatted-code indicator to the assembler at the beginning of the
7569 assembly file.
7571 @item -mcc-init
7572 @opindex mcc-init
7573 Do not use condition-code results from previous instruction; always emit
7574 compare and test instructions before use of condition codes.
7576 @item -mno-side-effects
7577 @opindex mno-side-effects
7578 Do not emit instructions with side-effects in addressing modes other than
7579 post-increment.
7581 @item -mstack-align
7582 @itemx -mno-stack-align
7583 @itemx -mdata-align
7584 @itemx -mno-data-align
7585 @itemx -mconst-align
7586 @itemx -mno-const-align
7587 @opindex mstack-align
7588 @opindex mno-stack-align
7589 @opindex mdata-align
7590 @opindex mno-data-align
7591 @opindex mconst-align
7592 @opindex mno-const-align
7593 These options (no-options) arranges (eliminate arrangements) for the
7594 stack-frame, individual data and constants to be aligned for the maximum
7595 single data access size for the chosen CPU model.  The default is to
7596 arrange for 32-bit alignment.  ABI details such as structure layout are
7597 not affected by these options.
7599 @item -m32-bit
7600 @itemx -m16-bit
7601 @itemx -m8-bit
7602 @opindex m32-bit
7603 @opindex m16-bit
7604 @opindex m8-bit
7605 Similar to the stack- data- and const-align options above, these options
7606 arrange for stack-frame, writable data and constants to all be 32-bit,
7607 16-bit or 8-bit aligned.  The default is 32-bit alignment.
7609 @item -mno-prologue-epilogue
7610 @itemx -mprologue-epilogue
7611 @opindex mno-prologue-epilogue
7612 @opindex mprologue-epilogue
7613 With @option{-mno-prologue-epilogue}, the normal function prologue and
7614 epilogue that sets up the stack-frame are omitted and no return
7615 instructions or return sequences are generated in the code.  Use this
7616 option only together with visual inspection of the compiled code: no
7617 warnings or errors are generated when call-saved registers must be saved,
7618 or storage for local variable needs to be allocated.
7620 @item -mno-gotplt
7621 @itemx -mgotplt
7622 @opindex mno-gotplt
7623 @opindex mgotplt
7624 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
7625 instruction sequences that load addresses for functions from the PLT part
7626 of the GOT rather than (traditional on other architectures) calls to the
7627 PLT@.  The default is @option{-mgotplt}.
7629 @item -maout
7630 @opindex maout
7631 Legacy no-op option only recognized with the cris-axis-aout target.
7633 @item -melf
7634 @opindex melf
7635 Legacy no-op option only recognized with the cris-axis-elf and
7636 cris-axis-linux-gnu targets.
7638 @item -melinux
7639 @opindex melinux
7640 Only recognized with the cris-axis-aout target, where it selects a
7641 GNU/linux-like multilib, include files and instruction set for
7642 @option{-march=v8}.
7644 @item -mlinux
7645 @opindex mlinux
7646 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
7648 @item -sim
7649 @opindex sim
7650 This option, recognized for the cris-axis-aout and cris-axis-elf arranges
7651 to link with input-output functions from a simulator library.  Code,
7652 initialized data and zero-initialized data are allocated consecutively.
7654 @item -sim2
7655 @opindex sim2
7656 Like @option{-sim}, but pass linker options to locate initialized data at
7657 0x40000000 and zero-initialized data at 0x80000000.
7658 @end table
7660 @node Darwin Options
7661 @subsection Darwin Options
7662 @cindex Darwin options
7664 These options are defined for all architectures running the Darwin operating
7665 system.
7667 FSF GCC on Darwin does not create ``fat'' object files; it will create
7668 an object file for the single architecture that it was built to
7669 target.  Apple's GCC on Darwin does create ``fat'' files if multiple
7670 @option{-arch} options are used; it does so by running the compiler or
7671 linker multiple times and joining the results together with
7672 @file{lipo}.
7674 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
7675 @samp{i686}) is determined by the flags that specify the ISA
7676 that GCC is targetting, like @option{-mcpu} or @option{-march}.  The
7677 @option{-force_cpusubtype_ALL} option can be used to override this.
7679 The Darwin tools vary in their behavior when presented with an ISA
7680 mismatch.  The assembler, @file{as}, will only permit instructions to
7681 be used that are valid for the subtype of the file it is generating,
7682 so you cannot put 64-bit instructions in an @samp{ppc750} object file.
7683 The linker for shared libraries, @file{/usr/bin/libtool}, will fail
7684 and print an error if asked to create a shared library with a less
7685 restrictive subtype than its input files (for instance, trying to put
7686 a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
7687 for executables, @file{ld}, will quietly give the executable the most
7688 restrictive subtype of any of its input files.
7690 @table @gcctabopt
7691 @item -F@var{dir}
7692 @opindex F
7693 Add the framework directory @var{dir} to the head of the list of
7694 directories to be searched for header files.  These directories are
7695 interleaved with those specified by @option{-I} options and are
7696 scanned in a left-to-right order.
7698 A framework directory is a directory with frameworks in it.  A
7699 framework is a directory with a @samp{"Headers"} and/or
7700 @samp{"PrivateHeaders"} directory contained directly in it that ends
7701 in @samp{".framework"}.  The name of a framework is the name of this
7702 directory excluding the @samp{".framework"}.  Headers associated with
7703 the framework are found in one of those two directories, with
7704 @samp{"Headers"} being searched first.  A subframework is a framework
7705 directory that is in a framework's @samp{"Frameworks"} directory.
7706 Includes of subframework headers can only appear in a header of a
7707 framework that contains the subframework, or in a sibling subframework
7708 header.  Two subframeworks are siblings if they occur in the same
7709 framework.  A subframework should not have the same name as a
7710 framework, a warning will be issued if this is violated.  Currently a
7711 subframework cannot have subframeworks, in the future, the mechanism
7712 may be extended to support this.  The standard frameworks can be found
7713 in @samp{"/System/Library/Frameworks"} and
7714 @samp{"/Library/Frameworks"}.  An example include looks like
7715 @code{#include <Framework/header.h>}, where @samp{Framework} denotes
7716 the name of the framework and header.h is found in the
7717 @samp{"PrivateHeaders"} or @samp{"Headers"} directory.
7719 @item -gused
7720 @opindex -gused
7721 Emit debugging information for symbols that are used.  For STABS
7722 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
7723 This is by default ON@.
7725 @item -gfull
7726 @opindex -gfull
7727 Emit debugging information for all symbols and types.
7729 @item -mmacosx-version-min=@var{version}
7730 The earliest version of MacOS X that this executable will run on
7731 is @var{version}.  Typical values of @var{version} include @code{10.1},
7732 @code{10.2}, and @code{10.3.9}.
7734 The default for this option is to make choices that seem to be most
7735 useful.  
7737 @item -mone-byte-bool
7738 @opindex -mone-byte-bool
7739 Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}.
7740 By default @samp{sizeof(bool)} is @samp{4} when compiling for
7741 Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this
7742 option has no effect on x86.
7744 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
7745 to generate code that is not binary compatible with code generated
7746 without that switch.  Using this switch may require recompiling all
7747 other modules in a program, including system libraries.  Use this
7748 switch to conform to a non-default data model.
7750 @item -mfix-and-continue
7751 @itemx -ffix-and-continue
7752 @itemx -findirect-data
7753 @opindex mfix-and-continue
7754 @opindex ffix-and-continue
7755 @opindex findirect-data
7756 Generate code suitable for fast turn around development.  Needed to
7757 enable gdb to dynamically load @code{.o} files into already running
7758 programs.  @option{-findirect-data} and @option{-ffix-and-continue}
7759 are provided for backwards compatibility.
7761 @item -all_load
7762 @opindex all_load
7763 Loads all members of static archive libraries.
7764 See man ld(1) for more information.
7766 @item -arch_errors_fatal
7767 @opindex arch_errors_fatal
7768 Cause the errors having to do with files that have the wrong architecture
7769 to be fatal.
7771 @item -bind_at_load
7772 @opindex bind_at_load
7773 Causes the output file to be marked such that the dynamic linker will
7774 bind all undefined references when the file is loaded or launched.
7776 @item -bundle
7777 @opindex bundle
7778 Produce a Mach-o bundle format file.
7779 See man ld(1) for more information.
7781 @item -bundle_loader @var{executable}
7782 @opindex bundle_loader
7783 This option specifies the @var{executable} that will be loading the build
7784 output file being linked.  See man ld(1) for more information.
7786 @item -dynamiclib
7787 @opindex -dynamiclib
7788 When passed this option, GCC will produce a dynamic library instead of
7789 an executable when linking, using the Darwin @file{libtool} command.
7791 @item -force_cpusubtype_ALL
7792 @opindex -force_cpusubtype_ALL
7793 This causes GCC's output file to have the @var{ALL} subtype, instead of
7794 one controlled by the @option{-mcpu} or @option{-march} option.
7796 @item -allowable_client  @var{client_name}
7797 @itemx -client_name
7798 @itemx -compatibility_version
7799 @itemx -current_version
7800 @itemx -dead_strip
7801 @itemx -dependency-file
7802 @itemx -dylib_file
7803 @itemx -dylinker_install_name
7804 @itemx -dynamic
7805 @itemx -exported_symbols_list
7806 @itemx -filelist
7807 @itemx -flat_namespace
7808 @itemx -force_flat_namespace
7809 @itemx -headerpad_max_install_names
7810 @itemx -image_base
7811 @itemx -init
7812 @itemx -install_name
7813 @itemx -keep_private_externs
7814 @itemx -multi_module
7815 @itemx -multiply_defined
7816 @itemx -multiply_defined_unused
7817 @itemx -noall_load
7818 @itemx -no_dead_strip_inits_and_terms
7819 @itemx -nofixprebinding
7820 @itemx -nomultidefs
7821 @itemx -noprebind
7822 @itemx -noseglinkedit
7823 @itemx -pagezero_size
7824 @itemx -prebind
7825 @itemx -prebind_all_twolevel_modules
7826 @itemx -private_bundle
7827 @itemx -read_only_relocs
7828 @itemx -sectalign
7829 @itemx -sectobjectsymbols
7830 @itemx -whyload
7831 @itemx -seg1addr
7832 @itemx -sectcreate
7833 @itemx -sectobjectsymbols
7834 @itemx -sectorder
7835 @itemx -segaddr
7836 @itemx -segs_read_only_addr
7837 @itemx -segs_read_write_addr
7838 @itemx -seg_addr_table
7839 @itemx -seg_addr_table_filename
7840 @itemx -seglinkedit
7841 @itemx -segprot
7842 @itemx -segs_read_only_addr
7843 @itemx -segs_read_write_addr
7844 @itemx -single_module
7845 @itemx -static
7846 @itemx -sub_library
7847 @itemx -sub_umbrella
7848 @itemx -twolevel_namespace
7849 @itemx -umbrella
7850 @itemx -undefined
7851 @itemx -unexported_symbols_list
7852 @itemx -weak_reference_mismatches
7853 @itemx -whatsloaded
7855 @opindex allowable_client
7856 @opindex client_name
7857 @opindex compatibility_version
7858 @opindex current_version
7859 @opindex dead_strip
7860 @opindex dependency-file
7861 @opindex dylib_file
7862 @opindex dylinker_install_name
7863 @opindex dynamic
7864 @opindex exported_symbols_list
7865 @opindex filelist
7866 @opindex flat_namespace
7867 @opindex force_flat_namespace
7868 @opindex headerpad_max_install_names
7869 @opindex image_base
7870 @opindex init
7871 @opindex install_name
7872 @opindex keep_private_externs
7873 @opindex multi_module
7874 @opindex multiply_defined
7875 @opindex multiply_defined_unused
7876 @opindex noall_load
7877 @opindex no_dead_strip_inits_and_terms
7878 @opindex nofixprebinding
7879 @opindex nomultidefs
7880 @opindex noprebind
7881 @opindex noseglinkedit
7882 @opindex pagezero_size
7883 @opindex prebind
7884 @opindex prebind_all_twolevel_modules
7885 @opindex private_bundle
7886 @opindex read_only_relocs
7887 @opindex sectalign
7888 @opindex sectobjectsymbols
7889 @opindex whyload
7890 @opindex seg1addr
7891 @opindex sectcreate
7892 @opindex sectobjectsymbols
7893 @opindex sectorder
7894 @opindex segaddr
7895 @opindex segs_read_only_addr
7896 @opindex segs_read_write_addr
7897 @opindex seg_addr_table
7898 @opindex seg_addr_table_filename
7899 @opindex seglinkedit
7900 @opindex segprot
7901 @opindex segs_read_only_addr
7902 @opindex segs_read_write_addr
7903 @opindex single_module
7904 @opindex static
7905 @opindex sub_library
7906 @opindex sub_umbrella
7907 @opindex twolevel_namespace
7908 @opindex umbrella
7909 @opindex undefined
7910 @opindex unexported_symbols_list
7911 @opindex weak_reference_mismatches
7912 @opindex whatsloaded
7914 These options are passed to the Darwin linker.  The Darwin linker man page
7915 describes them in detail.
7916 @end table
7918 @node DEC Alpha Options
7919 @subsection DEC Alpha Options
7921 These @samp{-m} options are defined for the DEC Alpha implementations:
7923 @table @gcctabopt
7924 @item -mno-soft-float
7925 @itemx -msoft-float
7926 @opindex mno-soft-float
7927 @opindex msoft-float
7928 Use (do not use) the hardware floating-point instructions for
7929 floating-point operations.  When @option{-msoft-float} is specified,
7930 functions in @file{libgcc.a} will be used to perform floating-point
7931 operations.  Unless they are replaced by routines that emulate the
7932 floating-point operations, or compiled in such a way as to call such
7933 emulations routines, these routines will issue floating-point
7934 operations.   If you are compiling for an Alpha without floating-point
7935 operations, you must ensure that the library is built so as not to call
7936 them.
7938 Note that Alpha implementations without floating-point operations are
7939 required to have floating-point registers.
7941 @item -mfp-reg
7942 @itemx -mno-fp-regs
7943 @opindex mfp-reg
7944 @opindex mno-fp-regs
7945 Generate code that uses (does not use) the floating-point register set.
7946 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
7947 register set is not used, floating point operands are passed in integer
7948 registers as if they were integers and floating-point results are passed
7949 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
7950 so any function with a floating-point argument or return value called by code
7951 compiled with @option{-mno-fp-regs} must also be compiled with that
7952 option.
7954 A typical use of this option is building a kernel that does not use,
7955 and hence need not save and restore, any floating-point registers.
7957 @item -mieee
7958 @opindex mieee
7959 The Alpha architecture implements floating-point hardware optimized for
7960 maximum performance.  It is mostly compliant with the IEEE floating
7961 point standard.  However, for full compliance, software assistance is
7962 required.  This option generates code fully IEEE compliant code
7963 @emph{except} that the @var{inexact-flag} is not maintained (see below).
7964 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
7965 defined during compilation.  The resulting code is less efficient but is
7966 able to correctly support denormalized numbers and exceptional IEEE
7967 values such as not-a-number and plus/minus infinity.  Other Alpha
7968 compilers call this option @option{-ieee_with_no_inexact}.
7970 @item -mieee-with-inexact
7971 @opindex mieee-with-inexact
7972 This is like @option{-mieee} except the generated code also maintains
7973 the IEEE @var{inexact-flag}.  Turning on this option causes the
7974 generated code to implement fully-compliant IEEE math.  In addition to
7975 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
7976 macro.  On some Alpha implementations the resulting code may execute
7977 significantly slower than the code generated by default.  Since there is
7978 very little code that depends on the @var{inexact-flag}, you should
7979 normally not specify this option.  Other Alpha compilers call this
7980 option @option{-ieee_with_inexact}.
7982 @item -mfp-trap-mode=@var{trap-mode}
7983 @opindex mfp-trap-mode
7984 This option controls what floating-point related traps are enabled.
7985 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
7986 The trap mode can be set to one of four values:
7988 @table @samp
7989 @item n
7990 This is the default (normal) setting.  The only traps that are enabled
7991 are the ones that cannot be disabled in software (e.g., division by zero
7992 trap).
7994 @item u
7995 In addition to the traps enabled by @samp{n}, underflow traps are enabled
7996 as well.
7998 @item su
7999 Like @samp{su}, but the instructions are marked to be safe for software
8000 completion (see Alpha architecture manual for details).
8002 @item sui
8003 Like @samp{su}, but inexact traps are enabled as well.
8004 @end table
8006 @item -mfp-rounding-mode=@var{rounding-mode}
8007 @opindex mfp-rounding-mode
8008 Selects the IEEE rounding mode.  Other Alpha compilers call this option
8009 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
8012 @table @samp
8013 @item n
8014 Normal IEEE rounding mode.  Floating point numbers are rounded towards
8015 the nearest machine number or towards the even machine number in case
8016 of a tie.
8018 @item m
8019 Round towards minus infinity.
8021 @item c
8022 Chopped rounding mode.  Floating point numbers are rounded towards zero.
8024 @item d
8025 Dynamic rounding mode.  A field in the floating point control register
8026 (@var{fpcr}, see Alpha architecture reference manual) controls the
8027 rounding mode in effect.  The C library initializes this register for
8028 rounding towards plus infinity.  Thus, unless your program modifies the
8029 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
8030 @end table
8032 @item -mtrap-precision=@var{trap-precision}
8033 @opindex mtrap-precision
8034 In the Alpha architecture, floating point traps are imprecise.  This
8035 means without software assistance it is impossible to recover from a
8036 floating trap and program execution normally needs to be terminated.
8037 GCC can generate code that can assist operating system trap handlers
8038 in determining the exact location that caused a floating point trap.
8039 Depending on the requirements of an application, different levels of
8040 precisions can be selected:
8042 @table @samp
8043 @item p
8044 Program precision.  This option is the default and means a trap handler
8045 can only identify which program caused a floating point exception.
8047 @item f
8048 Function precision.  The trap handler can determine the function that
8049 caused a floating point exception.
8051 @item i
8052 Instruction precision.  The trap handler can determine the exact
8053 instruction that caused a floating point exception.
8054 @end table
8056 Other Alpha compilers provide the equivalent options called
8057 @option{-scope_safe} and @option{-resumption_safe}.
8059 @item -mieee-conformant
8060 @opindex mieee-conformant
8061 This option marks the generated code as IEEE conformant.  You must not
8062 use this option unless you also specify @option{-mtrap-precision=i} and either
8063 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
8064 is to emit the line @samp{.eflag 48} in the function prologue of the
8065 generated assembly file.  Under DEC Unix, this has the effect that
8066 IEEE-conformant math library routines will be linked in.
8068 @item -mbuild-constants
8069 @opindex mbuild-constants
8070 Normally GCC examines a 32- or 64-bit integer constant to
8071 see if it can construct it from smaller constants in two or three
8072 instructions.  If it cannot, it will output the constant as a literal and
8073 generate code to load it from the data segment at runtime.
8075 Use this option to require GCC to construct @emph{all} integer constants
8076 using code, even if it takes more instructions (the maximum is six).
8078 You would typically use this option to build a shared library dynamic
8079 loader.  Itself a shared library, it must relocate itself in memory
8080 before it can find the variables and constants in its own data segment.
8082 @item -malpha-as
8083 @itemx -mgas
8084 @opindex malpha-as
8085 @opindex mgas
8086 Select whether to generate code to be assembled by the vendor-supplied
8087 assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
8089 @item -mbwx
8090 @itemx -mno-bwx
8091 @itemx -mcix
8092 @itemx -mno-cix
8093 @itemx -mfix
8094 @itemx -mno-fix
8095 @itemx -mmax
8096 @itemx -mno-max
8097 @opindex mbwx
8098 @opindex mno-bwx
8099 @opindex mcix
8100 @opindex mno-cix
8101 @opindex mfix
8102 @opindex mno-fix
8103 @opindex mmax
8104 @opindex mno-max
8105 Indicate whether GCC should generate code to use the optional BWX,
8106 CIX, FIX and MAX instruction sets.  The default is to use the instruction
8107 sets supported by the CPU type specified via @option{-mcpu=} option or that
8108 of the CPU on which GCC was built if none was specified.
8110 @item -mfloat-vax
8111 @itemx -mfloat-ieee
8112 @opindex mfloat-vax
8113 @opindex mfloat-ieee
8114 Generate code that uses (does not use) VAX F and G floating point
8115 arithmetic instead of IEEE single and double precision.
8117 @item -mexplicit-relocs
8118 @itemx -mno-explicit-relocs
8119 @opindex mexplicit-relocs
8120 @opindex mno-explicit-relocs
8121 Older Alpha assemblers provided no way to generate symbol relocations
8122 except via assembler macros.  Use of these macros does not allow
8123 optimal instruction scheduling.  GNU binutils as of version 2.12
8124 supports a new syntax that allows the compiler to explicitly mark
8125 which relocations should apply to which instructions.  This option
8126 is mostly useful for debugging, as GCC detects the capabilities of
8127 the assembler when it is built and sets the default accordingly.
8129 @item -msmall-data
8130 @itemx -mlarge-data
8131 @opindex msmall-data
8132 @opindex mlarge-data
8133 When @option{-mexplicit-relocs} is in effect, static data is
8134 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
8135 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
8136 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
8137 16-bit relocations off of the @code{$gp} register.  This limits the
8138 size of the small data area to 64KB, but allows the variables to be
8139 directly accessed via a single instruction.
8141 The default is @option{-mlarge-data}.  With this option the data area
8142 is limited to just below 2GB@.  Programs that require more than 2GB of
8143 data must use @code{malloc} or @code{mmap} to allocate the data in the
8144 heap instead of in the program's data segment.
8146 When generating code for shared libraries, @option{-fpic} implies
8147 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
8149 @item -msmall-text
8150 @itemx -mlarge-text
8151 @opindex msmall-text
8152 @opindex mlarge-text
8153 When @option{-msmall-text} is used, the compiler assumes that the
8154 code of the entire program (or shared library) fits in 4MB, and is
8155 thus reachable with a branch instruction.  When @option{-msmall-data}
8156 is used, the compiler can assume that all local symbols share the
8157 same @code{$gp} value, and thus reduce the number of instructions
8158 required for a function call from 4 to 1.
8160 The default is @option{-mlarge-text}.
8162 @item -mcpu=@var{cpu_type}
8163 @opindex mcpu
8164 Set the instruction set and instruction scheduling parameters for
8165 machine type @var{cpu_type}.  You can specify either the @samp{EV}
8166 style name or the corresponding chip number.  GCC supports scheduling
8167 parameters for the EV4, EV5 and EV6 family of processors and will
8168 choose the default values for the instruction set from the processor
8169 you specify.  If you do not specify a processor type, GCC will default
8170 to the processor on which the compiler was built.
8172 Supported values for @var{cpu_type} are
8174 @table @samp
8175 @item ev4
8176 @itemx ev45
8177 @itemx 21064
8178 Schedules as an EV4 and has no instruction set extensions.
8180 @item ev5
8181 @itemx 21164
8182 Schedules as an EV5 and has no instruction set extensions.
8184 @item ev56
8185 @itemx 21164a
8186 Schedules as an EV5 and supports the BWX extension.
8188 @item pca56
8189 @itemx 21164pc
8190 @itemx 21164PC
8191 Schedules as an EV5 and supports the BWX and MAX extensions.
8193 @item ev6
8194 @itemx 21264
8195 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
8197 @item ev67
8198 @itemx 21264a
8199 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
8200 @end table
8202 @item -mtune=@var{cpu_type}
8203 @opindex mtune
8204 Set only the instruction scheduling parameters for machine type
8205 @var{cpu_type}.  The instruction set is not changed.
8207 @item -mmemory-latency=@var{time}
8208 @opindex mmemory-latency
8209 Sets the latency the scheduler should assume for typical memory
8210 references as seen by the application.  This number is highly
8211 dependent on the memory access patterns used by the application
8212 and the size of the external cache on the machine.
8214 Valid options for @var{time} are
8216 @table @samp
8217 @item @var{number}
8218 A decimal number representing clock cycles.
8220 @item L1
8221 @itemx L2
8222 @itemx L3
8223 @itemx main
8224 The compiler contains estimates of the number of clock cycles for
8225 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
8226 (also called Dcache, Scache, and Bcache), as well as to main memory.
8227 Note that L3 is only valid for EV5.
8229 @end table
8230 @end table
8232 @node DEC Alpha/VMS Options
8233 @subsection DEC Alpha/VMS Options
8235 These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
8237 @table @gcctabopt
8238 @item -mvms-return-codes
8239 @opindex mvms-return-codes
8240 Return VMS condition codes from main.  The default is to return POSIX
8241 style condition (e.g.@ error) codes.
8242 @end table
8244 @node FRV Options
8245 @subsection FRV Options
8246 @cindex FRV Options
8248 @table @gcctabopt
8249 @item -mgpr-32
8250 @opindex mgpr-32
8252 Only use the first 32 general purpose registers.
8254 @item -mgpr-64
8255 @opindex mgpr-64
8257 Use all 64 general purpose registers.
8259 @item -mfpr-32
8260 @opindex mfpr-32
8262 Use only the first 32 floating point registers.
8264 @item -mfpr-64
8265 @opindex mfpr-64
8267 Use all 64 floating point registers
8269 @item -mhard-float
8270 @opindex mhard-float
8272 Use hardware instructions for floating point operations.
8274 @item -msoft-float
8275 @opindex msoft-float
8277 Use library routines for floating point operations.
8279 @item -malloc-cc
8280 @opindex malloc-cc
8282 Dynamically allocate condition code registers.
8284 @item -mfixed-cc
8285 @opindex mfixed-cc
8287 Do not try to dynamically allocate condition code registers, only
8288 use @code{icc0} and @code{fcc0}.
8290 @item -mdword
8291 @opindex mdword
8293 Change ABI to use double word insns.
8295 @item -mno-dword
8296 @opindex mno-dword
8298 Do not use double word instructions.
8300 @item -mdouble
8301 @opindex mdouble
8303 Use floating point double instructions.
8305 @item -mno-double
8306 @opindex mno-double
8308 Do not use floating point double instructions.
8310 @item -mmedia
8311 @opindex mmedia
8313 Use media instructions.
8315 @item -mno-media
8316 @opindex mno-media
8318 Do not use media instructions.
8320 @item -mmuladd
8321 @opindex mmuladd
8323 Use multiply and add/subtract instructions.
8325 @item -mno-muladd
8326 @opindex mno-muladd
8328 Do not use multiply and add/subtract instructions.
8330 @item -mfdpic
8331 @opindex mfdpic
8333 Select the FDPIC ABI, that uses function descriptors to represent
8334 pointers to functions.  Without any PIC/PIE-related options, it
8335 implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
8336 assumes GOT entries and small data are within a 12-bit range from the
8337 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
8338 are computed with 32 bits.
8340 @item -minline-plt
8341 @opindex minline-plt
8343 Enable inlining of PLT entries in function calls to functions that are
8344 not known to bind locally.  It has no effect without @option{-mfdpic}.
8345 It's enabled by default if optimizing for speed and compiling for
8346 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
8347 optimization option such as @option{-O3} or above is present in the
8348 command line.
8350 @item -mTLS
8351 @opindex TLS
8353 Assume a large TLS segment when generating thread-local code.
8355 @item -mtls
8356 @opindex tls
8358 Do not assume a large TLS segment when generating thread-local code.
8360 @item -mgprel-ro
8361 @opindex mgprel-ro
8363 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
8364 that is known to be in read-only sections.  It's enabled by default,
8365 except for @option{-fpic} or @option{-fpie}: even though it may help
8366 make the global offset table smaller, it trades 1 instruction for 4.
8367 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
8368 one of which may be shared by multiple symbols, and it avoids the need
8369 for a GOT entry for the referenced symbol, so it's more likely to be a
8370 win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
8372 @item -multilib-library-pic
8373 @opindex multilib-library-pic
8375 Link with the (library, not FD) pic libraries.  It's implied by
8376 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
8377 @option{-fpic} without @option{-mfdpic}.  You should never have to use
8378 it explicitly.
8380 @item -mlinked-fp
8381 @opindex mlinked-fp
8383 Follow the EABI requirement of always creating a frame pointer whenever
8384 a stack frame is allocated.  This option is enabled by default and can
8385 be disabled with @option{-mno-linked-fp}.
8387 @item -mlong-calls
8388 @opindex mlong-calls
8390 Use indirect addressing to call functions outside the current
8391 compilation unit.  This allows the functions to be placed anywhere
8392 within the 32-bit address space.
8394 @item -malign-labels
8395 @opindex malign-labels
8397 Try to align labels to an 8-byte boundary by inserting nops into the
8398 previous packet.  This option only has an effect when VLIW packing
8399 is enabled.  It doesn't create new packets; it merely adds nops to
8400 existing ones.
8402 @item -mlibrary-pic
8403 @opindex mlibrary-pic
8405 Generate position-independent EABI code.
8407 @item -macc-4
8408 @opindex macc-4
8410 Use only the first four media accumulator registers.
8412 @item -macc-8
8413 @opindex macc-8
8415 Use all eight media accumulator registers.
8417 @item -mpack
8418 @opindex mpack
8420 Pack VLIW instructions.
8422 @item -mno-pack
8423 @opindex mno-pack
8425 Do not pack VLIW instructions.
8427 @item -mno-eflags
8428 @opindex mno-eflags
8430 Do not mark ABI switches in e_flags.
8432 @item -mcond-move
8433 @opindex mcond-move
8435 Enable the use of conditional-move instructions (default).
8437 This switch is mainly for debugging the compiler and will likely be removed
8438 in a future version.
8440 @item -mno-cond-move
8441 @opindex mno-cond-move
8443 Disable the use of conditional-move instructions.
8445 This switch is mainly for debugging the compiler and will likely be removed
8446 in a future version.
8448 @item -mscc
8449 @opindex mscc
8451 Enable the use of conditional set instructions (default).
8453 This switch is mainly for debugging the compiler and will likely be removed
8454 in a future version.
8456 @item -mno-scc
8457 @opindex mno-scc
8459 Disable the use of conditional set instructions.
8461 This switch is mainly for debugging the compiler and will likely be removed
8462 in a future version.
8464 @item -mcond-exec
8465 @opindex mcond-exec
8467 Enable the use of conditional execution (default).
8469 This switch is mainly for debugging the compiler and will likely be removed
8470 in a future version.
8472 @item -mno-cond-exec
8473 @opindex mno-cond-exec
8475 Disable the use of conditional execution.
8477 This switch is mainly for debugging the compiler and will likely be removed
8478 in a future version.
8480 @item -mvliw-branch
8481 @opindex mvliw-branch
8483 Run a pass to pack branches into VLIW instructions (default).
8485 This switch is mainly for debugging the compiler and will likely be removed
8486 in a future version.
8488 @item -mno-vliw-branch
8489 @opindex mno-vliw-branch
8491 Do not run a pass to pack branches into VLIW instructions.
8493 This switch is mainly for debugging the compiler and will likely be removed
8494 in a future version.
8496 @item -mmulti-cond-exec
8497 @opindex mmulti-cond-exec
8499 Enable optimization of @code{&&} and @code{||} in conditional execution
8500 (default).
8502 This switch is mainly for debugging the compiler and will likely be removed
8503 in a future version.
8505 @item -mno-multi-cond-exec
8506 @opindex mno-multi-cond-exec
8508 Disable optimization of @code{&&} and @code{||} in conditional execution.
8510 This switch is mainly for debugging the compiler and will likely be removed
8511 in a future version.
8513 @item -mnested-cond-exec
8514 @opindex mnested-cond-exec
8516 Enable nested conditional execution optimizations (default).
8518 This switch is mainly for debugging the compiler and will likely be removed
8519 in a future version.
8521 @item -mno-nested-cond-exec
8522 @opindex mno-nested-cond-exec
8524 Disable nested conditional execution optimizations.
8526 This switch is mainly for debugging the compiler and will likely be removed
8527 in a future version.
8529 @item -mtomcat-stats
8530 @opindex mtomcat-stats
8532 Cause gas to print out tomcat statistics.
8534 @item -mcpu=@var{cpu}
8535 @opindex mcpu
8537 Select the processor type for which to generate code.  Possible values are
8538 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
8539 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
8541 @end table
8543 @node H8/300 Options
8544 @subsection H8/300 Options
8546 These @samp{-m} options are defined for the H8/300 implementations:
8548 @table @gcctabopt
8549 @item -mrelax
8550 @opindex mrelax
8551 Shorten some address references at link time, when possible; uses the
8552 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
8553 ld, Using ld}, for a fuller description.
8555 @item -mh
8556 @opindex mh
8557 Generate code for the H8/300H@.
8559 @item -ms
8560 @opindex ms
8561 Generate code for the H8S@.
8563 @item -mn
8564 @opindex mn
8565 Generate code for the H8S and H8/300H in the normal mode.  This switch
8566 must be used either with @option{-mh} or @option{-ms}.
8568 @item -ms2600
8569 @opindex ms2600
8570 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
8572 @item -mint32
8573 @opindex mint32
8574 Make @code{int} data 32 bits by default.
8576 @item -malign-300
8577 @opindex malign-300
8578 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
8579 The default for the H8/300H and H8S is to align longs and floats on 4
8580 byte boundaries.
8581 @option{-malign-300} causes them to be aligned on 2 byte boundaries.
8582 This option has no effect on the H8/300.
8583 @end table
8585 @node HPPA Options
8586 @subsection HPPA Options
8587 @cindex HPPA Options
8589 These @samp{-m} options are defined for the HPPA family of computers:
8591 @table @gcctabopt
8592 @item -march=@var{architecture-type}
8593 @opindex march
8594 Generate code for the specified architecture.  The choices for
8595 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
8596 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
8597 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
8598 architecture option for your machine.  Code compiled for lower numbered
8599 architectures will run on higher numbered architectures, but not the
8600 other way around.
8602 @item -mpa-risc-1-0
8603 @itemx -mpa-risc-1-1
8604 @itemx -mpa-risc-2-0
8605 @opindex mpa-risc-1-0
8606 @opindex mpa-risc-1-1
8607 @opindex mpa-risc-2-0
8608 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
8610 @item -mbig-switch
8611 @opindex mbig-switch
8612 Generate code suitable for big switch tables.  Use this option only if
8613 the assembler/linker complain about out of range branches within a switch
8614 table.
8616 @item -mjump-in-delay
8617 @opindex mjump-in-delay
8618 Fill delay slots of function calls with unconditional jump instructions
8619 by modifying the return pointer for the function call to be the target
8620 of the conditional jump.
8622 @item -mdisable-fpregs
8623 @opindex mdisable-fpregs
8624 Prevent floating point registers from being used in any manner.  This is
8625 necessary for compiling kernels which perform lazy context switching of
8626 floating point registers.  If you use this option and attempt to perform
8627 floating point operations, the compiler will abort.
8629 @item -mdisable-indexing
8630 @opindex mdisable-indexing
8631 Prevent the compiler from using indexing address modes.  This avoids some
8632 rather obscure problems when compiling MIG generated code under MACH@.
8634 @item -mno-space-regs
8635 @opindex mno-space-regs
8636 Generate code that assumes the target has no space registers.  This allows
8637 GCC to generate faster indirect calls and use unscaled index address modes.
8639 Such code is suitable for level 0 PA systems and kernels.
8641 @item -mfast-indirect-calls
8642 @opindex mfast-indirect-calls
8643 Generate code that assumes calls never cross space boundaries.  This
8644 allows GCC to emit code which performs faster indirect calls.
8646 This option will not work in the presence of shared libraries or nested
8647 functions.
8649 @item -mfixed-range=@var{register-range}
8650 @opindex mfixed-range
8651 Generate code treating the given register range as fixed registers.
8652 A fixed register is one that the register allocator can not use.  This is
8653 useful when compiling kernel code.  A register range is specified as
8654 two registers separated by a dash.  Multiple register ranges can be
8655 specified separated by a comma.
8657 @item -mlong-load-store
8658 @opindex mlong-load-store
8659 Generate 3-instruction load and store sequences as sometimes required by
8660 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
8661 the HP compilers.
8663 @item -mportable-runtime
8664 @opindex mportable-runtime
8665 Use the portable calling conventions proposed by HP for ELF systems.
8667 @item -mgas
8668 @opindex mgas
8669 Enable the use of assembler directives only GAS understands.
8671 @item -mschedule=@var{cpu-type}
8672 @opindex mschedule
8673 Schedule code according to the constraints for the machine type
8674 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
8675 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
8676 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
8677 proper scheduling option for your machine.  The default scheduling is
8678 @samp{8000}.
8680 @item -mlinker-opt
8681 @opindex mlinker-opt
8682 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
8683 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
8684 linkers in which they give bogus error messages when linking some programs.
8686 @item -msoft-float
8687 @opindex msoft-float
8688 Generate output containing library calls for floating point.
8689 @strong{Warning:} the requisite libraries are not available for all HPPA
8690 targets.  Normally the facilities of the machine's usual C compiler are
8691 used, but this cannot be done directly in cross-compilation.  You must make
8692 your own arrangements to provide suitable library functions for
8693 cross-compilation.  The embedded target @samp{hppa1.1-*-pro}
8694 does provide software floating point support.
8696 @option{-msoft-float} changes the calling convention in the output file;
8697 therefore, it is only useful if you compile @emph{all} of a program with
8698 this option.  In particular, you need to compile @file{libgcc.a}, the
8699 library that comes with GCC, with @option{-msoft-float} in order for
8700 this to work.
8702 @item -msio
8703 @opindex msio
8704 Generate the predefine, @code{_SIO}, for server IO@.  The default is
8705 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
8706 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
8707 options are available under HP-UX and HI-UX@.
8709 @item -mgnu-ld
8710 @opindex gnu-ld
8711 Use GNU ld specific options.  This passes @option{-shared} to ld when
8712 building a shared library.  It is the default when GCC is configured,
8713 explicitly or implicitly, with the GNU linker.  This option does not
8714 have any affect on which ld is called, it only changes what parameters
8715 are passed to that ld.  The ld that is called is determined by the
8716 @option{--with-ld} configure option, GCC's program search path, and
8717 finally by the user's @env{PATH}.  The linker used by GCC can be printed
8718 using @samp{which `gcc -print-prog-name=ld`}.
8720 @item -mhp-ld
8721 @opindex hp-ld
8722 Use HP ld specific options.  This passes @option{-b} to ld when building
8723 a shared library and passes @option{+Accept TypeMismatch} to ld on all
8724 links.  It is the default when GCC is configured, explicitly or
8725 implicitly, with the HP linker.  This option does not have any affect on
8726 which ld is called, it only changes what parameters are passed to that
8727 ld.  The ld that is called is determined by the @option{--with-ld}
8728 configure option, GCC's program search path, and finally by the user's
8729 @env{PATH}.  The linker used by GCC can be printed using @samp{which
8730 `gcc -print-prog-name=ld`}.
8732 @item -mlong-calls
8733 @opindex mno-long-calls
8734 Generate code that uses long call sequences.  This ensures that a call
8735 is always able to reach linker generated stubs.  The default is to generate
8736 long calls only when the distance from the call site to the beginning
8737 of the function or translation unit, as the case may be, exceeds a
8738 predefined limit set by the branch type being used.  The limits for
8739 normal calls are 7,600,000 and 240,000 bytes, respectively for the
8740 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
8741 240,000 bytes.
8743 Distances are measured from the beginning of functions when using the
8744 @option{-ffunction-sections} option, or when using the @option{-mgas}
8745 and @option{-mno-portable-runtime} options together under HP-UX with
8746 the SOM linker.
8748 It is normally not desirable to use this option as it will degrade
8749 performance.  However, it may be useful in large applications,
8750 particularly when partial linking is used to build the application.
8752 The types of long calls used depends on the capabilities of the
8753 assembler and linker, and the type of code being generated.  The
8754 impact on systems that support long absolute calls, and long pic
8755 symbol-difference or pc-relative calls should be relatively small.
8756 However, an indirect call is used on 32-bit ELF systems in pic code
8757 and it is quite long.
8759 @item -munix=@var{unix-std}
8760 @opindex march
8761 Generate compiler predefines and select a startfile for the specified
8762 UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
8763 and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
8764 is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
8765 11.11 and later.  The default values are @samp{93} for HP-UX 10.00,
8766 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
8767 and later.
8769 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
8770 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
8771 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
8772 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
8773 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
8774 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
8776 It is @emph{important} to note that this option changes the interfaces
8777 for various library routines.  It also affects the operational behavior
8778 of the C library.  Thus, @emph{extreme} care is needed in using this
8779 option.
8781 Library code that is intended to operate with more than one UNIX
8782 standard must test, set and restore the variable @var{__xpg4_extended_mask}
8783 as appropriate.  Most GNU software doesn't provide this capability.
8785 @item -nolibdld
8786 @opindex nolibdld
8787 Suppress the generation of link options to search libdld.sl when the
8788 @option{-static} option is specified on HP-UX 10 and later.
8790 @item -static
8791 @opindex static
8792 The HP-UX implementation of setlocale in libc has a dependency on
8793 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
8794 when the @option{-static} option is specified, special link options
8795 are needed to resolve this dependency.
8797 On HP-UX 10 and later, the GCC driver adds the necessary options to
8798 link with libdld.sl when the @option{-static} option is specified.
8799 This causes the resulting binary to be dynamic.  On the 64-bit port,
8800 the linkers generate dynamic binaries by default in any case.  The
8801 @option{-nolibdld} option can be used to prevent the GCC driver from
8802 adding these link options.
8804 @item -threads
8805 @opindex threads
8806 Add support for multithreading with the @dfn{dce thread} library
8807 under HP-UX@.  This option sets flags for both the preprocessor and
8808 linker.
8809 @end table
8811 @node i386 and x86-64 Options
8812 @subsection Intel 386 and AMD x86-64 Options
8813 @cindex i386 Options
8814 @cindex x86-64 Options
8815 @cindex Intel 386 Options
8816 @cindex AMD x86-64 Options
8818 These @samp{-m} options are defined for the i386 and x86-64 family of
8819 computers:
8821 @table @gcctabopt
8822 @item -mtune=@var{cpu-type}
8823 @opindex mtune
8824 Tune to @var{cpu-type} everything applicable about the generated code, except
8825 for the ABI and the set of available instructions.  The choices for
8826 @var{cpu-type} are:
8827 @table @emph
8828 @item i386
8829 Original Intel's i386 CPU@.
8830 @item i486
8831 Intel's i486 CPU@.  (No scheduling is implemented for this chip.)
8832 @item i586, pentium
8833 Intel Pentium CPU with no MMX support.
8834 @item pentium-mmx
8835 Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
8836 @item i686, pentiumpro
8837 Intel PentiumPro CPU@.
8838 @item pentium2
8839 Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
8840 @item pentium3, pentium3m
8841 Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
8842 support.
8843 @item pentium-m
8844 Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set
8845 support.  Used by Centrino notebooks.
8846 @item pentium4, pentium4m
8847 Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
8848 @item prescott
8849 Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction
8850 set support.
8851 @item nocona
8852 Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE,
8853 SSE2 and SSE3 instruction set support.
8854 @item k6
8855 AMD K6 CPU with MMX instruction set support.
8856 @item k6-2, k6-3
8857 Improved versions of AMD K6 CPU with MMX and 3dNOW! instruction set support.
8858 @item athlon, athlon-tbird
8859 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE prefetch instructions
8860 support.
8861 @item athlon-4, athlon-xp, athlon-mp
8862 Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and full SSE
8863 instruction set support.
8864 @item k8, opteron, athlon64, athlon-fx
8865 AMD K8 core based CPUs with x86-64 instruction set support.  (This supersets
8866 MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.)
8867 @item winchip-c6
8868 IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
8869 set support.
8870 @item winchip2
8871 IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW!
8872 instruction set support.
8873 @item c3
8874 Via C3 CPU with MMX and 3dNOW! instruction set support.  (No scheduling is
8875 implemented for this chip.)
8876 @item c3-2
8877 Via C3-2 CPU with MMX and SSE instruction set support.  (No scheduling is
8878 implemented for this chip.)
8879 @end table
8881 While picking a specific @var{cpu-type} will schedule things appropriately
8882 for that particular chip, the compiler will not generate any code that
8883 does not run on the i386 without the @option{-march=@var{cpu-type}} option
8884 being used.
8886 @item -march=@var{cpu-type}
8887 @opindex march
8888 Generate instructions for the machine type @var{cpu-type}.  The choices
8889 for @var{cpu-type} are the same as for @option{-mtune}.  Moreover,
8890 specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
8892 @item -mcpu=@var{cpu-type}
8893 @opindex mcpu
8894 A deprecated synonym for @option{-mtune}.
8896 @item -m386
8897 @itemx -m486
8898 @itemx -mpentium
8899 @itemx -mpentiumpro
8900 @opindex m386
8901 @opindex m486
8902 @opindex mpentium
8903 @opindex mpentiumpro
8904 These options are synonyms for @option{-mtune=i386}, @option{-mtune=i486},
8905 @option{-mtune=pentium}, and @option{-mtune=pentiumpro} respectively.
8906 These synonyms are deprecated.
8908 @item -mfpmath=@var{unit}
8909 @opindex march
8910 Generate floating point arithmetics for selected unit @var{unit}.  The choices
8911 for @var{unit} are:
8913 @table @samp
8914 @item 387
8915 Use the standard 387 floating point coprocessor present majority of chips and
8916 emulated otherwise.  Code compiled with this option will run almost everywhere.
8917 The temporary results are computed in 80bit precision instead of precision
8918 specified by the type resulting in slightly different results compared to most
8919 of other chips.  See @option{-ffloat-store} for more detailed description.
8921 This is the default choice for i386 compiler.
8923 @item sse
8924 Use scalar floating point instructions present in the SSE instruction set.
8925 This instruction set is supported by Pentium3 and newer chips, in the AMD line
8926 by Athlon-4, Athlon-xp and Athlon-mp chips.  The earlier version of SSE
8927 instruction set supports only single precision arithmetics, thus the double and
8928 extended precision arithmetics is still done using 387.  Later version, present
8929 only in Pentium4 and the future AMD x86-64 chips supports double precision
8930 arithmetics too.
8932 For the i386 compiler, you need to use @option{-march=@var{cpu-type}}, @option{-msse}
8933 or @option{-msse2} switches to enable SSE extensions and make this option
8934 effective.  For the x86-64 compiler, these extensions are enabled by default.
8936 The resulting code should be considerably faster in the majority of cases and avoid
8937 the numerical instability problems of 387 code, but may break some existing
8938 code that expects temporaries to be 80bit.
8940 This is the default choice for the x86-64 compiler.
8942 @item sse,387
8943 Attempt to utilize both instruction sets at once.  This effectively double the
8944 amount of available registers and on chips with separate execution units for
8945 387 and SSE the execution resources too.  Use this option with care, as it is
8946 still experimental, because the GCC register allocator does not model separate
8947 functional units well resulting in instable performance.
8948 @end table
8950 @item -masm=@var{dialect}
8951 @opindex masm=@var{dialect}
8952 Output asm instructions using selected @var{dialect}.  Supported choices are
8953 @samp{intel} or @samp{att} (the default one).
8955 @item -mieee-fp
8956 @itemx -mno-ieee-fp
8957 @opindex mieee-fp
8958 @opindex mno-ieee-fp
8959 Control whether or not the compiler uses IEEE floating point
8960 comparisons.  These handle correctly the case where the result of a
8961 comparison is unordered.
8963 @item -msoft-float
8964 @opindex msoft-float
8965 Generate output containing library calls for floating point.
8966 @strong{Warning:} the requisite libraries are not part of GCC@.
8967 Normally the facilities of the machine's usual C compiler are used, but
8968 this can't be done directly in cross-compilation.  You must make your
8969 own arrangements to provide suitable library functions for
8970 cross-compilation.
8972 On machines where a function returns floating point results in the 80387
8973 register stack, some floating point opcodes may be emitted even if
8974 @option{-msoft-float} is used.
8976 @item -mno-fp-ret-in-387
8977 @opindex mno-fp-ret-in-387
8978 Do not use the FPU registers for return values of functions.
8980 The usual calling convention has functions return values of types
8981 @code{float} and @code{double} in an FPU register, even if there
8982 is no FPU@.  The idea is that the operating system should emulate
8983 an FPU@.
8985 The option @option{-mno-fp-ret-in-387} causes such values to be returned
8986 in ordinary CPU registers instead.
8988 @item -mno-fancy-math-387
8989 @opindex mno-fancy-math-387
8990 Some 387 emulators do not support the @code{sin}, @code{cos} and
8991 @code{sqrt} instructions for the 387.  Specify this option to avoid
8992 generating those instructions.  This option is the default on FreeBSD,
8993 OpenBSD and NetBSD@.  This option is overridden when @option{-march}
8994 indicates that the target cpu will always have an FPU and so the
8995 instruction will not need emulation.  As of revision 2.6.1, these
8996 instructions are not generated unless you also use the
8997 @option{-funsafe-math-optimizations} switch.
8999 @item -malign-double
9000 @itemx -mno-align-double
9001 @opindex malign-double
9002 @opindex mno-align-double
9003 Control whether GCC aligns @code{double}, @code{long double}, and
9004 @code{long long} variables on a two word boundary or a one word
9005 boundary.  Aligning @code{double} variables on a two word boundary will
9006 produce code that runs somewhat faster on a @samp{Pentium} at the
9007 expense of more memory.
9009 @strong{Warning:} if you use the @option{-malign-double} switch,
9010 structures containing the above types will be aligned differently than
9011 the published application binary interface specifications for the 386
9012 and will not be binary compatible with structures in code compiled
9013 without that switch.
9015 @item -m96bit-long-double
9016 @itemx -m128bit-long-double
9017 @opindex m96bit-long-double
9018 @opindex m128bit-long-double
9019 These switches control the size of @code{long double} type.  The i386
9020 application binary interface specifies the size to be 96 bits,
9021 so @option{-m96bit-long-double} is the default in 32 bit mode.
9023 Modern architectures (Pentium and newer) would prefer @code{long double}
9024 to be aligned to an 8 or 16 byte boundary.  In arrays or structures
9025 conforming to the ABI, this would not be possible.  So specifying a
9026 @option{-m128bit-long-double} will align @code{long double}
9027 to a 16 byte boundary by padding the @code{long double} with an additional
9028 32 bit zero.
9030 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
9031 its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
9033 Notice that neither of these options enable any extra precision over the x87
9034 standard of 80 bits for a @code{long double}.
9036 @strong{Warning:} if you override the default value for your target ABI, the
9037 structures and arrays containing @code{long double} variables will change
9038 their size as well as function calling convention for function taking
9039 @code{long double} will be modified.  Hence they will not be binary
9040 compatible with arrays or structures in code compiled without that switch.
9043 @item -msvr3-shlib
9044 @itemx -mno-svr3-shlib
9045 @opindex msvr3-shlib
9046 @opindex mno-svr3-shlib
9047 Control whether GCC places uninitialized local variables into the
9048 @code{bss} or @code{data} segments.  @option{-msvr3-shlib} places them
9049 into @code{bss}.  These options are meaningful only on System V Release 3.
9051 @item -mrtd
9052 @opindex mrtd
9053 Use a different function-calling convention, in which functions that
9054 take a fixed number of arguments return with the @code{ret} @var{num}
9055 instruction, which pops their arguments while returning.  This saves one
9056 instruction in the caller since there is no need to pop the arguments
9057 there.
9059 You can specify that an individual function is called with this calling
9060 sequence with the function attribute @samp{stdcall}.  You can also
9061 override the @option{-mrtd} option by using the function attribute
9062 @samp{cdecl}.  @xref{Function Attributes}.
9064 @strong{Warning:} this calling convention is incompatible with the one
9065 normally used on Unix, so you cannot use it if you need to call
9066 libraries compiled with the Unix compiler.
9068 Also, you must provide function prototypes for all functions that
9069 take variable numbers of arguments (including @code{printf});
9070 otherwise incorrect code will be generated for calls to those
9071 functions.
9073 In addition, seriously incorrect code will result if you call a
9074 function with too many arguments.  (Normally, extra arguments are
9075 harmlessly ignored.)
9077 @item -mregparm=@var{num}
9078 @opindex mregparm
9079 Control how many registers are used to pass integer arguments.  By
9080 default, no registers are used to pass arguments, and at most 3
9081 registers can be used.  You can control this behavior for a specific
9082 function by using the function attribute @samp{regparm}.
9083 @xref{Function Attributes}.
9085 @strong{Warning:} if you use this switch, and
9086 @var{num} is nonzero, then you must build all modules with the same
9087 value, including any libraries.  This includes the system libraries and
9088 startup modules.
9090 @item -msseregparm
9091 @opindex msseregparm
9092 Use SSE register passing conventions for float and double arguments
9093 and return values.  You can control this behavior for a specific
9094 function by using the function attribute @samp{sseregparm}.
9095 @xref{Function Attributes}.
9097 @strong{Warning:} if you use this switch then you must build all
9098 modules with the same value, including any libraries.  This includes
9099 the system libraries and startup modules.
9101 @item -mpreferred-stack-boundary=@var{num}
9102 @opindex mpreferred-stack-boundary
9103 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
9104 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
9105 the default is 4 (16 bytes or 128 bits), except when optimizing for code
9106 size (@option{-Os}), in which case the default is the minimum correct
9107 alignment (4 bytes for x86, and 8 bytes for x86-64).
9109 On Pentium and PentiumPro, @code{double} and @code{long double} values
9110 should be aligned to an 8 byte boundary (see @option{-malign-double}) or
9111 suffer significant run time performance penalties.  On Pentium III, the
9112 Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar
9113 penalties if it is not 16 byte aligned.
9115 To ensure proper alignment of this values on the stack, the stack boundary
9116 must be as aligned as that required by any value stored on the stack.
9117 Further, every function must be generated such that it keeps the stack
9118 aligned.  Thus calling a function compiled with a higher preferred
9119 stack boundary from a function compiled with a lower preferred stack
9120 boundary will most likely misalign the stack.  It is recommended that
9121 libraries that use callbacks always use the default setting.
9123 This extra alignment does consume extra stack space, and generally
9124 increases code size.  Code that is sensitive to stack space usage, such
9125 as embedded systems and operating system kernels, may want to reduce the
9126 preferred alignment to @option{-mpreferred-stack-boundary=2}.
9128 @item -mmmx
9129 @itemx -mno-mmx
9130 @item -msse
9131 @itemx -mno-sse
9132 @item -msse2
9133 @itemx -mno-sse2
9134 @item -msse3
9135 @itemx -mno-sse3
9136 @item -m3dnow
9137 @itemx -mno-3dnow
9138 @opindex mmmx
9139 @opindex mno-mmx
9140 @opindex msse
9141 @opindex mno-sse
9142 @opindex m3dnow
9143 @opindex mno-3dnow
9144 These switches enable or disable the use of built-in functions that allow
9145 direct access to the MMX, SSE, SSE2, SSE3 and 3Dnow extensions of the
9146 instruction set.
9148 @xref{X86 Built-in Functions}, for details of the functions enabled
9149 and disabled by these switches.
9151 To have SSE/SSE2 instructions generated automatically from floating-point
9152 code, see @option{-mfpmath=sse}.
9154 @item -mpush-args
9155 @itemx -mno-push-args
9156 @opindex mpush-args
9157 @opindex mno-push-args
9158 Use PUSH operations to store outgoing parameters.  This method is shorter
9159 and usually equally fast as method using SUB/MOV operations and is enabled
9160 by default.  In some cases disabling it may improve performance because of
9161 improved scheduling and reduced dependencies.
9163 @item -maccumulate-outgoing-args
9164 @opindex maccumulate-outgoing-args
9165 If enabled, the maximum amount of space required for outgoing arguments will be
9166 computed in the function prologue.  This is faster on most modern CPUs
9167 because of reduced dependencies, improved scheduling and reduced stack usage
9168 when preferred stack boundary is not equal to 2.  The drawback is a notable
9169 increase in code size.  This switch implies @option{-mno-push-args}.
9171 @item -mthreads
9172 @opindex mthreads
9173 Support thread-safe exception handling on @samp{Mingw32}.  Code that relies
9174 on thread-safe exception handling must compile and link all code with the
9175 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
9176 @option{-D_MT}; when linking, it links in a special thread helper library
9177 @option{-lmingwthrd} which cleans up per thread exception handling data.
9179 @item -mno-align-stringops
9180 @opindex mno-align-stringops
9181 Do not align destination of inlined string operations.  This switch reduces
9182 code size and improves performance in case the destination is already aligned,
9183 but GCC doesn't know about it.
9185 @item -minline-all-stringops
9186 @opindex minline-all-stringops
9187 By default GCC inlines string operations only when destination is known to be
9188 aligned at least to 4 byte boundary.  This enables more inlining, increase code
9189 size, but may improve performance of code that depends on fast memcpy, strlen
9190 and memset for short lengths.
9192 @item -momit-leaf-frame-pointer
9193 @opindex momit-leaf-frame-pointer
9194 Don't keep the frame pointer in a register for leaf functions.  This
9195 avoids the instructions to save, set up and restore frame pointers and
9196 makes an extra register available in leaf functions.  The option
9197 @option{-fomit-frame-pointer} removes the frame pointer for all functions
9198 which might make debugging harder.
9200 @item -mtls-direct-seg-refs
9201 @itemx -mno-tls-direct-seg-refs
9202 @opindex mtls-direct-seg-refs
9203 Controls whether TLS variables may be accessed with offsets from the
9204 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
9205 or whether the thread base pointer must be added.  Whether or not this
9206 is legal depends on the operating system, and whether it maps the
9207 segment to cover the entire TLS area.
9209 For systems that use GNU libc, the default is on.
9210 @end table
9212 These @samp{-m} switches are supported in addition to the above
9213 on AMD x86-64 processors in 64-bit environments.
9215 @table @gcctabopt
9216 @item -m32
9217 @itemx -m64
9218 @opindex m32
9219 @opindex m64
9220 Generate code for a 32-bit or 64-bit environment.
9221 The 32-bit environment sets int, long and pointer to 32 bits and
9222 generates code that runs on any i386 system.
9223 The 64-bit environment sets int to 32 bits and long and pointer
9224 to 64 bits and generates code for AMD's x86-64 architecture.
9226 @item -mno-red-zone
9227 @opindex no-red-zone
9228 Do not use a so called red zone for x86-64 code.  The red zone is mandated
9229 by the x86-64 ABI, it is a 128-byte area beyond the location of the
9230 stack pointer that will not be modified by signal or interrupt handlers
9231 and therefore can be used for temporary data without adjusting the stack
9232 pointer.  The flag @option{-mno-red-zone} disables this red zone.
9234 @item -mcmodel=small
9235 @opindex mcmodel=small
9236 Generate code for the small code model: the program and its symbols must
9237 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
9238 Programs can be statically or dynamically linked.  This is the default
9239 code model.
9241 @item -mcmodel=kernel
9242 @opindex mcmodel=kernel
9243 Generate code for the kernel code model.  The kernel runs in the
9244 negative 2 GB of the address space.
9245 This model has to be used for Linux kernel code.
9247 @item -mcmodel=medium
9248 @opindex mcmodel=medium
9249 Generate code for the medium model: The program is linked in the lower 2
9250 GB of the address space but symbols can be located anywhere in the
9251 address space.  Programs can be statically or dynamically linked, but
9252 building of shared libraries are not supported with the medium model.
9254 @item -mcmodel=large
9255 @opindex mcmodel=large
9256 Generate code for the large model: This model makes no assumptions
9257 about addresses and sizes of sections.  Currently GCC does not implement
9258 this model.
9259 @end table
9261 @node IA-64 Options
9262 @subsection IA-64 Options
9263 @cindex IA-64 Options
9265 These are the @samp{-m} options defined for the Intel IA-64 architecture.
9267 @table @gcctabopt
9268 @item -mbig-endian
9269 @opindex mbig-endian
9270 Generate code for a big endian target.  This is the default for HP-UX@.
9272 @item -mlittle-endian
9273 @opindex mlittle-endian
9274 Generate code for a little endian target.  This is the default for AIX5
9275 and GNU/Linux.
9277 @item -mgnu-as
9278 @itemx -mno-gnu-as
9279 @opindex mgnu-as
9280 @opindex mno-gnu-as
9281 Generate (or don't) code for the GNU assembler.  This is the default.
9282 @c Also, this is the default if the configure option @option{--with-gnu-as}
9283 @c is used.
9285 @item -mgnu-ld
9286 @itemx -mno-gnu-ld
9287 @opindex mgnu-ld
9288 @opindex mno-gnu-ld
9289 Generate (or don't) code for the GNU linker.  This is the default.
9290 @c Also, this is the default if the configure option @option{--with-gnu-ld}
9291 @c is used.
9293 @item -mno-pic
9294 @opindex mno-pic
9295 Generate code that does not use a global pointer register.  The result
9296 is not position independent code, and violates the IA-64 ABI@.
9298 @item -mvolatile-asm-stop
9299 @itemx -mno-volatile-asm-stop
9300 @opindex mvolatile-asm-stop
9301 @opindex mno-volatile-asm-stop
9302 Generate (or don't) a stop bit immediately before and after volatile asm
9303 statements.
9305 @item -mregister-names
9306 @itemx -mno-register-names
9307 @opindex mregister-names
9308 @opindex mno-register-names
9309 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
9310 the stacked registers.  This may make assembler output more readable.
9312 @item -mno-sdata
9313 @itemx -msdata
9314 @opindex mno-sdata
9315 @opindex msdata
9316 Disable (or enable) optimizations that use the small data section.  This may
9317 be useful for working around optimizer bugs.
9319 @item -mconstant-gp
9320 @opindex mconstant-gp
9321 Generate code that uses a single constant global pointer value.  This is
9322 useful when compiling kernel code.
9324 @item -mauto-pic
9325 @opindex mauto-pic
9326 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
9327 This is useful when compiling firmware code.
9329 @item -minline-float-divide-min-latency
9330 @opindex minline-float-divide-min-latency
9331 Generate code for inline divides of floating point values
9332 using the minimum latency algorithm.
9334 @item -minline-float-divide-max-throughput
9335 @opindex minline-float-divide-max-throughput
9336 Generate code for inline divides of floating point values
9337 using the maximum throughput algorithm.
9339 @item -minline-int-divide-min-latency
9340 @opindex minline-int-divide-min-latency
9341 Generate code for inline divides of integer values
9342 using the minimum latency algorithm.
9344 @item -minline-int-divide-max-throughput
9345 @opindex minline-int-divide-max-throughput
9346 Generate code for inline divides of integer values
9347 using the maximum throughput algorithm.
9349 @item -minline-sqrt-min-latency
9350 @opindex minline-sqrt-min-latency
9351 Generate code for inline square roots
9352 using the minimum latency algorithm.
9354 @item -minline-sqrt-max-throughput
9355 @opindex minline-sqrt-max-throughput
9356 Generate code for inline square roots
9357 using the maximum throughput algorithm.
9359 @item -mno-dwarf2-asm
9360 @itemx -mdwarf2-asm
9361 @opindex mno-dwarf2-asm
9362 @opindex mdwarf2-asm
9363 Don't (or do) generate assembler code for the DWARF2 line number debugging
9364 info.  This may be useful when not using the GNU assembler.
9366 @item -mearly-stop-bits
9367 @itemx -mno-early-stop-bits
9368 @opindex mearly-stop-bits
9369 @opindex mno-early-stop-bits
9370 Allow stop bits to be placed earlier than immediately preceding the
9371 instruction that triggered the stop bit.  This can improve instruction
9372 scheduling, but does not always do so.
9374 @item -mfixed-range=@var{register-range}
9375 @opindex mfixed-range
9376 Generate code treating the given register range as fixed registers.
9377 A fixed register is one that the register allocator can not use.  This is
9378 useful when compiling kernel code.  A register range is specified as
9379 two registers separated by a dash.  Multiple register ranges can be
9380 specified separated by a comma.
9382 @item -mtls-size=@var{tls-size}
9383 @opindex mtls-size
9384 Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
9387 @item -mtune-arch=@var{cpu-type}
9388 @opindex mtune-arch
9389 Tune the instruction scheduling for a particular CPU, Valid values are
9390 itanium, itanium1, merced, itanium2, and mckinley.
9392 @item -mt
9393 @itemx -pthread
9394 @opindex mt
9395 @opindex pthread
9396 Add support for multithreading using the POSIX threads library.  This
9397 option sets flags for both the preprocessor and linker.  It does
9398 not affect the thread safety of object code produced by the compiler or
9399 that of libraries supplied with it.  These are HP-UX specific flags.
9401 @item -milp32
9402 @itemx -mlp64
9403 @opindex milp32
9404 @opindex mlp64
9405 Generate code for a 32-bit or 64-bit environment.
9406 The 32-bit environment sets int, long and pointer to 32 bits.
9407 The 64-bit environment sets int to 32 bits and long and pointer
9408 to 64 bits.  These are HP-UX specific flags.
9410 @end table
9412 @node M32C Options
9413 @subsection M32C Options
9414 @cindex M32C options
9416 @table @gcctabopt
9417 @item -mcpu=@var{name}
9418 @opindex mcpu=
9419 Select the CPU for which code is generated.  @var{name} may be one of
9420 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
9421 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
9422 the M32C/80 series.
9424 @item -msim
9425 @opindex msim
9426 Specifies that the program will be run on the simulator.  This causes
9427 an alternate runtime library to be linked in which supports, for
9428 example, file I/O.  You must not use this option when generating
9429 programs that will run on real hardware; you must provide your own
9430 runtime library for whatever I/O functions are needed.
9432 @item -memregs=@var{number}
9433 @opindex memregs=
9434 Specifies the number of memory-based pseudo-registers GCC will use
9435 during code generation.  These pseudo-registers will be used like real
9436 registers, so there is a tradeoff between GCC's ability to fit the
9437 code into available registers, and the performance penalty of using
9438 memory instead of registers.  Note that all modules in a program must
9439 be compiled with the same value for this option.  Because of that, you
9440 must not use this option with the default runtime libraries gcc
9441 builds.
9443 @end table
9445 @node M32R/D Options
9446 @subsection M32R/D Options
9447 @cindex M32R/D options
9449 These @option{-m} options are defined for Renesas M32R/D architectures:
9451 @table @gcctabopt
9452 @item -m32r2
9453 @opindex m32r2
9454 Generate code for the M32R/2@.
9456 @item -m32rx
9457 @opindex m32rx
9458 Generate code for the M32R/X@.
9460 @item -m32r
9461 @opindex m32r
9462 Generate code for the M32R@.  This is the default.
9464 @item -mmodel=small
9465 @opindex mmodel=small
9466 Assume all objects live in the lower 16MB of memory (so that their addresses
9467 can be loaded with the @code{ld24} instruction), and assume all subroutines
9468 are reachable with the @code{bl} instruction.
9469 This is the default.
9471 The addressability of a particular object can be set with the
9472 @code{model} attribute.
9474 @item -mmodel=medium
9475 @opindex mmodel=medium
9476 Assume objects may be anywhere in the 32-bit address space (the compiler
9477 will generate @code{seth/add3} instructions to load their addresses), and
9478 assume all subroutines are reachable with the @code{bl} instruction.
9480 @item -mmodel=large
9481 @opindex mmodel=large
9482 Assume objects may be anywhere in the 32-bit address space (the compiler
9483 will generate @code{seth/add3} instructions to load their addresses), and
9484 assume subroutines may not be reachable with the @code{bl} instruction
9485 (the compiler will generate the much slower @code{seth/add3/jl}
9486 instruction sequence).
9488 @item -msdata=none
9489 @opindex msdata=none
9490 Disable use of the small data area.  Variables will be put into
9491 one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
9492 @code{section} attribute has been specified).
9493 This is the default.
9495 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
9496 Objects may be explicitly put in the small data area with the
9497 @code{section} attribute using one of these sections.
9499 @item -msdata=sdata
9500 @opindex msdata=sdata
9501 Put small global and static data in the small data area, but do not
9502 generate special code to reference them.
9504 @item -msdata=use
9505 @opindex msdata=use
9506 Put small global and static data in the small data area, and generate
9507 special instructions to reference them.
9509 @item -G @var{num}
9510 @opindex G
9511 @cindex smaller data references
9512 Put global and static objects less than or equal to @var{num} bytes
9513 into the small data or bss sections instead of the normal data or bss
9514 sections.  The default value of @var{num} is 8.
9515 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
9516 for this option to have any effect.
9518 All modules should be compiled with the same @option{-G @var{num}} value.
9519 Compiling with different values of @var{num} may or may not work; if it
9520 doesn't the linker will give an error message---incorrect code will not be
9521 generated.
9523 @item -mdebug
9524 @opindex mdebug
9525 Makes the M32R specific code in the compiler display some statistics
9526 that might help in debugging programs.
9528 @item -malign-loops
9529 @opindex malign-loops
9530 Align all loops to a 32-byte boundary.
9532 @item -mno-align-loops
9533 @opindex mno-align-loops
9534 Do not enforce a 32-byte alignment for loops.  This is the default.
9536 @item -missue-rate=@var{number}
9537 @opindex missue-rate=@var{number}
9538 Issue @var{number} instructions per cycle.  @var{number} can only be 1
9539 or 2.
9541 @item -mbranch-cost=@var{number}
9542 @opindex mbranch-cost=@var{number}
9543 @var{number} can only be 1 or 2.  If it is 1 then branches will be
9544 preferred over conditional code, if it is 2, then the opposite will
9545 apply.
9547 @item -mflush-trap=@var{number}
9548 @opindex mflush-trap=@var{number}
9549 Specifies the trap number to use to flush the cache.  The default is
9550 12.  Valid numbers are between 0 and 15 inclusive.
9552 @item -mno-flush-trap
9553 @opindex mno-flush-trap
9554 Specifies that the cache cannot be flushed by using a trap.
9556 @item -mflush-func=@var{name}
9557 @opindex mflush-func=@var{name}
9558 Specifies the name of the operating system function to call to flush
9559 the cache.  The default is @emph{_flush_cache}, but a function call
9560 will only be used if a trap is not available.
9562 @item -mno-flush-func
9563 @opindex mno-flush-func
9564 Indicates that there is no OS function for flushing the cache.
9566 @end table
9568 @node M680x0 Options
9569 @subsection M680x0 Options
9570 @cindex M680x0 options
9572 These are the @samp{-m} options defined for the 68000 series.  The default
9573 values for these options depends on which style of 68000 was selected when
9574 the compiler was configured; the defaults for the most common choices are
9575 given below.
9577 @table @gcctabopt
9578 @item -m68000
9579 @itemx -mc68000
9580 @opindex m68000
9581 @opindex mc68000
9582 Generate output for a 68000.  This is the default
9583 when the compiler is configured for 68000-based systems.
9585 Use this option for microcontrollers with a 68000 or EC000 core,
9586 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
9588 @item -m68020
9589 @itemx -mc68020
9590 @opindex m68020
9591 @opindex mc68020
9592 Generate output for a 68020.  This is the default
9593 when the compiler is configured for 68020-based systems.
9595 @item -m68881
9596 @opindex m68881
9597 Generate output containing 68881 instructions for floating point.
9598 This is the default for most 68020 systems unless @option{--nfp} was
9599 specified when the compiler was configured.
9601 @item -m68030
9602 @opindex m68030
9603 Generate output for a 68030.  This is the default when the compiler is
9604 configured for 68030-based systems.
9606 @item -m68040
9607 @opindex m68040
9608 Generate output for a 68040.  This is the default when the compiler is
9609 configured for 68040-based systems.
9611 This option inhibits the use of 68881/68882 instructions that have to be
9612 emulated by software on the 68040.  Use this option if your 68040 does not
9613 have code to emulate those instructions.
9615 @item -m68060
9616 @opindex m68060
9617 Generate output for a 68060.  This is the default when the compiler is
9618 configured for 68060-based systems.
9620 This option inhibits the use of 68020 and 68881/68882 instructions that
9621 have to be emulated by software on the 68060.  Use this option if your 68060
9622 does not have code to emulate those instructions.
9624 @item -mcpu32
9625 @opindex mcpu32
9626 Generate output for a CPU32.  This is the default
9627 when the compiler is configured for CPU32-based systems.
9629 Use this option for microcontrollers with a
9630 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
9631 68336, 68340, 68341, 68349 and 68360.
9633 @item -m5200
9634 @opindex m5200
9635 Generate output for a 520X ``coldfire'' family cpu.  This is the default
9636 when the compiler is configured for 520X-based systems.
9638 Use this option for microcontroller with a 5200 core, including
9639 the MCF5202, MCF5203, MCF5204 and MCF5202.
9642 @item -m68020-40
9643 @opindex m68020-40
9644 Generate output for a 68040, without using any of the new instructions.
9645 This results in code which can run relatively efficiently on either a
9646 68020/68881 or a 68030 or a 68040.  The generated code does use the
9647 68881 instructions that are emulated on the 68040.
9649 @item -m68020-60
9650 @opindex m68020-60
9651 Generate output for a 68060, without using any of the new instructions.
9652 This results in code which can run relatively efficiently on either a
9653 68020/68881 or a 68030 or a 68040.  The generated code does use the
9654 68881 instructions that are emulated on the 68060.
9656 @item -msoft-float
9657 @opindex msoft-float
9658 Generate output containing library calls for floating point.
9659 @strong{Warning:} the requisite libraries are not available for all m68k
9660 targets.  Normally the facilities of the machine's usual C compiler are
9661 used, but this can't be done directly in cross-compilation.  You must
9662 make your own arrangements to provide suitable library functions for
9663 cross-compilation.  The embedded targets @samp{m68k-*-aout} and
9664 @samp{m68k-*-coff} do provide software floating point support.
9666 @item -mshort
9667 @opindex mshort
9668 Consider type @code{int} to be 16 bits wide, like @code{short int}.
9669 Additionally, parameters passed on the stack are also aligned to a
9670 16-bit boundary even on targets whose API mandates promotion to 32-bit.
9672 @item -mnobitfield
9673 @opindex mnobitfield
9674 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
9675 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
9677 @item -mbitfield
9678 @opindex mbitfield
9679 Do use the bit-field instructions.  The @option{-m68020} option implies
9680 @option{-mbitfield}.  This is the default if you use a configuration
9681 designed for a 68020.
9683 @item -mrtd
9684 @opindex mrtd
9685 Use a different function-calling convention, in which functions
9686 that take a fixed number of arguments return with the @code{rtd}
9687 instruction, which pops their arguments while returning.  This
9688 saves one instruction in the caller since there is no need to pop
9689 the arguments there.
9691 This calling convention is incompatible with the one normally
9692 used on Unix, so you cannot use it if you need to call libraries
9693 compiled with the Unix compiler.
9695 Also, you must provide function prototypes for all functions that
9696 take variable numbers of arguments (including @code{printf});
9697 otherwise incorrect code will be generated for calls to those
9698 functions.
9700 In addition, seriously incorrect code will result if you call a
9701 function with too many arguments.  (Normally, extra arguments are
9702 harmlessly ignored.)
9704 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
9705 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
9707 @item -malign-int
9708 @itemx -mno-align-int
9709 @opindex malign-int
9710 @opindex mno-align-int
9711 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
9712 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
9713 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
9714 Aligning variables on 32-bit boundaries produces code that runs somewhat
9715 faster on processors with 32-bit busses at the expense of more memory.
9717 @strong{Warning:} if you use the @option{-malign-int} switch, GCC will
9718 align structures containing the above types  differently than
9719 most published application binary interface specifications for the m68k.
9721 @item -mpcrel
9722 @opindex mpcrel
9723 Use the pc-relative addressing mode of the 68000 directly, instead of
9724 using a global offset table.  At present, this option implies @option{-fpic},
9725 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
9726 not presently supported with @option{-mpcrel}, though this could be supported for
9727 68020 and higher processors.
9729 @item -mno-strict-align
9730 @itemx -mstrict-align
9731 @opindex mno-strict-align
9732 @opindex mstrict-align
9733 Do not (do) assume that unaligned memory references will be handled by
9734 the system.
9736 @item -msep-data
9737 Generate code that allows the data segment to be located in a different
9738 area of memory from the text segment.  This allows for execute in place in
9739 an environment without virtual memory management.  This option implies
9740 @option{-fPIC}.
9742 @item -mno-sep-data
9743 Generate code that assumes that the data segment follows the text segment.
9744 This is the default.
9746 @item -mid-shared-library
9747 Generate code that supports shared libraries via the library ID method.
9748 This allows for execute in place and shared libraries in an environment
9749 without virtual memory management.  This option implies @option{-fPIC}.
9751 @item -mno-id-shared-library
9752 Generate code that doesn't assume ID based shared libraries are being used.
9753 This is the default.
9755 @item -mshared-library-id=n
9756 Specified the identification number of the ID based shared library being
9757 compiled.  Specifying a value of 0 will generate more compact code, specifying
9758 other values will force the allocation of that number to the current
9759 library but is no more space or time efficient than omitting this option.
9761 @end table
9763 @node M68hc1x Options
9764 @subsection M68hc1x Options
9765 @cindex M68hc1x options
9767 These are the @samp{-m} options defined for the 68hc11 and 68hc12
9768 microcontrollers.  The default values for these options depends on
9769 which style of microcontroller was selected when the compiler was configured;
9770 the defaults for the most common choices are given below.
9772 @table @gcctabopt
9773 @item -m6811
9774 @itemx -m68hc11
9775 @opindex m6811
9776 @opindex m68hc11
9777 Generate output for a 68HC11.  This is the default
9778 when the compiler is configured for 68HC11-based systems.
9780 @item -m6812
9781 @itemx -m68hc12
9782 @opindex m6812
9783 @opindex m68hc12
9784 Generate output for a 68HC12.  This is the default
9785 when the compiler is configured for 68HC12-based systems.
9787 @item -m68S12
9788 @itemx -m68hcs12
9789 @opindex m68S12
9790 @opindex m68hcs12
9791 Generate output for a 68HCS12.
9793 @item -mauto-incdec
9794 @opindex mauto-incdec
9795 Enable the use of 68HC12 pre and post auto-increment and auto-decrement
9796 addressing modes.
9798 @item -minmax
9799 @itemx -nominmax
9800 @opindex minmax
9801 @opindex mnominmax
9802 Enable the use of 68HC12 min and max instructions.
9804 @item -mlong-calls
9805 @itemx -mno-long-calls
9806 @opindex mlong-calls
9807 @opindex mno-long-calls
9808 Treat all calls as being far away (near).  If calls are assumed to be
9809 far away, the compiler will use the @code{call} instruction to
9810 call a function and the @code{rtc} instruction for returning.
9812 @item -mshort
9813 @opindex mshort
9814 Consider type @code{int} to be 16 bits wide, like @code{short int}.
9816 @item -msoft-reg-count=@var{count}
9817 @opindex msoft-reg-count
9818 Specify the number of pseudo-soft registers which are used for the
9819 code generation.  The maximum number is 32.  Using more pseudo-soft
9820 register may or may not result in better code depending on the program.
9821 The default is 4 for 68HC11 and 2 for 68HC12.
9823 @end table
9825 @node MCore Options
9826 @subsection MCore Options
9827 @cindex MCore options
9829 These are the @samp{-m} options defined for the Motorola M*Core
9830 processors.
9832 @table @gcctabopt
9834 @item -mhardlit
9835 @itemx -mno-hardlit
9836 @opindex mhardlit
9837 @opindex mno-hardlit
9838 Inline constants into the code stream if it can be done in two
9839 instructions or less.
9841 @item -mdiv
9842 @itemx -mno-div
9843 @opindex mdiv
9844 @opindex mno-div
9845 Use the divide instruction.  (Enabled by default).
9847 @item -mrelax-immediate
9848 @itemx -mno-relax-immediate
9849 @opindex mrelax-immediate
9850 @opindex mno-relax-immediate
9851 Allow arbitrary sized immediates in bit operations.
9853 @item -mwide-bitfields
9854 @itemx -mno-wide-bitfields
9855 @opindex mwide-bitfields
9856 @opindex mno-wide-bitfields
9857 Always treat bit-fields as int-sized.
9859 @item -m4byte-functions
9860 @itemx -mno-4byte-functions
9861 @opindex m4byte-functions
9862 @opindex mno-4byte-functions
9863 Force all functions to be aligned to a four byte boundary.
9865 @item -mcallgraph-data
9866 @itemx -mno-callgraph-data
9867 @opindex mcallgraph-data
9868 @opindex mno-callgraph-data
9869 Emit callgraph information.
9871 @item -mslow-bytes
9872 @itemx -mno-slow-bytes
9873 @opindex mslow-bytes
9874 @opindex mno-slow-bytes
9875 Prefer word access when reading byte quantities.
9877 @item -mlittle-endian
9878 @itemx -mbig-endian
9879 @opindex mlittle-endian
9880 @opindex mbig-endian
9881 Generate code for a little endian target.
9883 @item -m210
9884 @itemx -m340
9885 @opindex m210
9886 @opindex m340
9887 Generate code for the 210 processor.
9888 @end table
9890 @node MIPS Options
9891 @subsection MIPS Options
9892 @cindex MIPS options
9894 @table @gcctabopt
9896 @item -EB
9897 @opindex EB
9898 Generate big-endian code.
9900 @item -EL
9901 @opindex EL
9902 Generate little-endian code.  This is the default for @samp{mips*el-*-*}
9903 configurations.
9905 @item -march=@var{arch}
9906 @opindex march
9907 Generate code that will run on @var{arch}, which can be the name of a
9908 generic MIPS ISA, or the name of a particular processor.
9909 The ISA names are:
9910 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
9911 @samp{mips32}, @samp{mips32r2}, and @samp{mips64}.
9912 The processor names are:
9913 @samp{4kc}, @samp{4kp}, @samp{5kc}, @samp{20kc},
9914 @samp{m4k},
9915 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
9916 @samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000}, @samp{rm7000},
9917 @samp{rm9000},
9918 @samp{orion},
9919 @samp{sb1},
9920 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
9921 @samp{vr5000}, @samp{vr5400} and @samp{vr5500}.
9922 The special value @samp{from-abi} selects the
9923 most compatible architecture for the selected ABI (that is,
9924 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
9926 In processor names, a final @samp{000} can be abbreviated as @samp{k}
9927 (for example, @samp{-march=r2k}).  Prefixes are optional, and
9928 @samp{vr} may be written @samp{r}.
9930 GCC defines two macros based on the value of this option.  The first
9931 is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
9932 a string.  The second has the form @samp{_MIPS_ARCH_@var{foo}},
9933 where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
9934 For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
9935 to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
9937 Note that the @samp{_MIPS_ARCH} macro uses the processor names given
9938 above.  In other words, it will have the full prefix and will not
9939 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
9940 the macro names the resolved architecture (either @samp{"mips1"} or
9941 @samp{"mips3"}).  It names the default architecture when no
9942 @option{-march} option is given.
9944 @item -mtune=@var{arch}
9945 @opindex mtune
9946 Optimize for @var{arch}.  Among other things, this option controls
9947 the way instructions are scheduled, and the perceived cost of arithmetic
9948 operations.  The list of @var{arch} values is the same as for
9949 @option{-march}.
9951 When this option is not used, GCC will optimize for the processor
9952 specified by @option{-march}.  By using @option{-march} and
9953 @option{-mtune} together, it is possible to generate code that will
9954 run on a family of processors, but optimize the code for one
9955 particular member of that family.
9957 @samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
9958 @samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
9959 @samp{-march} ones described above.
9961 @item -mips1
9962 @opindex mips1
9963 Equivalent to @samp{-march=mips1}.
9965 @item -mips2
9966 @opindex mips2
9967 Equivalent to @samp{-march=mips2}.
9969 @item -mips3
9970 @opindex mips3
9971 Equivalent to @samp{-march=mips3}.
9973 @item -mips4
9974 @opindex mips4
9975 Equivalent to @samp{-march=mips4}.
9977 @item -mips32
9978 @opindex mips32
9979 Equivalent to @samp{-march=mips32}.
9981 @item -mips32r2
9982 @opindex mips32r2
9983 Equivalent to @samp{-march=mips32r2}.
9985 @item -mips64
9986 @opindex mips64
9987 Equivalent to @samp{-march=mips64}.
9989 @item -mips16
9990 @itemx -mno-mips16
9991 @opindex mips16
9992 @opindex mno-mips16
9993 Generate (do not generate) MIPS16 code.  If GCC is targetting a
9994 MIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE@.
9996 @item -mabi=32
9997 @itemx -mabi=o64
9998 @itemx -mabi=n32
9999 @itemx -mabi=64
10000 @itemx -mabi=eabi
10001 @opindex mabi=32
10002 @opindex mabi=o64
10003 @opindex mabi=n32
10004 @opindex mabi=64
10005 @opindex mabi=eabi
10006 Generate code for the given ABI@.
10008 Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
10009 generates 64-bit code when you select a 64-bit architecture, but you
10010 can use @option{-mgp32} to get 32-bit code instead.
10012 For information about the O64 ABI, see
10013 @w{@uref{http://gcc.gnu.org/projects/mipso64-abi.html}}.
10015 @item -mabicalls
10016 @itemx -mno-abicalls
10017 @opindex mabicalls
10018 @opindex mno-abicalls
10019 Generate (do not generate) SVR4-style position-independent code.
10020 @option{-mabicalls} is the default for SVR4-based systems.
10022 @item -mxgot
10023 @itemx -mno-xgot
10024 @opindex mxgot
10025 @opindex mno-xgot
10026 Lift (do not lift) the usual restrictions on the size of the global
10027 offset table.
10029 GCC normally uses a single instruction to load values from the GOT@.
10030 While this is relatively efficient, it will only work if the GOT
10031 is smaller than about 64k.  Anything larger will cause the linker
10032 to report an error such as:
10034 @cindex relocation truncated to fit (MIPS)
10035 @smallexample
10036 relocation truncated to fit: R_MIPS_GOT16 foobar
10037 @end smallexample
10039 If this happens, you should recompile your code with @option{-mxgot}.
10040 It should then work with very large GOTs, although it will also be
10041 less efficient, since it will take three instructions to fetch the
10042 value of a global symbol.
10044 Note that some linkers can create multiple GOTs.  If you have such a
10045 linker, you should only need to use @option{-mxgot} when a single object
10046 file accesses more than 64k's worth of GOT entries.  Very few do.
10048 These options have no effect unless GCC is generating position
10049 independent code.
10051 @item -mgp32
10052 @opindex mgp32
10053 Assume that general-purpose registers are 32 bits wide.
10055 @item -mgp64
10056 @opindex mgp64
10057 Assume that general-purpose registers are 64 bits wide.
10059 @item -mfp32
10060 @opindex mfp32
10061 Assume that floating-point registers are 32 bits wide.
10063 @item -mfp64
10064 @opindex mfp64
10065 Assume that floating-point registers are 64 bits wide.
10067 @item -mhard-float
10068 @opindex mhard-float
10069 Use floating-point coprocessor instructions.
10071 @item -msoft-float
10072 @opindex msoft-float
10073 Do not use floating-point coprocessor instructions.  Implement
10074 floating-point calculations using library calls instead.
10076 @item -msingle-float
10077 @opindex msingle-float
10078 Assume that the floating-point coprocessor only supports single-precision
10079 operations.
10081 @itemx -mdouble-float
10082 @opindex mdouble-float
10083 Assume that the floating-point coprocessor supports double-precision
10084 operations.  This is the default.
10086 @itemx -mdsp
10087 @itemx -mno-dsp
10088 @opindex mdsp
10089 @opindex mno-dsp
10090 Use (do not use) the MIPS DSP ASE.  @xref{MIPS DSP Built-in Functions}.
10092 @itemx -mpaired-single
10093 @itemx -mno-paired-single
10094 @opindex mpaired-single
10095 @opindex mno-paired-single
10096 Use (do not use) paired-single floating-point instructions.
10097 @xref{MIPS Paired-Single Support}.  This option can only be used
10098 when generating 64-bit code and requires hardware floating-point
10099 support to be enabled.
10101 @itemx -mips3d
10102 @itemx -mno-mips3d
10103 @opindex mips3d
10104 @opindex mno-mips3d
10105 Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
10106 The option @option{-mips3d} implies @option{-mpaired-single}.
10108 @item -mlong64
10109 @opindex mlong64
10110 Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
10111 an explanation of the default and the way that the pointer size is
10112 determined.
10114 @item -mlong32
10115 @opindex mlong32
10116 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
10118 The default size of @code{int}s, @code{long}s and pointers depends on
10119 the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
10120 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
10121 32-bit @code{long}s.  Pointers are the same size as @code{long}s,
10122 or the same size as integer registers, whichever is smaller.
10124 @item -msym32
10125 @itemx -mno-sym32
10126 @opindex msym32
10127 @opindex mno-sym32
10128 Assume (do not assume) that all symbols have 32-bit values, regardless
10129 of the selected ABI@.  This option is useful in combination with
10130 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
10131 to generate shorter and faster references to symbolic addresses.
10133 @item -G @var{num}
10134 @opindex G
10135 @cindex smaller data references (MIPS)
10136 @cindex gp-relative references (MIPS)
10137 Put global and static items less than or equal to @var{num} bytes into
10138 the small data or bss section instead of the normal data or bss section.
10139 This allows the data to be accessed using a single instruction.
10141 All modules should be compiled with the same @option{-G @var{num}}
10142 value.
10144 @item -membedded-data
10145 @itemx -mno-embedded-data
10146 @opindex membedded-data
10147 @opindex mno-embedded-data
10148 Allocate variables to the read-only data section first if possible, then
10149 next in the small data section if possible, otherwise in data.  This gives
10150 slightly slower code than the default, but reduces the amount of RAM required
10151 when executing, and thus may be preferred for some embedded systems.
10153 @item -muninit-const-in-rodata
10154 @itemx -mno-uninit-const-in-rodata
10155 @opindex muninit-const-in-rodata
10156 @opindex mno-uninit-const-in-rodata
10157 Put uninitialized @code{const} variables in the read-only data section.
10158 This option is only meaningful in conjunction with @option{-membedded-data}.
10160 @item -msplit-addresses
10161 @itemx -mno-split-addresses
10162 @opindex msplit-addresses
10163 @opindex mno-split-addresses
10164 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
10165 relocation operators.  This option has been superseded by
10166 @option{-mexplicit-relocs} but is retained for backwards compatibility.
10168 @item -mexplicit-relocs
10169 @itemx -mno-explicit-relocs
10170 @opindex mexplicit-relocs
10171 @opindex mno-explicit-relocs
10172 Use (do not use) assembler relocation operators when dealing with symbolic
10173 addresses.  The alternative, selected by @option{-mno-explicit-relocs},
10174 is to use assembler macros instead.
10176 @option{-mexplicit-relocs} is the default if GCC was configured
10177 to use an assembler that supports relocation operators.
10179 @item -mcheck-zero-division
10180 @itemx -mno-check-zero-division
10181 @opindex mcheck-zero-division
10182 @opindex mno-check-zero-division
10183 Trap (do not trap) on integer division by zero.  The default is
10184 @option{-mcheck-zero-division}.
10186 @item -mdivide-traps
10187 @itemx -mdivide-breaks
10188 @opindex mdivide-traps
10189 @opindex mdivide-breaks
10190 MIPS systems check for division by zero by generating either a
10191 conditional trap or a break instruction.  Using traps results in
10192 smaller code, but is only supported on MIPS II and later.  Also, some
10193 versions of the Linux kernel have a bug that prevents trap from
10194 generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
10195 allow conditional traps on architectures that support them and
10196 @option{-mdivide-breaks} to force the use of breaks.
10198 The default is usually @option{-mdivide-traps}, but this can be
10199 overridden at configure time using @option{--with-divide=breaks}.
10200 Divide-by-zero checks can be completely disabled using
10201 @option{-mno-check-zero-division}.
10203 @item -mmemcpy
10204 @itemx -mno-memcpy
10205 @opindex mmemcpy
10206 @opindex mno-memcpy
10207 Force (do not force) the use of @code{memcpy()} for non-trivial block
10208 moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
10209 most constant-sized copies.
10211 @item -mlong-calls
10212 @itemx -mno-long-calls
10213 @opindex mlong-calls
10214 @opindex mno-long-calls
10215 Disable (do not disable) use of the @code{jal} instruction.  Calling
10216 functions using @code{jal} is more efficient but requires the caller
10217 and callee to be in the same 256 megabyte segment.
10219 This option has no effect on abicalls code.  The default is
10220 @option{-mno-long-calls}.
10222 @item -mmad
10223 @itemx -mno-mad
10224 @opindex mmad
10225 @opindex mno-mad
10226 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
10227 instructions, as provided by the R4650 ISA@.
10229 @item -mfused-madd
10230 @itemx -mno-fused-madd
10231 @opindex mfused-madd
10232 @opindex mno-fused-madd
10233 Enable (disable) use of the floating point multiply-accumulate
10234 instructions, when they are available.  The default is
10235 @option{-mfused-madd}.
10237 When multiply-accumulate instructions are used, the intermediate
10238 product is calculated to infinite precision and is not subject to
10239 the FCSR Flush to Zero bit.  This may be undesirable in some
10240 circumstances.
10242 @item -nocpp
10243 @opindex nocpp
10244 Tell the MIPS assembler to not run its preprocessor over user
10245 assembler files (with a @samp{.s} suffix) when assembling them.
10247 @item -mfix-r4000
10248 @itemx -mno-fix-r4000
10249 @opindex mfix-r4000
10250 @opindex mno-fix-r4000
10251 Work around certain R4000 CPU errata:
10252 @itemize @minus
10253 @item
10254 A double-word or a variable shift may give an incorrect result if executed
10255 immediately after starting an integer division.
10256 @item
10257 A double-word or a variable shift may give an incorrect result if executed
10258 while an integer multiplication is in progress.
10259 @item
10260 An integer division may give an incorrect result if started in a delay slot
10261 of a taken branch or a jump.
10262 @end itemize
10264 @item -mfix-r4400
10265 @itemx -mno-fix-r4400
10266 @opindex mfix-r4400
10267 @opindex mno-fix-r4400
10268 Work around certain R4400 CPU errata:
10269 @itemize @minus
10270 @item
10271 A double-word or a variable shift may give an incorrect result if executed
10272 immediately after starting an integer division.
10273 @end itemize
10275 @item -mfix-vr4120
10276 @itemx -mno-fix-vr4120
10277 @opindex mfix-vr4120
10278 Work around certain VR4120 errata:
10279 @itemize @minus
10280 @item
10281 @code{dmultu} does not always produce the correct result.
10282 @item
10283 @code{div} and @code{ddiv} do not always produce the correct result if one
10284 of the operands is negative.
10285 @end itemize
10286 The workarounds for the division errata rely on special functions in
10287 @file{libgcc.a}.  At present, these functions are only provided by
10288 the @code{mips64vr*-elf} configurations.
10290 Other VR4120 errata require a nop to be inserted between certain pairs of
10291 instructions.  These errata are handled by the assembler, not by GCC itself.
10293 @item -mfix-vr4130
10294 @opindex mfix-vr4130
10295 Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
10296 workarounds are implemented by the assembler rather than by GCC,
10297 although GCC will avoid using @code{mflo} and @code{mfhi} if the
10298 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
10299 instructions are available instead.
10301 @item -mfix-sb1
10302 @itemx -mno-fix-sb1
10303 @opindex mfix-sb1
10304 Work around certain SB-1 CPU core errata.
10305 (This flag currently works around the SB-1 revision 2
10306 ``F1'' and ``F2'' floating point errata.)
10308 @item -mflush-func=@var{func}
10309 @itemx -mno-flush-func
10310 @opindex mflush-func
10311 Specifies the function to call to flush the I and D caches, or to not
10312 call any such function.  If called, the function must take the same
10313 arguments as the common @code{_flush_func()}, that is, the address of the
10314 memory range for which the cache is being flushed, the size of the
10315 memory range, and the number 3 (to flush both caches).  The default
10316 depends on the target GCC was configured for, but commonly is either
10317 @samp{_flush_func} or @samp{__cpu_flush}.
10319 @item -mbranch-likely
10320 @itemx -mno-branch-likely
10321 @opindex mbranch-likely
10322 @opindex mno-branch-likely
10323 Enable or disable use of Branch Likely instructions, regardless of the
10324 default for the selected architecture.  By default, Branch Likely
10325 instructions may be generated if they are supported by the selected
10326 architecture.  An exception is for the MIPS32 and MIPS64 architectures
10327 and processors which implement those architectures; for those, Branch
10328 Likely instructions will not be generated by default because the MIPS32
10329 and MIPS64 architectures specifically deprecate their use.
10331 @item -mfp-exceptions
10332 @itemx -mno-fp-exceptions
10333 @opindex mfp-exceptions
10334 Specifies whether FP exceptions are enabled.  This affects how we schedule
10335 FP instructions for some processors.  The default is that FP exceptions are
10336 enabled.
10338 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
10339 64-bit code, then we can use both FP pipes.  Otherwise, we can only use one
10340 FP pipe.
10342 @item -mvr4130-align
10343 @itemx -mno-vr4130-align
10344 @opindex mvr4130-align
10345 The VR4130 pipeline is two-way superscalar, but can only issue two
10346 instructions together if the first one is 8-byte aligned.  When this
10347 option is enabled, GCC will align pairs of instructions that it
10348 thinks should execute in parallel.
10350 This option only has an effect when optimizing for the VR4130.
10351 It normally makes code faster, but at the expense of making it bigger.
10352 It is enabled by default at optimization level @option{-O3}.
10353 @end table
10355 @node MMIX Options
10356 @subsection MMIX Options
10357 @cindex MMIX Options
10359 These options are defined for the MMIX:
10361 @table @gcctabopt
10362 @item -mlibfuncs
10363 @itemx -mno-libfuncs
10364 @opindex mlibfuncs
10365 @opindex mno-libfuncs
10366 Specify that intrinsic library functions are being compiled, passing all
10367 values in registers, no matter the size.
10369 @item -mepsilon
10370 @itemx -mno-epsilon
10371 @opindex mepsilon
10372 @opindex mno-epsilon
10373 Generate floating-point comparison instructions that compare with respect
10374 to the @code{rE} epsilon register.
10376 @item -mabi=mmixware
10377 @itemx -mabi=gnu
10378 @opindex mabi-mmixware
10379 @opindex mabi=gnu
10380 Generate code that passes function parameters and return values that (in
10381 the called function) are seen as registers @code{$0} and up, as opposed to
10382 the GNU ABI which uses global registers @code{$231} and up.
10384 @item -mzero-extend
10385 @itemx -mno-zero-extend
10386 @opindex mzero-extend
10387 @opindex mno-zero-extend
10388 When reading data from memory in sizes shorter than 64 bits, use (do not
10389 use) zero-extending load instructions by default, rather than
10390 sign-extending ones.
10392 @item -mknuthdiv
10393 @itemx -mno-knuthdiv
10394 @opindex mknuthdiv
10395 @opindex mno-knuthdiv
10396 Make the result of a division yielding a remainder have the same sign as
10397 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
10398 remainder follows the sign of the dividend.  Both methods are
10399 arithmetically valid, the latter being almost exclusively used.
10401 @item -mtoplevel-symbols
10402 @itemx -mno-toplevel-symbols
10403 @opindex mtoplevel-symbols
10404 @opindex mno-toplevel-symbols
10405 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
10406 code can be used with the @code{PREFIX} assembly directive.
10408 @item -melf
10409 @opindex melf
10410 Generate an executable in the ELF format, rather than the default
10411 @samp{mmo} format used by the @command{mmix} simulator.
10413 @item -mbranch-predict
10414 @itemx -mno-branch-predict
10415 @opindex mbranch-predict
10416 @opindex mno-branch-predict
10417 Use (do not use) the probable-branch instructions, when static branch
10418 prediction indicates a probable branch.
10420 @item -mbase-addresses
10421 @itemx -mno-base-addresses
10422 @opindex mbase-addresses
10423 @opindex mno-base-addresses
10424 Generate (do not generate) code that uses @emph{base addresses}.  Using a
10425 base address automatically generates a request (handled by the assembler
10426 and the linker) for a constant to be set up in a global register.  The
10427 register is used for one or more base address requests within the range 0
10428 to 255 from the value held in the register.  The generally leads to short
10429 and fast code, but the number of different data items that can be
10430 addressed is limited.  This means that a program that uses lots of static
10431 data may require @option{-mno-base-addresses}.
10433 @item -msingle-exit
10434 @itemx -mno-single-exit
10435 @opindex msingle-exit
10436 @opindex mno-single-exit
10437 Force (do not force) generated code to have a single exit point in each
10438 function.
10439 @end table
10441 @node MN10300 Options
10442 @subsection MN10300 Options
10443 @cindex MN10300 options
10445 These @option{-m} options are defined for Matsushita MN10300 architectures:
10447 @table @gcctabopt
10448 @item -mmult-bug
10449 @opindex mmult-bug
10450 Generate code to avoid bugs in the multiply instructions for the MN10300
10451 processors.  This is the default.
10453 @item -mno-mult-bug
10454 @opindex mno-mult-bug
10455 Do not generate code to avoid bugs in the multiply instructions for the
10456 MN10300 processors.
10458 @item -mam33
10459 @opindex mam33
10460 Generate code which uses features specific to the AM33 processor.
10462 @item -mno-am33
10463 @opindex mno-am33
10464 Do not generate code which uses features specific to the AM33 processor.  This
10465 is the default.
10467 @item -mno-crt0
10468 @opindex mno-crt0
10469 Do not link in the C run-time initialization object file.
10471 @item -mrelax
10472 @opindex mrelax
10473 Indicate to the linker that it should perform a relaxation optimization pass
10474 to shorten branches, calls and absolute memory addresses.  This option only
10475 has an effect when used on the command line for the final link step.
10477 This option makes symbolic debugging impossible.
10478 @end table
10480 @node PDP-11 Options
10481 @subsection PDP-11 Options
10482 @cindex PDP-11 Options
10484 These options are defined for the PDP-11:
10486 @table @gcctabopt
10487 @item -mfpu
10488 @opindex mfpu
10489 Use hardware FPP floating point.  This is the default.  (FIS floating
10490 point on the PDP-11/40 is not supported.)
10492 @item -msoft-float
10493 @opindex msoft-float
10494 Do not use hardware floating point.
10496 @item -mac0
10497 @opindex mac0
10498 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
10500 @item -mno-ac0
10501 @opindex mno-ac0
10502 Return floating-point results in memory.  This is the default.
10504 @item -m40
10505 @opindex m40
10506 Generate code for a PDP-11/40.
10508 @item -m45
10509 @opindex m45
10510 Generate code for a PDP-11/45.  This is the default.
10512 @item -m10
10513 @opindex m10
10514 Generate code for a PDP-11/10.
10516 @item -mbcopy-builtin
10517 @opindex bcopy-builtin
10518 Use inline @code{movmemhi} patterns for copying memory.  This is the
10519 default.
10521 @item -mbcopy
10522 @opindex mbcopy
10523 Do not use inline @code{movmemhi} patterns for copying memory.
10525 @item -mint16
10526 @itemx -mno-int32
10527 @opindex mint16
10528 @opindex mno-int32
10529 Use 16-bit @code{int}.  This is the default.
10531 @item -mint32
10532 @itemx -mno-int16
10533 @opindex mint32
10534 @opindex mno-int16
10535 Use 32-bit @code{int}.
10537 @item -mfloat64
10538 @itemx -mno-float32
10539 @opindex mfloat64
10540 @opindex mno-float32
10541 Use 64-bit @code{float}.  This is the default.
10543 @item -mfloat32
10544 @itemx -mno-float64
10545 @opindex mfloat32
10546 @opindex mno-float64
10547 Use 32-bit @code{float}.
10549 @item -mabshi
10550 @opindex mabshi
10551 Use @code{abshi2} pattern.  This is the default.
10553 @item -mno-abshi
10554 @opindex mno-abshi
10555 Do not use @code{abshi2} pattern.
10557 @item -mbranch-expensive
10558 @opindex mbranch-expensive
10559 Pretend that branches are expensive.  This is for experimenting with
10560 code generation only.
10562 @item -mbranch-cheap
10563 @opindex mbranch-cheap
10564 Do not pretend that branches are expensive.  This is the default.
10566 @item -msplit
10567 @opindex msplit
10568 Generate code for a system with split I&D@.
10570 @item -mno-split
10571 @opindex mno-split
10572 Generate code for a system without split I&D@.  This is the default.
10574 @item -munix-asm
10575 @opindex munix-asm
10576 Use Unix assembler syntax.  This is the default when configured for
10577 @samp{pdp11-*-bsd}.
10579 @item -mdec-asm
10580 @opindex mdec-asm
10581 Use DEC assembler syntax.  This is the default when configured for any
10582 PDP-11 target other than @samp{pdp11-*-bsd}.
10583 @end table
10585 @node PowerPC Options
10586 @subsection PowerPC Options
10587 @cindex PowerPC options
10589 These are listed under @xref{RS/6000 and PowerPC Options}.
10591 @node RS/6000 and PowerPC Options
10592 @subsection IBM RS/6000 and PowerPC Options
10593 @cindex RS/6000 and PowerPC Options
10594 @cindex IBM RS/6000 and PowerPC Options
10596 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
10597 @table @gcctabopt
10598 @item -mpower
10599 @itemx -mno-power
10600 @itemx -mpower2
10601 @itemx -mno-power2
10602 @itemx -mpowerpc
10603 @itemx -mno-powerpc
10604 @itemx -mpowerpc-gpopt
10605 @itemx -mno-powerpc-gpopt
10606 @itemx -mpowerpc-gfxopt
10607 @itemx -mno-powerpc-gfxopt
10608 @itemx -mpowerpc64
10609 @itemx -mno-powerpc64
10610 @opindex mpower
10611 @opindex mno-power
10612 @opindex mpower2
10613 @opindex mno-power2
10614 @opindex mpowerpc
10615 @opindex mno-powerpc
10616 @opindex mpowerpc-gpopt
10617 @opindex mno-powerpc-gpopt
10618 @opindex mpowerpc-gfxopt
10619 @opindex mno-powerpc-gfxopt
10620 @opindex mpowerpc64
10621 @opindex mno-powerpc64
10622 GCC supports two related instruction set architectures for the
10623 RS/6000 and PowerPC@.  The @dfn{POWER} instruction set are those
10624 instructions supported by the @samp{rios} chip set used in the original
10625 RS/6000 systems and the @dfn{PowerPC} instruction set is the
10626 architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and
10627 the IBM 4xx microprocessors.
10629 Neither architecture is a subset of the other.  However there is a
10630 large common subset of instructions supported by both.  An MQ
10631 register is included in processors supporting the POWER architecture.
10633 You use these options to specify which instructions are available on the
10634 processor you are using.  The default value of these options is
10635 determined when configuring GCC@.  Specifying the
10636 @option{-mcpu=@var{cpu_type}} overrides the specification of these
10637 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
10638 rather than the options listed above.
10640 The @option{-mpower} option allows GCC to generate instructions that
10641 are found only in the POWER architecture and to use the MQ register.
10642 Specifying @option{-mpower2} implies @option{-power} and also allows GCC
10643 to generate instructions that are present in the POWER2 architecture but
10644 not the original POWER architecture.
10646 The @option{-mpowerpc} option allows GCC to generate instructions that
10647 are found only in the 32-bit subset of the PowerPC architecture.
10648 Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
10649 GCC to use the optional PowerPC architecture instructions in the
10650 General Purpose group, including floating-point square root.  Specifying
10651 @option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
10652 use the optional PowerPC architecture instructions in the Graphics
10653 group, including floating-point select.
10655 The @option{-mpowerpc64} option allows GCC to generate the additional
10656 64-bit instructions that are found in the full PowerPC64 architecture
10657 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
10658 @option{-mno-powerpc64}.
10660 If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
10661 will use only the instructions in the common subset of both
10662 architectures plus some special AIX common-mode calls, and will not use
10663 the MQ register.  Specifying both @option{-mpower} and @option{-mpowerpc}
10664 permits GCC to use any instruction from either architecture and to
10665 allow use of the MQ register; specify this for the Motorola MPC601.
10667 @item -mnew-mnemonics
10668 @itemx -mold-mnemonics
10669 @opindex mnew-mnemonics
10670 @opindex mold-mnemonics
10671 Select which mnemonics to use in the generated assembler code.  With
10672 @option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
10673 the PowerPC architecture.  With @option{-mold-mnemonics} it uses the
10674 assembler mnemonics defined for the POWER architecture.  Instructions
10675 defined in only one architecture have only one mnemonic; GCC uses that
10676 mnemonic irrespective of which of these options is specified.
10678 GCC defaults to the mnemonics appropriate for the architecture in
10679 use.  Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
10680 value of these option.  Unless you are building a cross-compiler, you
10681 should normally not specify either @option{-mnew-mnemonics} or
10682 @option{-mold-mnemonics}, but should instead accept the default.
10684 @item -mcpu=@var{cpu_type}
10685 @opindex mcpu
10686 Set architecture type, register usage, choice of mnemonics, and
10687 instruction scheduling parameters for machine type @var{cpu_type}.
10688 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
10689 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{505},
10690 @samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604},
10691 @samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400},
10692 @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
10693 @samp{860}, @samp{970}, @samp{8540}, @samp{common}, @samp{ec603e}, @samp{G3},
10694 @samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3},
10695 @samp{power4}, @samp{power5}, @samp{powerpc}, @samp{powerpc64},
10696 @samp{rios}, @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}.
10698 @option{-mcpu=common} selects a completely generic processor.  Code
10699 generated under this option will run on any POWER or PowerPC processor.
10700 GCC will use only the instructions in the common subset of both
10701 architectures, and will not use the MQ register.  GCC assumes a generic
10702 processor model for scheduling purposes.
10704 @option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
10705 @option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
10706 PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
10707 types, with an appropriate, generic processor model assumed for
10708 scheduling purposes.
10710 The other options specify a specific processor.  Code generated under
10711 those options will run best on that processor, and may not run at all on
10712 others.
10714 The @option{-mcpu} options automatically enable or disable the
10715 following options: @option{-maltivec}, @option{-mhard-float},
10716 @option{-mmfcrf}, @option{-mmultiple}, @option{-mnew-mnemonics},
10717 @option{-mpower}, @option{-mpower2}, @option{-mpowerpc64},
10718 @option{-mpowerpc-gpopt}, @option{-mpowerpc-gfxopt},
10719 @option{-mstring}.  The particular options set for any particular CPU
10720 will vary between compiler versions, depending on what setting seems
10721 to produce optimal code for that CPU; it doesn't necessarily reflect
10722 the actual hardware's capabilities.  If you wish to set an individual
10723 option to a particular value, you may specify it after the
10724 @option{-mcpu} option, like @samp{-mcpu=970 -mno-altivec}.
10726 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
10727 not enabled or disabled by the @option{-mcpu} option at present, since
10728 AIX does not have full support for these options.  You may still
10729 enable or disable them individually if you're sure it'll work in your
10730 environment.
10732 @item -mtune=@var{cpu_type}
10733 @opindex mtune
10734 Set the instruction scheduling parameters for machine type
10735 @var{cpu_type}, but do not set the architecture type, register usage, or
10736 choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would.  The same
10737 values for @var{cpu_type} are used for @option{-mtune} as for
10738 @option{-mcpu}.  If both are specified, the code generated will use the
10739 architecture, registers, and mnemonics set by @option{-mcpu}, but the
10740 scheduling parameters set by @option{-mtune}.
10742 @item -mswdiv
10743 @itemx -mno-swdiv
10744 @opindex mswdiv
10745 @opindex mno-swdiv
10746 Generate code to compute division as reciprocal estimate and iterative
10747 refinement, creating opportunities for increased throughput.  This
10748 feature requires: optional PowerPC Graphics instruction set for single
10749 precision and FRE instruction for double precision, assuming divides
10750 cannot generate user-visible traps, and the domain values not include
10751 Infinities, denormals or zero denominator.
10753 @item -maltivec
10754 @itemx -mno-altivec
10755 @opindex maltivec
10756 @opindex mno-altivec
10757 Generate code that uses (does not use) AltiVec instructions, and also
10758 enable the use of built-in functions that allow more direct access to
10759 the AltiVec instruction set.  You may also need to set
10760 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
10761 enhancements.
10763 @item -mvrsave
10764 @item -mno-vrsave
10765 @opindex mvrsave
10766 @opindex mno-vrsave
10767 Generate VRSAVE instructions when generating AltiVec code.
10769 @item -mabi=spe
10770 @opindex mabi=spe
10771 Extend the current ABI with SPE ABI extensions.  This does not change
10772 the default ABI, instead it adds the SPE ABI extensions to the current
10773 ABI@.
10775 @item -mabi=no-spe
10776 @opindex mabi=no-spe
10777 Disable Booke SPE ABI extensions for the current ABI@.
10779 @item -msecure-plt
10780 @opindex msecure-plt
10781 Generate code that allows ld and ld.so to build executables and shared
10782 libraries with non-exec .plt and .got sections.  This is a PowerPC
10783 32-bit SYSV ABI option.
10785 @item -mbss-plt
10786 @opindex mbss-plt
10787 Generate code that uses a BSS .plt section that ld.so fills in, and
10788 requires .plt and .got sections that are both writable and executable.
10789 This is a PowerPC 32-bit SYSV ABI option.
10791 @item -misel
10792 @itemx -mno-isel
10793 @opindex misel
10794 @opindex mno-isel
10795 This switch enables or disables the generation of ISEL instructions.
10797 @item -misel=@var{yes/no}
10798 This switch has been deprecated.  Use @option{-misel} and
10799 @option{-mno-isel} instead.
10801 @item -mspe
10802 @itemx -mno-isel
10803 @opindex mspe
10804 @opindex mno-spe
10805 This switch enables or disables the generation of SPE simd
10806 instructions.
10808 @item -mspe=@var{yes/no}
10809 This option has been deprecated.  Use @option{-mspe} and
10810 @option{-mno-spe} instead.
10812 @item -mfloat-gprs=@var{yes/single/double/no}
10813 @itemx -mfloat-gprs
10814 @opindex mfloat-gprs
10815 This switch enables or disables the generation of floating point
10816 operations on the general purpose registers for architectures that
10817 support it.
10819 The argument @var{yes} or @var{single} enables the use of
10820 single-precision floating point operations.
10822 The argument @var{double} enables the use of single and
10823 double-precision floating point operations.
10825 The argument @var{no} disables floating point operations on the
10826 general purpose registers.
10828 This option is currently only available on the MPC854x.
10830 @item -m32
10831 @itemx -m64
10832 @opindex m32
10833 @opindex m64
10834 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
10835 targets (including GNU/Linux).  The 32-bit environment sets int, long
10836 and pointer to 32 bits and generates code that runs on any PowerPC
10837 variant.  The 64-bit environment sets int to 32 bits and long and
10838 pointer to 64 bits, and generates code for PowerPC64, as for
10839 @option{-mpowerpc64}.
10841 @item -mfull-toc
10842 @itemx -mno-fp-in-toc
10843 @itemx -mno-sum-in-toc
10844 @itemx -mminimal-toc
10845 @opindex mfull-toc
10846 @opindex mno-fp-in-toc
10847 @opindex mno-sum-in-toc
10848 @opindex mminimal-toc
10849 Modify generation of the TOC (Table Of Contents), which is created for
10850 every executable file.  The @option{-mfull-toc} option is selected by
10851 default.  In that case, GCC will allocate at least one TOC entry for
10852 each unique non-automatic variable reference in your program.  GCC
10853 will also place floating-point constants in the TOC@.  However, only
10854 16,384 entries are available in the TOC@.
10856 If you receive a linker error message that saying you have overflowed
10857 the available TOC space, you can reduce the amount of TOC space used
10858 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
10859 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
10860 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
10861 generate code to calculate the sum of an address and a constant at
10862 run-time instead of putting that sum into the TOC@.  You may specify one
10863 or both of these options.  Each causes GCC to produce very slightly
10864 slower and larger code at the expense of conserving TOC space.
10866 If you still run out of space in the TOC even when you specify both of
10867 these options, specify @option{-mminimal-toc} instead.  This option causes
10868 GCC to make only one TOC entry for every file.  When you specify this
10869 option, GCC will produce code that is slower and larger but which
10870 uses extremely little TOC space.  You may wish to use this option
10871 only on files that contain less frequently executed code.
10873 @item -maix64
10874 @itemx -maix32
10875 @opindex maix64
10876 @opindex maix32
10877 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
10878 @code{long} type, and the infrastructure needed to support them.
10879 Specifying @option{-maix64} implies @option{-mpowerpc64} and
10880 @option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
10881 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
10883 @item -mxl-compat
10884 @itemx -mno-xl-compat
10885 @opindex mxl-compat
10886 @opindex mno-xl-compat
10887 Produce code that conforms more closely to IBM XLC semantics when using
10888 AIX-compatible ABI.  Pass floating-point arguments to prototyped
10889 functions beyond the register save area (RSA) on the stack in addition
10890 to argument FPRs.  Do not assume that most significant double in 128
10891 bit long double value is properly rounded when comparing values.
10893 The AIX calling convention was extended but not initially documented to
10894 handle an obscure K&R C case of calling a function that takes the
10895 address of its arguments with fewer arguments than declared.  AIX XL
10896 compilers access floating point arguments which do not fit in the
10897 RSA from the stack when a subroutine is compiled without
10898 optimization.  Because always storing floating-point arguments on the
10899 stack is inefficient and rarely needed, this option is not enabled by
10900 default and only is necessary when calling subroutines compiled by AIX
10901 XL compilers without optimization.
10903 @item -mpe
10904 @opindex mpe
10905 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
10906 application written to use message passing with special startup code to
10907 enable the application to run.  The system must have PE installed in the
10908 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
10909 must be overridden with the @option{-specs=} option to specify the
10910 appropriate directory location.  The Parallel Environment does not
10911 support threads, so the @option{-mpe} option and the @option{-pthread}
10912 option are incompatible.
10914 @item -malign-natural
10915 @itemx -malign-power
10916 @opindex malign-natural
10917 @opindex malign-power
10918 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
10919 @option{-malign-natural} overrides the ABI-defined alignment of larger
10920 types, such as floating-point doubles, on their natural size-based boundary.
10921 The option @option{-malign-power} instructs GCC to follow the ABI-specified
10922 alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
10924 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
10925 is not supported.
10927 @item -msoft-float
10928 @itemx -mhard-float
10929 @opindex msoft-float
10930 @opindex mhard-float
10931 Generate code that does not use (uses) the floating-point register set.
10932 Software floating point emulation is provided if you use the
10933 @option{-msoft-float} option, and pass the option to GCC when linking.
10935 @item -mmultiple
10936 @itemx -mno-multiple
10937 @opindex mmultiple
10938 @opindex mno-multiple
10939 Generate code that uses (does not use) the load multiple word
10940 instructions and the store multiple word instructions.  These
10941 instructions are generated by default on POWER systems, and not
10942 generated on PowerPC systems.  Do not use @option{-mmultiple} on little
10943 endian PowerPC systems, since those instructions do not work when the
10944 processor is in little endian mode.  The exceptions are PPC740 and
10945 PPC750 which permit the instructions usage in little endian mode.
10947 @item -mstring
10948 @itemx -mno-string
10949 @opindex mstring
10950 @opindex mno-string
10951 Generate code that uses (does not use) the load string instructions
10952 and the store string word instructions to save multiple registers and
10953 do small block moves.  These instructions are generated by default on
10954 POWER systems, and not generated on PowerPC systems.  Do not use
10955 @option{-mstring} on little endian PowerPC systems, since those
10956 instructions do not work when the processor is in little endian mode.
10957 The exceptions are PPC740 and PPC750 which permit the instructions
10958 usage in little endian mode.
10960 @item -mupdate
10961 @itemx -mno-update
10962 @opindex mupdate
10963 @opindex mno-update
10964 Generate code that uses (does not use) the load or store instructions
10965 that update the base register to the address of the calculated memory
10966 location.  These instructions are generated by default.  If you use
10967 @option{-mno-update}, there is a small window between the time that the
10968 stack pointer is updated and the address of the previous frame is
10969 stored, which means code that walks the stack frame across interrupts or
10970 signals may get corrupted data.
10972 @item -mfused-madd
10973 @itemx -mno-fused-madd
10974 @opindex mfused-madd
10975 @opindex mno-fused-madd
10976 Generate code that uses (does not use) the floating point multiply and
10977 accumulate instructions.  These instructions are generated by default if
10978 hardware floating is used.
10980 @item -mno-bit-align
10981 @itemx -mbit-align
10982 @opindex mno-bit-align
10983 @opindex mbit-align
10984 On System V.4 and embedded PowerPC systems do not (do) force structures
10985 and unions that contain bit-fields to be aligned to the base type of the
10986 bit-field.
10988 For example, by default a structure containing nothing but 8
10989 @code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
10990 boundary and have a size of 4 bytes.  By using @option{-mno-bit-align},
10991 the structure would be aligned to a 1 byte boundary and be one byte in
10992 size.
10994 @item -mno-strict-align
10995 @itemx -mstrict-align
10996 @opindex mno-strict-align
10997 @opindex mstrict-align
10998 On System V.4 and embedded PowerPC systems do not (do) assume that
10999 unaligned memory references will be handled by the system.
11001 @item -mrelocatable
11002 @itemx -mno-relocatable
11003 @opindex mrelocatable
11004 @opindex mno-relocatable
11005 On embedded PowerPC systems generate code that allows (does not allow)
11006 the program to be relocated to a different address at runtime.  If you
11007 use @option{-mrelocatable} on any module, all objects linked together must
11008 be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
11010 @item -mrelocatable-lib
11011 @itemx -mno-relocatable-lib
11012 @opindex mrelocatable-lib
11013 @opindex mno-relocatable-lib
11014 On embedded PowerPC systems generate code that allows (does not allow)
11015 the program to be relocated to a different address at runtime.  Modules
11016 compiled with @option{-mrelocatable-lib} can be linked with either modules
11017 compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
11018 with modules compiled with the @option{-mrelocatable} options.
11020 @item -mno-toc
11021 @itemx -mtoc
11022 @opindex mno-toc
11023 @opindex mtoc
11024 On System V.4 and embedded PowerPC systems do not (do) assume that
11025 register 2 contains a pointer to a global area pointing to the addresses
11026 used in the program.
11028 @item -mlittle
11029 @itemx -mlittle-endian
11030 @opindex mlittle
11031 @opindex mlittle-endian
11032 On System V.4 and embedded PowerPC systems compile code for the
11033 processor in little endian mode.  The @option{-mlittle-endian} option is
11034 the same as @option{-mlittle}.
11036 @item -mbig
11037 @itemx -mbig-endian
11038 @opindex mbig
11039 @opindex mbig-endian
11040 On System V.4 and embedded PowerPC systems compile code for the
11041 processor in big endian mode.  The @option{-mbig-endian} option is
11042 the same as @option{-mbig}.
11044 @item -mdynamic-no-pic
11045 @opindex mdynamic-no-pic
11046 On Darwin and Mac OS X systems, compile code so that it is not
11047 relocatable, but that its external references are relocatable.  The
11048 resulting code is suitable for applications, but not shared
11049 libraries.
11051 @item -mprioritize-restricted-insns=@var{priority}
11052 @opindex mprioritize-restricted-insns
11053 This option controls the priority that is assigned to
11054 dispatch-slot restricted instructions during the second scheduling
11055 pass.  The argument @var{priority} takes the value @var{0/1/2} to assign
11056 @var{no/highest/second-highest} priority to dispatch slot restricted
11057 instructions.
11059 @item -msched-costly-dep=@var{dependence_type}
11060 @opindex msched-costly-dep
11061 This option controls which dependences are considered costly
11062 by the target during instruction scheduling.  The argument
11063 @var{dependence_type} takes one of the following values:
11064 @var{no}: no dependence is costly,
11065 @var{all}: all dependences are costly,
11066 @var{true_store_to_load}: a true dependence from store to load is costly,
11067 @var{store_to_load}: any dependence from store to load is costly,
11068 @var{number}: any dependence which latency >= @var{number} is costly.
11070 @item -minsert-sched-nops=@var{scheme}
11071 @opindex minsert-sched-nops
11072 This option controls which nop insertion scheme will be used during
11073 the second scheduling pass.  The argument @var{scheme} takes one of the
11074 following values:
11075 @var{no}: Don't insert nops.
11076 @var{pad}: Pad with nops any dispatch group which has vacant issue slots,
11077 according to the scheduler's grouping.
11078 @var{regroup_exact}: Insert nops to force costly dependent insns into
11079 separate groups.  Insert exactly as many nops as needed to force an insn
11080 to a new group, according to the estimated processor grouping.
11081 @var{number}: Insert nops to force costly dependent insns into
11082 separate groups.  Insert @var{number} nops to force an insn to a new group.
11084 @item -mcall-sysv
11085 @opindex mcall-sysv
11086 On System V.4 and embedded PowerPC systems compile code using calling
11087 conventions that adheres to the March 1995 draft of the System V
11088 Application Binary Interface, PowerPC processor supplement.  This is the
11089 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
11091 @item -mcall-sysv-eabi
11092 @opindex mcall-sysv-eabi
11093 Specify both @option{-mcall-sysv} and @option{-meabi} options.
11095 @item -mcall-sysv-noeabi
11096 @opindex mcall-sysv-noeabi
11097 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
11099 @item -mcall-solaris
11100 @opindex mcall-solaris
11101 On System V.4 and embedded PowerPC systems compile code for the Solaris
11102 operating system.
11104 @item -mcall-linux
11105 @opindex mcall-linux
11106 On System V.4 and embedded PowerPC systems compile code for the
11107 Linux-based GNU system.
11109 @item -mcall-gnu
11110 @opindex mcall-gnu
11111 On System V.4 and embedded PowerPC systems compile code for the
11112 Hurd-based GNU system.
11114 @item -mcall-netbsd
11115 @opindex mcall-netbsd
11116 On System V.4 and embedded PowerPC systems compile code for the
11117 NetBSD operating system.
11119 @item -maix-struct-return
11120 @opindex maix-struct-return
11121 Return all structures in memory (as specified by the AIX ABI)@.
11123 @item -msvr4-struct-return
11124 @opindex msvr4-struct-return
11125 Return structures smaller than 8 bytes in registers (as specified by the
11126 SVR4 ABI)@.
11128 @item -mabi=@var{abi-type}
11129 @opindex mabi
11130 Extend the current ABI with a particular extension, or remove such extension.
11131 Valid values are @var{altivec}, @var{no-altivec}, @var{spe},
11132 @var{no-spe}@.
11134 @item -mprototype
11135 @itemx -mno-prototype
11136 @opindex mprototype
11137 @opindex mno-prototype
11138 On System V.4 and embedded PowerPC systems assume that all calls to
11139 variable argument functions are properly prototyped.  Otherwise, the
11140 compiler must insert an instruction before every non prototyped call to
11141 set or clear bit 6 of the condition code register (@var{CR}) to
11142 indicate whether floating point values were passed in the floating point
11143 registers in case the function takes a variable arguments.  With
11144 @option{-mprototype}, only calls to prototyped variable argument functions
11145 will set or clear the bit.
11147 @item -msim
11148 @opindex msim
11149 On embedded PowerPC systems, assume that the startup module is called
11150 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
11151 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}.
11152 configurations.
11154 @item -mmvme
11155 @opindex mmvme
11156 On embedded PowerPC systems, assume that the startup module is called
11157 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
11158 @file{libc.a}.
11160 @item -mads
11161 @opindex mads
11162 On embedded PowerPC systems, assume that the startup module is called
11163 @file{crt0.o} and the standard C libraries are @file{libads.a} and
11164 @file{libc.a}.
11166 @item -myellowknife
11167 @opindex myellowknife
11168 On embedded PowerPC systems, assume that the startup module is called
11169 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
11170 @file{libc.a}.
11172 @item -mvxworks
11173 @opindex mvxworks
11174 On System V.4 and embedded PowerPC systems, specify that you are
11175 compiling for a VxWorks system.
11177 @item -mwindiss
11178 @opindex mwindiss
11179 Specify that you are compiling for the WindISS simulation environment.
11181 @item -memb
11182 @opindex memb
11183 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
11184 header to indicate that @samp{eabi} extended relocations are used.
11186 @item -meabi
11187 @itemx -mno-eabi
11188 @opindex meabi
11189 @opindex mno-eabi
11190 On System V.4 and embedded PowerPC systems do (do not) adhere to the
11191 Embedded Applications Binary Interface (eabi) which is a set of
11192 modifications to the System V.4 specifications.  Selecting @option{-meabi}
11193 means that the stack is aligned to an 8 byte boundary, a function
11194 @code{__eabi} is called to from @code{main} to set up the eabi
11195 environment, and the @option{-msdata} option can use both @code{r2} and
11196 @code{r13} to point to two separate small data areas.  Selecting
11197 @option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
11198 do not call an initialization function from @code{main}, and the
11199 @option{-msdata} option will only use @code{r13} to point to a single
11200 small data area.  The @option{-meabi} option is on by default if you
11201 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
11203 @item -msdata=eabi
11204 @opindex msdata=eabi
11205 On System V.4 and embedded PowerPC systems, put small initialized
11206 @code{const} global and static data in the @samp{.sdata2} section, which
11207 is pointed to by register @code{r2}.  Put small initialized
11208 non-@code{const} global and static data in the @samp{.sdata} section,
11209 which is pointed to by register @code{r13}.  Put small uninitialized
11210 global and static data in the @samp{.sbss} section, which is adjacent to
11211 the @samp{.sdata} section.  The @option{-msdata=eabi} option is
11212 incompatible with the @option{-mrelocatable} option.  The
11213 @option{-msdata=eabi} option also sets the @option{-memb} option.
11215 @item -msdata=sysv
11216 @opindex msdata=sysv
11217 On System V.4 and embedded PowerPC systems, put small global and static
11218 data in the @samp{.sdata} section, which is pointed to by register
11219 @code{r13}.  Put small uninitialized global and static data in the
11220 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
11221 The @option{-msdata=sysv} option is incompatible with the
11222 @option{-mrelocatable} option.
11224 @item -msdata=default
11225 @itemx -msdata
11226 @opindex msdata=default
11227 @opindex msdata
11228 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
11229 compile code the same as @option{-msdata=eabi}, otherwise compile code the
11230 same as @option{-msdata=sysv}.
11232 @item -msdata-data
11233 @opindex msdata-data
11234 On System V.4 and embedded PowerPC systems, put small global and static
11235 data in the @samp{.sdata} section.  Put small uninitialized global and
11236 static data in the @samp{.sbss} section.  Do not use register @code{r13}
11237 to address small data however.  This is the default behavior unless
11238 other @option{-msdata} options are used.
11240 @item -msdata=none
11241 @itemx -mno-sdata
11242 @opindex msdata=none
11243 @opindex mno-sdata
11244 On embedded PowerPC systems, put all initialized global and static data
11245 in the @samp{.data} section, and all uninitialized data in the
11246 @samp{.bss} section.
11248 @item -G @var{num}
11249 @opindex G
11250 @cindex smaller data references (PowerPC)
11251 @cindex .sdata/.sdata2 references (PowerPC)
11252 On embedded PowerPC systems, put global and static items less than or
11253 equal to @var{num} bytes into the small data or bss sections instead of
11254 the normal data or bss section.  By default, @var{num} is 8.  The
11255 @option{-G @var{num}} switch is also passed to the linker.
11256 All modules should be compiled with the same @option{-G @var{num}} value.
11258 @item -mregnames
11259 @itemx -mno-regnames
11260 @opindex mregnames
11261 @opindex mno-regnames
11262 On System V.4 and embedded PowerPC systems do (do not) emit register
11263 names in the assembly language output using symbolic forms.
11265 @item -mlongcall
11266 @itemx -mno-longcall
11267 @opindex mlongcall
11268 @opindex mno-longcall
11269 Default to making all function calls indirectly, using a register, so
11270 that functions which reside further than 32 megabytes (33,554,432
11271 bytes) from the current location can be called.  This setting can be
11272 overridden by the @code{shortcall} function attribute, or by
11273 @code{#pragma longcall(0)}.
11275 Some linkers are capable of detecting out-of-range calls and generating
11276 glue code on the fly.  On these systems, long calls are unnecessary and
11277 generate slower code.  As of this writing, the AIX linker can do this,
11278 as can the GNU linker for PowerPC/64.  It is planned to add this feature
11279 to the GNU linker for 32-bit PowerPC systems as well.
11281 On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr
11282 callee, L42'', plus a ``branch island'' (glue code).  The two target
11283 addresses represent the callee and the ``branch island''.  The
11284 Darwin/PPC linker will prefer the first address and generate a ``bl
11285 callee'' if the PPC ``bl'' instruction will reach the callee directly;
11286 otherwise, the linker will generate ``bl L42'' to call the ``branch
11287 island''.  The ``branch island'' is appended to the body of the
11288 calling function; it computes the full 32-bit address of the callee
11289 and jumps to it.
11291 On Mach-O (Darwin) systems, this option directs the compiler emit to
11292 the glue for every direct call, and the Darwin linker decides whether
11293 to use or discard it.
11295 In the future, we may cause GCC to ignore all longcall specifications
11296 when the linker is known to generate glue.
11298 @item -pthread
11299 @opindex pthread
11300 Adds support for multithreading with the @dfn{pthreads} library.
11301 This option sets flags for both the preprocessor and linker.
11303 @end table
11305 @node S/390 and zSeries Options
11306 @subsection S/390 and zSeries Options
11307 @cindex S/390 and zSeries Options
11309 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
11311 @table @gcctabopt
11312 @item -mhard-float
11313 @itemx -msoft-float
11314 @opindex mhard-float
11315 @opindex msoft-float
11316 Use (do not use) the hardware floating-point instructions and registers
11317 for floating-point operations.  When @option{-msoft-float} is specified,
11318 functions in @file{libgcc.a} will be used to perform floating-point
11319 operations.  When @option{-mhard-float} is specified, the compiler
11320 generates IEEE floating-point instructions.  This is the default.
11322 @item -mbackchain
11323 @itemx -mno-backchain
11324 @opindex mbackchain
11325 @opindex mno-backchain
11326 Store (do not store) the address of the caller's frame as backchain pointer
11327 into the callee's stack frame.
11328 A backchain may be needed to allow debugging using tools that do not understand
11329 DWARF-2 call frame information.
11330 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
11331 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
11332 the backchain is placed into the topmost word of the 96/160 byte register
11333 save area.
11335 In general, code compiled with @option{-mbackchain} is call-compatible with
11336 code compiled with @option{-mmo-backchain}; however, use of the backchain
11337 for debugging purposes usually requires that the whole binary is built with
11338 @option{-mbackchain}.  Note that the combination of @option{-mbackchain},
11339 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
11340 to build a linux kernel use @option{-msoft-float}.
11342 The default is to not maintain the backchain.
11344 @item -mpacked-stack
11345 @item -mno-packed-stack
11346 @opindex mpacked-stack
11347 @opindex mno-packed-stack
11348 Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
11349 specified, the compiler uses the all fields of the 96/160 byte register save
11350 area only for their default purpose; unused fields still take up stack space.
11351 When @option{-mpacked-stack} is specified, register save slots are densely
11352 packed at the top of the register save area; unused space is reused for other
11353 purposes, allowing for more efficient use of the available stack space.
11354 However, when @option{-mbackchain} is also in effect, the topmost word of
11355 the save area is always used to store the backchain, and the return address
11356 register is always saved two words below the backchain.
11358 As long as the stack frame backchain is not used, code generated with
11359 @option{-mpacked-stack} is call-compatible with code generated with
11360 @option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
11361 S/390 or zSeries generated code that uses the stack frame backchain at run
11362 time, not just for debugging purposes.  Such code is not call-compatible
11363 with code compiled with @option{-mpacked-stack}.  Also, note that the
11364 combination of @option{-mbackchain},
11365 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
11366 to build a linux kernel use @option{-msoft-float}.
11368 The default is to not use the packed stack layout.
11370 @item -msmall-exec
11371 @itemx -mno-small-exec
11372 @opindex msmall-exec
11373 @opindex mno-small-exec
11374 Generate (or do not generate) code using the @code{bras} instruction
11375 to do subroutine calls.
11376 This only works reliably if the total executable size does not
11377 exceed 64k.  The default is to use the @code{basr} instruction instead,
11378 which does not have this limitation.
11380 @item -m64
11381 @itemx -m31
11382 @opindex m64
11383 @opindex m31
11384 When @option{-m31} is specified, generate code compliant to the
11385 GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
11386 code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
11387 particular to generate 64-bit instructions.  For the @samp{s390}
11388 targets, the default is @option{-m31}, while the @samp{s390x}
11389 targets default to @option{-m64}.
11391 @item -mzarch
11392 @itemx -mesa
11393 @opindex mzarch
11394 @opindex mesa
11395 When @option{-mzarch} is specified, generate code using the
11396 instructions available on z/Architecture.
11397 When @option{-mesa} is specified, generate code using the
11398 instructions available on ESA/390.  Note that @option{-mesa} is
11399 not possible with @option{-m64}.
11400 When generating code compliant to the GNU/Linux for S/390 ABI,
11401 the default is @option{-mesa}.  When generating code compliant
11402 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
11404 @item -mmvcle
11405 @itemx -mno-mvcle
11406 @opindex mmvcle
11407 @opindex mno-mvcle
11408 Generate (or do not generate) code using the @code{mvcle} instruction
11409 to perform block moves.  When @option{-mno-mvcle} is specified,
11410 use a @code{mvc} loop instead.  This is the default unless optimizing for
11411 size.
11413 @item -mdebug
11414 @itemx -mno-debug
11415 @opindex mdebug
11416 @opindex mno-debug
11417 Print (or do not print) additional debug information when compiling.
11418 The default is to not print debug information.
11420 @item -march=@var{cpu-type}
11421 @opindex march
11422 Generate code that will run on @var{cpu-type}, which is the name of a system
11423 representing a certain processor type.  Possible values for
11424 @var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}.
11425 When generating code using the instructions available on z/Architecture,
11426 the default is @option{-march=z900}.  Otherwise, the default is
11427 @option{-march=g5}.
11429 @item -mtune=@var{cpu-type}
11430 @opindex mtune
11431 Tune to @var{cpu-type} everything applicable about the generated code,
11432 except for the ABI and the set of available instructions.
11433 The list of @var{cpu-type} values is the same as for @option{-march}.
11434 The default is the value used for @option{-march}.
11436 @item -mtpf-trace
11437 @itemx -mno-tpf-trace
11438 @opindex mtpf-trace
11439 @opindex mno-tpf-trace
11440 Generate code that adds (does not add) in TPF OS specific branches to trace
11441 routines in the operating system.  This option is off by default, even
11442 when compiling for the TPF OS@.
11444 @item -mfused-madd
11445 @itemx -mno-fused-madd
11446 @opindex mfused-madd
11447 @opindex mno-fused-madd
11448 Generate code that uses (does not use) the floating point multiply and
11449 accumulate instructions.  These instructions are generated by default if
11450 hardware floating point is used.
11452 @item -mwarn-framesize=@var{framesize}
11453 @opindex mwarn-framesize
11454 Emit a warning if the current function exceeds the given frame size.  Because
11455 this is a compile time check it doesn't need to be a real problem when the program
11456 runs.  It is intended to identify functions which most probably cause
11457 a stack overflow.  It is useful to be used in an environment with limited stack
11458 size e.g.@: the linux kernel.
11460 @item -mwarn-dynamicstack
11461 @opindex mwarn-dynamicstack
11462 Emit a warning if the function calls alloca or uses dynamically
11463 sized arrays.  This is generally a bad idea with a limited stack size.
11465 @item -mstack-guard=@var{stack-guard}
11466 @item -mstack-size=@var{stack-size}
11467 @opindex mstack-guard
11468 @opindex mstack-size
11469 These arguments always have to be used in conjunction.  If they are present the s390
11470 back end emits additional instructions in the function prologue which trigger a trap
11471 if the stack size is @var{stack-guard} bytes above the @var{stack-size}
11472 (remember that the stack on s390 grows downward).  These options are intended to
11473 be used to help debugging stack overflow problems.  The additionally emitted code
11474 cause only little overhead and hence can also be used in production like systems
11475 without greater performance degradation.  The given values have to be exact
11476 powers of 2 and @var{stack-size} has to be greater than @var{stack-guard}.
11477 In order to be efficient the extra code makes the assumption that the stack starts
11478 at an address aligned to the value given by @var{stack-size}.
11479 @end table
11481 @node SH Options
11482 @subsection SH Options
11484 These @samp{-m} options are defined for the SH implementations:
11486 @table @gcctabopt
11487 @item -m1
11488 @opindex m1
11489 Generate code for the SH1.
11491 @item -m2
11492 @opindex m2
11493 Generate code for the SH2.
11495 @item -m2e
11496 Generate code for the SH2e.
11498 @item -m3
11499 @opindex m3
11500 Generate code for the SH3.
11502 @item -m3e
11503 @opindex m3e
11504 Generate code for the SH3e.
11506 @item -m4-nofpu
11507 @opindex m4-nofpu
11508 Generate code for the SH4 without a floating-point unit.
11510 @item -m4-single-only
11511 @opindex m4-single-only
11512 Generate code for the SH4 with a floating-point unit that only
11513 supports single-precision arithmetic.
11515 @item -m4-single
11516 @opindex m4-single
11517 Generate code for the SH4 assuming the floating-point unit is in
11518 single-precision mode by default.
11520 @item -m4
11521 @opindex m4
11522 Generate code for the SH4.
11524 @item -m4a-nofpu
11525 @opindex m4a-nofpu
11526 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
11527 floating-point unit is not used.
11529 @item -m4a-single-only
11530 @opindex m4a-single-only
11531 Generate code for the SH4a, in such a way that no double-precision
11532 floating point operations are used.
11534 @item -m4a-single
11535 @opindex m4a-single
11536 Generate code for the SH4a assuming the floating-point unit is in
11537 single-precision mode by default.
11539 @item -m4a
11540 @opindex m4a
11541 Generate code for the SH4a.
11543 @item -m4al
11544 @opindex m4al
11545 Same as @option{-m4a-nofpu}, except that it implicitly passes
11546 @option{-dsp} to the assembler.  GCC doesn't generate any DSP
11547 instructions at the moment.
11549 @item -mb
11550 @opindex mb
11551 Compile code for the processor in big endian mode.
11553 @item -ml
11554 @opindex ml
11555 Compile code for the processor in little endian mode.
11557 @item -mdalign
11558 @opindex mdalign
11559 Align doubles at 64-bit boundaries.  Note that this changes the calling
11560 conventions, and thus some functions from the standard C library will
11561 not work unless you recompile it first with @option{-mdalign}.
11563 @item -mrelax
11564 @opindex mrelax
11565 Shorten some address references at link time, when possible; uses the
11566 linker option @option{-relax}.
11568 @item -mbigtable
11569 @opindex mbigtable
11570 Use 32-bit offsets in @code{switch} tables.  The default is to use
11571 16-bit offsets.
11573 @item -mfmovd
11574 @opindex mfmovd
11575 Enable the use of the instruction @code{fmovd}.
11577 @item -mhitachi
11578 @opindex mhitachi
11579 Comply with the calling conventions defined by Renesas.
11581 @item -mrenesas
11582 @opindex mhitachi
11583 Comply with the calling conventions defined by Renesas.
11585 @item -mno-renesas
11586 @opindex mhitachi
11587 Comply with the calling conventions defined for GCC before the Renesas
11588 conventions were available.  This option is the default for all
11589 targets of the SH toolchain except for @samp{sh-symbianelf}.
11591 @item -mnomacsave
11592 @opindex mnomacsave
11593 Mark the @code{MAC} register as call-clobbered, even if
11594 @option{-mhitachi} is given.
11596 @item -mieee
11597 @opindex mieee
11598 Increase IEEE-compliance of floating-point code.
11599 At the moment, this is equivalent to @option{-fno-finite-math-only}.
11600 When generating 16 bit SH opcodes, getting IEEE-conforming results for
11601 comparisons of NANs / infinities incurs extra overhead in every
11602 floating point comparison, therefore the default is set to
11603 @option{-ffinite-math-only}.
11605 @item -misize
11606 @opindex misize
11607 Dump instruction size and location in the assembly code.
11609 @item -mpadstruct
11610 @opindex mpadstruct
11611 This option is deprecated.  It pads structures to multiple of 4 bytes,
11612 which is incompatible with the SH ABI@.
11614 @item -mspace
11615 @opindex mspace
11616 Optimize for space instead of speed.  Implied by @option{-Os}.
11618 @item -mprefergot
11619 @opindex mprefergot
11620 When generating position-independent code, emit function calls using
11621 the Global Offset Table instead of the Procedure Linkage Table.
11623 @item -musermode
11624 @opindex musermode
11625 Generate a library function call to invalidate instruction cache
11626 entries, after fixing up a trampoline.  This library function call
11627 doesn't assume it can write to the whole memory address space.  This
11628 is the default when the target is @code{sh-*-linux*}.
11630 @item -multcost=@var{number}
11631 @opindex multcost=@var{number}
11632 Set the cost to assume for a multiply insn.
11634 @item -mdiv=@var{strategy}
11635 @opindex mdiv=@var{strategy}
11636 Set the division strategy to use for SHmedia code.  @var{strategy} must be
11637 one of: call, call2, fp, inv, inv:minlat, inv20u, inv20l, inv:call,
11638 inv:call2, inv:fp .
11639 "fp" performs the operation in floating point.  This has a very high latency,
11640 but needs only a few instructions, so it might be a good choice if
11641 your code has enough easily exploitable ILP to allow the compiler to
11642 schedule the floating point instructions together with other instructions.
11643 Division by zero causes a floating point exception.
11644 "inv" uses integer operations to calculate the inverse of the divisor,
11645 and then multiplies the dividend with the inverse.  This strategy allows
11646 cse and hoisting of the inverse calculation.  Division by zero calculates
11647 an unspecified result, but does not trap.
11648 "inv:minlat" is a variant of "inv" where if no cse / hoisting opportunities
11649 have been found, or if the entire operation has been hoisted to the same
11650 place, the last stages of the inverse calculation are intertwined with the
11651 final multiply to reduce the overall latency, at the expense of using a few
11652 more instructions, and thus offering fewer scheduling opportunities with
11653 other code.
11654 "call" calls a library function that usually implements the inv:minlat
11655 strategy.
11656 This gives high code density for m5-*media-nofpu compilations.
11657 "call2" uses a different entry point of the same library function, where it
11658 assumes that a pointer to a lookup table has already been set up, which
11659 exposes the pointer load to cse / code hoisting optimizations.
11660 "inv:call", "inv:call2" and "inv:fp" all use the "inv" algorithm for initial
11661 code generation, but if the code stays unoptimized, revert to the "call",
11662 "call2", or "fp" strategies, respectively.  Note that the
11663 potentially-trapping side effect of division by zero is carried by a
11664 separate instruction, so it is possible that all the integer instructions
11665 are hoisted out, but the marker for the side effect stays where it is.
11666 A recombination to fp operations or a call is not possible in that case.
11667 "inv20u" and "inv20l" are variants of the "inv:minlat" strategy.  In the case
11668 that the inverse calculation was nor separated from the multiply, they speed
11669 up division where the dividend fits into 20 bits (plus sign where applicable),
11670 by inserting a test to skip a number of operations in this case; this test
11671 slows down the case of larger dividends.  inv20u assumes the case of a such
11672 a small dividend to be unlikely, and inv20l assumes it to be likely.
11674 @item -mdivsi3_libfunc=@var{name}
11675 @opindex mdivsi3_libfunc=@var{name}
11676 Set the name of the library function used for 32 bit signed division to
11677 @var{name}.  This only affect the name used in the call and inv:call
11678 division strategies, and the compiler will still expect the same
11679 sets of input/output/clobbered registers as if this option was not present.
11681 @item -madjust-unroll
11682 @opindex madjust-unroll
11683 Throttle unrolling to avoid thrashing target registers.
11684 This option only has an effect if the gcc code base supports the
11685 TARGET_ADJUST_UNROLL_MAX target hook.
11687 @item -mindexed-addressing
11688 @opindex mindexed-addressing
11689 Enable the use of the indexed addressing mode for SHmedia32/SHcompact.
11690 This is only safe if the hardware and/or OS implement 32 bit wrap-around
11691 semantics for the indexed addressing mode.  The architecture allows the
11692 implementation of processors with 64 bit MMU, which the OS could use to
11693 get 32 bit addressing, but since no current hardware implementation supports
11694 this or any other way to make the indexed addressing mode safe to use in
11695 the 32 bit ABI, the default is -mno-indexed-addressing.
11697 @item -mgettrcost=@var{number}
11698 @opindex mgettrcost=@var{number}
11699 Set the cost assumed for the gettr instruction to @var{number}.
11700 The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise.
11702 @item -mpt-fixed
11703 @opindex mpt-fixed
11704 Assume pt* instructions won't trap.  This will generally generate better
11705 scheduled code, but is unsafe on current hardware.  The current architecture
11706 definition says that ptabs and ptrel trap when the target anded with 3 is 3.
11707 This has the unintentional effect of making it unsafe to schedule ptabs /
11708 ptrel before a branch, or hoist it out of a loop.  For example,
11709 __do_global_ctors, a part of libgcc that runs constructors at program
11710 startup, calls functions in a list which is delimited by -1.  With the
11711 -mpt-fixed option, the ptabs will be done before testing against -1.
11712 That means that all the constructors will be run a bit quicker, but when
11713 the loop comes to the end of the list, the program crashes because ptabs
11714 loads -1 into a target register.  Since this option is unsafe for any
11715 hardware implementing the current architecture specification, the default
11716 is -mno-pt-fixed.  Unless the user specifies a specific cost with
11717 @option{-mgettrcost}, -mno-pt-fixed also implies @option{-mgettrcost=100};
11718 this deters register allocation using target registers for storing
11719 ordinary integers.
11721 @item -minvalid-symbols
11722 @opindex minvalid-symbols
11723 Assume symbols might be invalid.  Ordinary function symbols generated by
11724 the compiler will always be valid to load with movi/shori/ptabs or
11725 movi/shori/ptrel, but with assembler and/or linker tricks it is possible
11726 to generate symbols that will cause ptabs / ptrel to trap.
11727 This option is only meaningful when @option{-mno-pt-fixed} is in effect.
11728 It will then prevent cross-basic-block cse, hoisting and most scheduling
11729 of symbol loads.  The default is @option{-mno-invalid-symbols}.
11730 @end table
11732 @node SPARC Options
11733 @subsection SPARC Options
11734 @cindex SPARC options
11736 These @samp{-m} options are supported on the SPARC:
11738 @table @gcctabopt
11739 @item -mno-app-regs
11740 @itemx -mapp-regs
11741 @opindex mno-app-regs
11742 @opindex mapp-regs
11743 Specify @option{-mapp-regs} to generate output using the global registers
11744 2 through 4, which the SPARC SVR4 ABI reserves for applications.  This
11745 is the default.
11747 To be fully SVR4 ABI compliant at the cost of some performance loss,
11748 specify @option{-mno-app-regs}.  You should compile libraries and system
11749 software with this option.
11751 @item -mfpu
11752 @itemx -mhard-float
11753 @opindex mfpu
11754 @opindex mhard-float
11755 Generate output containing floating point instructions.  This is the
11756 default.
11758 @item -mno-fpu
11759 @itemx -msoft-float
11760 @opindex mno-fpu
11761 @opindex msoft-float
11762 Generate output containing library calls for floating point.
11763 @strong{Warning:} the requisite libraries are not available for all SPARC
11764 targets.  Normally the facilities of the machine's usual C compiler are
11765 used, but this cannot be done directly in cross-compilation.  You must make
11766 your own arrangements to provide suitable library functions for
11767 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
11768 @samp{sparclite-*-*} do provide software floating point support.
11770 @option{-msoft-float} changes the calling convention in the output file;
11771 therefore, it is only useful if you compile @emph{all} of a program with
11772 this option.  In particular, you need to compile @file{libgcc.a}, the
11773 library that comes with GCC, with @option{-msoft-float} in order for
11774 this to work.
11776 @item -mhard-quad-float
11777 @opindex mhard-quad-float
11778 Generate output containing quad-word (long double) floating point
11779 instructions.
11781 @item -msoft-quad-float
11782 @opindex msoft-quad-float
11783 Generate output containing library calls for quad-word (long double)
11784 floating point instructions.  The functions called are those specified
11785 in the SPARC ABI@.  This is the default.
11787 As of this writing, there are no SPARC implementations that have hardware
11788 support for the quad-word floating point instructions.  They all invoke
11789 a trap handler for one of these instructions, and then the trap handler
11790 emulates the effect of the instruction.  Because of the trap handler overhead,
11791 this is much slower than calling the ABI library routines.  Thus the
11792 @option{-msoft-quad-float} option is the default.
11794 @item -mno-unaligned-doubles
11795 @itemx -munaligned-doubles
11796 @opindex mno-unaligned-doubles
11797 @opindex munaligned-doubles
11798 Assume that doubles have 8 byte alignment.  This is the default.
11800 With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
11801 alignment only if they are contained in another type, or if they have an
11802 absolute address.  Otherwise, it assumes they have 4 byte alignment.
11803 Specifying this option avoids some rare compatibility problems with code
11804 generated by other compilers.  It is not the default because it results
11805 in a performance loss, especially for floating point code.
11807 @item -mno-faster-structs
11808 @itemx -mfaster-structs
11809 @opindex mno-faster-structs
11810 @opindex mfaster-structs
11811 With @option{-mfaster-structs}, the compiler assumes that structures
11812 should have 8 byte alignment.  This enables the use of pairs of
11813 @code{ldd} and @code{std} instructions for copies in structure
11814 assignment, in place of twice as many @code{ld} and @code{st} pairs.
11815 However, the use of this changed alignment directly violates the SPARC
11816 ABI@.  Thus, it's intended only for use on targets where the developer
11817 acknowledges that their resulting code will not be directly in line with
11818 the rules of the ABI@.
11820 @item -mimpure-text
11821 @opindex mimpure-text
11822 @option{-mimpure-text}, used in addition to @option{-shared}, tells
11823 the compiler to not pass @option{-z text} to the linker when linking a
11824 shared object.  Using this option, you can link position-dependent
11825 code into a shared object.
11827 @option{-mimpure-text} suppresses the ``relocations remain against
11828 allocatable but non-writable sections'' linker error message.
11829 However, the necessary relocations will trigger copy-on-write, and the
11830 shared object is not actually shared across processes.  Instead of
11831 using @option{-mimpure-text}, you should compile all source code with
11832 @option{-fpic} or @option{-fPIC}.
11834 This option is only available on SunOS and Solaris.
11836 @item -mcpu=@var{cpu_type}
11837 @opindex mcpu
11838 Set the instruction set, register set, and instruction scheduling parameters
11839 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
11840 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
11841 @samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x},
11842 @samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc}, and
11843 @samp{ultrasparc3}.
11845 Default instruction scheduling parameters are used for values that select
11846 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
11847 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
11849 Here is a list of each supported architecture and their supported
11850 implementations.
11852 @smallexample
11853     v7:             cypress
11854     v8:             supersparc, hypersparc
11855     sparclite:      f930, f934, sparclite86x
11856     sparclet:       tsc701
11857     v9:             ultrasparc, ultrasparc3
11858 @end smallexample
11860 By default (unless configured otherwise), GCC generates code for the V7
11861 variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
11862 additionally optimizes it for the Cypress CY7C602 chip, as used in the
11863 SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
11864 SPARCStation 1, 2, IPX etc.
11866 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
11867 architecture.  The only difference from V7 code is that the compiler emits
11868 the integer multiply and integer divide instructions which exist in SPARC-V8
11869 but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
11870 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
11871 2000 series.
11873 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
11874 the SPARC architecture.  This adds the integer multiply, integer divide step
11875 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
11876 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
11877 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
11878 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
11879 MB86934 chip, which is the more recent SPARClite with FPU@.
11881 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
11882 the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
11883 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
11884 but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
11885 optimizes it for the TEMIC SPARClet chip.
11887 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
11888 architecture.  This adds 64-bit integer and floating-point move instructions,
11889 3 additional floating-point condition code registers and conditional move
11890 instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
11891 optimizes it for the Sun UltraSPARC I/II chips.  With
11892 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
11893 Sun UltraSPARC III chip.
11895 @item -mtune=@var{cpu_type}
11896 @opindex mtune
11897 Set the instruction scheduling parameters for machine type
11898 @var{cpu_type}, but do not set the instruction set or register set that the
11899 option @option{-mcpu=@var{cpu_type}} would.
11901 The same values for @option{-mcpu=@var{cpu_type}} can be used for
11902 @option{-mtune=@var{cpu_type}}, but the only useful values are those
11903 that select a particular cpu implementation.  Those are @samp{cypress},
11904 @samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
11905 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, and
11906 @samp{ultrasparc3}.
11908 @item -mv8plus
11909 @itemx -mno-v8plus
11910 @opindex mv8plus
11911 @opindex mno-v8plus
11912 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
11913 difference from the V8 ABI is that the global and out registers are
11914 considered 64-bit wide.  This is enabled by default on Solaris in 32-bit
11915 mode for all SPARC-V9 processors.
11917 @item -mvis
11918 @itemx -mno-vis
11919 @opindex mvis
11920 @opindex mno-vis
11921 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
11922 Visual Instruction Set extensions.  The default is @option{-mno-vis}.
11923 @end table
11925 These @samp{-m} options are supported in addition to the above
11926 on SPARC-V9 processors in 64-bit environments:
11928 @table @gcctabopt
11929 @item -mlittle-endian
11930 @opindex mlittle-endian
11931 Generate code for a processor running in little-endian mode.  It is only
11932 available for a few configurations and most notably not on Solaris and Linux.
11934 @item -m32
11935 @itemx -m64
11936 @opindex m32
11937 @opindex m64
11938 Generate code for a 32-bit or 64-bit environment.
11939 The 32-bit environment sets int, long and pointer to 32 bits.
11940 The 64-bit environment sets int to 32 bits and long and pointer
11941 to 64 bits.
11943 @item -mcmodel=medlow
11944 @opindex mcmodel=medlow
11945 Generate code for the Medium/Low code model: 64-bit addresses, programs
11946 must be linked in the low 32 bits of memory.  Programs can be statically
11947 or dynamically linked.
11949 @item -mcmodel=medmid
11950 @opindex mcmodel=medmid
11951 Generate code for the Medium/Middle code model: 64-bit addresses, programs
11952 must be linked in the low 44 bits of memory, the text and data segments must
11953 be less than 2GB in size and the data segment must be located within 2GB of
11954 the text segment.
11956 @item -mcmodel=medany
11957 @opindex mcmodel=medany
11958 Generate code for the Medium/Anywhere code model: 64-bit addresses, programs
11959 may be linked anywhere in memory, the text and data segments must be less
11960 than 2GB in size and the data segment must be located within 2GB of the
11961 text segment.
11963 @item -mcmodel=embmedany
11964 @opindex mcmodel=embmedany
11965 Generate code for the Medium/Anywhere code model for embedded systems:
11966 64-bit addresses, the text and data segments must be less than 2GB in
11967 size, both starting anywhere in memory (determined at link time).  The
11968 global register %g4 points to the base of the data segment.  Programs
11969 are statically linked and PIC is not supported.
11971 @item -mstack-bias
11972 @itemx -mno-stack-bias
11973 @opindex mstack-bias
11974 @opindex mno-stack-bias
11975 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
11976 frame pointer if present, are offset by @minus{}2047 which must be added back
11977 when making stack frame references.  This is the default in 64-bit mode.
11978 Otherwise, assume no such offset is present.
11979 @end table
11981 These switches are supported in addition to the above on Solaris:
11983 @table @gcctabopt
11984 @item -threads
11985 @opindex threads
11986 Add support for multithreading using the Solaris threads library.  This
11987 option sets flags for both the preprocessor and linker.  This option does
11988 not affect the thread safety of object code produced by the compiler or
11989 that of libraries supplied with it.
11991 @item -pthreads
11992 @opindex pthreads
11993 Add support for multithreading using the POSIX threads library.  This
11994 option sets flags for both the preprocessor and linker.  This option does
11995 not affect the thread safety of object code produced  by the compiler or
11996 that of libraries supplied with it.
11997 @end table
11999 @node System V Options
12000 @subsection Options for System V
12002 These additional options are available on System V Release 4 for
12003 compatibility with other compilers on those systems:
12005 @table @gcctabopt
12006 @item -G
12007 @opindex G
12008 Create a shared object.
12009 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
12011 @item -Qy
12012 @opindex Qy
12013 Identify the versions of each tool used by the compiler, in a
12014 @code{.ident} assembler directive in the output.
12016 @item -Qn
12017 @opindex Qn
12018 Refrain from adding @code{.ident} directives to the output file (this is
12019 the default).
12021 @item -YP,@var{dirs}
12022 @opindex YP
12023 Search the directories @var{dirs}, and no others, for libraries
12024 specified with @option{-l}.
12026 @item -Ym,@var{dir}
12027 @opindex Ym
12028 Look in the directory @var{dir} to find the M4 preprocessor.
12029 The assembler uses this option.
12030 @c This is supposed to go with a -Yd for predefined M4 macro files, but
12031 @c the generic assembler that comes with Solaris takes just -Ym.
12032 @end table
12034 @node TMS320C3x/C4x Options
12035 @subsection TMS320C3x/C4x Options
12036 @cindex TMS320C3x/C4x Options
12038 These @samp{-m} options are defined for TMS320C3x/C4x implementations:
12040 @table @gcctabopt
12042 @item -mcpu=@var{cpu_type}
12043 @opindex mcpu
12044 Set the instruction set, register set, and instruction scheduling
12045 parameters for machine type @var{cpu_type}.  Supported values for
12046 @var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
12047 @samp{c44}.  The default is @samp{c40} to generate code for the
12048 TMS320C40.
12050 @item -mbig-memory
12051 @itemx -mbig
12052 @itemx -msmall-memory
12053 @itemx -msmall
12054 @opindex mbig-memory
12055 @opindex mbig
12056 @opindex msmall-memory
12057 @opindex msmall
12058 Generates code for the big or small memory model.  The small memory
12059 model assumed that all data fits into one 64K word page.  At run-time
12060 the data page (DP) register must be set to point to the 64K page
12061 containing the .bss and .data program sections.  The big memory model is
12062 the default and requires reloading of the DP register for every direct
12063 memory access.
12065 @item -mbk
12066 @itemx -mno-bk
12067 @opindex mbk
12068 @opindex mno-bk
12069 Allow (disallow) allocation of general integer operands into the block
12070 count register BK@.
12072 @item -mdb
12073 @itemx -mno-db
12074 @opindex mdb
12075 @opindex mno-db
12076 Enable (disable) generation of code using decrement and branch,
12077 DBcond(D), instructions.  This is enabled by default for the C4x.  To be
12078 on the safe side, this is disabled for the C3x, since the maximum
12079 iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than
12080 @math{2^{23}} times on the C3x?).  Note that GCC will try to reverse a loop so
12081 that it can utilize the decrement and branch instruction, but will give
12082 up if there is more than one memory reference in the loop.  Thus a loop
12083 where the loop counter is decremented can generate slightly more
12084 efficient code, in cases where the RPTB instruction cannot be utilized.
12086 @item -mdp-isr-reload
12087 @itemx -mparanoid
12088 @opindex mdp-isr-reload
12089 @opindex mparanoid
12090 Force the DP register to be saved on entry to an interrupt service
12091 routine (ISR), reloaded to point to the data section, and restored on
12092 exit from the ISR@.  This should not be required unless someone has
12093 violated the small memory model by modifying the DP register, say within
12094 an object library.
12096 @item -mmpyi
12097 @itemx -mno-mpyi
12098 @opindex mmpyi
12099 @opindex mno-mpyi
12100 For the C3x use the 24-bit MPYI instruction for integer multiplies
12101 instead of a library call to guarantee 32-bit results.  Note that if one
12102 of the operands is a constant, then the multiplication will be performed
12103 using shifts and adds.  If the @option{-mmpyi} option is not specified for the C3x,
12104 then squaring operations are performed inline instead of a library call.
12106 @item -mfast-fix
12107 @itemx -mno-fast-fix
12108 @opindex mfast-fix
12109 @opindex mno-fast-fix
12110 The C3x/C4x FIX instruction to convert a floating point value to an
12111 integer value chooses the nearest integer less than or equal to the
12112 floating point value rather than to the nearest integer.  Thus if the
12113 floating point number is negative, the result will be incorrectly
12114 truncated an additional code is necessary to detect and correct this
12115 case.  This option can be used to disable generation of the additional
12116 code required to correct the result.
12118 @item -mrptb
12119 @itemx -mno-rptb
12120 @opindex mrptb
12121 @opindex mno-rptb
12122 Enable (disable) generation of repeat block sequences using the RPTB
12123 instruction for zero overhead looping.  The RPTB construct is only used
12124 for innermost loops that do not call functions or jump across the loop
12125 boundaries.  There is no advantage having nested RPTB loops due to the
12126 overhead required to save and restore the RC, RS, and RE registers.
12127 This is enabled by default with @option{-O2}.
12129 @item -mrpts=@var{count}
12130 @itemx -mno-rpts
12131 @opindex mrpts
12132 @opindex mno-rpts
12133 Enable (disable) the use of the single instruction repeat instruction
12134 RPTS@.  If a repeat block contains a single instruction, and the loop
12135 count can be guaranteed to be less than the value @var{count}, GCC will
12136 emit a RPTS instruction instead of a RPTB@.  If no value is specified,
12137 then a RPTS will be emitted even if the loop count cannot be determined
12138 at compile time.  Note that the repeated instruction following RPTS does
12139 not have to be reloaded from memory each iteration, thus freeing up the
12140 CPU buses for operands.  However, since interrupts are blocked by this
12141 instruction, it is disabled by default.
12143 @item -mloop-unsigned
12144 @itemx -mno-loop-unsigned
12145 @opindex mloop-unsigned
12146 @opindex mno-loop-unsigned
12147 The maximum iteration count when using RPTS and RPTB (and DB on the C40)
12148 is @math{2^{31} + 1} since these instructions test if the iteration count is
12149 negative to terminate the loop.  If the iteration count is unsigned
12150 there is a possibility than the @math{2^{31} + 1} maximum iteration count may be
12151 exceeded.  This switch allows an unsigned iteration count.
12153 @item -mti
12154 @opindex mti
12155 Try to emit an assembler syntax that the TI assembler (asm30) is happy
12156 with.  This also enforces compatibility with the API employed by the TI
12157 C3x C compiler.  For example, long doubles are passed as structures
12158 rather than in floating point registers.
12160 @item -mregparm
12161 @itemx -mmemparm
12162 @opindex mregparm
12163 @opindex mmemparm
12164 Generate code that uses registers (stack) for passing arguments to functions.
12165 By default, arguments are passed in registers where possible rather
12166 than by pushing arguments on to the stack.
12168 @item -mparallel-insns
12169 @itemx -mno-parallel-insns
12170 @opindex mparallel-insns
12171 @opindex mno-parallel-insns
12172 Allow the generation of parallel instructions.  This is enabled by
12173 default with @option{-O2}.
12175 @item -mparallel-mpy
12176 @itemx -mno-parallel-mpy
12177 @opindex mparallel-mpy
12178 @opindex mno-parallel-mpy
12179 Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
12180 provided @option{-mparallel-insns} is also specified.  These instructions have
12181 tight register constraints which can pessimize the code generation
12182 of large functions.
12184 @end table
12186 @node V850 Options
12187 @subsection V850 Options
12188 @cindex V850 Options
12190 These @samp{-m} options are defined for V850 implementations:
12192 @table @gcctabopt
12193 @item -mlong-calls
12194 @itemx -mno-long-calls
12195 @opindex mlong-calls
12196 @opindex mno-long-calls
12197 Treat all calls as being far away (near).  If calls are assumed to be
12198 far away, the compiler will always load the functions address up into a
12199 register, and call indirect through the pointer.
12201 @item -mno-ep
12202 @itemx -mep
12203 @opindex mno-ep
12204 @opindex mep
12205 Do not optimize (do optimize) basic blocks that use the same index
12206 pointer 4 or more times to copy pointer into the @code{ep} register, and
12207 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
12208 option is on by default if you optimize.
12210 @item -mno-prolog-function
12211 @itemx -mprolog-function
12212 @opindex mno-prolog-function
12213 @opindex mprolog-function
12214 Do not use (do use) external functions to save and restore registers
12215 at the prologue and epilogue of a function.  The external functions
12216 are slower, but use less code space if more than one function saves
12217 the same number of registers.  The @option{-mprolog-function} option
12218 is on by default if you optimize.
12220 @item -mspace
12221 @opindex mspace
12222 Try to make the code as small as possible.  At present, this just turns
12223 on the @option{-mep} and @option{-mprolog-function} options.
12225 @item -mtda=@var{n}
12226 @opindex mtda
12227 Put static or global variables whose size is @var{n} bytes or less into
12228 the tiny data area that register @code{ep} points to.  The tiny data
12229 area can hold up to 256 bytes in total (128 bytes for byte references).
12231 @item -msda=@var{n}
12232 @opindex msda
12233 Put static or global variables whose size is @var{n} bytes or less into
12234 the small data area that register @code{gp} points to.  The small data
12235 area can hold up to 64 kilobytes.
12237 @item -mzda=@var{n}
12238 @opindex mzda
12239 Put static or global variables whose size is @var{n} bytes or less into
12240 the first 32 kilobytes of memory.
12242 @item -mv850
12243 @opindex mv850
12244 Specify that the target processor is the V850.
12246 @item -mbig-switch
12247 @opindex mbig-switch
12248 Generate code suitable for big switch tables.  Use this option only if
12249 the assembler/linker complain about out of range branches within a switch
12250 table.
12252 @item -mapp-regs
12253 @opindex mapp-regs
12254 This option will cause r2 and r5 to be used in the code generated by
12255 the compiler.  This setting is the default.
12257 @item -mno-app-regs
12258 @opindex mno-app-regs
12259 This option will cause r2 and r5 to be treated as fixed registers.
12261 @item -mv850e1
12262 @opindex mv850e1
12263 Specify that the target processor is the V850E1.  The preprocessor
12264 constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
12265 this option is used.
12267 @item -mv850e
12268 @opindex mv850e
12269 Specify that the target processor is the V850E@.  The preprocessor
12270 constant @samp{__v850e__} will be defined if this option is used.
12272 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
12273 are defined then a default target processor will be chosen and the
12274 relevant @samp{__v850*__} preprocessor constant will be defined.
12276 The preprocessor constants @samp{__v850} and @samp{__v851__} are always
12277 defined, regardless of which processor variant is the target.
12279 @item -mdisable-callt
12280 @opindex mdisable-callt
12281 This option will suppress generation of the CALLT instruction for the
12282 v850e and v850e1 flavors of the v850 architecture.  The default is
12283 @option{-mno-disable-callt} which allows the CALLT instruction to be used.
12285 @end table
12287 @node VAX Options
12288 @subsection VAX Options
12289 @cindex VAX options
12291 These @samp{-m} options are defined for the VAX:
12293 @table @gcctabopt
12294 @item -munix
12295 @opindex munix
12296 Do not output certain jump instructions (@code{aobleq} and so on)
12297 that the Unix assembler for the VAX cannot handle across long
12298 ranges.
12300 @item -mgnu
12301 @opindex mgnu
12302 Do output those jump instructions, on the assumption that you
12303 will assemble with the GNU assembler.
12305 @item -mg
12306 @opindex mg
12307 Output code for g-format floating point numbers instead of d-format.
12308 @end table
12310 @node x86-64 Options
12311 @subsection x86-64 Options
12312 @cindex x86-64 options
12314 These are listed under @xref{i386 and x86-64 Options}.
12316 @node Xstormy16 Options
12317 @subsection Xstormy16 Options
12318 @cindex Xstormy16 Options
12320 These options are defined for Xstormy16:
12322 @table @gcctabopt
12323 @item -msim
12324 @opindex msim
12325 Choose startup files and linker script suitable for the simulator.
12326 @end table
12328 @node Xtensa Options
12329 @subsection Xtensa Options
12330 @cindex Xtensa Options
12332 These options are supported for Xtensa targets:
12334 @table @gcctabopt
12335 @item -mconst16
12336 @itemx -mno-const16
12337 @opindex mconst16
12338 @opindex mno-const16
12339 Enable or disable use of @code{CONST16} instructions for loading
12340 constant values.  The @code{CONST16} instruction is currently not a
12341 standard option from Tensilica.  When enabled, @code{CONST16}
12342 instructions are always used in place of the standard @code{L32R}
12343 instructions.  The use of @code{CONST16} is enabled by default only if
12344 the @code{L32R} instruction is not available.
12346 @item -mfused-madd
12347 @itemx -mno-fused-madd
12348 @opindex mfused-madd
12349 @opindex mno-fused-madd
12350 Enable or disable use of fused multiply/add and multiply/subtract
12351 instructions in the floating-point option.  This has no effect if the
12352 floating-point option is not also enabled.  Disabling fused multiply/add
12353 and multiply/subtract instructions forces the compiler to use separate
12354 instructions for the multiply and add/subtract operations.  This may be
12355 desirable in some cases where strict IEEE 754-compliant results are
12356 required: the fused multiply add/subtract instructions do not round the
12357 intermediate result, thereby producing results with @emph{more} bits of
12358 precision than specified by the IEEE standard.  Disabling fused multiply
12359 add/subtract instructions also ensures that the program output is not
12360 sensitive to the compiler's ability to combine multiply and add/subtract
12361 operations.
12363 @item -mtext-section-literals
12364 @itemx -mno-text-section-literals
12365 @opindex mtext-section-literals
12366 @opindex mno-text-section-literals
12367 Control the treatment of literal pools.  The default is
12368 @option{-mno-text-section-literals}, which places literals in a separate
12369 section in the output file.  This allows the literal pool to be placed
12370 in a data RAM/ROM, and it also allows the linker to combine literal
12371 pools from separate object files to remove redundant literals and
12372 improve code size.  With @option{-mtext-section-literals}, the literals
12373 are interspersed in the text section in order to keep them as close as
12374 possible to their references.  This may be necessary for large assembly
12375 files.
12377 @item -mtarget-align
12378 @itemx -mno-target-align
12379 @opindex mtarget-align
12380 @opindex mno-target-align
12381 When this option is enabled, GCC instructs the assembler to
12382 automatically align instructions to reduce branch penalties at the
12383 expense of some code density.  The assembler attempts to widen density
12384 instructions to align branch targets and the instructions following call
12385 instructions.  If there are not enough preceding safe density
12386 instructions to align a target, no widening will be performed.  The
12387 default is @option{-mtarget-align}.  These options do not affect the
12388 treatment of auto-aligned instructions like @code{LOOP}, which the
12389 assembler will always align, either by widening density instructions or
12390 by inserting no-op instructions.
12392 @item -mlongcalls
12393 @itemx -mno-longcalls
12394 @opindex mlongcalls
12395 @opindex mno-longcalls
12396 When this option is enabled, GCC instructs the assembler to translate
12397 direct calls to indirect calls unless it can determine that the target
12398 of a direct call is in the range allowed by the call instruction.  This
12399 translation typically occurs for calls to functions in other source
12400 files.  Specifically, the assembler translates a direct @code{CALL}
12401 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
12402 The default is @option{-mno-longcalls}.  This option should be used in
12403 programs where the call target can potentially be out of range.  This
12404 option is implemented in the assembler, not the compiler, so the
12405 assembly code generated by GCC will still show direct call
12406 instructions---look at the disassembled object code to see the actual
12407 instructions.  Note that the assembler will use an indirect call for
12408 every cross-file call, not just those that really will be out of range.
12409 @end table
12411 @node zSeries Options
12412 @subsection zSeries Options
12413 @cindex zSeries options
12415 These are listed under @xref{S/390 and zSeries Options}.
12417 @node Code Gen Options
12418 @section Options for Code Generation Conventions
12419 @cindex code generation conventions
12420 @cindex options, code generation
12421 @cindex run-time options
12423 These machine-independent options control the interface conventions
12424 used in code generation.
12426 Most of them have both positive and negative forms; the negative form
12427 of @option{-ffoo} would be @option{-fno-foo}.  In the table below, only
12428 one of the forms is listed---the one which is not the default.  You
12429 can figure out the other form by either removing @samp{no-} or adding
12432 @table @gcctabopt
12433 @item -fbounds-check
12434 @opindex fbounds-check
12435 For front-ends that support it, generate additional code to check that
12436 indices used to access arrays are within the declared range.  This is
12437 currently only supported by the Java and Fortran 77 front-ends, where
12438 this option defaults to true and false respectively.
12440 @item -ftrapv
12441 @opindex ftrapv
12442 This option generates traps for signed overflow on addition, subtraction,
12443 multiplication operations.
12445 @item -fwrapv
12446 @opindex fwrapv
12447 This option instructs the compiler to assume that signed arithmetic
12448 overflow of addition, subtraction and multiplication wraps around
12449 using twos-complement representation.  This flag enables some optimizations
12450 and disables other.  This option is enabled by default for the Java
12451 front-end, as required by the Java language specification.
12453 @item -fexceptions
12454 @opindex fexceptions
12455 Enable exception handling.  Generates extra code needed to propagate
12456 exceptions.  For some targets, this implies GCC will generate frame
12457 unwind information for all functions, which can produce significant data
12458 size overhead, although it does not affect execution.  If you do not
12459 specify this option, GCC will enable it by default for languages like
12460 C++ which normally require exception handling, and disable it for
12461 languages like C that do not normally require it.  However, you may need
12462 to enable this option when compiling C code that needs to interoperate
12463 properly with exception handlers written in C++.  You may also wish to
12464 disable this option if you are compiling older C++ programs that don't
12465 use exception handling.
12467 @item -fnon-call-exceptions
12468 @opindex fnon-call-exceptions
12469 Generate code that allows trapping instructions to throw exceptions.
12470 Note that this requires platform-specific runtime support that does
12471 not exist everywhere.  Moreover, it only allows @emph{trapping}
12472 instructions to throw exceptions, i.e.@: memory references or floating
12473 point instructions.  It does not allow exceptions to be thrown from
12474 arbitrary signal handlers such as @code{SIGALRM}.
12476 @item -funwind-tables
12477 @opindex funwind-tables
12478 Similar to @option{-fexceptions}, except that it will just generate any needed
12479 static data, but will not affect the generated code in any other way.
12480 You will normally not enable this option; instead, a language processor
12481 that needs this handling would enable it on your behalf.
12483 @item -fasynchronous-unwind-tables
12484 @opindex fasynchronous-unwind-tables
12485 Generate unwind table in dwarf2 format, if supported by target machine.  The
12486 table is exact at each instruction boundary, so it can be used for stack
12487 unwinding from asynchronous events (such as debugger or garbage collector).
12489 @item -fpcc-struct-return
12490 @opindex fpcc-struct-return
12491 Return ``short'' @code{struct} and @code{union} values in memory like
12492 longer ones, rather than in registers.  This convention is less
12493 efficient, but it has the advantage of allowing intercallability between
12494 GCC-compiled files and files compiled with other compilers, particularly
12495 the Portable C Compiler (pcc).
12497 The precise convention for returning structures in memory depends
12498 on the target configuration macros.
12500 Short structures and unions are those whose size and alignment match
12501 that of some integer type.
12503 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
12504 switch is not binary compatible with code compiled with the
12505 @option{-freg-struct-return} switch.
12506 Use it to conform to a non-default application binary interface.
12508 @item -freg-struct-return
12509 @opindex freg-struct-return
12510 Return @code{struct} and @code{union} values in registers when possible.
12511 This is more efficient for small structures than
12512 @option{-fpcc-struct-return}.
12514 If you specify neither @option{-fpcc-struct-return} nor
12515 @option{-freg-struct-return}, GCC defaults to whichever convention is
12516 standard for the target.  If there is no standard convention, GCC
12517 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
12518 the principal compiler.  In those cases, we can choose the standard, and
12519 we chose the more efficient register return alternative.
12521 @strong{Warning:} code compiled with the @option{-freg-struct-return}
12522 switch is not binary compatible with code compiled with the
12523 @option{-fpcc-struct-return} switch.
12524 Use it to conform to a non-default application binary interface.
12526 @item -fshort-enums
12527 @opindex fshort-enums
12528 Allocate to an @code{enum} type only as many bytes as it needs for the
12529 declared range of possible values.  Specifically, the @code{enum} type
12530 will be equivalent to the smallest integer type which has enough room.
12532 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
12533 code that is not binary compatible with code generated without that switch.
12534 Use it to conform to a non-default application binary interface.
12536 @item -fshort-double
12537 @opindex fshort-double
12538 Use the same size for @code{double} as for @code{float}.
12540 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
12541 code that is not binary compatible with code generated without that switch.
12542 Use it to conform to a non-default application binary interface.
12544 @item -fshort-wchar
12545 @opindex fshort-wchar
12546 Override the underlying type for @samp{wchar_t} to be @samp{short
12547 unsigned int} instead of the default for the target.  This option is
12548 useful for building programs to run under WINE@.
12550 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
12551 code that is not binary compatible with code generated without that switch.
12552 Use it to conform to a non-default application binary interface.
12554 @item -fshared-data
12555 @opindex fshared-data
12556 Requests that the data and non-@code{const} variables of this
12557 compilation be shared data rather than private data.  The distinction
12558 makes sense only on certain operating systems, where shared data is
12559 shared between processes running the same program, while private data
12560 exists in one copy per process.
12562 @item -fno-common
12563 @opindex fno-common
12564 In C, allocate even uninitialized global variables in the data section of the
12565 object file, rather than generating them as common blocks.  This has the
12566 effect that if the same variable is declared (without @code{extern}) in
12567 two different compilations, you will get an error when you link them.
12568 The only reason this might be useful is if you wish to verify that the
12569 program will work on other systems which always work this way.
12571 @item -fno-ident
12572 @opindex fno-ident
12573 Ignore the @samp{#ident} directive.
12575 @item -finhibit-size-directive
12576 @opindex finhibit-size-directive
12577 Don't output a @code{.size} assembler directive, or anything else that
12578 would cause trouble if the function is split in the middle, and the
12579 two halves are placed at locations far apart in memory.  This option is
12580 used when compiling @file{crtstuff.c}; you should not need to use it
12581 for anything else.
12583 @item -fverbose-asm
12584 @opindex fverbose-asm
12585 Put extra commentary information in the generated assembly code to
12586 make it more readable.  This option is generally only of use to those
12587 who actually need to read the generated assembly code (perhaps while
12588 debugging the compiler itself).
12590 @option{-fno-verbose-asm}, the default, causes the
12591 extra information to be omitted and is useful when comparing two assembler
12592 files.
12594 @item -fpic
12595 @opindex fpic
12596 @cindex global offset table
12597 @cindex PIC
12598 Generate position-independent code (PIC) suitable for use in a shared
12599 library, if supported for the target machine.  Such code accesses all
12600 constant addresses through a global offset table (GOT)@.  The dynamic
12601 loader resolves the GOT entries when the program starts (the dynamic
12602 loader is not part of GCC; it is part of the operating system).  If
12603 the GOT size for the linked executable exceeds a machine-specific
12604 maximum size, you get an error message from the linker indicating that
12605 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
12606 instead.  (These maximums are 8k on the SPARC and 32k
12607 on the m68k and RS/6000.  The 386 has no such limit.)
12609 Position-independent code requires special support, and therefore works
12610 only on certain machines.  For the 386, GCC supports PIC for System V
12611 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
12612 position-independent.
12614 @item -fPIC
12615 @opindex fPIC
12616 If supported for the target machine, emit position-independent code,
12617 suitable for dynamic linking and avoiding any limit on the size of the
12618 global offset table.  This option makes a difference on the m68k,
12619 PowerPC and SPARC@.
12621 Position-independent code requires special support, and therefore works
12622 only on certain machines.
12624 @item -fpie
12625 @itemx -fPIE
12626 @opindex fpie
12627 @opindex fPIE
12628 These options are similar to @option{-fpic} and @option{-fPIC}, but
12629 generated position independent code can be only linked into executables.
12630 Usually these options are used when @option{-pie} GCC option will be
12631 used during linking.
12633 @item -fno-jump-tables
12634 @opindex fno-jump-tables
12635 Do not use jump tables for switch statements even where it would be
12636 more efficient than other code generation strategies.  This option is
12637 of use in conjunction with @option{-fpic} or @option{-fPIC} for
12638 building code which forms part of a dynamic linker and cannot
12639 reference the address of a jump table.  On some targets, jump tables
12640 do not require a GOT and this option is not needed.
12642 @item -ffixed-@var{reg}
12643 @opindex ffixed
12644 Treat the register named @var{reg} as a fixed register; generated code
12645 should never refer to it (except perhaps as a stack pointer, frame
12646 pointer or in some other fixed role).
12648 @var{reg} must be the name of a register.  The register names accepted
12649 are machine-specific and are defined in the @code{REGISTER_NAMES}
12650 macro in the machine description macro file.
12652 This flag does not have a negative form, because it specifies a
12653 three-way choice.
12655 @item -fcall-used-@var{reg}
12656 @opindex fcall-used
12657 Treat the register named @var{reg} as an allocable register that is
12658 clobbered by function calls.  It may be allocated for temporaries or
12659 variables that do not live across a call.  Functions compiled this way
12660 will not save and restore the register @var{reg}.
12662 It is an error to used this flag with the frame pointer or stack pointer.
12663 Use of this flag for other registers that have fixed pervasive roles in
12664 the machine's execution model will produce disastrous results.
12666 This flag does not have a negative form, because it specifies a
12667 three-way choice.
12669 @item -fcall-saved-@var{reg}
12670 @opindex fcall-saved
12671 Treat the register named @var{reg} as an allocable register saved by
12672 functions.  It may be allocated even for temporaries or variables that
12673 live across a call.  Functions compiled this way will save and restore
12674 the register @var{reg} if they use it.
12676 It is an error to used this flag with the frame pointer or stack pointer.
12677 Use of this flag for other registers that have fixed pervasive roles in
12678 the machine's execution model will produce disastrous results.
12680 A different sort of disaster will result from the use of this flag for
12681 a register in which function values may be returned.
12683 This flag does not have a negative form, because it specifies a
12684 three-way choice.
12686 @item -fpack-struct[=@var{n}]
12687 @opindex fpack-struct
12688 Without a value specified, pack all structure members together without
12689 holes.  When a value is specified (which must be a small power of two), pack
12690 structure members according to this value, representing the maximum
12691 alignment (that is, objects with default alignment requirements larger than
12692 this will be output potentially unaligned at the next fitting location.
12694 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
12695 code that is not binary compatible with code generated without that switch.
12696 Additionally, it makes the code suboptimal.
12697 Use it to conform to a non-default application binary interface.
12699 @item -finstrument-functions
12700 @opindex finstrument-functions
12701 Generate instrumentation calls for entry and exit to functions.  Just
12702 after function entry and just before function exit, the following
12703 profiling functions will be called with the address of the current
12704 function and its call site.  (On some platforms,
12705 @code{__builtin_return_address} does not work beyond the current
12706 function, so the call site information may not be available to the
12707 profiling functions otherwise.)
12709 @smallexample
12710 void __cyg_profile_func_enter (void *this_fn,
12711                                void *call_site);
12712 void __cyg_profile_func_exit  (void *this_fn,
12713                                void *call_site);
12714 @end smallexample
12716 The first argument is the address of the start of the current function,
12717 which may be looked up exactly in the symbol table.
12719 This instrumentation is also done for functions expanded inline in other
12720 functions.  The profiling calls will indicate where, conceptually, the
12721 inline function is entered and exited.  This means that addressable
12722 versions of such functions must be available.  If all your uses of a
12723 function are expanded inline, this may mean an additional expansion of
12724 code size.  If you use @samp{extern inline} in your C code, an
12725 addressable version of such functions must be provided.  (This is
12726 normally the case anyways, but if you get lucky and the optimizer always
12727 expands the functions inline, you might have gotten away without
12728 providing static copies.)
12730 A function may be given the attribute @code{no_instrument_function}, in
12731 which case this instrumentation will not be done.  This can be used, for
12732 example, for the profiling functions listed above, high-priority
12733 interrupt routines, and any functions from which the profiling functions
12734 cannot safely be called (perhaps signal handlers, if the profiling
12735 routines generate output or allocate memory).
12737 @item -fstack-check
12738 @opindex fstack-check
12739 Generate code to verify that you do not go beyond the boundary of the
12740 stack.  You should specify this flag if you are running in an
12741 environment with multiple threads, but only rarely need to specify it in
12742 a single-threaded environment since stack overflow is automatically
12743 detected on nearly all systems if there is only one stack.
12745 Note that this switch does not actually cause checking to be done; the
12746 operating system must do that.  The switch causes generation of code
12747 to ensure that the operating system sees the stack being extended.
12749 @item -fstack-limit-register=@var{reg}
12750 @itemx -fstack-limit-symbol=@var{sym}
12751 @itemx -fno-stack-limit
12752 @opindex fstack-limit-register
12753 @opindex fstack-limit-symbol
12754 @opindex fno-stack-limit
12755 Generate code to ensure that the stack does not grow beyond a certain value,
12756 either the value of a register or the address of a symbol.  If the stack
12757 would grow beyond the value, a signal is raised.  For most targets,
12758 the signal is raised before the stack overruns the boundary, so
12759 it is possible to catch the signal without taking special precautions.
12761 For instance, if the stack starts at absolute address @samp{0x80000000}
12762 and grows downwards, you can use the flags
12763 @option{-fstack-limit-symbol=__stack_limit} and
12764 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
12765 of 128KB@.  Note that this may only work with the GNU linker.
12767 @cindex aliasing of parameters
12768 @cindex parameters, aliased
12769 @item -fargument-alias
12770 @itemx -fargument-noalias
12771 @itemx -fargument-noalias-global
12772 @opindex fargument-alias
12773 @opindex fargument-noalias
12774 @opindex fargument-noalias-global
12775 Specify the possible relationships among parameters and between
12776 parameters and global data.
12778 @option{-fargument-alias} specifies that arguments (parameters) may
12779 alias each other and may alias global storage.@*
12780 @option{-fargument-noalias} specifies that arguments do not alias
12781 each other, but may alias global storage.@*
12782 @option{-fargument-noalias-global} specifies that arguments do not
12783 alias each other and do not alias global storage.
12785 Each language will automatically use whatever option is required by
12786 the language standard.  You should not need to use these options yourself.
12788 @item -fleading-underscore
12789 @opindex fleading-underscore
12790 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
12791 change the way C symbols are represented in the object file.  One use
12792 is to help link with legacy assembly code.
12794 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
12795 generate code that is not binary compatible with code generated without that
12796 switch.  Use it to conform to a non-default application binary interface.
12797 Not all targets provide complete support for this switch.
12799 @item -ftls-model=@var{model}
12800 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
12801 The @var{model} argument should be one of @code{global-dynamic},
12802 @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
12804 The default without @option{-fpic} is @code{initial-exec}; with
12805 @option{-fpic} the default is @code{global-dynamic}.
12807 @item -fvisibility=@var{default|internal|hidden|protected}
12808 @opindex fvisibility
12809 Set the default ELF image symbol visibility to the specified option---all
12810 symbols will be marked with this unless overridden within the code.
12811 Using this feature can very substantially improve linking and
12812 load times of shared object libraries, produce more optimized
12813 code, provide near-perfect API export and prevent symbol clashes.
12814 It is @strong{strongly} recommended that you use this in any shared objects
12815 you distribute.
12817 Despite the nomenclature, @code{default} always means public ie;
12818 available to be linked against from outside the shared object.
12819 @code{protected} and @code{internal} are pretty useless in real-world
12820 usage so the only other commonly used option will be @code{hidden}.
12821 The default if @option{-fvisibility} isn't specified is
12822 @code{default}, i.e., make every
12823 symbol public---this causes the same behavior as previous versions of
12824 GCC@.
12826 A good explanation of the benefits offered by ensuring ELF
12827 symbols have the correct visibility is given by ``How To Write
12828 Shared Libraries'' by Ulrich Drepper (which can be found at
12829 @w{@uref{http://people.redhat.com/~drepper/}})---however a superior
12830 solution made possible by this option to marking things hidden when
12831 the default is public is to make the default hidden and mark things
12832 public.  This is the norm with DLL's on Windows and with @option{-fvisibility=hidden}
12833 and @code{__attribute__ ((visibility("default")))} instead of
12834 @code{__declspec(dllexport)} you get almost identical semantics with
12835 identical syntax.  This is a great boon to those working with
12836 cross-platform projects.
12838 For those adding visibility support to existing code, you may find
12839 @samp{#pragma GCC visibility} of use.  This works by you enclosing
12840 the declarations you wish to set visibility for with (for example)
12841 @samp{#pragma GCC visibility push(hidden)} and
12842 @samp{#pragma GCC visibility pop}.
12843 Bear in mind that symbol visibility should be viewed @strong{as
12844 part of the API interface contract} and thus all new code should
12845 always specify visibility when it is not the default ie; declarations
12846 only for use within the local DSO should @strong{always} be marked explicitly
12847 as hidden as so to avoid PLT indirection overheads---making this
12848 abundantly clear also aids readability and self-documentation of the code.
12849 Note that due to ISO C++ specification requirements, operator new and
12850 operator delete must always be of default visibility.
12852 An overview of these techniques, their benefits and how to use them
12853 is at @w{@uref{http://gcc.gnu.org/wiki/Visibility}}.
12855 @end table
12857 @c man end
12859 @node Environment Variables
12860 @section Environment Variables Affecting GCC
12861 @cindex environment variables
12863 @c man begin ENVIRONMENT
12864 This section describes several environment variables that affect how GCC
12865 operates.  Some of them work by specifying directories or prefixes to use
12866 when searching for various kinds of files.  Some are used to specify other
12867 aspects of the compilation environment.
12869 Note that you can also specify places to search using options such as
12870 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
12871 take precedence over places specified using environment variables, which
12872 in turn take precedence over those specified by the configuration of GCC@.
12873 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
12874 GNU Compiler Collection (GCC) Internals}.
12876 @table @env
12877 @item LANG
12878 @itemx LC_CTYPE
12879 @c @itemx LC_COLLATE
12880 @itemx LC_MESSAGES
12881 @c @itemx LC_MONETARY
12882 @c @itemx LC_NUMERIC
12883 @c @itemx LC_TIME
12884 @itemx LC_ALL
12885 @findex LANG
12886 @findex LC_CTYPE
12887 @c @findex LC_COLLATE
12888 @findex LC_MESSAGES
12889 @c @findex LC_MONETARY
12890 @c @findex LC_NUMERIC
12891 @c @findex LC_TIME
12892 @findex LC_ALL
12893 @cindex locale
12894 These environment variables control the way that GCC uses
12895 localization information that allow GCC to work with different
12896 national conventions.  GCC inspects the locale categories
12897 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
12898 so.  These locale categories can be set to any value supported by your
12899 installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
12900 Kingdom encoded in UTF-8.
12902 The @env{LC_CTYPE} environment variable specifies character
12903 classification.  GCC uses it to determine the character boundaries in
12904 a string; this is needed for some multibyte encodings that contain quote
12905 and escape characters that would otherwise be interpreted as a string
12906 end or escape.
12908 The @env{LC_MESSAGES} environment variable specifies the language to
12909 use in diagnostic messages.
12911 If the @env{LC_ALL} environment variable is set, it overrides the value
12912 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
12913 and @env{LC_MESSAGES} default to the value of the @env{LANG}
12914 environment variable.  If none of these variables are set, GCC
12915 defaults to traditional C English behavior.
12917 @item TMPDIR
12918 @findex TMPDIR
12919 If @env{TMPDIR} is set, it specifies the directory to use for temporary
12920 files.  GCC uses temporary files to hold the output of one stage of
12921 compilation which is to be used as input to the next stage: for example,
12922 the output of the preprocessor, which is the input to the compiler
12923 proper.
12925 @item GCC_EXEC_PREFIX
12926 @findex GCC_EXEC_PREFIX
12927 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
12928 names of the subprograms executed by the compiler.  No slash is added
12929 when this prefix is combined with the name of a subprogram, but you can
12930 specify a prefix that ends with a slash if you wish.
12932 If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
12933 an appropriate prefix to use based on the pathname it was invoked with.
12935 If GCC cannot find the subprogram using the specified prefix, it
12936 tries looking in the usual places for the subprogram.
12938 The default value of @env{GCC_EXEC_PREFIX} is
12939 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the value
12940 of @code{prefix} when you ran the @file{configure} script.
12942 Other prefixes specified with @option{-B} take precedence over this prefix.
12944 This prefix is also used for finding files such as @file{crt0.o} that are
12945 used for linking.
12947 In addition, the prefix is used in an unusual way in finding the
12948 directories to search for header files.  For each of the standard
12949 directories whose name normally begins with @samp{/usr/local/lib/gcc}
12950 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
12951 replacing that beginning with the specified prefix to produce an
12952 alternate directory name.  Thus, with @option{-Bfoo/}, GCC will search
12953 @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
12954 These alternate directories are searched first; the standard directories
12955 come next.
12957 @item COMPILER_PATH
12958 @findex COMPILER_PATH
12959 The value of @env{COMPILER_PATH} is a colon-separated list of
12960 directories, much like @env{PATH}.  GCC tries the directories thus
12961 specified when searching for subprograms, if it can't find the
12962 subprograms using @env{GCC_EXEC_PREFIX}.
12964 @item LIBRARY_PATH
12965 @findex LIBRARY_PATH
12966 The value of @env{LIBRARY_PATH} is a colon-separated list of
12967 directories, much like @env{PATH}.  When configured as a native compiler,
12968 GCC tries the directories thus specified when searching for special
12969 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}.  Linking
12970 using GCC also uses these directories when searching for ordinary
12971 libraries for the @option{-l} option (but directories specified with
12972 @option{-L} come first).
12974 @item LANG
12975 @findex LANG
12976 @cindex locale definition
12977 This variable is used to pass locale information to the compiler.  One way in
12978 which this information is used is to determine the character set to be used
12979 when character literals, string literals and comments are parsed in C and C++.
12980 When the compiler is configured to allow multibyte characters,
12981 the following values for @env{LANG} are recognized:
12983 @table @samp
12984 @item C-JIS
12985 Recognize JIS characters.
12986 @item C-SJIS
12987 Recognize SJIS characters.
12988 @item C-EUCJP
12989 Recognize EUCJP characters.
12990 @end table
12992 If @env{LANG} is not defined, or if it has some other value, then the
12993 compiler will use mblen and mbtowc as defined by the default locale to
12994 recognize and translate multibyte characters.
12995 @end table
12997 @noindent
12998 Some additional environments variables affect the behavior of the
12999 preprocessor.
13001 @include cppenv.texi
13003 @c man end
13005 @node Precompiled Headers
13006 @section Using Precompiled Headers
13007 @cindex precompiled headers
13008 @cindex speed of compilation
13010 Often large projects have many header files that are included in every
13011 source file.  The time the compiler takes to process these header files
13012 over and over again can account for nearly all of the time required to
13013 build the project.  To make builds faster, GCC allows users to
13014 `precompile' a header file; then, if builds can use the precompiled
13015 header file they will be much faster.
13017 To create a precompiled header file, simply compile it as you would any
13018 other file, if necessary using the @option{-x} option to make the driver
13019 treat it as a C or C++ header file.  You will probably want to use a
13020 tool like @command{make} to keep the precompiled header up-to-date when
13021 the headers it contains change.
13023 A precompiled header file will be searched for when @code{#include} is
13024 seen in the compilation.  As it searches for the included file
13025 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
13026 compiler looks for a precompiled header in each directory just before it
13027 looks for the include file in that directory.  The name searched for is
13028 the name specified in the @code{#include} with @samp{.gch} appended.  If
13029 the precompiled header file can't be used, it is ignored.
13031 For instance, if you have @code{#include "all.h"}, and you have
13032 @file{all.h.gch} in the same directory as @file{all.h}, then the
13033 precompiled header file will be used if possible, and the original
13034 header will be used otherwise.
13036 Alternatively, you might decide to put the precompiled header file in a
13037 directory and use @option{-I} to ensure that directory is searched
13038 before (or instead of) the directory containing the original header.
13039 Then, if you want to check that the precompiled header file is always
13040 used, you can put a file of the same name as the original header in this
13041 directory containing an @code{#error} command.
13043 This also works with @option{-include}.  So yet another way to use
13044 precompiled headers, good for projects not designed with precompiled
13045 header files in mind, is to simply take most of the header files used by
13046 a project, include them from another header file, precompile that header
13047 file, and @option{-include} the precompiled header.  If the header files
13048 have guards against multiple inclusion, they will be skipped because
13049 they've already been included (in the precompiled header).
13051 If you need to precompile the same header file for different
13052 languages, targets, or compiler options, you can instead make a
13053 @emph{directory} named like @file{all.h.gch}, and put each precompiled
13054 header in the directory, perhaps using @option{-o}.  It doesn't matter
13055 what you call the files in the directory, every precompiled header in
13056 the directory will be considered.  The first precompiled header
13057 encountered in the directory that is valid for this compilation will
13058 be used; they're searched in no particular order.
13060 There are many other possibilities, limited only by your imagination,
13061 good sense, and the constraints of your build system.
13063 A precompiled header file can be used only when these conditions apply:
13065 @itemize
13066 @item
13067 Only one precompiled header can be used in a particular compilation.
13069 @item
13070 A precompiled header can't be used once the first C token is seen.  You
13071 can have preprocessor directives before a precompiled header; you can
13072 even include a precompiled header from inside another header, so long as
13073 there are no C tokens before the @code{#include}.
13075 @item
13076 The precompiled header file must be produced for the same language as
13077 the current compilation.  You can't use a C precompiled header for a C++
13078 compilation.
13080 @item
13081 The precompiled header file must have been produced by the same compiler
13082 binary as the current compilation is using.
13084 @item
13085 Any macros defined before the precompiled header is included must
13086 either be defined in the same way as when the precompiled header was
13087 generated, or must not affect the precompiled header, which usually
13088 means that they don't appear in the precompiled header at all.
13090 The @option{-D} option is one way to define a macro before a
13091 precompiled header is included; using a @code{#define} can also do it.
13092 There are also some options that define macros implicitly, like
13093 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
13094 defined this way.
13096 @item If debugging information is output when using the precompiled
13097 header, using @option{-g} or similar, the same kind of debugging information
13098 must have been output when building the precompiled header.  However,
13099 a precompiled header built using @option{-g} can be used in a compilation
13100 when no debugging information is being output.
13102 @item The same @option{-m} options must generally be used when building
13103 and using the precompiled header.  @xref{Submodel Options},
13104 for any cases where this rule is relaxed.
13106 @item Each of the following options must be the same when building and using
13107 the precompiled header:
13109 @gccoptlist{-fexceptions -funit-at-a-time}
13111 @item
13112 Some other command-line options starting with @option{-f},
13113 @option{-p}, or @option{-O} must be defined in the same way as when
13114 the precompiled header was generated.  At present, it's not clear
13115 which options are safe to change and which are not; the safest choice
13116 is to use exactly the same options when generating and using the
13117 precompiled header.  The following are known to be safe:
13119 @gccoptlist{-fpreprocessed
13120 -fsched-interblock -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous
13121 -fsched-verbose=<number> -fschedule-insns
13122 -pedantic-errors}
13124 @end itemize
13126 For all of these except the last, the compiler will automatically
13127 ignore the precompiled header if the conditions aren't met.  If you
13128 find an option combination that doesn't work and doesn't cause the
13129 precompiled header to be ignored, please consider filing a bug report,
13130 see @ref{Bugs}.
13132 If you do use differing options when generating and using the
13133 precompiled header, the actual behavior will be a mixture of the
13134 behavior for the options.  For instance, if you use @option{-g} to
13135 generate the precompiled header but not when using it, you may or may
13136 not get debugging information for routines in the precompiled header.
13138 @node Running Protoize
13139 @section Running Protoize
13141 The program @code{protoize} is an optional part of GCC@.  You can use
13142 it to add prototypes to a program, thus converting the program to ISO
13143 C in one respect.  The companion program @code{unprotoize} does the
13144 reverse: it removes argument types from any prototypes that are found.
13146 When you run these programs, you must specify a set of source files as
13147 command line arguments.  The conversion programs start out by compiling
13148 these files to see what functions they define.  The information gathered
13149 about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
13151 After scanning comes actual conversion.  The specified files are all
13152 eligible to be converted; any files they include (whether sources or
13153 just headers) are eligible as well.
13155 But not all the eligible files are converted.  By default,
13156 @code{protoize} and @code{unprotoize} convert only source and header
13157 files in the current directory.  You can specify additional directories
13158 whose files should be converted with the @option{-d @var{directory}}
13159 option.  You can also specify particular files to exclude with the
13160 @option{-x @var{file}} option.  A file is converted if it is eligible, its
13161 directory name matches one of the specified directory names, and its
13162 name within the directory has not been excluded.
13164 Basic conversion with @code{protoize} consists of rewriting most
13165 function definitions and function declarations to specify the types of
13166 the arguments.  The only ones not rewritten are those for varargs
13167 functions.
13169 @code{protoize} optionally inserts prototype declarations at the
13170 beginning of the source file, to make them available for any calls that
13171 precede the function's definition.  Or it can insert prototype
13172 declarations with block scope in the blocks where undeclared functions
13173 are called.
13175 Basic conversion with @code{unprotoize} consists of rewriting most
13176 function declarations to remove any argument types, and rewriting
13177 function definitions to the old-style pre-ISO form.
13179 Both conversion programs print a warning for any function declaration or
13180 definition that they can't convert.  You can suppress these warnings
13181 with @option{-q}.
13183 The output from @code{protoize} or @code{unprotoize} replaces the
13184 original source file.  The original file is renamed to a name ending
13185 with @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
13186 without the original @samp{.c} suffix).  If the @samp{.save} (@samp{.sav}
13187 for DOS) file already exists, then the source file is simply discarded.
13189 @code{protoize} and @code{unprotoize} both depend on GCC itself to
13190 scan the program and collect information about the functions it uses.
13191 So neither of these programs will work until GCC is installed.
13193 Here is a table of the options you can use with @code{protoize} and
13194 @code{unprotoize}.  Each option works with both programs unless
13195 otherwise stated.
13197 @table @code
13198 @item -B @var{directory}
13199 Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
13200 usual directory (normally @file{/usr/local/lib}).  This file contains
13201 prototype information about standard system functions.  This option
13202 applies only to @code{protoize}.
13204 @item -c @var{compilation-options}
13205 Use @var{compilation-options} as the options when running @command{gcc} to
13206 produce the @samp{.X} files.  The special option @option{-aux-info} is
13207 always passed in addition, to tell @command{gcc} to write a @samp{.X} file.
13209 Note that the compilation options must be given as a single argument to
13210 @code{protoize} or @code{unprotoize}.  If you want to specify several
13211 @command{gcc} options, you must quote the entire set of compilation options
13212 to make them a single word in the shell.
13214 There are certain @command{gcc} arguments that you cannot use, because they
13215 would produce the wrong kind of output.  These include @option{-g},
13216 @option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
13217 the @var{compilation-options}, they are ignored.
13219 @item -C
13220 Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file
13221 systems) instead of @samp{.c}.  This is convenient if you are converting
13222 a C program to C++.  This option applies only to @code{protoize}.
13224 @item -g
13225 Add explicit global declarations.  This means inserting explicit
13226 declarations at the beginning of each source file for each function
13227 that is called in the file and was not declared.  These declarations
13228 precede the first function definition that contains a call to an
13229 undeclared function.  This option applies only to @code{protoize}.
13231 @item -i @var{string}
13232 Indent old-style parameter declarations with the string @var{string}.
13233 This option applies only to @code{protoize}.
13235 @code{unprotoize} converts prototyped function definitions to old-style
13236 function definitions, where the arguments are declared between the
13237 argument list and the initial @samp{@{}.  By default, @code{unprotoize}
13238 uses five spaces as the indentation.  If you want to indent with just
13239 one space instead, use @option{-i " "}.
13241 @item -k
13242 Keep the @samp{.X} files.  Normally, they are deleted after conversion
13243 is finished.
13245 @item -l
13246 Add explicit local declarations.  @code{protoize} with @option{-l} inserts
13247 a prototype declaration for each function in each block which calls the
13248 function without any declaration.  This option applies only to
13249 @code{protoize}.
13251 @item -n
13252 Make no real changes.  This mode just prints information about the conversions
13253 that would have been done without @option{-n}.
13255 @item -N
13256 Make no @samp{.save} files.  The original files are simply deleted.
13257 Use this option with caution.
13259 @item -p @var{program}
13260 Use the program @var{program} as the compiler.  Normally, the name
13261 @file{gcc} is used.
13263 @item -q
13264 Work quietly.  Most warnings are suppressed.
13266 @item -v
13267 Print the version number, just like @option{-v} for @command{gcc}.
13268 @end table
13270 If you need special compiler options to compile one of your program's
13271 source files, then you should generate that file's @samp{.X} file
13272 specially, by running @command{gcc} on that source file with the
13273 appropriate options and the option @option{-aux-info}.  Then run
13274 @code{protoize} on the entire set of files.  @code{protoize} will use
13275 the existing @samp{.X} file because it is newer than the source file.
13276 For example:
13278 @smallexample
13279 gcc -Dfoo=bar file1.c -aux-info file1.X
13280 protoize *.c
13281 @end smallexample
13283 @noindent
13284 You need to include the special files along with the rest in the
13285 @code{protoize} command, even though their @samp{.X} files already
13286 exist, because otherwise they won't get converted.
13288 @xref{Protoize Caveats}, for more information on how to use
13289 @code{protoize} successfully.