gcc:
[official-gcc.git] / gcc / doc / invoke.texi
blob32fe747b4da639cb7609da0ff11c25e59c998418
1 @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2 @c 2000, 2001, 2002, 2003, 2004, 2005, 2006 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 INCLUDE
8 @include gcc-vers.texi
9 @c man end
11 @c man begin COPYRIGHT
12 Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
13 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
15 Permission is granted to copy, distribute and/or modify this document
16 under the terms of the GNU Free Documentation License, Version 1.2 or
17 any later version published by the Free Software Foundation; with the
18 Invariant Sections being ``GNU General Public License'' and ``Funding
19 Free Software'', the Front-Cover texts being (a) (see below), and with
20 the Back-Cover Texts being (b) (see below).  A copy of the license is
21 included in the gfdl(7) man page.
23 (a) The FSF's Front-Cover Text is:
25      A GNU Manual
27 (b) The FSF's Back-Cover Text is:
29      You have freedom to copy and modify this GNU Manual, like GNU
30      software.  Copies published by the Free Software Foundation raise
31      funds for GNU development.
32 @c man end
33 @c Set file name and title for the man page.
34 @setfilename gcc
35 @settitle GNU project C and C++ compiler
36 @c man begin SYNOPSIS
37 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
38     [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
39     [@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
40     [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
41     [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
42     [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
43     [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
45 Only the most useful options are listed here; see below for the
46 remainder.  @samp{g++} accepts mostly the same options as @samp{gcc}.
47 @c man end
48 @c man begin SEEALSO
49 gpl(7), gfdl(7), fsf-funding(7),
50 cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
51 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
52 @file{ld}, @file{binutils} and @file{gdb}.
53 @c man end
54 @c man begin BUGS
55 For instructions on reporting bugs, see
56 @w{@uref{http://gcc.gnu.org/bugs.html}}.
57 @c man end
58 @c man begin AUTHOR
59 See the Info entry for @command{gcc}, or
60 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
61 for contributors to GCC@.
62 @c man end
63 @end ignore
65 @node Invoking GCC
66 @chapter GCC Command Options
67 @cindex GCC command options
68 @cindex command options
69 @cindex options, GCC command
71 @c man begin DESCRIPTION
72 When you invoke GCC, it normally does preprocessing, compilation,
73 assembly and linking.  The ``overall options'' allow you to stop this
74 process at an intermediate stage.  For example, the @option{-c} option
75 says not to run the linker.  Then the output consists of object files
76 output by the assembler.
78 Other options are passed on to one stage of processing.  Some options
79 control the preprocessor and others the compiler itself.  Yet other
80 options control the assembler and linker; most of these are not
81 documented here, since you rarely need to use any of them.
83 @cindex C compilation options
84 Most of the command line options that you can use with GCC are useful
85 for C programs; when an option is only useful with another language
86 (usually C++), the explanation says so explicitly.  If the description
87 for a particular option does not mention a source language, you can use
88 that option with all supported languages.
90 @cindex C++ compilation options
91 @xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
92 options for compiling C++ programs.
94 @cindex grouping options
95 @cindex options, grouping
96 The @command{gcc} program accepts options and file names as operands.  Many
97 options have multi-letter names; therefore multiple single-letter options
98 may @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d
99 -r}}.
101 @cindex order of options
102 @cindex options, order
103 You can mix options and other arguments.  For the most part, the order
104 you use doesn't matter.  Order does matter when you use several options
105 of the same kind; for example, if you specify @option{-L} more than once,
106 the directories are searched in the order specified.
108 Many options have long names starting with @samp{-f} or with
109 @samp{-W}---for example, 
110 @option{-fmove-loop-invariants}, @option{-Wformat} and so on.  Most of
111 these have both positive and negative forms; the negative form of
112 @option{-ffoo} would be @option{-fno-foo}.  This manual documents
113 only one of these two forms, whichever one is not the default.
115 @c man end
117 @xref{Option Index}, for an index to GCC's options.
119 @menu
120 * Option Summary::      Brief list of all options, without explanations.
121 * Overall Options::     Controlling the kind of output:
122                         an executable, object files, assembler files,
123                         or preprocessed source.
124 * Invoking G++::        Compiling C++ programs.
125 * C Dialect Options::   Controlling the variant of C language compiled.
126 * C++ Dialect Options:: Variations on C++.
127 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
128                         and Objective-C++.
129 * Language Independent Options:: Controlling how diagnostics should be
130                         formatted.
131 * Warning Options::     How picky should the compiler be?
132 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
133 * Optimize Options::    How much optimization?
134 * Preprocessor Options:: Controlling header files and macro definitions.
135                          Also, getting dependency information for Make.
136 * Assembler Options::   Passing options to the assembler.
137 * Link Options::        Specifying libraries and so on.
138 * Directory Options::   Where to find header files and libraries.
139                         Where to find the compiler executable files.
140 * Spec Files::          How to pass switches to sub-processes.
141 * Target Options::      Running a cross-compiler, or an old version of GCC.
142 * Submodel Options::    Specifying minor hardware or convention variations,
143                         such as 68010 vs 68020.
144 * Code Gen Options::    Specifying conventions for function calls, data layout
145                         and register usage.
146 * Environment Variables:: Env vars that affect GCC.
147 * Precompiled Headers:: Compiling a header once, and using it many times.
148 * Running Protoize::    Automatically adding or removing function prototypes.
149 @end menu
151 @c man begin OPTIONS
153 @node Option Summary
154 @section Option Summary
156 Here is a summary of all the options, grouped by type.  Explanations are
157 in the following sections.
159 @table @emph
160 @item Overall Options
161 @xref{Overall Options,,Options Controlling the Kind of Output}.
162 @gccoptlist{-c  -S  -E  -o @var{file}  -combine -pipe  -pass-exit-codes  @gol
163 -x @var{language}  -v  -###  --help  --target-help  --version @@@var{file}}
165 @item C Language Options
166 @xref{C Dialect Options,,Options Controlling C Dialect}.
167 @gccoptlist{-ansi  -std=@var{standard}  -aux-info @var{filename} @gol
168 -fno-asm  -fno-builtin  -fno-builtin-@var{function} @gol
169 -fhosted  -ffreestanding -fopenmp -fms-extensions @gol
170 -trigraphs  -no-integrated-cpp  -traditional  -traditional-cpp @gol
171 -fallow-single-precision  -fcond-mismatch @gol
172 -fsigned-bitfields  -fsigned-char @gol
173 -funsigned-bitfields  -funsigned-char}
175 @item C++ Language Options
176 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
177 @gccoptlist{-fabi-version=@var{n}  -fno-access-control  -fcheck-new @gol
178 -fconserve-space  -ffriend-injection @gol
179 -fno-elide-constructors @gol
180 -fno-enforce-eh-specs @gol
181 -ffor-scope  -fno-for-scope  -fno-gnu-keywords @gol
182 -fno-implicit-templates @gol
183 -fno-implicit-inline-templates @gol
184 -fno-implement-inlines  -fms-extensions @gol
185 -fno-nonansi-builtins  -fno-operator-names @gol
186 -fno-optional-diags  -fpermissive @gol
187 -frepo  -fno-rtti  -fstats  -ftemplate-depth-@var{n} @gol
188 -fno-threadsafe-statics -fuse-cxa-atexit  -fno-weak  -nostdinc++ @gol
189 -fno-default-inline  -fvisibility-inlines-hidden @gol
190 -Wabi  -Wctor-dtor-privacy @gol
191 -Wnon-virtual-dtor  -Wreorder @gol
192 -Weffc++  -Wno-deprecated  -Wstrict-null-sentinel @gol
193 -Wno-non-template-friend  -Wold-style-cast @gol
194 -Woverloaded-virtual  -Wno-pmf-conversions @gol
195 -Wsign-promo}
197 @item Objective-C and Objective-C++ Language Options
198 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
199 Objective-C and Objective-C++ Dialects}.
200 @gccoptlist{
201 -fconstant-string-class=@var{class-name} @gol
202 -fgnu-runtime  -fnext-runtime @gol
203 -fno-nil-receivers @gol
204 -fobjc-call-cxx-cdtors @gol
205 -fobjc-direct-dispatch @gol
206 -fobjc-exceptions @gol
207 -fobjc-gc @gol
208 -freplace-objc-classes @gol
209 -fzero-link @gol
210 -gen-decls @gol
211 -Wassign-intercept @gol
212 -Wno-protocol  -Wselector @gol
213 -Wstrict-selector-match @gol
214 -Wundeclared-selector}
216 @item Language Independent Options
217 @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
218 @gccoptlist{-fmessage-length=@var{n}  @gol
219 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}} @gol
220 -fdiagnostics-show-options
222 @item Warning Options
223 @xref{Warning Options,,Options to Request or Suppress Warnings}.
224 @gccoptlist{-fsyntax-only  -pedantic  -pedantic-errors @gol
225 -w  -Wextra  -Wall  -Waggregate-return -Walways-true -Wno-attributes @gol
226 -Wc++-compat -Wcast-align  -Wcast-qual  -Wchar-subscripts  -Wcomment @gol
227 -Wconversion  -Wno-deprecated-declarations @gol
228 -Wdisabled-optimization  -Wno-div-by-zero  -Wno-endif-labels @gol
229 -Werror  -Werror-* -Werror-implicit-function-declaration @gol
230 -Wfatal-errors  -Wfloat-equal  -Wformat  -Wformat=2 @gol
231 -Wno-format-extra-args -Wformat-nonliteral @gol
232 -Wformat-security  -Wformat-y2k @gol
233 -Wimplicit  -Wimplicit-function-declaration  -Wimplicit-int @gol
234 -Wimport  -Wno-import  -Winit-self  -Winline @gol
235 -Wno-int-to-pointer-cast @gol
236 -Wno-invalid-offsetof  -Winvalid-pch @gol
237 -Wlarger-than-@var{len}  -Wunsafe-loop-optimizations  -Wlong-long @gol
238 -Wmain  -Wmissing-braces  -Wmissing-field-initializers @gol
239 -Wmissing-format-attribute  -Wmissing-include-dirs @gol
240 -Wmissing-noreturn @gol
241 -Wno-multichar  -Wnonnull  -Wno-overflow @gol
242 -Woverlength-strings  -Wpacked  -Wpadded @gol
243 -Wparentheses  -Wpointer-arith  -Wno-pointer-to-int-cast @gol
244 -Wredundant-decls @gol
245 -Wreturn-type  -Wsequence-point  -Wshadow @gol
246 -Wsign-compare  -Wstack-protector @gol
247 -Wstrict-aliasing -Wstrict-aliasing=2 @gol
248 -Wstring-literal-comparison @gol
249 -Wswitch  -Wswitch-default  -Wswitch-enum @gol
250 -Wsystem-headers  -Wtrigraphs  -Wundef  -Wuninitialized @gol
251 -Wunknown-pragmas  -Wno-pragmas -Wunreachable-code @gol
252 -Wunused  -Wunused-function  -Wunused-label  -Wunused-parameter @gol
253 -Wunused-value  -Wunused-variable  -Wvariadic-macros @gol
254 -Wvolatile-register-var  -Wwrite-strings}
256 @item C-only Warning Options
257 @gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
258 -Wmissing-prototypes  -Wnested-externs  -Wold-style-definition @gol
259 -Wstrict-prototypes  -Wtraditional @gol
260 -Wdeclaration-after-statement -Wpointer-sign}
262 @item Debugging Options
263 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
264 @gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
265 -fdump-noaddr -fdump-unnumbered  -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
266 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
267 -fdump-ipa-all -fdump-ipa-cgraph @gol
268 -fdump-tree-all @gol
269 -fdump-tree-original@r{[}-@var{n}@r{]}  @gol
270 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
271 -fdump-tree-inlined@r{[}-@var{n}@r{]} @gol
272 -fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol
273 -fdump-tree-ch @gol
274 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
275 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
276 -fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
277 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
278 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
279 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
280 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
281 -fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
282 -fdump-tree-nrv -fdump-tree-vect @gol
283 -fdump-tree-sink @gol
284 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
285 -fdump-tree-salias @gol
286 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
287 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
288 -ftree-vectorizer-verbose=@var{n} @gol
289 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
290 -feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
291 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
292 -fmem-report -fprofile-arcs @gol
293 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
294 -ftest-coverage  -ftime-report -fvar-tracking @gol
295 -g  -g@var{level}  -gcoff -gdwarf-2 @gol
296 -ggdb  -gstabs  -gstabs+  -gvms  -gxcoff  -gxcoff+ @gol
297 -p  -pg  -print-file-name=@var{library}  -print-libgcc-file-name @gol
298 -print-multi-directory  -print-multi-lib @gol
299 -print-prog-name=@var{program}  -print-search-dirs  -Q @gol
300 -save-temps  -time}
302 @item Optimization Options
303 @xref{Optimize Options,,Options that Control Optimization}.
304 @gccoptlist{-falign-functions=@var{n}  -falign-jumps=@var{n} @gol
305 -falign-labels=@var{n}  -falign-loops=@var{n}  @gol
306 -fbounds-check -fmudflap -fmudflapth -fmudflapir @gol
307 -fbranch-probabilities -fprofile-values -fvpt -fbranch-target-load-optimize @gol
308 -fbranch-target-load-optimize2 -fbtr-bb-exclusive @gol
309 -fcaller-saves  -fcprop-registers  -fcse-follow-jumps @gol
310 -fcse-skip-blocks  -fcx-limited-range  -fdata-sections @gol
311 -fdelayed-branch  -fdelete-null-pointer-checks -fearly-inlining @gol
312 -fexpensive-optimizations  -ffast-math  -ffloat-store @gol
313 -fforce-addr  -ffunction-sections @gol
314 -fgcse  -fgcse-lm  -fgcse-sm  -fgcse-las  -fgcse-after-reload @gol
315 -fcrossjumping  -fif-conversion  -fif-conversion2 @gol
316 -finline-functions  -finline-functions-called-once @gol
317 -finline-limit=@var{n}  -fkeep-inline-functions @gol
318 -fkeep-static-consts  -fmerge-constants  -fmerge-all-constants @gol
319 -fmodulo-sched -fno-branch-count-reg @gol
320 -fno-default-inline  -fno-defer-pop -fmove-loop-invariants @gol
321 -fno-function-cse  -fno-guess-branch-probability @gol
322 -fno-inline  -fno-math-errno  -fno-peephole  -fno-peephole2 @gol
323 -funsafe-math-optimizations  -funsafe-loop-optimizations  -ffinite-math-only @gol
324 -fno-toplevel-reorder -fno-trapping-math  -fno-zero-initialized-in-bss @gol
325 -fomit-frame-pointer  -foptimize-register-move @gol
326 -foptimize-sibling-calls  -fprefetch-loop-arrays @gol
327 -fprofile-generate -fprofile-use @gol
328 -fregmove  -frename-registers @gol
329 -freorder-blocks  -freorder-blocks-and-partition -freorder-functions @gol
330 -frerun-cse-after-loop @gol
331 -frounding-math -frtl-abstract-sequences @gol
332 -fschedule-insns  -fschedule-insns2 @gol
333 -fno-sched-interblock  -fno-sched-spec  -fsched-spec-load @gol
334 -fsched-spec-load-dangerous  @gol
335 -fsched-stalled-insns=@var{n} -fsched-stalled-insns-dep=@var{n} @gol
336 -fsched2-use-superblocks @gol
337 -fsched2-use-traces -fsee -freschedule-modulo-scheduled-loops @gol
338 -fsection-anchors  -fsignaling-nans  -fsingle-precision-constant @gol
339 -fstack-protector  -fstack-protector-all @gol
340 -fstrict-aliasing  -ftracer  -fthread-jumps @gol
341 -funroll-all-loops  -funroll-loops  -fpeel-loops @gol
342 -fsplit-ivs-in-unroller -funswitch-loops @gol
343 -fvariable-expansion-in-unroller @gol
344 -ftree-pre  -ftree-ccp  -ftree-dce -ftree-loop-optimize @gol
345 -ftree-loop-linear -ftree-loop-im -ftree-loop-ivcanon -fivopts @gol
346 -ftree-dominator-opts -ftree-dse -ftree-copyrename -ftree-sink @gol
347 -ftree-ch -ftree-sra -ftree-ter -ftree-lrs -ftree-fre -ftree-vectorize @gol
348 -ftree-vect-loop-version -ftree-salias -fipa-pta -fweb @gol
349 -ftree-copy-prop -ftree-store-ccp -ftree-store-copy-prop -fwhole-program @gol
350 --param @var{name}=@var{value}
351 -O  -O0  -O1  -O2  -O3  -Os}
353 @item Preprocessor Options
354 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
355 @gccoptlist{-A@var{question}=@var{answer} @gol
356 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
357 -C  -dD  -dI  -dM  -dN @gol
358 -D@var{macro}@r{[}=@var{defn}@r{]}  -E  -H @gol
359 -idirafter @var{dir} @gol
360 -include @var{file}  -imacros @var{file} @gol
361 -iprefix @var{file}  -iwithprefix @var{dir} @gol
362 -iwithprefixbefore @var{dir}  -isystem @var{dir} @gol
363 -imultilib @var{dir} -isysroot @var{dir} @gol
364 -M  -MM  -MF  -MG  -MP  -MQ  -MT  -nostdinc  @gol
365 -P  -fworking-directory  -remap @gol
366 -trigraphs  -undef  -U@var{macro}  -Wp,@var{option} @gol
367 -Xpreprocessor @var{option}}
369 @item Assembler Option
370 @xref{Assembler Options,,Passing Options to the Assembler}.
371 @gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
373 @item Linker Options
374 @xref{Link Options,,Options for Linking}.
375 @gccoptlist{@var{object-file-name}  -l@var{library} @gol
376 -nostartfiles  -nodefaultlibs  -nostdlib -pie -rdynamic @gol
377 -s  -static  -static-libgcc  -shared  -shared-libgcc  -symbolic @gol
378 -Wl,@var{option}  -Xlinker @var{option} @gol
379 -u @var{symbol}}
381 @item Directory Options
382 @xref{Directory Options,,Options for Directory Search}.
383 @gccoptlist{-B@var{prefix}  -I@var{dir}  -iquote@var{dir}  -L@var{dir}
384 -specs=@var{file}  -I- --sysroot=@var{dir}}
386 @item Target Options
387 @c I wrote this xref this way to avoid overfull hbox. -- rms
388 @xref{Target Options}.
389 @gccoptlist{-V @var{version}  -b @var{machine}}
391 @item Machine Dependent Options
392 @xref{Submodel Options,,Hardware Models and Configurations}.
393 @c This list is ordered alphanumerically by subsection name.
394 @c Try and put the significant identifier (CPU or system) first,
395 @c so users have a clue at guessing where the ones they want will be.
397 @emph{ARC Options}
398 @gccoptlist{-EB  -EL @gol
399 -mmangle-cpu  -mcpu=@var{cpu}  -mtext=@var{text-section} @gol
400 -mdata=@var{data-section}  -mrodata=@var{readonly-data-section}}
402 @emph{ARM Options}
403 @gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
404 -mabi=@var{name} @gol
405 -mapcs-stack-check  -mno-apcs-stack-check @gol
406 -mapcs-float  -mno-apcs-float @gol
407 -mapcs-reentrant  -mno-apcs-reentrant @gol
408 -msched-prolog  -mno-sched-prolog @gol
409 -mlittle-endian  -mbig-endian  -mwords-little-endian @gol
410 -mfloat-abi=@var{name}  -msoft-float  -mhard-float  -mfpe @gol
411 -mthumb-interwork  -mno-thumb-interwork @gol
412 -mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
413 -mstructure-size-boundary=@var{n} @gol
414 -mabort-on-noreturn @gol
415 -mlong-calls  -mno-long-calls @gol
416 -msingle-pic-base  -mno-single-pic-base @gol
417 -mpic-register=@var{reg} @gol
418 -mnop-fun-dllimport @gol
419 -mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
420 -mpoke-function-name @gol
421 -mthumb  -marm @gol
422 -mtpcs-frame  -mtpcs-leaf-frame @gol
423 -mcaller-super-interworking  -mcallee-super-interworking @gol
424 -mtp=@var{name}}
426 @emph{AVR Options}
427 @gccoptlist{-mmcu=@var{mcu}  -msize  -minit-stack=@var{n}  -mno-interrupts @gol
428 -mcall-prologues  -mno-tablejump  -mtiny-stack  -mint8}
430 @emph{Blackfin Options}
431 @gccoptlist{-momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
432 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
433 -mlow-64k -mno-low64k -mid-shared-library @gol
434 -mno-id-shared-library -mshared-library-id=@var{n} @gol
435 -mlong-calls  -mno-long-calls}
437 @emph{CRIS Options}
438 @gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}  -mtune=@var{cpu} @gol
439 -mmax-stack-frame=@var{n}  -melinux-stacksize=@var{n} @gol
440 -metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
441 -mstack-align  -mdata-align  -mconst-align @gol
442 -m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue  -mno-gotplt @gol
443 -melf  -maout  -melinux  -mlinux  -sim  -sim2 @gol
444 -mmul-bug-workaround  -mno-mul-bug-workaround}
446 @emph{CRX Options}
447 @gccoptlist{-mmac -mpush-args}
449 @emph{Darwin Options}
450 @gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal @gol
451 -arch_only  -bind_at_load  -bundle  -bundle_loader @gol
452 -client_name  -compatibility_version  -current_version @gol
453 -dead_strip @gol
454 -dependency-file  -dylib_file  -dylinker_install_name @gol
455 -dynamic  -dynamiclib  -exported_symbols_list @gol
456 -filelist  -flat_namespace  -force_cpusubtype_ALL @gol
457 -force_flat_namespace  -headerpad_max_install_names @gol
458 -image_base  -init  -install_name  -keep_private_externs @gol
459 -multi_module  -multiply_defined  -multiply_defined_unused @gol
460 -noall_load   -no_dead_strip_inits_and_terms @gol
461 -nofixprebinding -nomultidefs  -noprebind  -noseglinkedit @gol
462 -pagezero_size  -prebind  -prebind_all_twolevel_modules @gol
463 -private_bundle  -read_only_relocs  -sectalign @gol
464 -sectobjectsymbols  -whyload  -seg1addr @gol
465 -sectcreate  -sectobjectsymbols  -sectorder @gol
466 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
467 -seg_addr_table  -seg_addr_table_filename  -seglinkedit @gol
468 -segprot  -segs_read_only_addr  -segs_read_write_addr @gol
469 -single_module  -static  -sub_library  -sub_umbrella @gol
470 -twolevel_namespace  -umbrella  -undefined @gol
471 -unexported_symbols_list  -weak_reference_mismatches @gol
472 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
473 -mone-byte-bool}
475 @emph{DEC Alpha Options}
476 @gccoptlist{-mno-fp-regs  -msoft-float  -malpha-as  -mgas @gol
477 -mieee  -mieee-with-inexact  -mieee-conformant @gol
478 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
479 -mtrap-precision=@var{mode}  -mbuild-constants @gol
480 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
481 -mbwx  -mmax  -mfix  -mcix @gol
482 -mfloat-vax  -mfloat-ieee @gol
483 -mexplicit-relocs  -msmall-data  -mlarge-data @gol
484 -msmall-text  -mlarge-text @gol
485 -mmemory-latency=@var{time}}
487 @emph{DEC Alpha/VMS Options}
488 @gccoptlist{-mvms-return-codes}
490 @emph{FRV Options}
491 @gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
492 -mhard-float  -msoft-float @gol
493 -malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
494 -mdouble  -mno-double @gol
495 -mmedia  -mno-media  -mmuladd  -mno-muladd @gol
496 -mfdpic  -minline-plt -mgprel-ro  -multilib-library-pic @gol
497 -mlinked-fp  -mlong-calls  -malign-labels @gol
498 -mlibrary-pic  -macc-4  -macc-8 @gol
499 -mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
500 -moptimize-membar -mno-optimize-membar @gol
501 -mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
502 -mvliw-branch  -mno-vliw-branch @gol
503 -mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
504 -mno-nested-cond-exec  -mtomcat-stats @gol
505 -mTLS -mtls @gol
506 -mcpu=@var{cpu}}
508 @emph{GNU/Linux Options}
509 @gccoptlist{-muclibc}
511 @emph{H8/300 Options}
512 @gccoptlist{-mrelax  -mh  -ms  -mn  -mint32  -malign-300}
514 @emph{HPPA Options}
515 @gccoptlist{-march=@var{architecture-type} @gol
516 -mbig-switch  -mdisable-fpregs  -mdisable-indexing @gol
517 -mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
518 -mfixed-range=@var{register-range} @gol
519 -mjump-in-delay -mlinker-opt -mlong-calls @gol
520 -mlong-load-store  -mno-big-switch  -mno-disable-fpregs @gol
521 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
522 -mno-jump-in-delay  -mno-long-load-store @gol
523 -mno-portable-runtime  -mno-soft-float @gol
524 -mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
525 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
526 -mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
527 -munix=@var{unix-std}  -nolibdld  -static  -threads}
529 @emph{i386 and x86-64 Options}
530 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
531 -mfpmath=@var{unit} @gol
532 -masm=@var{dialect}  -mno-fancy-math-387 @gol
533 -mno-fp-ret-in-387  -msoft-float  -msvr3-shlib @gol
534 -mno-wide-multiply  -mrtd  -malign-double @gol
535 -mpreferred-stack-boundary=@var{num} @gol
536 -mmmx  -msse  -msse2 -msse3 -m3dnow @gol
537 -mthreads  -mno-align-stringops  -minline-all-stringops @gol
538 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
539 -m96bit-long-double  -mregparm=@var{num}  -msseregparm @gol
540 -mstackrealign @gol
541 -momit-leaf-frame-pointer  -mno-red-zone -mno-tls-direct-seg-refs @gol
542 -mcmodel=@var{code-model} @gol
543 -m32  -m64 -mlarge-data-threshold=@var{num}}
545 @emph{IA-64 Options}
546 @gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
547 -mvolatile-asm-stop  -mregister-names  -mno-sdata @gol
548 -mconstant-gp  -mauto-pic  -minline-float-divide-min-latency @gol
549 -minline-float-divide-max-throughput @gol
550 -minline-int-divide-min-latency @gol
551 -minline-int-divide-max-throughput  @gol
552 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
553 -mno-dwarf2-asm -mearly-stop-bits @gol
554 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
555 -mtune=@var{cpu-type} -mt -pthread -milp32 -mlp64 @gol
556 -mno-sched-br-data-spec -msched-ar-data-spec -mno-sched-control-spec @gol
557 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
558 -msched-ldc -mno-sched-control-ldc -mno-sched-spec-verbose @gol
559 -mno-sched-prefer-non-data-spec-insns @gol
560 -mno-sched-prefer-non-control-spec-insns @gol
561 -mno-sched-count-spec-in-critical-path}
563 @emph{M32R/D Options}
564 @gccoptlist{-m32r2 -m32rx -m32r @gol
565 -mdebug @gol
566 -malign-loops -mno-align-loops @gol
567 -missue-rate=@var{number} @gol
568 -mbranch-cost=@var{number} @gol
569 -mmodel=@var{code-size-model-type} @gol
570 -msdata=@var{sdata-type} @gol
571 -mno-flush-func -mflush-func=@var{name} @gol
572 -mno-flush-trap -mflush-trap=@var{number} @gol
573 -G @var{num}}
575 @emph{M32C Options}
576 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
578 @emph{M680x0 Options}
579 @gccoptlist{-m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
580 -m68060  -mcpu32  -m5200  -mcfv4e -m68881  -mbitfield  @gol
581 -mc68000  -mc68020   @gol
582 -mnobitfield  -mrtd  -mshort  -msoft-float  -mpcrel @gol
583 -malign-int  -mstrict-align  -msep-data  -mno-sep-data @gol
584 -mshared-library-id=n  -mid-shared-library  -mno-id-shared-library}
586 @emph{M68hc1x Options}
587 @gccoptlist{-m6811  -m6812  -m68hc11  -m68hc12   -m68hcs12 @gol
588 -mauto-incdec  -minmax  -mlong-calls  -mshort @gol
589 -msoft-reg-count=@var{count}}
591 @emph{MCore Options}
592 @gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
593 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
594 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
595 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
596 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
598 @emph{MIPS Options}
599 @gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
600 -mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips64 @gol
601 -mips16  -mno-mips16  -mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
602 -mshared  -mno-shared  -mxgot  -mno-xgot  -mgp32  -mgp64  @gol
603 -mfp32  -mfp64  -mhard-float  -msoft-float  @gol
604 -msingle-float  -mdouble-float  -mdsp  -mpaired-single  -mips3d @gol
605 -mlong64  -mlong32  -msym32  -mno-sym32 @gol
606 -G@var{num}  -membedded-data  -mno-embedded-data @gol
607 -muninit-const-in-rodata  -mno-uninit-const-in-rodata @gol
608 -msplit-addresses  -mno-split-addresses  @gol
609 -mexplicit-relocs  -mno-explicit-relocs  @gol
610 -mcheck-zero-division  -mno-check-zero-division @gol
611 -mdivide-traps  -mdivide-breaks @gol
612 -mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls @gol
613 -mmad  -mno-mad  -mfused-madd  -mno-fused-madd  -nocpp @gol
614 -mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400 @gol
615 -mfix-vr4120  -mno-fix-vr4120  -mfix-vr4130 @gol
616 -mfix-sb1  -mno-fix-sb1 @gol
617 -mflush-func=@var{func}  -mno-flush-func @gol
618 -mbranch-likely  -mno-branch-likely @gol
619 -mfp-exceptions -mno-fp-exceptions @gol
620 -mvr4130-align -mno-vr4130-align}
622 @emph{MMIX Options}
623 @gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
624 -mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
625 -melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
626 -mno-base-addresses  -msingle-exit  -mno-single-exit}
628 @emph{MN10300 Options}
629 @gccoptlist{-mmult-bug  -mno-mult-bug @gol
630 -mam33  -mno-am33 @gol
631 -mam33-2  -mno-am33-2 @gol
632 -mreturn-pointer-on-d0 @gol
633 -mno-crt0  -mrelax}
635 @emph{MT Options}
636 @gccoptlist{-mno-crt0 -mbacc -msim @gol
637 -march=@var{cpu-type} }
639 @emph{PDP-11 Options}
640 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
641 -mbcopy  -mbcopy-builtin  -mint32  -mno-int16 @gol
642 -mint16  -mno-int32  -mfloat32  -mno-float64 @gol
643 -mfloat64  -mno-float32  -mabshi  -mno-abshi @gol
644 -mbranch-expensive  -mbranch-cheap @gol
645 -msplit  -mno-split  -munix-asm  -mdec-asm}
647 @emph{PowerPC Options}
648 See RS/6000 and PowerPC Options.
650 @emph{RS/6000 and PowerPC Options}
651 @gccoptlist{-mcpu=@var{cpu-type} @gol
652 -mtune=@var{cpu-type} @gol
653 -mpower  -mno-power  -mpower2  -mno-power2 @gol
654 -mpowerpc  -mpowerpc64  -mno-powerpc @gol
655 -maltivec  -mno-altivec @gol
656 -mpowerpc-gpopt  -mno-powerpc-gpopt @gol
657 -mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
658 -mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb  -mfprnd  -mno-fprnd @gol
659 -mnew-mnemonics  -mold-mnemonics @gol
660 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
661 -m64  -m32  -mxl-compat  -mno-xl-compat  -mpe @gol
662 -malign-power  -malign-natural @gol
663 -msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
664 -mstring  -mno-string  -mupdate  -mno-update @gol
665 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
666 -mstrict-align  -mno-strict-align  -mrelocatable @gol
667 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
668 -mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
669 -mdynamic-no-pic  -maltivec  -mswdiv @gol
670 -mprioritize-restricted-insns=@var{priority} @gol
671 -msched-costly-dep=@var{dependence_type} @gol
672 -minsert-sched-nops=@var{scheme} @gol
673 -mcall-sysv  -mcall-netbsd @gol
674 -maix-struct-return  -msvr4-struct-return @gol
675 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
676 -misel -mno-isel @gol
677 -misel=yes  -misel=no @gol
678 -mspe -mno-spe @gol
679 -mspe=yes  -mspe=no @gol
680 -mvrsave -mno-vrsave @gol
681 -mmulhw -mno-mulhw @gol
682 -mdlmzb -mno-dlmzb @gol
683 -mfloat-gprs=yes  -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
684 -mprototype  -mno-prototype @gol
685 -msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
686 -msdata=@var{opt}  -mvxworks  -mwindiss  -G @var{num}  -pthread}
688 @emph{S/390 and zSeries Options}
689 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
690 -mhard-float  -msoft-float -mlong-double-64 -mlong-double-128 @gol
691 -mbackchain  -mno-backchain -mpacked-stack  -mno-packed-stack @gol
692 -msmall-exec  -mno-small-exec  -mmvcle -mno-mvcle @gol
693 -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch @gol
694 -mtpf-trace -mno-tpf-trace  -mfused-madd  -mno-fused-madd @gol
695 -mwarn-framesize  -mwarn-dynamicstack  -mstack-size -mstack-guard}
697 @emph{SH Options}
698 @gccoptlist{-m1  -m2  -m2e  -m3  -m3e @gol
699 -m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
700 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
701 -m5-64media  -m5-64media-nofpu @gol
702 -m5-32media  -m5-32media-nofpu @gol
703 -m5-compact  -m5-compact-nofpu @gol
704 -mb  -ml  -mdalign  -mrelax @gol
705 -mbigtable  -mfmovd  -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
706 -mieee  -misize  -mpadstruct  -mspace @gol
707 -mprefergot  -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
708 -mdivsi3_libfunc=@var{name}  @gol
709 -madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
710  -minvalid-symbols}
712 @emph{SPARC Options}
713 @gccoptlist{-mcpu=@var{cpu-type} @gol
714 -mtune=@var{cpu-type} @gol
715 -mcmodel=@var{code-model} @gol
716 -m32  -m64  -mapp-regs  -mno-app-regs @gol
717 -mfaster-structs  -mno-faster-structs @gol
718 -mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
719 -mhard-quad-float  -msoft-quad-float @gol
720 -mimpure-text  -mno-impure-text  -mlittle-endian @gol
721 -mstack-bias  -mno-stack-bias @gol
722 -munaligned-doubles  -mno-unaligned-doubles @gol
723 -mv8plus  -mno-v8plus  -mvis  -mno-vis
724 -threads -pthreads -pthread}
726 @emph{System V Options}
727 @gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
729 @emph{TMS320C3x/C4x Options}
730 @gccoptlist{-mcpu=@var{cpu}  -mbig  -msmall  -mregparm  -mmemparm @gol
731 -mfast-fix  -mmpyi  -mbk  -mti  -mdp-isr-reload @gol
732 -mrpts=@var{count}  -mrptb  -mdb  -mloop-unsigned @gol
733 -mparallel-insns  -mparallel-mpy  -mpreserve-float}
735 @emph{V850 Options}
736 @gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
737 -mprolog-function  -mno-prolog-function  -mspace @gol
738 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
739 -mapp-regs  -mno-app-regs @gol
740 -mdisable-callt  -mno-disable-callt @gol
741 -mv850e1 @gol
742 -mv850e @gol
743 -mv850  -mbig-switch}
745 @emph{VAX Options}
746 @gccoptlist{-mg  -mgnu  -munix}
748 @emph{x86-64 Options}
749 See i386 and x86-64 Options.
751 @emph{Xstormy16 Options}
752 @gccoptlist{-msim}
754 @emph{Xtensa Options}
755 @gccoptlist{-mconst16 -mno-const16 @gol
756 -mfused-madd  -mno-fused-madd @gol
757 -mtext-section-literals  -mno-text-section-literals @gol
758 -mtarget-align  -mno-target-align @gol
759 -mlongcalls  -mno-longcalls}
761 @emph{zSeries Options}
762 See S/390 and zSeries Options.
764 @item Code Generation Options
765 @xref{Code Gen Options,,Options for Code Generation Conventions}.
766 @gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
767 -ffixed-@var{reg}  -fexceptions @gol
768 -fnon-call-exceptions  -funwind-tables @gol
769 -fasynchronous-unwind-tables @gol
770 -finhibit-size-directive  -finstrument-functions @gol
771 -fno-common  -fno-ident @gol
772 -fpcc-struct-return  -fpic  -fPIC -fpie -fPIE @gol
773 -fno-jump-tables @gol
774 -freg-struct-return  -fshort-enums @gol
775 -fshort-double  -fshort-wchar @gol
776 -fverbose-asm  -fpack-struct[=@var{n}]  -fstack-check @gol
777 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
778 -fargument-alias  -fargument-noalias @gol
779 -fargument-noalias-global  -fargument-noalias-anything
780 -fleading-underscore  -ftls-model=@var{model} @gol
781 -ftrapv  -fwrapv  -fbounds-check @gol
782 -fvisibility}
783 @end table
785 @menu
786 * Overall Options::     Controlling the kind of output:
787                         an executable, object files, assembler files,
788                         or preprocessed source.
789 * C Dialect Options::   Controlling the variant of C language compiled.
790 * C++ Dialect Options:: Variations on C++.
791 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
792                         and Objective-C++.
793 * Language Independent Options:: Controlling how diagnostics should be
794                         formatted.
795 * Warning Options::     How picky should the compiler be?
796 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
797 * Optimize Options::    How much optimization?
798 * Preprocessor Options:: Controlling header files and macro definitions.
799                          Also, getting dependency information for Make.
800 * Assembler Options::   Passing options to the assembler.
801 * Link Options::        Specifying libraries and so on.
802 * Directory Options::   Where to find header files and libraries.
803                         Where to find the compiler executable files.
804 * Spec Files::          How to pass switches to sub-processes.
805 * Target Options::      Running a cross-compiler, or an old version of GCC.
806 @end menu
808 @node Overall Options
809 @section Options Controlling the Kind of Output
811 Compilation can involve up to four stages: preprocessing, compilation
812 proper, assembly and linking, always in that order.  GCC is capable of
813 preprocessing and compiling several files either into several
814 assembler input files, or into one assembler input file; then each
815 assembler input file produces an object file, and linking combines all
816 the object files (those newly compiled, and those specified as input)
817 into an executable file.
819 @cindex file name suffix
820 For any given input file, the file name suffix determines what kind of
821 compilation is done:
823 @table @gcctabopt
824 @item @var{file}.c
825 C source code which must be preprocessed.
827 @item @var{file}.i
828 C source code which should not be preprocessed.
830 @item @var{file}.ii
831 C++ source code which should not be preprocessed.
833 @item @var{file}.m
834 Objective-C source code.  Note that you must link with the @file{libobjc}
835 library to make an Objective-C program work.
837 @item @var{file}.mi
838 Objective-C source code which should not be preprocessed.
840 @item @var{file}.mm
841 @itemx @var{file}.M
842 Objective-C++ source code.  Note that you must link with the @file{libobjc}
843 library to make an Objective-C++ program work.  Note that @samp{.M} refers
844 to a literal capital M@.
846 @item @var{file}.mii
847 Objective-C++ source code which should not be preprocessed.
849 @item @var{file}.h
850 C, C++, Objective-C or Objective-C++ header file to be turned into a
851 precompiled header.
853 @item @var{file}.cc
854 @itemx @var{file}.cp
855 @itemx @var{file}.cxx
856 @itemx @var{file}.cpp
857 @itemx @var{file}.CPP
858 @itemx @var{file}.c++
859 @itemx @var{file}.C
860 C++ source code which must be preprocessed.  Note that in @samp{.cxx},
861 the last two letters must both be literally @samp{x}.  Likewise,
862 @samp{.C} refers to a literal capital C@.
864 @item @var{file}.mm
865 @itemx @var{file}.M
866 Objective-C++ source code which must be preprocessed.
868 @item @var{file}.mii
869 Objective-C++ source code which should not be preprocessed.
871 @item @var{file}.hh
872 @itemx @var{file}.H
873 C++ header file to be turned into a precompiled header.
875 @item @var{file}.f
876 @itemx @var{file}.for
877 @itemx @var{file}.FOR
878 Fixed form Fortran source code which should not be preprocessed.
880 @item @var{file}.F
881 @itemx @var{file}.fpp
882 @itemx @var{file}.FPP
883 Fixed form Fortran source code which must be preprocessed (with the traditional
884 preprocessor).
886 @item @var{file}.f90
887 @itemx @var{file}.f95
888 Free form Fortran source code which should not be preprocessed.
890 @item @var{file}.F90
891 @itemx @var{file}.F95
892 Free form Fortran source code which must be preprocessed (with the
893 traditional preprocessor).
895 @c FIXME: Descriptions of Java file types.
896 @c @var{file}.java
897 @c @var{file}.class
898 @c @var{file}.zip
899 @c @var{file}.jar
901 @item @var{file}.ads
902 Ada source code file which contains a library unit declaration (a
903 declaration of a package, subprogram, or generic, or a generic
904 instantiation), or a library unit renaming declaration (a package,
905 generic, or subprogram renaming declaration).  Such files are also
906 called @dfn{specs}.
908 @itemx @var{file}.adb
909 Ada source code file containing a library unit body (a subprogram or
910 package body).  Such files are also called @dfn{bodies}.
912 @c GCC also knows about some suffixes for languages not yet included:
913 @c Pascal:
914 @c @var{file}.p
915 @c @var{file}.pas
916 @c Ratfor:
917 @c @var{file}.r
919 @item @var{file}.s
920 Assembler code.
922 @item @var{file}.S
923 Assembler code which must be preprocessed.
925 @item @var{other}
926 An object file to be fed straight into linking.
927 Any file name with no recognized suffix is treated this way.
928 @end table
930 @opindex x
931 You can specify the input language explicitly with the @option{-x} option:
933 @table @gcctabopt
934 @item -x @var{language}
935 Specify explicitly the @var{language} for the following input files
936 (rather than letting the compiler choose a default based on the file
937 name suffix).  This option applies to all following input files until
938 the next @option{-x} option.  Possible values for @var{language} are:
939 @smallexample
940 c  c-header  c-cpp-output
941 c++  c++-header  c++-cpp-output
942 objective-c  objective-c-header  objective-c-cpp-output
943 objective-c++ objective-c++-header objective-c++-cpp-output
944 assembler  assembler-with-cpp
946 f77  f77-cpp-input
947 f95  f95-cpp-input
948 java
949 treelang
950 @end smallexample
952 @item -x none
953 Turn off any specification of a language, so that subsequent files are
954 handled according to their file name suffixes (as they are if @option{-x}
955 has not been used at all).
957 @item -pass-exit-codes
958 @opindex pass-exit-codes
959 Normally the @command{gcc} program will exit with the code of 1 if any
960 phase of the compiler returns a non-success return code.  If you specify
961 @option{-pass-exit-codes}, the @command{gcc} program will instead return with
962 numerically highest error produced by any phase that returned an error
963 indication.  The C, C++, and Fortran frontends return 4, if an internal
964 compiler error is encountered.
965 @end table
967 If you only want some of the stages of compilation, you can use
968 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
969 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
970 @command{gcc} is to stop.  Note that some combinations (for example,
971 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
973 @table @gcctabopt
974 @item -c
975 @opindex c
976 Compile or assemble the source files, but do not link.  The linking
977 stage simply is not done.  The ultimate output is in the form of an
978 object file for each source file.
980 By default, the object file name for a source file is made by replacing
981 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
983 Unrecognized input files, not requiring compilation or assembly, are
984 ignored.
986 @item -S
987 @opindex S
988 Stop after the stage of compilation proper; do not assemble.  The output
989 is in the form of an assembler code file for each non-assembler input
990 file specified.
992 By default, the assembler file name for a source file is made by
993 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
995 Input files that don't require compilation are ignored.
997 @item -E
998 @opindex E
999 Stop after the preprocessing stage; do not run the compiler proper.  The
1000 output is in the form of preprocessed source code, which is sent to the
1001 standard output.
1003 Input files which don't require preprocessing are ignored.
1005 @cindex output file option
1006 @item -o @var{file}
1007 @opindex o
1008 Place output in file @var{file}.  This applies regardless to whatever
1009 sort of output is being produced, whether it be an executable file,
1010 an object file, an assembler file or preprocessed C code.
1012 If @option{-o} is not specified, the default is to put an executable
1013 file in @file{a.out}, the object file for
1014 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1015 assembler file in @file{@var{source}.s}, a precompiled header file in
1016 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1017 standard output.
1019 @item -v
1020 @opindex v
1021 Print (on standard error output) the commands executed to run the stages
1022 of compilation.  Also print the version number of the compiler driver
1023 program and of the preprocessor and the compiler proper.
1025 @item -###
1026 @opindex ###
1027 Like @option{-v} except the commands are not executed and all command
1028 arguments are quoted.  This is useful for shell scripts to capture the
1029 driver-generated command lines.
1031 @item -pipe
1032 @opindex pipe
1033 Use pipes rather than temporary files for communication between the
1034 various stages of compilation.  This fails to work on some systems where
1035 the assembler is unable to read from a pipe; but the GNU assembler has
1036 no trouble.
1038 @item -combine
1039 @opindex combine
1040 If you are compiling multiple source files, this option tells the driver
1041 to pass all the source files to the compiler at once (for those
1042 languages for which the compiler can handle this).  This will allow
1043 intermodule analysis (IMA) to be performed by the compiler.  Currently the only
1044 language for which this is supported is C@.  If you pass source files for
1045 multiple languages to the driver, using this option, the driver will invoke
1046 the compiler(s) that support IMA once each, passing each compiler all the
1047 source files appropriate for it.  For those languages that do not support
1048 IMA this option will be ignored, and the compiler will be invoked once for
1049 each source file in that language.  If you use this option in conjunction
1050 with @option{-save-temps}, the compiler will generate multiple
1051 pre-processed files
1052 (one for each source file), but only one (combined) @file{.o} or
1053 @file{.s} file.
1055 @item --help
1056 @opindex help
1057 Print (on the standard output) a description of the command line options
1058 understood by @command{gcc}.  If the @option{-v} option is also specified
1059 then @option{--help} will also be passed on to the various processes
1060 invoked by @command{gcc}, so that they can display the command line options
1061 they accept.  If the @option{-Wextra} option is also specified then command
1062 line options which have no documentation associated with them will also
1063 be displayed.
1065 @item --target-help
1066 @opindex target-help
1067 Print (on the standard output) a description of target specific command
1068 line options for each tool.
1070 @item --version
1071 @opindex version
1072 Display the version number and copyrights of the invoked GCC@.
1074 @include @value{srcdir}/../libiberty/at-file.texi
1075 @end table
1077 @node Invoking G++
1078 @section Compiling C++ Programs
1080 @cindex suffixes for C++ source
1081 @cindex C++ source file suffixes
1082 C++ source files conventionally use one of the suffixes @samp{.C},
1083 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1084 @samp{.cxx}; C++ header files often use @samp{.hh} or @samp{.H}; and
1085 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
1086 files with these names and compiles them as C++ programs even if you
1087 call the compiler the same way as for compiling C programs (usually
1088 with the name @command{gcc}).
1090 @findex g++
1091 @findex c++
1092 However, the use of @command{gcc} does not add the C++ library.
1093 @command{g++} is a program that calls GCC and treats @samp{.c},
1094 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1095 files unless @option{-x} is used, and automatically specifies linking
1096 against the C++ library.  This program is also useful when
1097 precompiling a C header file with a @samp{.h} extension for use in C++
1098 compilations.  On many systems, @command{g++} is also installed with
1099 the name @command{c++}.
1101 @cindex invoking @command{g++}
1102 When you compile C++ programs, you may specify many of the same
1103 command-line options that you use for compiling programs in any
1104 language; or command-line options meaningful for C and related
1105 languages; or options that are meaningful only for C++ programs.
1106 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1107 explanations of options for languages related to C@.
1108 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1109 explanations of options that are meaningful only for C++ programs.
1111 @node C Dialect Options
1112 @section Options Controlling C Dialect
1113 @cindex dialect options
1114 @cindex language dialect options
1115 @cindex options, dialect
1117 The following options control the dialect of C (or languages derived
1118 from C, such as C++, Objective-C and Objective-C++) that the compiler
1119 accepts:
1121 @table @gcctabopt
1122 @cindex ANSI support
1123 @cindex ISO support
1124 @item -ansi
1125 @opindex ansi
1126 In C mode, support all ISO C90 programs.  In C++ mode,
1127 remove GNU extensions that conflict with ISO C++.
1129 This turns off certain features of GCC that are incompatible with ISO
1130 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1131 such as the @code{asm} and @code{typeof} keywords, and
1132 predefined macros such as @code{unix} and @code{vax} that identify the
1133 type of system you are using.  It also enables the undesirable and
1134 rarely used ISO trigraph feature.  For the C compiler,
1135 it disables recognition of C++ style @samp{//} comments as well as
1136 the @code{inline} keyword.
1138 The alternate keywords @code{__asm__}, @code{__extension__},
1139 @code{__inline__} and @code{__typeof__} continue to work despite
1140 @option{-ansi}.  You would not want to use them in an ISO C program, of
1141 course, but it is useful to put them in header files that might be included
1142 in compilations done with @option{-ansi}.  Alternate predefined macros
1143 such as @code{__unix__} and @code{__vax__} are also available, with or
1144 without @option{-ansi}.
1146 The @option{-ansi} option does not cause non-ISO programs to be
1147 rejected gratuitously.  For that, @option{-pedantic} is required in
1148 addition to @option{-ansi}.  @xref{Warning Options}.
1150 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1151 option is used.  Some header files may notice this macro and refrain
1152 from declaring certain functions or defining certain macros that the
1153 ISO standard doesn't call for; this is to avoid interfering with any
1154 programs that might use these names for other things.
1156 Functions which would normally be built in but do not have semantics
1157 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1158 functions with @option{-ansi} is used.  @xref{Other Builtins,,Other
1159 built-in functions provided by GCC}, for details of the functions
1160 affected.
1162 @item -std=
1163 @opindex std
1164 Determine the language standard.  This option is currently only
1165 supported when compiling C or C++.  A value for this option must be
1166 provided; possible values are
1168 @table @samp
1169 @item c89
1170 @itemx iso9899:1990
1171 ISO C90 (same as @option{-ansi}).
1173 @item iso9899:199409
1174 ISO C90 as modified in amendment 1.
1176 @item c99
1177 @itemx c9x
1178 @itemx iso9899:1999
1179 @itemx iso9899:199x
1180 ISO C99.  Note that this standard is not yet fully supported; see
1181 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information.  The
1182 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1184 @item gnu89
1185 Default, ISO C90 plus GNU extensions (including some C99 features).
1187 @item gnu99
1188 @itemx gnu9x
1189 ISO C99 plus GNU extensions.  When ISO C99 is fully implemented in GCC,
1190 this will become the default.  The name @samp{gnu9x} is deprecated.
1192 @item c++98
1193 The 1998 ISO C++ standard plus amendments.
1195 @item gnu++98
1196 The same as @option{-std=c++98} plus GNU extensions.  This is the
1197 default for C++ code.
1198 @end table
1200 Even when this option is not specified, you can still use some of the
1201 features of newer standards in so far as they do not conflict with
1202 previous C standards.  For example, you may use @code{__restrict__} even
1203 when @option{-std=c99} is not specified.
1205 The @option{-std} options specifying some version of ISO C have the same
1206 effects as @option{-ansi}, except that features that were not in ISO C90
1207 but are in the specified version (for example, @samp{//} comments and
1208 the @code{inline} keyword in ISO C99) are not disabled.
1210 @xref{Standards,,Language Standards Supported by GCC}, for details of
1211 these standard versions.
1213 @item -aux-info @var{filename}
1214 @opindex aux-info
1215 Output to the given filename prototyped declarations for all functions
1216 declared and/or defined in a translation unit, including those in header
1217 files.  This option is silently ignored in any language other than C@.
1219 Besides declarations, the file indicates, in comments, the origin of
1220 each declaration (source file and line), whether the declaration was
1221 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1222 @samp{O} for old, respectively, in the first character after the line
1223 number and the colon), and whether it came from a declaration or a
1224 definition (@samp{C} or @samp{F}, respectively, in the following
1225 character).  In the case of function definitions, a K&R-style list of
1226 arguments followed by their declarations is also provided, inside
1227 comments, after the declaration.
1229 @item -fno-asm
1230 @opindex fno-asm
1231 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1232 keyword, so that code can use these words as identifiers.  You can use
1233 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1234 instead.  @option{-ansi} implies @option{-fno-asm}.
1236 In C++, this switch only affects the @code{typeof} keyword, since
1237 @code{asm} and @code{inline} are standard keywords.  You may want to
1238 use the @option{-fno-gnu-keywords} flag instead, which has the same
1239 effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1240 switch only affects the @code{asm} and @code{typeof} keywords, since
1241 @code{inline} is a standard keyword in ISO C99.
1243 @item -fno-builtin
1244 @itemx -fno-builtin-@var{function}
1245 @opindex fno-builtin
1246 @cindex built-in functions
1247 Don't recognize built-in functions that do not begin with
1248 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
1249 functions provided by GCC}, for details of the functions affected,
1250 including those which are not built-in functions when @option{-ansi} or
1251 @option{-std} options for strict ISO C conformance are used because they
1252 do not have an ISO standard meaning.
1254 GCC normally generates special code to handle certain built-in functions
1255 more efficiently; for instance, calls to @code{alloca} may become single
1256 instructions that adjust the stack directly, and calls to @code{memcpy}
1257 may become inline copy loops.  The resulting code is often both smaller
1258 and faster, but since the function calls no longer appear as such, you
1259 cannot set a breakpoint on those calls, nor can you change the behavior
1260 of the functions by linking with a different library.  In addition,
1261 when a function is recognized as a built-in function, GCC may use
1262 information about that function to warn about problems with calls to
1263 that function, or to generate more efficient code, even if the
1264 resulting code still contains calls to that function.  For example,
1265 warnings are given with @option{-Wformat} for bad calls to
1266 @code{printf}, when @code{printf} is built in, and @code{strlen} is
1267 known not to modify global memory.
1269 With the @option{-fno-builtin-@var{function}} option
1270 only the built-in function @var{function} is
1271 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
1272 function is named this is not built-in in this version of GCC, this
1273 option is ignored.  There is no corresponding
1274 @option{-fbuiltin-@var{function}} option; if you wish to enable
1275 built-in functions selectively when using @option{-fno-builtin} or
1276 @option{-ffreestanding}, you may define macros such as:
1278 @smallexample
1279 #define abs(n)          __builtin_abs ((n))
1280 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
1281 @end smallexample
1283 @item -fhosted
1284 @opindex fhosted
1285 @cindex hosted environment
1287 Assert that compilation takes place in a hosted environment.  This implies
1288 @option{-fbuiltin}.  A hosted environment is one in which the
1289 entire standard library is available, and in which @code{main} has a return
1290 type of @code{int}.  Examples are nearly everything except a kernel.
1291 This is equivalent to @option{-fno-freestanding}.
1293 @item -ffreestanding
1294 @opindex ffreestanding
1295 @cindex hosted environment
1297 Assert that compilation takes place in a freestanding environment.  This
1298 implies @option{-fno-builtin}.  A freestanding environment
1299 is one in which the standard library may not exist, and program startup may
1300 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
1301 This is equivalent to @option{-fno-hosted}.
1303 @xref{Standards,,Language Standards Supported by GCC}, for details of
1304 freestanding and hosted environments.
1306 @item -fopenmp
1307 @opindex fopenmp
1308 @cindex openmp parallel
1309 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1310 @code{!$omp} in Fortran.  When @option{-fopenmp} is specified, the
1311 compiler generates parallel code according to the OpenMP Application
1312 Program Interface v2.5 @w{@uref{http://www.openmp.org/}}.
1314 @item -fms-extensions
1315 @opindex fms-extensions
1316 Accept some non-standard constructs used in Microsoft header files.
1318 Some cases of unnamed fields in structures and unions are only
1319 accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
1320 fields within structs/unions}, for details.
1322 @item -trigraphs
1323 @opindex trigraphs
1324 Support ISO C trigraphs.  The @option{-ansi} option (and @option{-std}
1325 options for strict ISO C conformance) implies @option{-trigraphs}.
1327 @item -no-integrated-cpp
1328 @opindex no-integrated-cpp
1329 Performs a compilation in two passes: preprocessing and compiling.  This
1330 option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1331 @option{-B} option.  The user supplied compilation step can then add in
1332 an additional preprocessing step after normal preprocessing but before
1333 compiling.  The default is to use the integrated cpp (internal cpp)
1335 The semantics of this option will change if "cc1", "cc1plus", and
1336 "cc1obj" are merged.
1338 @cindex traditional C language
1339 @cindex C language, traditional
1340 @item -traditional
1341 @itemx -traditional-cpp
1342 @opindex traditional-cpp
1343 @opindex traditional
1344 Formerly, these options caused GCC to attempt to emulate a pre-standard
1345 C compiler.  They are now only supported with the @option{-E} switch.
1346 The preprocessor continues to support a pre-standard mode.  See the GNU
1347 CPP manual for details.
1349 @item -fcond-mismatch
1350 @opindex fcond-mismatch
1351 Allow conditional expressions with mismatched types in the second and
1352 third arguments.  The value of such an expression is void.  This option
1353 is not supported for C++.
1355 @item -funsigned-char
1356 @opindex funsigned-char
1357 Let the type @code{char} be unsigned, like @code{unsigned char}.
1359 Each kind of machine has a default for what @code{char} should
1360 be.  It is either like @code{unsigned char} by default or like
1361 @code{signed char} by default.
1363 Ideally, a portable program should always use @code{signed char} or
1364 @code{unsigned char} when it depends on the signedness of an object.
1365 But many programs have been written to use plain @code{char} and
1366 expect it to be signed, or expect it to be unsigned, depending on the
1367 machines they were written for.  This option, and its inverse, let you
1368 make such a program work with the opposite default.
1370 The type @code{char} is always a distinct type from each of
1371 @code{signed char} or @code{unsigned char}, even though its behavior
1372 is always just like one of those two.
1374 @item -fsigned-char
1375 @opindex fsigned-char
1376 Let the type @code{char} be signed, like @code{signed char}.
1378 Note that this is equivalent to @option{-fno-unsigned-char}, which is
1379 the negative form of @option{-funsigned-char}.  Likewise, the option
1380 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1382 @item -fsigned-bitfields
1383 @itemx -funsigned-bitfields
1384 @itemx -fno-signed-bitfields
1385 @itemx -fno-unsigned-bitfields
1386 @opindex fsigned-bitfields
1387 @opindex funsigned-bitfields
1388 @opindex fno-signed-bitfields
1389 @opindex fno-unsigned-bitfields
1390 These options control whether a bit-field is signed or unsigned, when the
1391 declaration does not use either @code{signed} or @code{unsigned}.  By
1392 default, such a bit-field is signed, because this is consistent: the
1393 basic integer types such as @code{int} are signed types.
1394 @end table
1396 @node C++ Dialect Options
1397 @section Options Controlling C++ Dialect
1399 @cindex compiler options, C++
1400 @cindex C++ options, command line
1401 @cindex options, C++
1402 This section describes the command-line options that are only meaningful
1403 for C++ programs; but you can also use most of the GNU compiler options
1404 regardless of what language your program is in.  For example, you
1405 might compile a file @code{firstClass.C} like this:
1407 @smallexample
1408 g++ -g -frepo -O -c firstClass.C
1409 @end smallexample
1411 @noindent
1412 In this example, only @option{-frepo} is an option meant
1413 only for C++ programs; you can use the other options with any
1414 language supported by GCC@.
1416 Here is a list of options that are @emph{only} for compiling C++ programs:
1418 @table @gcctabopt
1420 @item -fabi-version=@var{n}
1421 @opindex fabi-version
1422 Use version @var{n} of the C++ ABI@.  Version 2 is the version of the
1423 C++ ABI that first appeared in G++ 3.4.  Version 1 is the version of
1424 the C++ ABI that first appeared in G++ 3.2.  Version 0 will always be
1425 the version that conforms most closely to the C++ ABI specification.
1426 Therefore, the ABI obtained using version 0 will change as ABI bugs
1427 are fixed.
1429 The default is version 2.
1431 @item -fno-access-control
1432 @opindex fno-access-control
1433 Turn off all access checking.  This switch is mainly useful for working
1434 around bugs in the access control code.
1436 @item -fcheck-new
1437 @opindex fcheck-new
1438 Check that the pointer returned by @code{operator new} is non-null
1439 before attempting to modify the storage allocated.  This check is
1440 normally unnecessary because the C++ standard specifies that
1441 @code{operator new} will only return @code{0} if it is declared
1442 @samp{throw()}, in which case the compiler will always check the
1443 return value even without this option.  In all other cases, when
1444 @code{operator new} has a non-empty exception specification, memory
1445 exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
1446 @samp{new (nothrow)}.
1448 @item -fconserve-space
1449 @opindex fconserve-space
1450 Put uninitialized or runtime-initialized global variables into the
1451 common segment, as C does.  This saves space in the executable at the
1452 cost of not diagnosing duplicate definitions.  If you compile with this
1453 flag and your program mysteriously crashes after @code{main()} has
1454 completed, you may have an object that is being destroyed twice because
1455 two definitions were merged.
1457 This option is no longer useful on most targets, now that support has
1458 been added for putting variables into BSS without making them common.
1460 @item -ffriend-injection
1461 @opindex ffriend-injection
1462 Inject friend functions into the enclosing namespace, so that they are
1463 visible outside the scope of the class in which they are declared.
1464 Friend functions were documented to work this way in the old Annotated
1465 C++ Reference Manual, and versions of G++ before 4.1 always worked
1466 that way.  However, in ISO C++ a friend function which is not declared
1467 in an enclosing scope can only be found using argument dependent
1468 lookup.  This option causes friends to be injected as they were in
1469 earlier releases.
1471 This option is for compatibility, and may be removed in a future
1472 release of G++.
1474 @item -fno-elide-constructors
1475 @opindex fno-elide-constructors
1476 The C++ standard allows an implementation to omit creating a temporary
1477 which is only used to initialize another object of the same type.
1478 Specifying this option disables that optimization, and forces G++ to
1479 call the copy constructor in all cases.
1481 @item -fno-enforce-eh-specs
1482 @opindex fno-enforce-eh-specs
1483 Don't generate code to check for violation of exception specifications
1484 at runtime.  This option violates the C++ standard, but may be useful
1485 for reducing code size in production builds, much like defining
1486 @samp{NDEBUG}.  This does not give user code permission to throw
1487 exceptions in violation of the exception specifications; the compiler
1488 will still optimize based on the specifications, so throwing an
1489 unexpected exception will result in undefined behavior.
1491 @item -ffor-scope
1492 @itemx -fno-for-scope
1493 @opindex ffor-scope
1494 @opindex fno-for-scope
1495 If @option{-ffor-scope} is specified, the scope of variables declared in
1496 a @i{for-init-statement} is limited to the @samp{for} loop itself,
1497 as specified by the C++ standard.
1498 If @option{-fno-for-scope} is specified, the scope of variables declared in
1499 a @i{for-init-statement} extends to the end of the enclosing scope,
1500 as was the case in old versions of G++, and other (traditional)
1501 implementations of C++.
1503 The default if neither flag is given to follow the standard,
1504 but to allow and give a warning for old-style code that would
1505 otherwise be invalid, or have different behavior.
1507 @item -fno-gnu-keywords
1508 @opindex fno-gnu-keywords
1509 Do not recognize @code{typeof} as a keyword, so that code can use this
1510 word as an identifier.  You can use the keyword @code{__typeof__} instead.
1511 @option{-ansi} implies @option{-fno-gnu-keywords}.
1513 @item -fno-implicit-templates
1514 @opindex fno-implicit-templates
1515 Never emit code for non-inline templates which are instantiated
1516 implicitly (i.e.@: by use); only emit code for explicit instantiations.
1517 @xref{Template Instantiation}, for more information.
1519 @item -fno-implicit-inline-templates
1520 @opindex fno-implicit-inline-templates
1521 Don't emit code for implicit instantiations of inline templates, either.
1522 The default is to handle inlines differently so that compiles with and
1523 without optimization will need the same set of explicit instantiations.
1525 @item -fno-implement-inlines
1526 @opindex fno-implement-inlines
1527 To save space, do not emit out-of-line copies of inline functions
1528 controlled by @samp{#pragma implementation}.  This will cause linker
1529 errors if these functions are not inlined everywhere they are called.
1531 @item -fms-extensions
1532 @opindex fms-extensions
1533 Disable pedantic warnings about constructs used in MFC, such as implicit
1534 int and getting a pointer to member function via non-standard syntax.
1536 @item -fno-nonansi-builtins
1537 @opindex fno-nonansi-builtins
1538 Disable built-in declarations of functions that are not mandated by
1539 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
1540 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
1542 @item -fno-operator-names
1543 @opindex fno-operator-names
1544 Do not treat the operator name keywords @code{and}, @code{bitand},
1545 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1546 synonyms as keywords.
1548 @item -fno-optional-diags
1549 @opindex fno-optional-diags
1550 Disable diagnostics that the standard says a compiler does not need to
1551 issue.  Currently, the only such diagnostic issued by G++ is the one for
1552 a name having multiple meanings within a class.
1554 @item -fpermissive
1555 @opindex fpermissive
1556 Downgrade some diagnostics about nonconformant code from errors to
1557 warnings.  Thus, using @option{-fpermissive} will allow some
1558 nonconforming code to compile.
1560 @item -frepo
1561 @opindex frepo
1562 Enable automatic template instantiation at link time.  This option also
1563 implies @option{-fno-implicit-templates}.  @xref{Template
1564 Instantiation}, for more information.
1566 @item -fno-rtti
1567 @opindex fno-rtti
1568 Disable generation of information about every class with virtual
1569 functions for use by the C++ runtime type identification features
1570 (@samp{dynamic_cast} and @samp{typeid}).  If you don't use those parts
1571 of the language, you can save some space by using this flag.  Note that
1572 exception handling uses the same information, but it will generate it as
1573 needed.
1575 @item -fstats
1576 @opindex fstats
1577 Emit statistics about front-end processing at the end of the compilation.
1578 This information is generally only useful to the G++ development team.
1580 @item -ftemplate-depth-@var{n}
1581 @opindex ftemplate-depth
1582 Set the maximum instantiation depth for template classes to @var{n}.
1583 A limit on the template instantiation depth is needed to detect
1584 endless recursions during template class instantiation.  ANSI/ISO C++
1585 conforming programs must not rely on a maximum depth greater than 17.
1587 @item -fno-threadsafe-statics
1588 @opindex fno-threadsafe-statics
1589 Do not emit the extra code to use the routines specified in the C++
1590 ABI for thread-safe initialization of local statics.  You can use this
1591 option to reduce code size slightly in code that doesn't need to be
1592 thread-safe.
1594 @item -fuse-cxa-atexit
1595 @opindex fuse-cxa-atexit
1596 Register destructors for objects with static storage duration with the
1597 @code{__cxa_atexit} function rather than the @code{atexit} function.
1598 This option is required for fully standards-compliant handling of static
1599 destructors, but will only work if your C library supports
1600 @code{__cxa_atexit}.
1602 @item -fno-use-cxa-get-exception-ptr
1603 @opindex fno-use-cxa-get-exception-ptr
1604 Don't use the @code{__cxa_get_exception_ptr} runtime routine.  This
1605 will cause @code{std::uncaught_exception} to be incorrect, but is necessary
1606 if the runtime routine is not available.
1608 @item -fvisibility-inlines-hidden
1609 @opindex fvisibility-inlines-hidden
1610 This switch declares that the user does not attempt to compare
1611 pointers to inline methods where the addresses of the two functions
1612 were taken in different shared objects.
1614 The effect of this is that GCC may, effectively, mark inline methods with
1615 @code{__attribute__ ((visibility ("hidden")))} so that they do not
1616 appear in the export table of a DSO and do not require a PLT indirection
1617 when used within the DSO@.  Enabling this option can have a dramatic effect
1618 on load and link times of a DSO as it massively reduces the size of the
1619 dynamic export table when the library makes heavy use of templates.
1621 The behaviour of this switch is not quite the same as marking the
1622 methods as hidden directly, because it does not affect static variables
1623 local to the function or cause the compiler to deduce that
1624 the function is defined in only one shared object.
1626 You may mark a method as having a visibility explicitly to negate the
1627 effect of the switch for that method.  For example, if you do want to
1628 compare pointers to a particular inline method, you might mark it as
1629 having default visibility.
1631 @item -fno-weak
1632 @opindex fno-weak
1633 Do not use weak symbol support, even if it is provided by the linker.
1634 By default, G++ will use weak symbols if they are available.  This
1635 option exists only for testing, and should not be used by end-users;
1636 it will result in inferior code and has no benefits.  This option may
1637 be removed in a future release of G++.
1639 @item -nostdinc++
1640 @opindex nostdinc++
1641 Do not search for header files in the standard directories specific to
1642 C++, but do still search the other standard directories.  (This option
1643 is used when building the C++ library.)
1644 @end table
1646 In addition, these optimization, warning, and code generation options
1647 have meanings only for C++ programs:
1649 @table @gcctabopt
1650 @item -fno-default-inline
1651 @opindex fno-default-inline
1652 Do not assume @samp{inline} for functions defined inside a class scope.
1653 @xref{Optimize Options,,Options That Control Optimization}.  Note that these
1654 functions will have linkage like inline functions; they just won't be
1655 inlined by default.
1657 @item -Wabi @r{(C++ only)}
1658 @opindex Wabi
1659 Warn when G++ generates code that is probably not compatible with the
1660 vendor-neutral C++ ABI@.  Although an effort has been made to warn about
1661 all such cases, there are probably some cases that are not warned about,
1662 even though G++ is generating incompatible code.  There may also be
1663 cases where warnings are emitted even though the code that is generated
1664 will be compatible.
1666 You should rewrite your code to avoid these warnings if you are
1667 concerned about the fact that code generated by G++ may not be binary
1668 compatible with code generated by other compilers.
1670 The known incompatibilities at this point include:
1672 @itemize @bullet
1674 @item
1675 Incorrect handling of tail-padding for bit-fields.  G++ may attempt to
1676 pack data into the same byte as a base class.  For example:
1678 @smallexample
1679 struct A @{ virtual void f(); int f1 : 1; @};
1680 struct B : public A @{ int f2 : 1; @};
1681 @end smallexample
1683 @noindent
1684 In this case, G++ will place @code{B::f2} into the same byte
1685 as@code{A::f1}; other compilers will not.  You can avoid this problem
1686 by explicitly padding @code{A} so that its size is a multiple of the
1687 byte size on your platform; that will cause G++ and other compilers to
1688 layout @code{B} identically.
1690 @item
1691 Incorrect handling of tail-padding for virtual bases.  G++ does not use
1692 tail padding when laying out virtual bases.  For example:
1694 @smallexample
1695 struct A @{ virtual void f(); char c1; @};
1696 struct B @{ B(); char c2; @};
1697 struct C : public A, public virtual B @{@};
1698 @end smallexample
1700 @noindent
1701 In this case, G++ will not place @code{B} into the tail-padding for
1702 @code{A}; other compilers will.  You can avoid this problem by
1703 explicitly padding @code{A} so that its size is a multiple of its
1704 alignment (ignoring virtual base classes); that will cause G++ and other
1705 compilers to layout @code{C} identically.
1707 @item
1708 Incorrect handling of bit-fields with declared widths greater than that
1709 of their underlying types, when the bit-fields appear in a union.  For
1710 example:
1712 @smallexample
1713 union U @{ int i : 4096; @};
1714 @end smallexample
1716 @noindent
1717 Assuming that an @code{int} does not have 4096 bits, G++ will make the
1718 union too small by the number of bits in an @code{int}.
1720 @item
1721 Empty classes can be placed at incorrect offsets.  For example:
1723 @smallexample
1724 struct A @{@};
1726 struct B @{
1727   A a;
1728   virtual void f ();
1731 struct C : public B, public A @{@};
1732 @end smallexample
1734 @noindent
1735 G++ will place the @code{A} base class of @code{C} at a nonzero offset;
1736 it should be placed at offset zero.  G++ mistakenly believes that the
1737 @code{A} data member of @code{B} is already at offset zero.
1739 @item
1740 Names of template functions whose types involve @code{typename} or
1741 template template parameters can be mangled incorrectly.
1743 @smallexample
1744 template <typename Q>
1745 void f(typename Q::X) @{@}
1747 template <template <typename> class Q>
1748 void f(typename Q<int>::X) @{@}
1749 @end smallexample
1751 @noindent
1752 Instantiations of these templates may be mangled incorrectly.
1754 @end itemize
1756 @item -Wctor-dtor-privacy @r{(C++ only)}
1757 @opindex Wctor-dtor-privacy
1758 Warn when a class seems unusable because all the constructors or
1759 destructors in that class are private, and it has neither friends nor
1760 public static member functions.
1762 @item -Wnon-virtual-dtor @r{(C++ only)}
1763 @opindex Wnon-virtual-dtor
1764 Warn when a class appears to be polymorphic, thereby requiring a virtual
1765 destructor, yet it declares a non-virtual one.  This warning is also
1766 enabled if -Weffc++ is specified.
1768 @item -Wreorder @r{(C++ only)}
1769 @opindex Wreorder
1770 @cindex reordering, warning
1771 @cindex warning for reordering of member initializers
1772 Warn when the order of member initializers given in the code does not
1773 match the order in which they must be executed.  For instance:
1775 @smallexample
1776 struct A @{
1777   int i;
1778   int j;
1779   A(): j (0), i (1) @{ @}
1781 @end smallexample
1783 The compiler will rearrange the member initializers for @samp{i}
1784 and @samp{j} to match the declaration order of the members, emitting
1785 a warning to that effect.  This warning is enabled by @option{-Wall}.
1786 @end table
1788 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
1790 @table @gcctabopt
1791 @item -Weffc++ @r{(C++ only)}
1792 @opindex Weffc++
1793 Warn about violations of the following style guidelines from Scott Meyers'
1794 @cite{Effective C++} book:
1796 @itemize @bullet
1797 @item
1798 Item 11:  Define a copy constructor and an assignment operator for classes
1799 with dynamically allocated memory.
1801 @item
1802 Item 12:  Prefer initialization to assignment in constructors.
1804 @item
1805 Item 14:  Make destructors virtual in base classes.
1807 @item
1808 Item 15:  Have @code{operator=} return a reference to @code{*this}.
1810 @item
1811 Item 23:  Don't try to return a reference when you must return an object.
1813 @end itemize
1815 Also warn about violations of the following style guidelines from
1816 Scott Meyers' @cite{More Effective C++} book:
1818 @itemize @bullet
1819 @item
1820 Item 6:  Distinguish between prefix and postfix forms of increment and
1821 decrement operators.
1823 @item
1824 Item 7:  Never overload @code{&&}, @code{||}, or @code{,}.
1826 @end itemize
1828 When selecting this option, be aware that the standard library
1829 headers do not obey all of these guidelines; use @samp{grep -v}
1830 to filter out those warnings.
1832 @item -Wno-deprecated @r{(C++ only)}
1833 @opindex Wno-deprecated
1834 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
1836 @item -Wstrict-null-sentinel @r{(C++ only)}
1837 @opindex Wstrict-null-sentinel
1838 Warn also about the use of an uncasted @code{NULL} as sentinel.  When
1839 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
1840 to @code{__null}.  Although it is a null pointer constant not a null pointer,
1841 it is guaranteed to of the same size as a pointer.  But this use is
1842 not portable across different compilers.
1844 @item -Wno-non-template-friend @r{(C++ only)}
1845 @opindex Wno-non-template-friend
1846 Disable warnings when non-templatized friend functions are declared
1847 within a template.  Since the advent of explicit template specification
1848 support in G++, if the name of the friend is an unqualified-id (i.e.,
1849 @samp{friend foo(int)}), the C++ language specification demands that the
1850 friend declare or define an ordinary, nontemplate function.  (Section
1851 14.5.3).  Before G++ implemented explicit specification, unqualified-ids
1852 could be interpreted as a particular specialization of a templatized
1853 function.  Because this non-conforming behavior is no longer the default
1854 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
1855 check existing code for potential trouble spots and is on by default.
1856 This new compiler behavior can be turned off with
1857 @option{-Wno-non-template-friend} which keeps the conformant compiler code
1858 but disables the helpful warning.
1860 @item -Wold-style-cast @r{(C++ only)}
1861 @opindex Wold-style-cast
1862 Warn if an old-style (C-style) cast to a non-void type is used within
1863 a C++ program.  The new-style casts (@samp{dynamic_cast},
1864 @samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are
1865 less vulnerable to unintended effects and much easier to search for.
1867 @item -Woverloaded-virtual @r{(C++ only)}
1868 @opindex Woverloaded-virtual
1869 @cindex overloaded virtual fn, warning
1870 @cindex warning for overloaded virtual fn
1871 Warn when a function declaration hides virtual functions from a
1872 base class.  For example, in:
1874 @smallexample
1875 struct A @{
1876   virtual void f();
1879 struct B: public A @{
1880   void f(int);
1882 @end smallexample
1884 the @code{A} class version of @code{f} is hidden in @code{B}, and code
1885 like:
1887 @smallexample
1888 B* b;
1889 b->f();
1890 @end smallexample
1892 will fail to compile.
1894 @item -Wno-pmf-conversions @r{(C++ only)}
1895 @opindex Wno-pmf-conversions
1896 Disable the diagnostic for converting a bound pointer to member function
1897 to a plain pointer.
1899 @item -Wsign-promo @r{(C++ only)}
1900 @opindex Wsign-promo
1901 Warn when overload resolution chooses a promotion from unsigned or
1902 enumerated type to a signed type, over a conversion to an unsigned type of
1903 the same size.  Previous versions of G++ would try to preserve
1904 unsignedness, but the standard mandates the current behavior.
1906 @smallexample
1907 struct A @{
1908   operator int ();
1909   A& operator = (int);
1912 main ()
1914   A a,b;
1915   a = b;
1917 @end smallexample
1919 In this example, G++ will synthesize a default @samp{A& operator =
1920 (const A&);}, while cfront will use the user-defined @samp{operator =}.
1921 @end table
1923 @node Objective-C and Objective-C++ Dialect Options
1924 @section Options Controlling Objective-C and Objective-C++ Dialects
1926 @cindex compiler options, Objective-C and Objective-C++
1927 @cindex Objective-C and Objective-C++ options, command line
1928 @cindex options, Objective-C and Objective-C++
1929 (NOTE: This manual does not describe the Objective-C and Objective-C++
1930 languages themselves.  See @xref{Standards,,Language Standards
1931 Supported by GCC}, for references.)
1933 This section describes the command-line options that are only meaningful
1934 for Objective-C and Objective-C++ programs, but you can also use most of
1935 the language-independent GNU compiler options.
1936 For example, you might compile a file @code{some_class.m} like this:
1938 @smallexample
1939 gcc -g -fgnu-runtime -O -c some_class.m
1940 @end smallexample
1942 @noindent
1943 In this example, @option{-fgnu-runtime} is an option meant only for
1944 Objective-C and Objective-C++ programs; you can use the other options with
1945 any language supported by GCC@.
1947 Note that since Objective-C is an extension of the C language, Objective-C
1948 compilations may also use options specific to the C front-end (e.g.,
1949 @option{-Wtraditional}).  Similarly, Objective-C++ compilations may use
1950 C++-specific options (e.g., @option{-Wabi}).
1952 Here is a list of options that are @emph{only} for compiling Objective-C
1953 and Objective-C++ programs:
1955 @table @gcctabopt
1956 @item -fconstant-string-class=@var{class-name}
1957 @opindex fconstant-string-class
1958 Use @var{class-name} as the name of the class to instantiate for each
1959 literal string specified with the syntax @code{@@"@dots{}"}.  The default
1960 class name is @code{NXConstantString} if the GNU runtime is being used, and
1961 @code{NSConstantString} if the NeXT runtime is being used (see below).  The
1962 @option{-fconstant-cfstrings} option, if also present, will override the
1963 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
1964 to be laid out as constant CoreFoundation strings.
1966 @item -fgnu-runtime
1967 @opindex fgnu-runtime
1968 Generate object code compatible with the standard GNU Objective-C
1969 runtime.  This is the default for most types of systems.
1971 @item -fnext-runtime
1972 @opindex fnext-runtime
1973 Generate output compatible with the NeXT runtime.  This is the default
1974 for NeXT-based systems, including Darwin and Mac OS X@.  The macro
1975 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
1976 used.
1978 @item -fno-nil-receivers
1979 @opindex fno-nil-receivers
1980 Assume that all Objective-C message dispatches (e.g.,
1981 @code{[receiver message:arg]}) in this translation unit ensure that the receiver
1982 is not @code{nil}.  This allows for more efficient entry points in the runtime
1983 to be used.  Currently, this option is only available in conjunction with
1984 the NeXT runtime on Mac OS X 10.3 and later.
1986 @item -fobjc-call-cxx-cdtors
1987 @opindex fobjc-call-cxx-cdtors
1988 For each Objective-C class, check if any of its instance variables is a
1989 C++ object with a non-trivial default constructor.  If so, synthesize a
1990 special @code{- (id) .cxx_construct} instance method that will run
1991 non-trivial default constructors on any such instance variables, in order,
1992 and then return @code{self}.  Similarly, check if any instance variable
1993 is a C++ object with a non-trivial destructor, and if so, synthesize a
1994 special @code{- (void) .cxx_destruct} method that will run
1995 all such default destructors, in reverse order.
1997 The @code{- (id) .cxx_construct} and/or @code{- (void) .cxx_destruct} methods
1998 thusly generated will only operate on instance variables declared in the
1999 current Objective-C class, and not those inherited from superclasses.  It
2000 is the responsibility of the Objective-C runtime to invoke all such methods
2001 in an object's inheritance hierarchy.  The @code{- (id) .cxx_construct} methods
2002 will be invoked by the runtime immediately after a new object
2003 instance is allocated; the @code{- (void) .cxx_destruct} methods will
2004 be invoked immediately before the runtime deallocates an object instance.
2006 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
2007 support for invoking the @code{- (id) .cxx_construct} and
2008 @code{- (void) .cxx_destruct} methods.
2010 @item -fobjc-direct-dispatch
2011 @opindex fobjc-direct-dispatch
2012 Allow fast jumps to the message dispatcher.  On Darwin this is
2013 accomplished via the comm page.
2015 @item -fobjc-exceptions
2016 @opindex fobjc-exceptions
2017 Enable syntactic support for structured exception handling in Objective-C,
2018 similar to what is offered by C++ and Java.  This option is
2019 unavailable in conjunction with the NeXT runtime on Mac OS X 10.2 and
2020 earlier.
2022 @smallexample
2023   @@try @{
2024     @dots{}
2025        @@throw expr;
2026     @dots{}
2027   @}
2028   @@catch (AnObjCClass *exc) @{
2029     @dots{}
2030       @@throw expr;
2031     @dots{}
2032       @@throw;
2033     @dots{}
2034   @}
2035   @@catch (AnotherClass *exc) @{
2036     @dots{}
2037   @}
2038   @@catch (id allOthers) @{
2039     @dots{}
2040   @}
2041   @@finally @{
2042     @dots{}
2043       @@throw expr;
2044     @dots{}
2045   @}
2046 @end smallexample
2048 The @code{@@throw} statement may appear anywhere in an Objective-C or
2049 Objective-C++ program; when used inside of a @code{@@catch} block, the
2050 @code{@@throw} may appear without an argument (as shown above), in which case
2051 the object caught by the @code{@@catch} will be rethrown.
2053 Note that only (pointers to) Objective-C objects may be thrown and
2054 caught using this scheme.  When an object is thrown, it will be caught
2055 by the nearest @code{@@catch} clause capable of handling objects of that type,
2056 analogously to how @code{catch} blocks work in C++ and Java.  A
2057 @code{@@catch(id @dots{})} clause (as shown above) may also be provided to catch
2058 any and all Objective-C exceptions not caught by previous @code{@@catch}
2059 clauses (if any).
2061 The @code{@@finally} clause, if present, will be executed upon exit from the
2062 immediately preceding @code{@@try @dots{} @@catch} section.  This will happen
2063 regardless of whether any exceptions are thrown, caught or rethrown
2064 inside the @code{@@try @dots{} @@catch} section, analogously to the behavior
2065 of the @code{finally} clause in Java.
2067 There are several caveats to using the new exception mechanism:
2069 @itemize @bullet
2070 @item
2071 Although currently designed to be binary compatible with @code{NS_HANDLER}-style
2072 idioms provided by the @code{NSException} class, the new
2073 exceptions can only be used on Mac OS X 10.3 (Panther) and later
2074 systems, due to additional functionality needed in the (NeXT) Objective-C
2075 runtime.
2077 @item
2078 As mentioned above, the new exceptions do not support handling
2079 types other than Objective-C objects.   Furthermore, when used from
2080 Objective-C++, the Objective-C exception model does not interoperate with C++
2081 exceptions at this time.  This means you cannot @code{@@throw} an exception
2082 from Objective-C and @code{catch} it in C++, or vice versa
2083 (i.e., @code{throw @dots{} @@catch}).
2084 @end itemize
2086 The @option{-fobjc-exceptions} switch also enables the use of synchronization
2087 blocks for thread-safe execution:
2089 @smallexample
2090   @@synchronized (ObjCClass *guard) @{
2091     @dots{}
2092   @}
2093 @end smallexample
2095 Upon entering the @code{@@synchronized} block, a thread of execution shall
2096 first check whether a lock has been placed on the corresponding @code{guard}
2097 object by another thread.  If it has, the current thread shall wait until
2098 the other thread relinquishes its lock.  Once @code{guard} becomes available,
2099 the current thread will place its own lock on it, execute the code contained in
2100 the @code{@@synchronized} block, and finally relinquish the lock (thereby
2101 making @code{guard} available to other threads).
2103 Unlike Java, Objective-C does not allow for entire methods to be marked
2104 @code{@@synchronized}.  Note that throwing exceptions out of
2105 @code{@@synchronized} blocks is allowed, and will cause the guarding object
2106 to be unlocked properly.
2108 @item -fobjc-gc
2109 @opindex fobjc-gc
2110 Enable garbage collection (GC) in Objective-C and Objective-C++ programs.
2112 @item -freplace-objc-classes
2113 @opindex freplace-objc-classes
2114 Emit a special marker instructing @command{ld(1)} not to statically link in
2115 the resulting object file, and allow @command{dyld(1)} to load it in at
2116 run time instead.  This is used in conjunction with the Fix-and-Continue
2117 debugging mode, where the object file in question may be recompiled and
2118 dynamically reloaded in the course of program execution, without the need
2119 to restart the program itself.  Currently, Fix-and-Continue functionality
2120 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
2121 and later.
2123 @item -fzero-link
2124 @opindex fzero-link
2125 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
2126 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
2127 compile time) with static class references that get initialized at load time,
2128 which improves run-time performance.  Specifying the @option{-fzero-link} flag
2129 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
2130 to be retained.  This is useful in Zero-Link debugging mode, since it allows
2131 for individual class implementations to be modified during program execution.
2133 @item -gen-decls
2134 @opindex gen-decls
2135 Dump interface declarations for all classes seen in the source file to a
2136 file named @file{@var{sourcename}.decl}.
2138 @item -Wassign-intercept
2139 @opindex Wassign-intercept
2140 Warn whenever an Objective-C assignment is being intercepted by the
2141 garbage collector.
2143 @item -Wno-protocol
2144 @opindex Wno-protocol
2145 If a class is declared to implement a protocol, a warning is issued for
2146 every method in the protocol that is not implemented by the class.  The
2147 default behavior is to issue a warning for every method not explicitly
2148 implemented in the class, even if a method implementation is inherited
2149 from the superclass.  If you use the @option{-Wno-protocol} option, then
2150 methods inherited from the superclass are considered to be implemented,
2151 and no warning is issued for them.
2153 @item -Wselector
2154 @opindex Wselector
2155 Warn if multiple methods of different types for the same selector are
2156 found during compilation.  The check is performed on the list of methods
2157 in the final stage of compilation.  Additionally, a check is performed
2158 for each selector appearing in a @code{@@selector(@dots{})}
2159 expression, and a corresponding method for that selector has been found
2160 during compilation.  Because these checks scan the method table only at
2161 the end of compilation, these warnings are not produced if the final
2162 stage of compilation is not reached, for example because an error is
2163 found during compilation, or because the @option{-fsyntax-only} option is
2164 being used.
2166 @item -Wstrict-selector-match
2167 @opindex Wstrict-selector-match
2168 Warn if multiple methods with differing argument and/or return types are
2169 found for a given selector when attempting to send a message using this
2170 selector to a receiver of type @code{id} or @code{Class}.  When this flag
2171 is off (which is the default behavior), the compiler will omit such warnings
2172 if any differences found are confined to types which share the same size
2173 and alignment.
2175 @item -Wundeclared-selector
2176 @opindex Wundeclared-selector
2177 Warn if a @code{@@selector(@dots{})} expression referring to an
2178 undeclared selector is found.  A selector is considered undeclared if no
2179 method with that name has been declared before the
2180 @code{@@selector(@dots{})} expression, either explicitly in an
2181 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
2182 an @code{@@implementation} section.  This option always performs its
2183 checks as soon as a @code{@@selector(@dots{})} expression is found,
2184 while @option{-Wselector} only performs its checks in the final stage of
2185 compilation.  This also enforces the coding style convention
2186 that methods and selectors must be declared before being used.
2188 @item -print-objc-runtime-info
2189 @opindex print-objc-runtime-info
2190 Generate C header describing the largest structure that is passed by
2191 value, if any.
2193 @end table
2195 @node Language Independent Options
2196 @section Options to Control Diagnostic Messages Formatting
2197 @cindex options to control diagnostics formatting
2198 @cindex diagnostic messages
2199 @cindex message formatting
2201 Traditionally, diagnostic messages have been formatted irrespective of
2202 the output device's aspect (e.g.@: its width, @dots{}).  The options described
2203 below can be used to control the diagnostic messages formatting
2204 algorithm, e.g.@: how many characters per line, how often source location
2205 information should be reported.  Right now, only the C++ front end can
2206 honor these options.  However it is expected, in the near future, that
2207 the remaining front ends would be able to digest them correctly.
2209 @table @gcctabopt
2210 @item -fmessage-length=@var{n}
2211 @opindex fmessage-length
2212 Try to format error messages so that they fit on lines of about @var{n}
2213 characters.  The default is 72 characters for @command{g++} and 0 for the rest of
2214 the front ends supported by GCC@.  If @var{n} is zero, then no
2215 line-wrapping will be done; each error message will appear on a single
2216 line.
2218 @opindex fdiagnostics-show-location
2219 @item -fdiagnostics-show-location=once
2220 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
2221 reporter to emit @emph{once} source location information; that is, in
2222 case the message is too long to fit on a single physical line and has to
2223 be wrapped, the source location won't be emitted (as prefix) again,
2224 over and over, in subsequent continuation lines.  This is the default
2225 behavior.
2227 @item -fdiagnostics-show-location=every-line
2228 Only meaningful in line-wrapping mode.  Instructs the diagnostic
2229 messages reporter to emit the same source location information (as
2230 prefix) for physical lines that result from the process of breaking
2231 a message which is too long to fit on a single line.
2233 @item -fdiagnostics-show-options
2234 @opindex fdiagnostics-show-options
2235 This option instructs the diagnostic machinery to add text to each
2236 diagnostic emitted, which indicates which command line option directly
2237 controls that diagnostic, when such an option is known to the
2238 diagnostic machinery.
2240 @end table
2242 @node Warning Options
2243 @section Options to Request or Suppress Warnings
2244 @cindex options to control warnings
2245 @cindex warning messages
2246 @cindex messages, warning
2247 @cindex suppressing warnings
2249 Warnings are diagnostic messages that report constructions which
2250 are not inherently erroneous but which are risky or suggest there
2251 may have been an error.
2253 You can request many specific warnings with options beginning @samp{-W},
2254 for example @option{-Wimplicit} to request warnings on implicit
2255 declarations.  Each of these specific warning options also has a
2256 negative form beginning @samp{-Wno-} to turn off warnings;
2257 for example, @option{-Wno-implicit}.  This manual lists only one of the
2258 two forms, whichever is not the default.
2260 The following options control the amount and kinds of warnings produced
2261 by GCC; for further, language-specific options also refer to
2262 @ref{C++ Dialect Options} and @ref{Objective-C and Objective-C++ Dialect
2263 Options}.
2265 @table @gcctabopt
2266 @cindex syntax checking
2267 @item -fsyntax-only
2268 @opindex fsyntax-only
2269 Check the code for syntax errors, but don't do anything beyond that.
2271 @item -pedantic
2272 @opindex pedantic
2273 Issue all the warnings demanded by strict ISO C and ISO C++;
2274 reject all programs that use forbidden extensions, and some other
2275 programs that do not follow ISO C and ISO C++.  For ISO C, follows the
2276 version of the ISO C standard specified by any @option{-std} option used.
2278 Valid ISO C and ISO C++ programs should compile properly with or without
2279 this option (though a rare few will require @option{-ansi} or a
2280 @option{-std} option specifying the required version of ISO C)@.  However,
2281 without this option, certain GNU extensions and traditional C and C++
2282 features are supported as well.  With this option, they are rejected.
2284 @option{-pedantic} does not cause warning messages for use of the
2285 alternate keywords whose names begin and end with @samp{__}.  Pedantic
2286 warnings are also disabled in the expression that follows
2287 @code{__extension__}.  However, only system header files should use
2288 these escape routes; application programs should avoid them.
2289 @xref{Alternate Keywords}.
2291 Some users try to use @option{-pedantic} to check programs for strict ISO
2292 C conformance.  They soon find that it does not do quite what they want:
2293 it finds some non-ISO practices, but not all---only those for which
2294 ISO C @emph{requires} a diagnostic, and some others for which
2295 diagnostics have been added.
2297 A feature to report any failure to conform to ISO C might be useful in
2298 some instances, but would require considerable additional work and would
2299 be quite different from @option{-pedantic}.  We don't have plans to
2300 support such a feature in the near future.
2302 Where the standard specified with @option{-std} represents a GNU
2303 extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
2304 corresponding @dfn{base standard}, the version of ISO C on which the GNU
2305 extended dialect is based.  Warnings from @option{-pedantic} are given
2306 where they are required by the base standard.  (It would not make sense
2307 for such warnings to be given only for features not in the specified GNU
2308 C dialect, since by definition the GNU dialects of C include all
2309 features the compiler supports with the given option, and there would be
2310 nothing to warn about.)
2312 @item -pedantic-errors
2313 @opindex pedantic-errors
2314 Like @option{-pedantic}, except that errors are produced rather than
2315 warnings.
2317 @item -w
2318 @opindex w
2319 Inhibit all warning messages.
2321 @item -Wno-import
2322 @opindex Wno-import
2323 Inhibit warning messages about the use of @samp{#import}.
2325 @item -Wchar-subscripts
2326 @opindex Wchar-subscripts
2327 Warn if an array subscript has type @code{char}.  This is a common cause
2328 of error, as programmers often forget that this type is signed on some
2329 machines.
2330 This warning is enabled by @option{-Wall}.
2332 @item -Wcomment
2333 @opindex Wcomment
2334 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
2335 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
2336 This warning is enabled by @option{-Wall}.
2338 @item -Wfatal-errors
2339 @opindex Wfatal-errors
2340 This option causes the compiler to abort compilation on the first error
2341 occurred rather than trying to keep going and printing further error
2342 messages.
2344 @item -Wformat
2345 @opindex Wformat
2346 @opindex ffreestanding
2347 @opindex fno-builtin
2348 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
2349 the arguments supplied have types appropriate to the format string
2350 specified, and that the conversions specified in the format string make
2351 sense.  This includes standard functions, and others specified by format
2352 attributes (@pxref{Function Attributes}), in the @code{printf},
2353 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
2354 not in the C standard) families (or other target-specific families).
2355 Which functions are checked without format attributes having been
2356 specified depends on the standard version selected, and such checks of
2357 functions without the attribute specified are disabled by
2358 @option{-ffreestanding} or @option{-fno-builtin}.
2360 The formats are checked against the format features supported by GNU
2361 libc version 2.2.  These include all ISO C90 and C99 features, as well
2362 as features from the Single Unix Specification and some BSD and GNU
2363 extensions.  Other library implementations may not support all these
2364 features; GCC does not support warning about features that go beyond a
2365 particular library's limitations.  However, if @option{-pedantic} is used
2366 with @option{-Wformat}, warnings will be given about format features not
2367 in the selected standard version (but not for @code{strfmon} formats,
2368 since those are not in any version of the C standard).  @xref{C Dialect
2369 Options,,Options Controlling C Dialect}.
2371 Since @option{-Wformat} also checks for null format arguments for
2372 several functions, @option{-Wformat} also implies @option{-Wnonnull}.
2374 @option{-Wformat} is included in @option{-Wall}.  For more control over some
2375 aspects of format checking, the options @option{-Wformat-y2k},
2376 @option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
2377 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
2378 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
2380 @item -Wformat-y2k
2381 @opindex Wformat-y2k
2382 If @option{-Wformat} is specified, also warn about @code{strftime}
2383 formats which may yield only a two-digit year.
2385 @item -Wno-format-extra-args
2386 @opindex Wno-format-extra-args
2387 If @option{-Wformat} is specified, do not warn about excess arguments to a
2388 @code{printf} or @code{scanf} format function.  The C standard specifies
2389 that such arguments are ignored.
2391 Where the unused arguments lie between used arguments that are
2392 specified with @samp{$} operand number specifications, normally
2393 warnings are still given, since the implementation could not know what
2394 type to pass to @code{va_arg} to skip the unused arguments.  However,
2395 in the case of @code{scanf} formats, this option will suppress the
2396 warning if the unused arguments are all pointers, since the Single
2397 Unix Specification says that such unused arguments are allowed.
2399 @item -Wno-format-zero-length
2400 @opindex Wno-format-zero-length
2401 If @option{-Wformat} is specified, do not warn about zero-length formats.
2402 The C standard specifies that zero-length formats are allowed.
2404 @item -Wformat-nonliteral
2405 @opindex Wformat-nonliteral
2406 If @option{-Wformat} is specified, also warn if the format string is not a
2407 string literal and so cannot be checked, unless the format function
2408 takes its format arguments as a @code{va_list}.
2410 @item -Wformat-security
2411 @opindex Wformat-security
2412 If @option{-Wformat} is specified, also warn about uses of format
2413 functions that represent possible security problems.  At present, this
2414 warns about calls to @code{printf} and @code{scanf} functions where the
2415 format string is not a string literal and there are no format arguments,
2416 as in @code{printf (foo);}.  This may be a security hole if the format
2417 string came from untrusted input and contains @samp{%n}.  (This is
2418 currently a subset of what @option{-Wformat-nonliteral} warns about, but
2419 in future warnings may be added to @option{-Wformat-security} that are not
2420 included in @option{-Wformat-nonliteral}.)
2422 @item -Wformat=2
2423 @opindex Wformat=2
2424 Enable @option{-Wformat} plus format checks not included in
2425 @option{-Wformat}.  Currently equivalent to @samp{-Wformat
2426 -Wformat-nonliteral -Wformat-security -Wformat-y2k}.
2428 @item -Wnonnull
2429 @opindex Wnonnull
2430 Warn about passing a null pointer for arguments marked as
2431 requiring a non-null value by the @code{nonnull} function attribute.
2433 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
2434 can be disabled with the @option{-Wno-nonnull} option.
2436 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
2437 @opindex Winit-self
2438 Warn about uninitialized variables which are initialized with themselves.
2439 Note this option can only be used with the @option{-Wuninitialized} option,
2440 which in turn only works with @option{-O1} and above.
2442 For example, GCC will warn about @code{i} being uninitialized in the
2443 following snippet only when @option{-Winit-self} has been specified:
2444 @smallexample
2445 @group
2446 int f()
2448   int i = i;
2449   return i;
2451 @end group
2452 @end smallexample
2454 @item -Wimplicit-int
2455 @opindex Wimplicit-int
2456 Warn when a declaration does not specify a type.
2457 This warning is enabled by @option{-Wall}.
2459 @item -Wimplicit-function-declaration
2460 @itemx -Werror-implicit-function-declaration
2461 @opindex Wimplicit-function-declaration
2462 @opindex Werror-implicit-function-declaration
2463 Give a warning (or error) whenever a function is used before being
2464 declared.  The form @option{-Wno-error-implicit-function-declaration}
2465 is not supported.
2466 This warning is enabled by @option{-Wall} (as a warning, not an error).
2468 @item -Wimplicit
2469 @opindex Wimplicit
2470 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
2471 This warning is enabled by @option{-Wall}.
2473 @item -Wmain
2474 @opindex Wmain
2475 Warn if the type of @samp{main} is suspicious.  @samp{main} should be a
2476 function with external linkage, returning int, taking either zero
2477 arguments, two, or three arguments of appropriate types.
2478 This warning is enabled by @option{-Wall}.
2480 @item -Wmissing-braces
2481 @opindex Wmissing-braces
2482 Warn if an aggregate or union initializer is not fully bracketed.  In
2483 the following example, the initializer for @samp{a} is not fully
2484 bracketed, but that for @samp{b} is fully bracketed.
2486 @smallexample
2487 int a[2][2] = @{ 0, 1, 2, 3 @};
2488 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
2489 @end smallexample
2491 This warning is enabled by @option{-Wall}.
2493 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
2494 @opindex Wmissing-include-dirs
2495 Warn if a user-supplied include directory does not exist.
2497 @item -Wparentheses
2498 @opindex Wparentheses
2499 Warn if parentheses are omitted in certain contexts, such
2500 as when there is an assignment in a context where a truth value
2501 is expected, or when operators are nested whose precedence people
2502 often get confused about.  Only the warning for an assignment used as
2503 a truth value is supported when compiling C++; the other warnings are
2504 only supported when compiling C@.
2506 Also warn if a comparison like @samp{x<=y<=z} appears; this is
2507 equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
2508 interpretation from that of ordinary mathematical notation.
2510 Also warn about constructions where there may be confusion to which
2511 @code{if} statement an @code{else} branch belongs.  Here is an example of
2512 such a case:
2514 @smallexample
2515 @group
2517   if (a)
2518     if (b)
2519       foo ();
2520   else
2521     bar ();
2523 @end group
2524 @end smallexample
2526 In C, every @code{else} branch belongs to the innermost possible @code{if}
2527 statement, which in this example is @code{if (b)}.  This is often not
2528 what the programmer expected, as illustrated in the above example by
2529 indentation the programmer chose.  When there is the potential for this
2530 confusion, GCC will issue a warning when this flag is specified.
2531 To eliminate the warning, add explicit braces around the innermost
2532 @code{if} statement so there is no way the @code{else} could belong to
2533 the enclosing @code{if}.  The resulting code would look like this:
2535 @smallexample
2536 @group
2538   if (a)
2539     @{
2540       if (b)
2541         foo ();
2542       else
2543         bar ();
2544     @}
2546 @end group
2547 @end smallexample
2549 This warning is enabled by @option{-Wall}.
2551 @item -Wsequence-point
2552 @opindex Wsequence-point
2553 Warn about code that may have undefined semantics because of violations
2554 of sequence point rules in the C and C++ standards.
2556 The C and C++ standards defines the order in which expressions in a C/C++
2557 program are evaluated in terms of @dfn{sequence points}, which represent
2558 a partial ordering between the execution of parts of the program: those
2559 executed before the sequence point, and those executed after it.  These
2560 occur after the evaluation of a full expression (one which is not part
2561 of a larger expression), after the evaluation of the first operand of a
2562 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
2563 function is called (but after the evaluation of its arguments and the
2564 expression denoting the called function), and in certain other places.
2565 Other than as expressed by the sequence point rules, the order of
2566 evaluation of subexpressions of an expression is not specified.  All
2567 these rules describe only a partial order rather than a total order,
2568 since, for example, if two functions are called within one expression
2569 with no sequence point between them, the order in which the functions
2570 are called is not specified.  However, the standards committee have
2571 ruled that function calls do not overlap.
2573 It is not specified when between sequence points modifications to the
2574 values of objects take effect.  Programs whose behavior depends on this
2575 have undefined behavior; the C and C++ standards specify that ``Between
2576 the previous and next sequence point an object shall have its stored
2577 value modified at most once by the evaluation of an expression.  
2578 Furthermore, the prior value shall be read only to determine the value
2579 to be stored.''.  If a program breaks these rules, the results on any
2580 particular implementation are entirely unpredictable.
2582 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
2583 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
2584 diagnosed by this option, and it may give an occasional false positive
2585 result, but in general it has been found fairly effective at detecting
2586 this sort of problem in programs.
2588 The standard is worded confusingly, therefore there is some debate
2589 over the precise meaning of the sequence point rules in subtle cases.
2590 Links to discussions of the problem, including proposed formal
2591 definitions, may be found on the GCC readings page, at
2592 @w{@uref{http://gcc.gnu.org/readings.html}}.
2594 This warning is enabled by @option{-Wall} for C and C++.
2596 @item -Wreturn-type
2597 @opindex Wreturn-type
2598 Warn whenever a function is defined with a return-type that defaults to
2599 @code{int}.  Also warn about any @code{return} statement with no
2600 return-value in a function whose return-type is not @code{void}.
2602 For C, also warn if the return type of a function has a type qualifier
2603 such as @code{const}.  Such a type qualifier has no effect, since the
2604 value returned by a function is not an lvalue.  ISO C prohibits
2605 qualified @code{void} return types on function definitions, so such
2606 return types always receive a warning even without this option.
2608 For C++, a function without return type always produces a diagnostic
2609 message, even when @option{-Wno-return-type} is specified.  The only
2610 exceptions are @samp{main} and functions defined in system headers.
2612 This warning is enabled by @option{-Wall}.
2614 @item -Wswitch
2615 @opindex Wswitch
2616 Warn whenever a @code{switch} statement has an index of enumerated type
2617 and lacks a @code{case} for one or more of the named codes of that
2618 enumeration.  (The presence of a @code{default} label prevents this
2619 warning.)  @code{case} labels outside the enumeration range also
2620 provoke warnings when this option is used.
2621 This warning is enabled by @option{-Wall}.
2623 @item -Wswitch-default
2624 @opindex Wswitch-switch
2625 Warn whenever a @code{switch} statement does not have a @code{default}
2626 case.
2628 @item -Wswitch-enum
2629 @opindex Wswitch-enum
2630 Warn whenever a @code{switch} statement has an index of enumerated type
2631 and lacks a @code{case} for one or more of the named codes of that
2632 enumeration.  @code{case} labels outside the enumeration range also
2633 provoke warnings when this option is used.
2635 @item -Wtrigraphs
2636 @opindex Wtrigraphs
2637 Warn if any trigraphs are encountered that might change the meaning of
2638 the program (trigraphs within comments are not warned about).
2639 This warning is enabled by @option{-Wall}.
2641 @item -Wunused-function
2642 @opindex Wunused-function
2643 Warn whenever a static function is declared but not defined or a
2644 non-inline static function is unused.
2645 This warning is enabled by @option{-Wall}.
2647 @item -Wunused-label
2648 @opindex Wunused-label
2649 Warn whenever a label is declared but not used.
2650 This warning is enabled by @option{-Wall}.
2652 To suppress this warning use the @samp{unused} attribute
2653 (@pxref{Variable Attributes}).
2655 @item -Wunused-parameter
2656 @opindex Wunused-parameter
2657 Warn whenever a function parameter is unused aside from its declaration.
2659 To suppress this warning use the @samp{unused} attribute
2660 (@pxref{Variable Attributes}).
2662 @item -Wunused-variable
2663 @opindex Wunused-variable
2664 Warn whenever a local variable or non-constant static variable is unused
2665 aside from its declaration
2666 This warning is enabled by @option{-Wall}.
2668 To suppress this warning use the @samp{unused} attribute
2669 (@pxref{Variable Attributes}).
2671 @item -Wunused-value
2672 @opindex Wunused-value
2673 Warn whenever a statement computes a result that is explicitly not used.
2674 This warning is enabled by @option{-Wall}.
2676 To suppress this warning cast the expression to @samp{void}.
2678 @item -Wunused
2679 @opindex Wunused
2680 All the above @option{-Wunused} options combined.
2682 In order to get a warning about an unused function parameter, you must
2683 either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
2684 @samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
2686 @item -Wuninitialized
2687 @opindex Wuninitialized
2688 Warn if an automatic variable is used without first being initialized or
2689 if a variable may be clobbered by a @code{setjmp} call.
2691 These warnings are possible only in optimizing compilation,
2692 because they require data flow information that is computed only
2693 when optimizing.  If you do not specify @option{-O}, you will not get 
2694 these warnings. Instead, GCC will issue a warning about @option{-Wuninitialized}
2695 requiring @option{-O}.
2697 If you want to warn about code which uses the uninitialized value of the
2698 variable in its own initializer, use the @option{-Winit-self} option.
2700 These warnings occur for individual uninitialized or clobbered
2701 elements of structure, union or array variables as well as for
2702 variables which are uninitialized or clobbered as a whole.  They do
2703 not occur for variables or elements declared @code{volatile}.  Because
2704 these warnings depend on optimization, the exact variables or elements
2705 for which there are warnings will depend on the precise optimization
2706 options and version of GCC used.
2708 Note that there may be no warning about a variable that is used only
2709 to compute a value that itself is never used, because such
2710 computations may be deleted by data flow analysis before the warnings
2711 are printed.
2713 These warnings are made optional because GCC is not smart
2714 enough to see all the reasons why the code might be correct
2715 despite appearing to have an error.  Here is one example of how
2716 this can happen:
2718 @smallexample
2719 @group
2721   int x;
2722   switch (y)
2723     @{
2724     case 1: x = 1;
2725       break;
2726     case 2: x = 4;
2727       break;
2728     case 3: x = 5;
2729     @}
2730   foo (x);
2732 @end group
2733 @end smallexample
2735 @noindent
2736 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
2737 always initialized, but GCC doesn't know this.  Here is
2738 another common case:
2740 @smallexample
2742   int save_y;
2743   if (change_y) save_y = y, y = new_y;
2744   @dots{}
2745   if (change_y) y = save_y;
2747 @end smallexample
2749 @noindent
2750 This has no bug because @code{save_y} is used only if it is set.
2752 @cindex @code{longjmp} warnings
2753 This option also warns when a non-volatile automatic variable might be
2754 changed by a call to @code{longjmp}.  These warnings as well are possible
2755 only in optimizing compilation.
2757 The compiler sees only the calls to @code{setjmp}.  It cannot know
2758 where @code{longjmp} will be called; in fact, a signal handler could
2759 call it at any point in the code.  As a result, you may get a warning
2760 even when there is in fact no problem because @code{longjmp} cannot
2761 in fact be called at the place which would cause a problem.
2763 Some spurious warnings can be avoided if you declare all the functions
2764 you use that never return as @code{noreturn}.  @xref{Function
2765 Attributes}.
2767 This warning is enabled by @option{-Wall}.
2769 @item -Wunknown-pragmas
2770 @opindex Wunknown-pragmas
2771 @cindex warning for unknown pragmas
2772 @cindex unknown pragmas, warning
2773 @cindex pragmas, warning of unknown
2774 Warn when a #pragma directive is encountered which is not understood by
2775 GCC@.  If this command line option is used, warnings will even be issued
2776 for unknown pragmas in system header files.  This is not the case if
2777 the warnings were only enabled by the @option{-Wall} command line option.
2779 @item -Wno-pragmas
2780 @opindex Wno-pragmas
2781 @opindex Wpragmas
2782 Do not warn about misuses of pragmas, such as incorrect parameters,
2783 invalid syntax, or conflicts between pragmas.  See also
2784 @samp{-Wunknown-pragmas}.
2786 @item -Wstrict-aliasing
2787 @opindex Wstrict-aliasing
2788 This option is only active when @option{-fstrict-aliasing} is active.
2789 It warns about code which might break the strict aliasing rules that the
2790 compiler is using for optimization.  The warning does not catch all
2791 cases, but does attempt to catch the more common pitfalls.  It is
2792 included in @option{-Wall}.
2794 @item -Wstrict-aliasing=2
2795 @opindex Wstrict-aliasing=2
2796 This option is only active when @option{-fstrict-aliasing} is active.
2797 It warns about code which might break the strict aliasing rules that the
2798 compiler is using for optimization.  This warning catches more cases than
2799 @option{-Wstrict-aliasing}, but it will also give a warning for some ambiguous
2800 cases that are safe.
2802 @item -Wall
2803 @opindex Wall
2804 All of the above @samp{-W} options combined.  This enables all the
2805 warnings about constructions that some users consider questionable, and
2806 that are easy to avoid (or modify to prevent the warning), even in
2807 conjunction with macros.  This also enables some language-specific
2808 warnings described in @ref{C++ Dialect Options} and
2809 @ref{Objective-C and Objective-C++ Dialect Options}.
2810 @end table
2812 The following @option{-W@dots{}} options are not implied by @option{-Wall}.
2813 Some of them warn about constructions that users generally do not
2814 consider questionable, but which occasionally you might wish to check
2815 for; others warn about constructions that are necessary or hard to avoid
2816 in some cases, and there is no simple way to modify the code to suppress
2817 the warning.
2819 @table @gcctabopt
2820 @item -Wextra
2821 @opindex W
2822 @opindex Wextra
2823 (This option used to be called @option{-W}.  The older name is still
2824 supported, but the newer name is more descriptive.)  Print extra warning
2825 messages for these events:
2827 @itemize @bullet
2828 @item
2829 A function can return either with or without a value.  (Falling
2830 off the end of the function body is considered returning without
2831 a value.)  For example, this function would evoke such a
2832 warning:
2834 @smallexample
2835 @group
2836 foo (a)
2838   if (a > 0)
2839     return a;
2841 @end group
2842 @end smallexample
2844 @item
2845 An expression-statement or the left-hand side of a comma expression
2846 contains no side effects.
2847 To suppress the warning, cast the unused expression to void.
2848 For example, an expression such as @samp{x[i,j]} will cause a warning,
2849 but @samp{x[(void)i,j]} will not.
2851 @item
2852 An unsigned value is compared against zero with @samp{<} or @samp{>=}.
2854 @item
2855 Storage-class specifiers like @code{static} are not the first things in
2856 a declaration.  According to the C Standard, this usage is obsolescent.
2858 @item
2859 If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
2860 arguments.
2862 @item
2863 A comparison between signed and unsigned values could produce an
2864 incorrect result when the signed value is converted to unsigned.
2865 (But don't warn if @option{-Wno-sign-compare} is also specified.)
2867 @item
2868 An aggregate has an initializer which does not initialize all members.
2869 This warning can be independently controlled by
2870 @option{-Wmissing-field-initializers}.
2872 @item
2873 A function parameter is declared without a type specifier in K&R-style
2874 functions:
2876 @smallexample
2877 void foo(bar) @{ @}
2878 @end smallexample
2880 @item
2881 An empty body occurs in an @samp{if} or @samp{else} statement.
2883 @item
2884 A pointer is compared against integer zero with @samp{<}, @samp{<=},
2885 @samp{>}, or @samp{>=}.
2887 @item
2888 A variable might be changed by @samp{longjmp} or @samp{vfork}.
2890 @item
2891 Any of several floating-point events that often indicate errors, such as
2892 overflow, underflow, loss of precision, etc.
2894 @item @r{(C++ only)}
2895 An enumerator and a non-enumerator both appear in a conditional expression.
2897 @item @r{(C++ only)}
2898 A non-static reference or non-static @samp{const} member appears in a
2899 class without constructors.
2901 @item @r{(C++ only)}
2902 Ambiguous virtual bases.
2904 @item @r{(C++ only)}
2905 Subscripting an array which has been declared @samp{register}.
2907 @item @r{(C++ only)}
2908 Taking the address of a variable which has been declared @samp{register}.
2910 @item @r{(C++ only)}
2911 A base class is not initialized in a derived class' copy constructor.
2912 @end itemize
2914 @item -Wno-div-by-zero
2915 @opindex Wno-div-by-zero
2916 @opindex Wdiv-by-zero
2917 Do not warn about compile-time integer division by zero.  Floating point
2918 division by zero is not warned about, as it can be a legitimate way of
2919 obtaining infinities and NaNs.
2921 @item -Wsystem-headers
2922 @opindex Wsystem-headers
2923 @cindex warnings from system headers
2924 @cindex system headers, warnings from
2925 Print warning messages for constructs found in system header files.
2926 Warnings from system headers are normally suppressed, on the assumption
2927 that they usually do not indicate real problems and would only make the
2928 compiler output harder to read.  Using this command line option tells
2929 GCC to emit warnings from system headers as if they occurred in user
2930 code.  However, note that using @option{-Wall} in conjunction with this
2931 option will @emph{not} warn about unknown pragmas in system
2932 headers---for that, @option{-Wunknown-pragmas} must also be used.
2934 @item -Wfloat-equal
2935 @opindex Wfloat-equal
2936 Warn if floating point values are used in equality comparisons.
2938 The idea behind this is that sometimes it is convenient (for the
2939 programmer) to consider floating-point values as approximations to
2940 infinitely precise real numbers.  If you are doing this, then you need
2941 to compute (by analyzing the code, or in some other way) the maximum or
2942 likely maximum error that the computation introduces, and allow for it
2943 when performing comparisons (and when producing output, but that's a
2944 different problem).  In particular, instead of testing for equality, you
2945 would check to see whether the two values have ranges that overlap; and
2946 this is done with the relational operators, so equality comparisons are
2947 probably mistaken.
2949 @item -Wtraditional @r{(C only)}
2950 @opindex Wtraditional
2951 Warn about certain constructs that behave differently in traditional and
2952 ISO C@.  Also warn about ISO C constructs that have no traditional C
2953 equivalent, and/or problematic constructs which should be avoided.
2955 @itemize @bullet
2956 @item
2957 Macro parameters that appear within string literals in the macro body.
2958 In traditional C macro replacement takes place within string literals,
2959 but does not in ISO C@.
2961 @item
2962 In traditional C, some preprocessor directives did not exist.
2963 Traditional preprocessors would only consider a line to be a directive
2964 if the @samp{#} appeared in column 1 on the line.  Therefore
2965 @option{-Wtraditional} warns about directives that traditional C
2966 understands but would ignore because the @samp{#} does not appear as the
2967 first character on the line.  It also suggests you hide directives like
2968 @samp{#pragma} not understood by traditional C by indenting them.  Some
2969 traditional implementations would not recognize @samp{#elif}, so it
2970 suggests avoiding it altogether.
2972 @item
2973 A function-like macro that appears without arguments.
2975 @item
2976 The unary plus operator.
2978 @item
2979 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
2980 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
2981 constants.)  Note, these suffixes appear in macros defined in the system
2982 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
2983 Use of these macros in user code might normally lead to spurious
2984 warnings, however GCC's integrated preprocessor has enough context to
2985 avoid warning in these cases.
2987 @item
2988 A function declared external in one block and then used after the end of
2989 the block.
2991 @item
2992 A @code{switch} statement has an operand of type @code{long}.
2994 @item
2995 A non-@code{static} function declaration follows a @code{static} one.
2996 This construct is not accepted by some traditional C compilers.
2998 @item
2999 The ISO type of an integer constant has a different width or
3000 signedness from its traditional type.  This warning is only issued if
3001 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
3002 typically represent bit patterns, are not warned about.
3004 @item
3005 Usage of ISO string concatenation is detected.
3007 @item
3008 Initialization of automatic aggregates.
3010 @item
3011 Identifier conflicts with labels.  Traditional C lacks a separate
3012 namespace for labels.
3014 @item
3015 Initialization of unions.  If the initializer is zero, the warning is
3016 omitted.  This is done under the assumption that the zero initializer in
3017 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
3018 initializer warnings and relies on default initialization to zero in the
3019 traditional C case.
3021 @item
3022 Conversions by prototypes between fixed/floating point values and vice
3023 versa.  The absence of these prototypes when compiling with traditional
3024 C would cause serious problems.  This is a subset of the possible
3025 conversion warnings, for the full set use @option{-Wconversion}.
3027 @item
3028 Use of ISO C style function definitions.  This warning intentionally is
3029 @emph{not} issued for prototype declarations or variadic functions
3030 because these ISO C features will appear in your code when using
3031 libiberty's traditional C compatibility macros, @code{PARAMS} and
3032 @code{VPARAMS}.  This warning is also bypassed for nested functions
3033 because that feature is already a GCC extension and thus not relevant to
3034 traditional C compatibility.
3035 @end itemize
3037 @item -Wdeclaration-after-statement @r{(C only)}
3038 @opindex Wdeclaration-after-statement
3039 Warn when a declaration is found after a statement in a block.  This
3040 construct, known from C++, was introduced with ISO C99 and is by default
3041 allowed in GCC@.  It is not supported by ISO C90 and was not supported by
3042 GCC versions before GCC 3.0.  @xref{Mixed Declarations}.
3044 @item -Wundef
3045 @opindex Wundef
3046 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
3048 @item -Wno-endif-labels
3049 @opindex Wno-endif-labels
3050 @opindex Wendif-labels
3051 Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
3053 @item -Wshadow
3054 @opindex Wshadow
3055 Warn whenever a local variable shadows another local variable, parameter or
3056 global variable or whenever a built-in function is shadowed.
3058 @item -Wlarger-than-@var{len}
3059 @opindex Wlarger-than
3060 Warn whenever an object of larger than @var{len} bytes is defined.
3062 @item -Wunsafe-loop-optimizations
3063 @opindex Wunsafe-loop-optimizations
3064 Warn if the loop cannot be optimized because the compiler could not
3065 assume anything on the bounds of the loop indices.  With
3066 @option{-funsafe-loop-optimizations} warn if the compiler made
3067 such assumptions.
3069 @item -Wpointer-arith
3070 @opindex Wpointer-arith
3071 Warn about anything that depends on the ``size of'' a function type or
3072 of @code{void}.  GNU C assigns these types a size of 1, for
3073 convenience in calculations with @code{void *} pointers and pointers
3074 to functions.
3076 @item -Wbad-function-cast @r{(C only)}
3077 @opindex Wbad-function-cast
3078 Warn whenever a function call is cast to a non-matching type.
3079 For example, warn if @code{int malloc()} is cast to @code{anything *}.
3081 @item -Wc++-compat
3082 Warn about ISO C constructs that are outside of the common subset of
3083 ISO C and ISO C++, e.g.@: request for implicit conversion from
3084 @code{void *} to a pointer to non-@code{void} type.
3086 @item -Wcast-qual
3087 @opindex Wcast-qual
3088 Warn whenever a pointer is cast so as to remove a type qualifier from
3089 the target type.  For example, warn if a @code{const char *} is cast
3090 to an ordinary @code{char *}.
3092 @item -Wcast-align
3093 @opindex Wcast-align
3094 Warn whenever a pointer is cast such that the required alignment of the
3095 target is increased.  For example, warn if a @code{char *} is cast to
3096 an @code{int *} on machines where integers can only be accessed at
3097 two- or four-byte boundaries.
3099 @item -Wwrite-strings
3100 @opindex Wwrite-strings
3101 When compiling C, give string constants the type @code{const
3102 char[@var{length}]} so that
3103 copying the address of one into a non-@code{const} @code{char *}
3104 pointer will get a warning; when compiling C++, warn about the
3105 deprecated conversion from string literals to @code{char *}.  This
3106 warning, by default, is enabled for C++ programs.
3107 These warnings will help you find at
3108 compile time code that can try to write into a string constant, but
3109 only if you have been very careful about using @code{const} in
3110 declarations and prototypes.  Otherwise, it will just be a nuisance;
3111 this is why we did not make @option{-Wall} request these warnings.
3113 @item -Wconversion
3114 @opindex Wconversion
3115 Warn if a prototype causes a type conversion that is different from what
3116 would happen to the same argument in the absence of a prototype.  This
3117 includes conversions of fixed point to floating and vice versa, and
3118 conversions changing the width or signedness of a fixed point argument
3119 except when the same as the default promotion.
3121 Also, warn if a negative integer constant expression is implicitly
3122 converted to an unsigned type.  For example, warn about the assignment
3123 @code{x = -1} if @code{x} is unsigned.  But do not warn about explicit
3124 casts like @code{(unsigned) -1}.
3126 @item -Wsign-compare
3127 @opindex Wsign-compare
3128 @cindex warning for comparison of signed and unsigned values
3129 @cindex comparison of signed and unsigned values, warning
3130 @cindex signed and unsigned values, comparison warning
3131 Warn when a comparison between signed and unsigned values could produce
3132 an incorrect result when the signed value is converted to unsigned.
3133 This warning is also enabled by @option{-Wextra}; to get the other warnings
3134 of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
3136 @item -Waggregate-return
3137 @opindex Waggregate-return
3138 Warn if any functions that return structures or unions are defined or
3139 called.  (In languages where you can return an array, this also elicits
3140 a warning.)
3142 @item -Walways-true
3143 @opindex Walways-true
3144 Warn about comparisons which are always true such as testing if
3145 unsigned values are greater than or equal to zero.  This warning is
3146 enabled by @option{-Wall}.
3148 @item -Wno-attributes
3149 @opindex Wno-attributes
3150 @opindex Wattributes
3151 Do not warn if an unexpected @code{__attribute__} is used, such as
3152 unrecognized attributes, function attributes applied to variables,
3153 etc.  This will not stop errors for incorrect use of supported
3154 attributes.
3156 @item -Wstrict-prototypes @r{(C only)}
3157 @opindex Wstrict-prototypes
3158 Warn if a function is declared or defined without specifying the
3159 argument types.  (An old-style function definition is permitted without
3160 a warning if preceded by a declaration which specifies the argument
3161 types.)
3163 @item -Wold-style-definition @r{(C only)}
3164 @opindex Wold-style-definition
3165 Warn if an old-style function definition is used.  A warning is given
3166 even if there is a previous prototype.
3168 @item -Wmissing-prototypes @r{(C only)}
3169 @opindex Wmissing-prototypes
3170 Warn if a global function is defined without a previous prototype
3171 declaration.  This warning is issued even if the definition itself
3172 provides a prototype.  The aim is to detect global functions that fail
3173 to be declared in header files.
3175 @item -Wmissing-declarations @r{(C only)}
3176 @opindex Wmissing-declarations
3177 Warn if a global function is defined without a previous declaration.
3178 Do so even if the definition itself provides a prototype.
3179 Use this option to detect global functions that are not declared in
3180 header files.
3182 @item -Wmissing-field-initializers
3183 @opindex Wmissing-field-initializers
3184 @opindex W
3185 @opindex Wextra
3186 Warn if a structure's initializer has some fields missing.  For
3187 example, the following code would cause such a warning, because
3188 @code{x.h} is implicitly zero:
3190 @smallexample
3191 struct s @{ int f, g, h; @};
3192 struct s x = @{ 3, 4 @};
3193 @end smallexample
3195 This option does not warn about designated initializers, so the following
3196 modification would not trigger a warning:
3198 @smallexample
3199 struct s @{ int f, g, h; @};
3200 struct s x = @{ .f = 3, .g = 4 @};
3201 @end smallexample
3203 This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
3204 warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}.
3206 @item -Wmissing-noreturn
3207 @opindex Wmissing-noreturn
3208 Warn about functions which might be candidates for attribute @code{noreturn}.
3209 Note these are only possible candidates, not absolute ones.  Care should
3210 be taken to manually verify functions actually do not ever return before
3211 adding the @code{noreturn} attribute, otherwise subtle code generation
3212 bugs could be introduced.  You will not get a warning for @code{main} in
3213 hosted C environments.
3215 @item -Wmissing-format-attribute
3216 @opindex Wmissing-format-attribute
3217 @opindex Wformat
3218 Warn about function pointers which might be candidates for @code{format}
3219 attributes.  Note these are only possible candidates, not absolute ones.
3220 GCC will guess that function pointers with @code{format} attributes that
3221 are used in assignment, initialization, parameter passing or return
3222 statements should have a corresponding @code{format} attribute in the
3223 resulting type.  I.e.@: the left-hand side of the assignment or
3224 initialization, the type of the parameter variable, or the return type
3225 of the containing function respectively should also have a @code{format}
3226 attribute to avoid the warning.
3228 GCC will also warn about function definitions which might be
3229 candidates for @code{format} attributes.  Again, these are only
3230 possible candidates.  GCC will guess that @code{format} attributes
3231 might be appropriate for any function that calls a function like
3232 @code{vprintf} or @code{vscanf}, but this might not always be the
3233 case, and some functions for which @code{format} attributes are
3234 appropriate may not be detected.
3236 @item -Wno-multichar
3237 @opindex Wno-multichar
3238 @opindex Wmultichar
3239 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
3240 Usually they indicate a typo in the user's code, as they have
3241 implementation-defined values, and should not be used in portable code.
3243 @item -Wnormalized=<none|id|nfc|nfkc>
3244 @opindex Wnormalized
3245 @cindex NFC
3246 @cindex NFKC
3247 @cindex character set, input normalization
3248 In ISO C and ISO C++, two identifiers are different if they are
3249 different sequences of characters.  However, sometimes when characters
3250 outside the basic ASCII character set are used, you can have two
3251 different character sequences that look the same.  To avoid confusion,
3252 the ISO 10646 standard sets out some @dfn{normalization rules} which
3253 when applied ensure that two sequences that look the same are turned into
3254 the same sequence.  GCC can warn you if you are using identifiers which
3255 have not been normalized; this option controls that warning.
3257 There are four levels of warning that GCC supports.  The default is
3258 @option{-Wnormalized=nfc}, which warns about any identifier which is
3259 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
3260 recommended form for most uses.
3262 Unfortunately, there are some characters which ISO C and ISO C++ allow
3263 in identifiers that when turned into NFC aren't allowable as
3264 identifiers.  That is, there's no way to use these symbols in portable
3265 ISO C or C++ and have all your identifiers in NFC.
3266 @option{-Wnormalized=id} suppresses the warning for these characters.
3267 It is hoped that future versions of the standards involved will correct
3268 this, which is why this option is not the default.
3270 You can switch the warning off for all characters by writing
3271 @option{-Wnormalized=none}.  You would only want to do this if you
3272 were using some other normalization scheme (like ``D''), because
3273 otherwise you can easily create bugs that are literally impossible to see.
3275 Some characters in ISO 10646 have distinct meanings but look identical
3276 in some fonts or display methodologies, especially once formatting has
3277 been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
3278 LETTER N'', will display just like a regular @code{n} which has been
3279 placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
3280 normalization scheme to convert all these into a standard form as
3281 well, and GCC will warn if your code is not in NFKC if you use
3282 @option{-Wnormalized=nfkc}.  This warning is comparable to warning
3283 about every identifier that contains the letter O because it might be
3284 confused with the digit 0, and so is not the default, but may be
3285 useful as a local coding convention if the programming environment is
3286 unable to be fixed to display these characters distinctly.
3288 @item -Wno-deprecated-declarations
3289 @opindex Wno-deprecated-declarations
3290 Do not warn about uses of functions, variables, and types marked as
3291 deprecated by using the @code{deprecated} attribute.
3292 (@pxref{Function Attributes}, @pxref{Variable Attributes},
3293 @pxref{Type Attributes}.)
3295 @item -Wno-overflow
3296 @opindex Wno-overflow
3297 Do not warn about compile-time overflow in constant expressions.
3299 @item -Wpacked
3300 @opindex Wpacked
3301 Warn if a structure is given the packed attribute, but the packed
3302 attribute has no effect on the layout or size of the structure.
3303 Such structures may be mis-aligned for little benefit.  For
3304 instance, in this code, the variable @code{f.x} in @code{struct bar}
3305 will be misaligned even though @code{struct bar} does not itself
3306 have the packed attribute:
3308 @smallexample
3309 @group
3310 struct foo @{
3311   int x;
3312   char a, b, c, d;
3313 @} __attribute__((packed));
3314 struct bar @{
3315   char z;
3316   struct foo f;
3318 @end group
3319 @end smallexample
3321 @item -Wpadded
3322 @opindex Wpadded
3323 Warn if padding is included in a structure, either to align an element
3324 of the structure or to align the whole structure.  Sometimes when this
3325 happens it is possible to rearrange the fields of the structure to
3326 reduce the padding and so make the structure smaller.
3328 @item -Wredundant-decls
3329 @opindex Wredundant-decls
3330 Warn if anything is declared more than once in the same scope, even in
3331 cases where multiple declaration is valid and changes nothing.
3333 @item -Wnested-externs @r{(C only)}
3334 @opindex Wnested-externs
3335 Warn if an @code{extern} declaration is encountered within a function.
3337 @item -Wunreachable-code
3338 @opindex Wunreachable-code
3339 Warn if the compiler detects that code will never be executed.
3341 This option is intended to warn when the compiler detects that at
3342 least a whole line of source code will never be executed, because
3343 some condition is never satisfied or because it is after a
3344 procedure that never returns.
3346 It is possible for this option to produce a warning even though there
3347 are circumstances under which part of the affected line can be executed,
3348 so care should be taken when removing apparently-unreachable code.
3350 For instance, when a function is inlined, a warning may mean that the
3351 line is unreachable in only one inlined copy of the function.
3353 This option is not made part of @option{-Wall} because in a debugging
3354 version of a program there is often substantial code which checks
3355 correct functioning of the program and is, hopefully, unreachable
3356 because the program does work.  Another common use of unreachable
3357 code is to provide behavior which is selectable at compile-time.
3359 @item -Winline
3360 @opindex Winline
3361 Warn if a function can not be inlined and it was declared as inline.
3362 Even with this option, the compiler will not warn about failures to
3363 inline functions declared in system headers.
3365 The compiler uses a variety of heuristics to determine whether or not
3366 to inline a function.  For example, the compiler takes into account
3367 the size of the function being inlined and the amount of inlining
3368 that has already been done in the current function.  Therefore,
3369 seemingly insignificant changes in the source program can cause the
3370 warnings produced by @option{-Winline} to appear or disappear.
3372 @item -Wno-invalid-offsetof @r{(C++ only)}
3373 @opindex Wno-invalid-offsetof
3374 Suppress warnings from applying the @samp{offsetof} macro to a non-POD
3375 type.  According to the 1998 ISO C++ standard, applying @samp{offsetof}
3376 to a non-POD type is undefined.  In existing C++ implementations,
3377 however, @samp{offsetof} typically gives meaningful results even when
3378 applied to certain kinds of non-POD types. (Such as a simple
3379 @samp{struct} that fails to be a POD type only by virtue of having a
3380 constructor.)  This flag is for users who are aware that they are
3381 writing nonportable code and who have deliberately chosen to ignore the
3382 warning about it.
3384 The restrictions on @samp{offsetof} may be relaxed in a future version
3385 of the C++ standard.
3387 @item -Wno-int-to-pointer-cast @r{(C only)}
3388 @opindex Wno-int-to-pointer-cast
3389 Suppress warnings from casts to pointer type of an integer of a
3390 different size.
3392 @item -Wno-pointer-to-int-cast @r{(C only)}
3393 @opindex Wno-pointer-to-int-cast
3394 Suppress warnings from casts from a pointer to an integer type of a
3395 different size.
3397 @item -Winvalid-pch
3398 @opindex Winvalid-pch
3399 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
3400 the search path but can't be used.
3402 @item -Wlong-long
3403 @opindex Wlong-long
3404 @opindex Wno-long-long
3405 Warn if @samp{long long} type is used.  This is default.  To inhibit
3406 the warning messages, use @option{-Wno-long-long}.  Flags
3407 @option{-Wlong-long} and @option{-Wno-long-long} are taken into account
3408 only when @option{-pedantic} flag is used.
3410 @item -Wvariadic-macros
3411 @opindex Wvariadic-macros
3412 @opindex Wno-variadic-macros
3413 Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
3414 alternate syntax when in pedantic ISO C99 mode.  This is default.
3415 To inhibit the warning messages, use @option{-Wno-variadic-macros}.
3417 @item -Wvolatile-register-var
3418 @opindex Wvolatile-register-var
3419 @opindex Wno-volatile-register-var
3420 Warn if a register variable is declared volatile.  The volatile
3421 modifier does not inhibit all optimizations that may eliminate reads
3422 and/or writes to register variables.
3424 @item -Wdisabled-optimization
3425 @opindex Wdisabled-optimization
3426 Warn if a requested optimization pass is disabled.  This warning does
3427 not generally indicate that there is anything wrong with your code; it
3428 merely indicates that GCC's optimizers were unable to handle the code
3429 effectively.  Often, the problem is that your code is too big or too
3430 complex; GCC will refuse to optimize programs when the optimization
3431 itself is likely to take inordinate amounts of time.
3433 @item -Wpointer-sign
3434 @opindex Wpointer-sign
3435 @opindex Wno-pointer-sign
3436 Warn for pointer argument passing or assignment with different signedness.
3437 This option is only supported for C and Objective-C@.  It is implied by
3438 @option{-Wall} and by @option{-pedantic}, which can be disabled with
3439 @option{-Wno-pointer-sign}.
3441 @item -Werror
3442 @opindex Werror
3443 Make all warnings into errors.
3445 @item -Werror=
3446 @opindex Werror=
3447 Make the specified warning into an errors.  The specifier for a
3448 warning is appended, for example @option{-Werror=switch} turns the
3449 warnings controlled by @option{-Wswitch} into errors.  This switch
3450 takes a negative form, to be used to negate @option{-Werror} for
3451 specific warnings, for example @option{-Wno-error=switch} makes
3452 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3453 is in effect.  You can use the @option{-fdiagnostics-show-option}
3454 option to have each controllable warning amended with the option which
3455 controls it, to determine what to use with this option.
3457 Note that specifying @option{-Werror=}@var{foo} automatically implies
3458 @option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
3459 imply anything.
3461 @item -Wstack-protector
3462 @opindex Wstack-protector
3463 This option is only active when @option{-fstack-protector} is active.  It
3464 warns about functions that will not be protected against stack smashing.
3466 @item -Wstring-literal-comparison
3467 @opindex Wstring-literal-comparison
3468 Warn about suspicious comparisons to string literal constants.  In C,
3469 direct comparisons against the memory address of a string literal, such
3470 as @code{if (x == "abc")}, typically indicate a programmer error, and
3471 even when intentional, result in unspecified behavior and are not portable.
3472 Usually these warnings alert that the programmer intended to use
3473 @code{strcmp}.  This warning is enabled by @option{-Wall}.
3475 @item -Woverlength-strings
3476 @opindex Woverlength-strings
3477 Warn about string constants which are longer than the ``minimum
3478 maximum'' length specified in the C standard.  Modern compilers
3479 generally allow string constants which are much longer than the
3480 standard's minimum limit, but very portable programs should avoid
3481 using longer strings.
3483 The limit applies @emph{after} string constant concatenation, and does
3484 not count the trailing NUL@.  In C89, the limit was 509 characters; in
3485 C99, it was raised to 4095.  C++98 does not specify a normative
3486 minimum maximum, so we do not diagnose overlength strings in C++@.
3488 This option is implied by @option{-pedantic}, and can be disabled with
3489 @option{-Wno-overlength-strings}.
3490 @end table
3492 @node Debugging Options
3493 @section Options for Debugging Your Program or GCC
3494 @cindex options, debugging
3495 @cindex debugging information options
3497 GCC has various special options that are used for debugging
3498 either your program or GCC:
3500 @table @gcctabopt
3501 @item -g
3502 @opindex g
3503 Produce debugging information in the operating system's native format
3504 (stabs, COFF, XCOFF, or DWARF 2)@.  GDB can work with this debugging
3505 information.
3507 On most systems that use stabs format, @option{-g} enables use of extra
3508 debugging information that only GDB can use; this extra information
3509 makes debugging work better in GDB but will probably make other debuggers
3510 crash or
3511 refuse to read the program.  If you want to control for certain whether
3512 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
3513 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
3515 GCC allows you to use @option{-g} with
3516 @option{-O}.  The shortcuts taken by optimized code may occasionally
3517 produce surprising results: some variables you declared may not exist
3518 at all; flow of control may briefly move where you did not expect it;
3519 some statements may not be executed because they compute constant
3520 results or their values were already at hand; some statements may
3521 execute in different places because they were moved out of loops.
3523 Nevertheless it proves possible to debug optimized output.  This makes
3524 it reasonable to use the optimizer for programs that might have bugs.
3526 The following options are useful when GCC is generated with the
3527 capability for more than one debugging format.
3529 @item -ggdb
3530 @opindex ggdb
3531 Produce debugging information for use by GDB@.  This means to use the
3532 most expressive format available (DWARF 2, stabs, or the native format
3533 if neither of those are supported), including GDB extensions if at all
3534 possible.
3536 @item -gstabs
3537 @opindex gstabs
3538 Produce debugging information in stabs format (if that is supported),
3539 without GDB extensions.  This is the format used by DBX on most BSD
3540 systems.  On MIPS, Alpha and System V Release 4 systems this option
3541 produces stabs debugging output which is not understood by DBX or SDB@.
3542 On System V Release 4 systems this option requires the GNU assembler.
3544 @item -feliminate-unused-debug-symbols
3545 @opindex feliminate-unused-debug-symbols
3546 Produce debugging information in stabs format (if that is supported),
3547 for only symbols that are actually used.
3549 @item -femit-class-debug-always
3550 Instead of emitting debugging information for a C++ class in only one
3551 object file, emit it in all object files using the class.  This option
3552 should be used only with debuggers that are unable to handle the way GCC
3553 normally emits debugging information for classes because using this
3554 option will increase the size of debugging information by as much as a
3555 factor of two.
3557 @item -gstabs+
3558 @opindex gstabs+
3559 Produce debugging information in stabs format (if that is supported),
3560 using GNU extensions understood only by the GNU debugger (GDB)@.  The
3561 use of these extensions is likely to make other debuggers crash or
3562 refuse to read the program.
3564 @item -gcoff
3565 @opindex gcoff
3566 Produce debugging information in COFF format (if that is supported).
3567 This is the format used by SDB on most System V systems prior to
3568 System V Release 4.
3570 @item -gxcoff
3571 @opindex gxcoff
3572 Produce debugging information in XCOFF format (if that is supported).
3573 This is the format used by the DBX debugger on IBM RS/6000 systems.
3575 @item -gxcoff+
3576 @opindex gxcoff+
3577 Produce debugging information in XCOFF format (if that is supported),
3578 using GNU extensions understood only by the GNU debugger (GDB)@.  The
3579 use of these extensions is likely to make other debuggers crash or
3580 refuse to read the program, and may cause assemblers other than the GNU
3581 assembler (GAS) to fail with an error.
3583 @item -gdwarf-2
3584 @opindex gdwarf-2
3585 Produce debugging information in DWARF version 2 format (if that is
3586 supported).  This is the format used by DBX on IRIX 6.  With this
3587 option, GCC uses features of DWARF version 3 when they are useful;
3588 version 3 is upward compatible with version 2, but may still cause
3589 problems for older debuggers.
3591 @item -gvms
3592 @opindex gvms
3593 Produce debugging information in VMS debug format (if that is
3594 supported).  This is the format used by DEBUG on VMS systems.
3596 @item -g@var{level}
3597 @itemx -ggdb@var{level}
3598 @itemx -gstabs@var{level}
3599 @itemx -gcoff@var{level}
3600 @itemx -gxcoff@var{level}
3601 @itemx -gvms@var{level}
3602 Request debugging information and also use @var{level} to specify how
3603 much information.  The default level is 2.
3605 Level 1 produces minimal information, enough for making backtraces in
3606 parts of the program that you don't plan to debug.  This includes
3607 descriptions of functions and external variables, but no information
3608 about local variables and no line numbers.
3610 Level 3 includes extra information, such as all the macro definitions
3611 present in the program.  Some debuggers support macro expansion when
3612 you use @option{-g3}.
3614 @option{-gdwarf-2} does not accept a concatenated debug level, because
3615 GCC used to support an option @option{-gdwarf} that meant to generate
3616 debug information in version 1 of the DWARF format (which is very
3617 different from version 2), and it would have been too confusing.  That
3618 debug format is long obsolete, but the option cannot be changed now.
3619 Instead use an additional @option{-g@var{level}} option to change the
3620 debug level for DWARF2.
3622 @item -feliminate-dwarf2-dups
3623 @opindex feliminate-dwarf2-dups
3624 Compress DWARF2 debugging information by eliminating duplicated
3625 information about each symbol.  This option only makes sense when
3626 generating DWARF2 debugging information with @option{-gdwarf-2}.
3628 @cindex @command{prof}
3629 @item -p
3630 @opindex p
3631 Generate extra code to write profile information suitable for the
3632 analysis program @command{prof}.  You must use this option when compiling
3633 the source files you want data about, and you must also use it when
3634 linking.
3636 @cindex @command{gprof}
3637 @item -pg
3638 @opindex pg
3639 Generate extra code to write profile information suitable for the
3640 analysis program @command{gprof}.  You must use this option when compiling
3641 the source files you want data about, and you must also use it when
3642 linking.
3644 @item -Q
3645 @opindex Q
3646 Makes the compiler print out each function name as it is compiled, and
3647 print some statistics about each pass when it finishes.
3649 @item -ftime-report
3650 @opindex ftime-report
3651 Makes the compiler print some statistics about the time consumed by each
3652 pass when it finishes.
3654 @item -fmem-report
3655 @opindex fmem-report
3656 Makes the compiler print some statistics about permanent memory
3657 allocation when it finishes.
3659 @item -fprofile-arcs
3660 @opindex fprofile-arcs
3661 Add code so that program flow @dfn{arcs} are instrumented.  During
3662 execution the program records how many times each branch and call is
3663 executed and how many times it is taken or returns.  When the compiled
3664 program exits it saves this data to a file called
3665 @file{@var{auxname}.gcda} for each source file.  The data may be used for
3666 profile-directed optimizations (@option{-fbranch-probabilities}), or for
3667 test coverage analysis (@option{-ftest-coverage}).  Each object file's
3668 @var{auxname} is generated from the name of the output file, if
3669 explicitly specified and it is not the final executable, otherwise it is
3670 the basename of the source file.  In both cases any suffix is removed
3671 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
3672 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
3673 @xref{Cross-profiling}.
3675 @cindex @command{gcov}
3676 @item --coverage
3677 @opindex coverage
3679 This option is used to compile and link code instrumented for coverage
3680 analysis.  The option is a synonym for @option{-fprofile-arcs}
3681 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
3682 linking).  See the documentation for those options for more details.
3684 @itemize
3686 @item
3687 Compile the source files with @option{-fprofile-arcs} plus optimization
3688 and code generation options.  For test coverage analysis, use the
3689 additional @option{-ftest-coverage} option.  You do not need to profile
3690 every source file in a program.
3692 @item
3693 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
3694 (the latter implies the former).
3696 @item
3697 Run the program on a representative workload to generate the arc profile
3698 information.  This may be repeated any number of times.  You can run
3699 concurrent instances of your program, and provided that the file system
3700 supports locking, the data files will be correctly updated.  Also
3701 @code{fork} calls are detected and correctly handled (double counting
3702 will not happen).
3704 @item
3705 For profile-directed optimizations, compile the source files again with
3706 the same optimization and code generation options plus
3707 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
3708 Control Optimization}).
3710 @item
3711 For test coverage analysis, use @command{gcov} to produce human readable
3712 information from the @file{.gcno} and @file{.gcda} files.  Refer to the
3713 @command{gcov} documentation for further information.
3715 @end itemize
3717 With @option{-fprofile-arcs}, for each function of your program GCC
3718 creates a program flow graph, then finds a spanning tree for the graph.
3719 Only arcs that are not on the spanning tree have to be instrumented: the
3720 compiler adds code to count the number of times that these arcs are
3721 executed.  When an arc is the only exit or only entrance to a block, the
3722 instrumentation code can be added to the block; otherwise, a new basic
3723 block must be created to hold the instrumentation code.
3725 @need 2000
3726 @item -ftest-coverage
3727 @opindex ftest-coverage
3728 Produce a notes file that the @command{gcov} code-coverage utility
3729 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
3730 show program coverage.  Each source file's note file is called
3731 @file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
3732 above for a description of @var{auxname} and instructions on how to
3733 generate test coverage data.  Coverage data will match the source files
3734 more closely, if you do not optimize.
3736 @item -d@var{letters}
3737 @item -fdump-rtl-@var{pass}
3738 @opindex d
3739 Says to make debugging dumps during compilation at times specified by
3740 @var{letters}.    This is used for debugging the RTL-based passes of the
3741 compiler.  The file names for most of the dumps are made by appending a
3742 pass number and a word to the @var{dumpname}.  @var{dumpname} is generated
3743 from the name of the output file, if explicitly specified and it is not
3744 an executable, otherwise it is the basename of the source file.
3746 Most debug dumps can be enabled either passing a letter to the @option{-d}
3747 option, or with a long @option{-fdump-rtl} switch; here are the possible
3748 letters for use in @var{letters} and @var{pass}, and their meanings:
3750 @table @gcctabopt
3751 @item -dA
3752 @opindex dA
3753 Annotate the assembler output with miscellaneous debugging information.
3755 @item -dB
3756 @itemx -fdump-rtl-bbro
3757 @opindex dB
3758 @opindex fdump-rtl-bbro
3759 Dump after block reordering, to @file{@var{file}.148r.bbro}.
3761 @item -dc
3762 @itemx -fdump-rtl-combine
3763 @opindex dc
3764 @opindex fdump-rtl-combine
3765 Dump after instruction combination, to the file @file{@var{file}.129r.combine}.
3767 @item -dC
3768 @itemx -fdump-rtl-ce1
3769 @itemx -fdump-rtl-ce2
3770 @opindex dC
3771 @opindex fdump-rtl-ce1
3772 @opindex fdump-rtl-ce2
3773 @option{-dC} and @option{-fdump-rtl-ce1} enable dumping after the
3774 first if conversion, to the file @file{@var{file}.117r.ce1}.  @option{-dC}
3775 and @option{-fdump-rtl-ce2} enable dumping after the second if
3776 conversion, to the file @file{@var{file}.130r.ce2}.
3778 @item -dd
3779 @itemx -fdump-rtl-btl
3780 @itemx -fdump-rtl-dbr
3781 @opindex dd
3782 @opindex fdump-rtl-btl
3783 @opindex fdump-rtl-dbr
3784 @option{-dd} and @option{-fdump-rtl-btl} enable dumping after branch
3785 target load optimization, to @file{@var{file}.31.btl}.  @option{-dd}
3786 and @option{-fdump-rtl-dbr} enable dumping after delayed branch
3787 scheduling, to @file{@var{file}.36.dbr}.
3789 @item -dD
3790 @opindex dD
3791 Dump all macro definitions, at the end of preprocessing, in addition to
3792 normal output.
3794 @item -dE
3795 @itemx -fdump-rtl-ce3
3796 @opindex dE
3797 @opindex fdump-rtl-ce3
3798 Dump after the third if conversion, to @file{@var{file}.146r.ce3}.
3800 @item -df
3801 @itemx -fdump-rtl-cfg
3802 @itemx -fdump-rtl-life
3803 @opindex df
3804 @opindex fdump-rtl-cfg
3805 @opindex fdump-rtl-life
3806 @option{-df} and @option{-fdump-rtl-cfg} enable dumping after control
3807 and data flow analysis, to @file{@var{file}.116r.cfg}.  @option{-df}
3808 and @option{-fdump-rtl-cfg} enable dumping dump after life analysis,
3809 to @file{@var{file}.128r.life1} and @file{@var{file}.135r.life2}.
3811 @item -dg
3812 @itemx -fdump-rtl-greg
3813 @opindex dg
3814 @opindex fdump-rtl-greg
3815 Dump after global register allocation, to @file{@var{file}.139r.greg}.
3817 @item -dG
3818 @itemx -fdump-rtl-gcse
3819 @itemx -fdump-rtl-bypass
3820 @opindex dG
3821 @opindex fdump-rtl-gcse
3822 @opindex fdump-rtl-bypass
3823 @option{-dG} and @option{-fdump-rtl-gcse} enable dumping after GCSE, to
3824 @file{@var{file}.114r.gcse}.  @option{-dG} and @option{-fdump-rtl-bypass}
3825 enable dumping after jump bypassing and control flow optimizations, to
3826 @file{@var{file}.115r.bypass}.
3828 @item -dh
3829 @itemx -fdump-rtl-eh
3830 @opindex dh
3831 @opindex fdump-rtl-eh
3832 Dump after finalization of EH handling code, to @file{@var{file}.02.eh}.
3834 @item -di
3835 @itemx -fdump-rtl-sibling
3836 @opindex di
3837 @opindex fdump-rtl-sibling
3838 Dump after sibling call optimizations, to @file{@var{file}.106r.sibling}.
3840 @item -dj
3841 @itemx -fdump-rtl-jump
3842 @opindex dj
3843 @opindex fdump-rtl-jump
3844 Dump after the first jump optimization, to @file{@var{file}.112r.jump}.
3846 @item -dk
3847 @itemx -fdump-rtl-stack
3848 @opindex dk
3849 @opindex fdump-rtl-stack
3850 Dump after conversion from registers to stack, to @file{@var{file}.152r.stack}.
3852 @item -dl
3853 @itemx -fdump-rtl-lreg
3854 @opindex dl
3855 @opindex fdump-rtl-lreg
3856 Dump after local register allocation, to @file{@var{file}.138r.lreg}.
3858 @item -dL
3859 @itemx -fdump-rtl-loop2
3860 @opindex dL
3861 @opindex fdump-rtl-loop2
3862 @option{-dL} and @option{-fdump-rtl-loop2} enable dumping after the
3863 loop optimization pass, to @file{@var{file}.119r.loop2},
3864 @file{@var{file}.120r.loop2_init},
3865 @file{@var{file}.121r.loop2_invariant}, and
3866 @file{@var{file}.125r.loop2_done}.
3868 @item -dm
3869 @itemx -fdump-rtl-sms
3870 @opindex dm
3871 @opindex fdump-rtl-sms
3872 Dump after modulo scheduling, to @file{@var{file}.136r.sms}.
3874 @item -dM
3875 @itemx -fdump-rtl-mach
3876 @opindex dM
3877 @opindex fdump-rtl-mach
3878 Dump after performing the machine dependent reorganization pass, to
3879 @file{@var{file}.155r.mach}.
3881 @item -dn
3882 @itemx -fdump-rtl-rnreg
3883 @opindex dn
3884 @opindex fdump-rtl-rnreg
3885 Dump after register renumbering, to @file{@var{file}.147r.rnreg}.
3887 @item -dN
3888 @itemx -fdump-rtl-regmove
3889 @opindex dN
3890 @opindex fdump-rtl-regmove
3891 Dump after the register move pass, to @file{@var{file}.132r.regmove}.
3893 @item -do
3894 @itemx -fdump-rtl-postreload
3895 @opindex do
3896 @opindex fdump-rtl-postreload
3897 Dump after post-reload optimizations, to @file{@var{file}.24.postreload}.
3899 @item -dr
3900 @itemx -fdump-rtl-expand
3901 @opindex dr
3902 @opindex fdump-rtl-expand
3903 Dump after RTL generation, to @file{@var{file}.104r.expand}.
3905 @item -dR
3906 @itemx -fdump-rtl-sched2
3907 @opindex dR
3908 @opindex fdump-rtl-sched2
3909 Dump after the second scheduling pass, to @file{@var{file}.150r.sched2}.
3911 @item -ds
3912 @itemx -fdump-rtl-cse
3913 @opindex ds
3914 @opindex fdump-rtl-cse
3915 Dump after CSE (including the jump optimization that sometimes follows
3916 CSE), to @file{@var{file}.113r.cse}.
3918 @item -dS
3919 @itemx -fdump-rtl-sched
3920 @opindex dS
3921 @opindex fdump-rtl-sched
3922 Dump after the first scheduling pass, to @file{@var{file}.21.sched}.
3924 @item -dt
3925 @itemx -fdump-rtl-cse2
3926 @opindex dt
3927 @opindex fdump-rtl-cse2
3928 Dump after the second CSE pass (including the jump optimization that
3929 sometimes follows CSE), to @file{@var{file}.127r.cse2}.
3931 @item -dT
3932 @itemx -fdump-rtl-tracer
3933 @opindex dT
3934 @opindex fdump-rtl-tracer
3935 Dump after running tracer, to @file{@var{file}.118r.tracer}.
3937 @item -dV
3938 @itemx -fdump-rtl-vpt
3939 @itemx -fdump-rtl-vartrack
3940 @opindex dV
3941 @opindex fdump-rtl-vpt
3942 @opindex fdump-rtl-vartrack
3943 @option{-dV} and @option{-fdump-rtl-vpt} enable dumping after the value
3944 profile transformations, to @file{@var{file}.10.vpt}.  @option{-dV}
3945 and @option{-fdump-rtl-vartrack} enable dumping after variable tracking,
3946 to @file{@var{file}.154r.vartrack}.
3948 @item -dw
3949 @itemx -fdump-rtl-flow2
3950 @opindex dw
3951 @opindex fdump-rtl-flow2
3952 Dump after the second flow pass, to @file{@var{file}.142r.flow2}.
3954 @item -dz
3955 @itemx -fdump-rtl-peephole2
3956 @opindex dz
3957 @opindex fdump-rtl-peephole2
3958 Dump after the peephole pass, to @file{@var{file}.145r.peephole2}.
3960 @item -dZ
3961 @itemx -fdump-rtl-web
3962 @opindex dZ
3963 @opindex fdump-rtl-web
3964 Dump after live range splitting, to @file{@var{file}.126r.web}.
3966 @item -da
3967 @itemx -fdump-rtl-all
3968 @opindex da
3969 @opindex fdump-rtl-all
3970 Produce all the dumps listed above.
3972 @item -dH
3973 @opindex dH
3974 Produce a core dump whenever an error occurs.
3976 @item -dm
3977 @opindex dm
3978 Print statistics on memory usage, at the end of the run, to
3979 standard error.
3981 @item -dp
3982 @opindex dp
3983 Annotate the assembler output with a comment indicating which
3984 pattern and alternative was used.  The length of each instruction is
3985 also printed.
3987 @item -dP
3988 @opindex dP
3989 Dump the RTL in the assembler output as a comment before each instruction.
3990 Also turns on @option{-dp} annotation.
3992 @item -dv
3993 @opindex dv
3994 For each of the other indicated dump files (either with @option{-d} or
3995 @option{-fdump-rtl-@var{pass}}), dump a representation of the control flow
3996 graph suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
3998 @item -dx
3999 @opindex dx
4000 Just generate RTL for a function instead of compiling it.  Usually used
4001 with @samp{r} (@option{-fdump-rtl-expand}).
4003 @item -dy
4004 @opindex dy
4005 Dump debugging information during parsing, to standard error.
4006 @end table
4008 @item -fdump-noaddr
4009 @opindex fdump-noaddr
4010 When doing debugging dumps (see @option{-d} option above), suppress
4011 address output.  This makes it more feasible to use diff on debugging
4012 dumps for compiler invocations with different compiler binaries and/or
4013 different text / bss / data / heap / stack / dso start locations.
4015 @item -fdump-unnumbered
4016 @opindex fdump-unnumbered
4017 When doing debugging dumps (see @option{-d} option above), suppress instruction
4018 numbers, line number note and address output.  This makes it more feasible to
4019 use diff on debugging dumps for compiler invocations with different
4020 options, in particular with and without @option{-g}.
4022 @item -fdump-translation-unit @r{(C++ only)}
4023 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
4024 @opindex fdump-translation-unit
4025 Dump a representation of the tree structure for the entire translation
4026 unit to a file.  The file name is made by appending @file{.tu} to the
4027 source file name.  If the @samp{-@var{options}} form is used, @var{options}
4028 controls the details of the dump as described for the
4029 @option{-fdump-tree} options.
4031 @item -fdump-class-hierarchy @r{(C++ only)}
4032 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
4033 @opindex fdump-class-hierarchy
4034 Dump a representation of each class's hierarchy and virtual function
4035 table layout to a file.  The file name is made by appending @file{.class}
4036 to the source file name.  If the @samp{-@var{options}} form is used,
4037 @var{options} controls the details of the dump as described for the
4038 @option{-fdump-tree} options.
4040 @item -fdump-ipa-@var{switch}
4041 @opindex fdump-ipa
4042 Control the dumping at various stages of inter-procedural analysis
4043 language tree to a file.  The file name is generated by appending a switch
4044 specific suffix to the source file name.  The following dumps are possible:
4046 @table @samp
4047 @item all
4048 Enables all inter-procedural analysis dumps; currently the only produced
4049 dump is the @samp{cgraph} dump.
4051 @item cgraph
4052 Dumps information about call-graph optimization, unused function removal,
4053 and inlining decisions.
4054 @end table
4056 @item -fdump-tree-@var{switch}
4057 @itemx -fdump-tree-@var{switch}-@var{options}
4058 @opindex fdump-tree
4059 Control the dumping at various stages of processing the intermediate
4060 language tree to a file.  The file name is generated by appending a switch
4061 specific suffix to the source file name.  If the @samp{-@var{options}}
4062 form is used, @var{options} is a list of @samp{-} separated options that
4063 control the details of the dump.  Not all options are applicable to all
4064 dumps, those which are not meaningful will be ignored.  The following
4065 options are available
4067 @table @samp
4068 @item address
4069 Print the address of each node.  Usually this is not meaningful as it
4070 changes according to the environment and source file.  Its primary use
4071 is for tying up a dump file with a debug environment.
4072 @item slim
4073 Inhibit dumping of members of a scope or body of a function merely
4074 because that scope has been reached.  Only dump such items when they
4075 are directly reachable by some other path.  When dumping pretty-printed
4076 trees, this option inhibits dumping the bodies of control structures.
4077 @item raw
4078 Print a raw representation of the tree.  By default, trees are
4079 pretty-printed into a C-like representation.
4080 @item details
4081 Enable more detailed dumps (not honored by every dump option).
4082 @item stats
4083 Enable dumping various statistics about the pass (not honored by every dump
4084 option).
4085 @item blocks
4086 Enable showing basic block boundaries (disabled in raw dumps).
4087 @item vops
4088 Enable showing virtual operands for every statement.
4089 @item lineno
4090 Enable showing line numbers for statements.
4091 @item uid
4092 Enable showing the unique ID (@code{DECL_UID}) for each variable.
4093 @item all
4094 Turn on all options, except @option{raw}, @option{slim} and @option{lineno}.
4095 @end table
4097 The following tree dumps are possible:
4098 @table @samp
4100 @item original
4101 Dump before any tree based optimization, to @file{@var{file}.original}.
4103 @item optimized
4104 Dump after all tree based optimization, to @file{@var{file}.optimized}.
4106 @item inlined
4107 Dump after function inlining, to @file{@var{file}.inlined}.
4109 @item gimple
4110 @opindex fdump-tree-gimple
4111 Dump each function before and after the gimplification pass to a file.  The
4112 file name is made by appending @file{.gimple} to the source file name.
4114 @item cfg
4115 @opindex fdump-tree-cfg
4116 Dump the control flow graph of each function to a file.  The file name is
4117 made by appending @file{.cfg} to the source file name.
4119 @item vcg
4120 @opindex fdump-tree-vcg
4121 Dump the control flow graph of each function to a file in VCG format.  The
4122 file name is made by appending @file{.vcg} to the source file name.  Note
4123 that if the file contains more than one function, the generated file cannot
4124 be used directly by VCG@.  You will need to cut and paste each function's
4125 graph into its own separate file first.
4127 @item ch
4128 @opindex fdump-tree-ch
4129 Dump each function after copying loop headers.  The file name is made by
4130 appending @file{.ch} to the source file name.
4132 @item ssa
4133 @opindex fdump-tree-ssa
4134 Dump SSA related information to a file.  The file name is made by appending
4135 @file{.ssa} to the source file name.
4137 @item salias
4138 @opindex fdump-tree-salias
4139 Dump structure aliasing variable information to a file.  This file name
4140 is made by appending @file{.salias} to the source file name.
4142 @item alias
4143 @opindex fdump-tree-alias
4144 Dump aliasing information for each function.  The file name is made by
4145 appending @file{.alias} to the source file name.
4147 @item ccp
4148 @opindex fdump-tree-ccp
4149 Dump each function after CCP@.  The file name is made by appending
4150 @file{.ccp} to the source file name.
4152 @item storeccp
4153 @opindex fdump-tree-storeccp
4154 Dump each function after STORE-CCP.  The file name is made by appending
4155 @file{.storeccp} to the source file name.
4157 @item pre
4158 @opindex fdump-tree-pre
4159 Dump trees after partial redundancy elimination.  The file name is made
4160 by appending @file{.pre} to the source file name.
4162 @item fre
4163 @opindex fdump-tree-fre
4164 Dump trees after full redundancy elimination.  The file name is made
4165 by appending @file{.fre} to the source file name.
4167 @item copyprop
4168 @opindex fdump-tree-copyprop
4169 Dump trees after copy propagation.  The file name is made
4170 by appending @file{.copyprop} to the source file name.
4172 @item store_copyprop
4173 @opindex fdump-tree-store_copyprop
4174 Dump trees after store copy-propagation.  The file name is made
4175 by appending @file{.store_copyprop} to the source file name.
4177 @item dce
4178 @opindex fdump-tree-dce
4179 Dump each function after dead code elimination.  The file name is made by
4180 appending @file{.dce} to the source file name.
4182 @item mudflap
4183 @opindex fdump-tree-mudflap
4184 Dump each function after adding mudflap instrumentation.  The file name is
4185 made by appending @file{.mudflap} to the source file name.
4187 @item sra
4188 @opindex fdump-tree-sra
4189 Dump each function after performing scalar replacement of aggregates.  The
4190 file name is made by appending @file{.sra} to the source file name.
4192 @item sink
4193 @opindex fdump-tree-sink
4194 Dump each function after performing code sinking.  The file name is made
4195 by appending @file{.sink} to the source file name. 
4197 @item dom
4198 @opindex fdump-tree-dom
4199 Dump each function after applying dominator tree optimizations.  The file
4200 name is made by appending @file{.dom} to the source file name.
4202 @item dse
4203 @opindex fdump-tree-dse
4204 Dump each function after applying dead store elimination.  The file
4205 name is made by appending @file{.dse} to the source file name.
4207 @item phiopt
4208 @opindex fdump-tree-phiopt
4209 Dump each function after optimizing PHI nodes into straightline code.  The file
4210 name is made by appending @file{.phiopt} to the source file name.
4212 @item forwprop
4213 @opindex fdump-tree-forwprop
4214 Dump each function after forward propagating single use variables.  The file
4215 name is made by appending @file{.forwprop} to the source file name.
4217 @item copyrename
4218 @opindex fdump-tree-copyrename
4219 Dump each function after applying the copy rename optimization.  The file
4220 name is made by appending @file{.copyrename} to the source file name.
4222 @item nrv
4223 @opindex fdump-tree-nrv
4224 Dump each function after applying the named return value optimization on
4225 generic trees.  The file name is made by appending @file{.nrv} to the source
4226 file name.
4228 @item vect
4229 @opindex fdump-tree-vect
4230 Dump each function after applying vectorization of loops.  The file name is
4231 made by appending @file{.vect} to the source file name.
4233 @item vrp
4234 @opindex fdump-tree-vrp
4235 Dump each function after Value Range Propagation (VRP).  The file name
4236 is made by appending @file{.vrp} to the source file name.
4238 @item all
4239 @opindex fdump-tree-all
4240 Enable all the available tree dumps with the flags provided in this option.
4241 @end table
4243 @item -ftree-vectorizer-verbose=@var{n}
4244 @opindex ftree-vectorizer-verbose
4245 This option controls the amount of debugging output the vectorizer prints.
4246 This information is written to standard error, unless 
4247 @option{-fdump-tree-all} or @option{-fdump-tree-vect} is specified, 
4248 in which case it is output to the usual dump listing file, @file{.vect}.
4249 For @var{n}=0 no diagnostic information is reported.
4250 If @var{n}=1 the vectorizer reports each loop that got vectorized, 
4251 and the total number of loops that got vectorized.
4252 If @var{n}=2 the vectorizer also reports non-vectorized loops that passed 
4253 the first analysis phase (vect_analyze_loop_form) - i.e. countable, 
4254 inner-most, single-bb, single-entry/exit loops.  This is the same verbosity 
4255 level that @option{-fdump-tree-vect-stats} uses.
4256 Higher verbosity levels mean either more information dumped for each 
4257 reported loop, or same amount of information reported for more loops:
4258 If @var{n}=3, alignment related information is added to the reports.
4259 If @var{n}=4, data-references related information (e.g. memory dependences, 
4260 memory access-patterns) is added to the reports.
4261 If @var{n}=5, the vectorizer reports also non-vectorized inner-most loops 
4262 that did not pass the first analysis phase (i.e. may not be countable, or 
4263 may have complicated control-flow).
4264 If @var{n}=6, the vectorizer reports also non-vectorized nested loops.
4265 For @var{n}=7, all the information the vectorizer generates during its 
4266 analysis and transformation is reported.  This is the same verbosity level
4267 that @option{-fdump-tree-vect-details} uses.
4269 @item -frandom-seed=@var{string}
4270 @opindex frandom-string
4271 This option provides a seed that GCC uses when it would otherwise use
4272 random numbers.  It is used to generate certain symbol names
4273 that have to be different in every compiled file.  It is also used to
4274 place unique stamps in coverage data files and the object files that
4275 produce them.  You can use the @option{-frandom-seed} option to produce
4276 reproducibly identical object files.
4278 The @var{string} should be different for every file you compile.
4280 @item -fsched-verbose=@var{n}
4281 @opindex fsched-verbose
4282 On targets that use instruction scheduling, this option controls the
4283 amount of debugging output the scheduler prints.  This information is
4284 written to standard error, unless @option{-dS} or @option{-dR} is
4285 specified, in which case it is output to the usual dump
4286 listing file, @file{.sched} or @file{.sched2} respectively.  However
4287 for @var{n} greater than nine, the output is always printed to standard
4288 error.
4290 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
4291 same information as @option{-dRS}.  For @var{n} greater than one, it
4292 also output basic block probabilities, detailed ready list information
4293 and unit/insn info.  For @var{n} greater than two, it includes RTL
4294 at abort point, control-flow and regions info.  And for @var{n} over
4295 four, @option{-fsched-verbose} also includes dependence info.
4297 @item -save-temps
4298 @opindex save-temps
4299 Store the usual ``temporary'' intermediate files permanently; place them
4300 in the current directory and name them based on the source file.  Thus,
4301 compiling @file{foo.c} with @samp{-c -save-temps} would produce files
4302 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
4303 preprocessed @file{foo.i} output file even though the compiler now
4304 normally uses an integrated preprocessor.
4306 When used in combination with the @option{-x} command line option,
4307 @option{-save-temps} is sensible enough to avoid over writing an
4308 input source file with the same extension as an intermediate file.
4309 The corresponding intermediate file may be obtained by renaming the
4310 source file before using @option{-save-temps}.
4312 @item -time
4313 @opindex time
4314 Report the CPU time taken by each subprocess in the compilation
4315 sequence.  For C source files, this is the compiler proper and assembler
4316 (plus the linker if linking is done).  The output looks like this:
4318 @smallexample
4319 # cc1 0.12 0.01
4320 # as 0.00 0.01
4321 @end smallexample
4323 The first number on each line is the ``user time'', that is time spent
4324 executing the program itself.  The second number is ``system time'',
4325 time spent executing operating system routines on behalf of the program.
4326 Both numbers are in seconds.
4328 @item -fvar-tracking
4329 @opindex fvar-tracking
4330 Run variable tracking pass.  It computes where variables are stored at each
4331 position in code.  Better debugging information is then generated
4332 (if the debugging information format supports this information).
4334 It is enabled by default when compiling with optimization (@option{-Os},
4335 @option{-O}, @option{-O2}, ...), debugging information (@option{-g}) and
4336 the debug info format supports it.
4338 @item -print-file-name=@var{library}
4339 @opindex print-file-name
4340 Print the full absolute name of the library file @var{library} that
4341 would be used when linking---and don't do anything else.  With this
4342 option, GCC does not compile or link anything; it just prints the
4343 file name.
4345 @item -print-multi-directory
4346 @opindex print-multi-directory
4347 Print the directory name corresponding to the multilib selected by any
4348 other switches present in the command line.  This directory is supposed
4349 to exist in @env{GCC_EXEC_PREFIX}.
4351 @item -print-multi-lib
4352 @opindex print-multi-lib
4353 Print the mapping from multilib directory names to compiler switches
4354 that enable them.  The directory name is separated from the switches by
4355 @samp{;}, and each switch starts with an @samp{@@} instead of the
4356 @samp{-}, without spaces between multiple switches.  This is supposed to
4357 ease shell-processing.
4359 @item -print-prog-name=@var{program}
4360 @opindex print-prog-name
4361 Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
4363 @item -print-libgcc-file-name
4364 @opindex print-libgcc-file-name
4365 Same as @option{-print-file-name=libgcc.a}.
4367 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
4368 but you do want to link with @file{libgcc.a}.  You can do
4370 @smallexample
4371 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
4372 @end smallexample
4374 @item -print-search-dirs
4375 @opindex print-search-dirs
4376 Print the name of the configured installation directory and a list of
4377 program and library directories @command{gcc} will search---and don't do anything else.
4379 This is useful when @command{gcc} prints the error message
4380 @samp{installation problem, cannot exec cpp0: No such file or directory}.
4381 To resolve this you either need to put @file{cpp0} and the other compiler
4382 components where @command{gcc} expects to find them, or you can set the environment
4383 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
4384 Don't forget the trailing @samp{/}.
4385 @xref{Environment Variables}.
4387 @item -dumpmachine
4388 @opindex dumpmachine
4389 Print the compiler's target machine (for example,
4390 @samp{i686-pc-linux-gnu})---and don't do anything else.
4392 @item -dumpversion
4393 @opindex dumpversion
4394 Print the compiler version (for example, @samp{3.0})---and don't do
4395 anything else.
4397 @item -dumpspecs
4398 @opindex dumpspecs
4399 Print the compiler's built-in specs---and don't do anything else.  (This
4400 is used when GCC itself is being built.)  @xref{Spec Files}.
4402 @item -feliminate-unused-debug-types
4403 @opindex feliminate-unused-debug-types
4404 Normally, when producing DWARF2 output, GCC will emit debugging
4405 information for all types declared in a compilation
4406 unit, regardless of whether or not they are actually used
4407 in that compilation unit.  Sometimes this is useful, such as
4408 if, in the debugger, you want to cast a value to a type that is
4409 not actually used in your program (but is declared).  More often,
4410 however, this results in a significant amount of wasted space.
4411 With this option, GCC will avoid producing debug symbol output
4412 for types that are nowhere used in the source file being compiled.
4413 @end table
4415 @node Optimize Options
4416 @section Options That Control Optimization
4417 @cindex optimize options
4418 @cindex options, optimization
4420 These options control various sorts of optimizations.
4422 Without any optimization option, the compiler's goal is to reduce the
4423 cost of compilation and to make debugging produce the expected
4424 results.  Statements are independent: if you stop the program with a
4425 breakpoint between statements, you can then assign a new value to any
4426 variable or change the program counter to any other statement in the
4427 function and get exactly the results you would expect from the source
4428 code.
4430 Turning on optimization flags makes the compiler attempt to improve
4431 the performance and/or code size at the expense of compilation time
4432 and possibly the ability to debug the program.
4434 The compiler performs optimization based on the knowledge it has of
4435 the program.  Optimization levels @option{-O} and above, in
4436 particular, enable @emph{unit-at-a-time} mode, which allows the
4437 compiler to consider information gained from later functions in
4438 the file when compiling a function.  Compiling multiple files at
4439 once to a single output file in @emph{unit-at-a-time} mode allows
4440 the compiler to use information gained from all of the files when
4441 compiling each of them.
4443 Not all optimizations are controlled directly by a flag.  Only
4444 optimizations that have a flag are listed.
4446 @table @gcctabopt
4447 @item -O
4448 @itemx -O1
4449 @opindex O
4450 @opindex O1
4451 Optimize.  Optimizing compilation takes somewhat more time, and a lot
4452 more memory for a large function.
4454 With @option{-O}, the compiler tries to reduce code size and execution
4455 time, without performing any optimizations that take a great deal of
4456 compilation time.
4458 @option{-O} turns on the following optimization flags:
4459 @gccoptlist{-fdefer-pop @gol
4460 -fdelayed-branch @gol
4461 -fguess-branch-probability @gol
4462 -fcprop-registers @gol
4463 -fif-conversion @gol
4464 -fif-conversion2 @gol
4465 -ftree-ccp @gol
4466 -ftree-dce @gol
4467 -ftree-dominator-opts @gol
4468 -ftree-dse @gol
4469 -ftree-ter @gol
4470 -ftree-lrs @gol
4471 -ftree-sra @gol
4472 -ftree-copyrename @gol
4473 -ftree-fre @gol
4474 -ftree-ch @gol
4475 -funit-at-a-time @gol
4476 -fmerge-constants}
4478 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
4479 where doing so does not interfere with debugging.
4481 @item -O2
4482 @opindex O2
4483 Optimize even more.  GCC performs nearly all supported optimizations
4484 that do not involve a space-speed tradeoff.  The compiler does not
4485 perform loop unrolling or function inlining when you specify @option{-O2}.
4486 As compared to @option{-O}, this option increases both compilation time
4487 and the performance of the generated code.
4489 @option{-O2} turns on all optimization flags specified by @option{-O}.  It
4490 also turns on the following optimization flags:
4491 @gccoptlist{-fthread-jumps @gol
4492 -fcrossjumping @gol
4493 -foptimize-sibling-calls @gol
4494 -fcse-follow-jumps  -fcse-skip-blocks @gol
4495 -fgcse  -fgcse-lm  @gol
4496 -fexpensive-optimizations @gol
4497 -frerun-cse-after-loop  @gol
4498 -fcaller-saves @gol
4499 -fpeephole2 @gol
4500 -fschedule-insns  -fschedule-insns2 @gol
4501 -fsched-interblock  -fsched-spec @gol
4502 -fregmove @gol
4503 -fstrict-aliasing @gol
4504 -fdelete-null-pointer-checks @gol
4505 -freorder-blocks  -freorder-functions @gol
4506 -falign-functions  -falign-jumps @gol
4507 -falign-loops  -falign-labels @gol
4508 -ftree-vrp @gol
4509 -ftree-pre}
4511 Please note the warning under @option{-fgcse} about
4512 invoking @option{-O2} on programs that use computed gotos.
4514 @item -O3
4515 @opindex O3
4516 Optimize yet more.  @option{-O3} turns on all optimizations specified by
4517 @option{-O2} and also turns on the @option{-finline-functions},
4518 @option{-funswitch-loops} and @option{-fgcse-after-reload} options.
4520 @item -O0
4521 @opindex O0
4522 Do not optimize.  This is the default.
4524 @item -Os
4525 @opindex Os
4526 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations that
4527 do not typically increase code size.  It also performs further
4528 optimizations designed to reduce code size.
4530 @option{-Os} disables the following optimization flags:
4531 @gccoptlist{-falign-functions  -falign-jumps  -falign-loops @gol
4532 -falign-labels  -freorder-blocks  -freorder-blocks-and-partition @gol
4533 -fprefetch-loop-arrays  -ftree-vect-loop-version}
4535 If you use multiple @option{-O} options, with or without level numbers,
4536 the last such option is the one that is effective.
4537 @end table
4539 Options of the form @option{-f@var{flag}} specify machine-independent
4540 flags.  Most flags have both positive and negative forms; the negative
4541 form of @option{-ffoo} would be @option{-fno-foo}.  In the table
4542 below, only one of the forms is listed---the one you typically will
4543 use.  You can figure out the other form by either removing @samp{no-}
4544 or adding it.
4546 The following options control specific optimizations.  They are either
4547 activated by @option{-O} options or are related to ones that are.  You
4548 can use the following flags in the rare cases when ``fine-tuning'' of
4549 optimizations to be performed is desired.
4551 @table @gcctabopt
4552 @item -fno-default-inline
4553 @opindex fno-default-inline
4554 Do not make member functions inline by default merely because they are
4555 defined inside the class scope (C++ only).  Otherwise, when you specify
4556 @w{@option{-O}}, member functions defined inside class scope are compiled
4557 inline by default; i.e., you don't need to add @samp{inline} in front of
4558 the member function name.
4560 @item -fno-defer-pop
4561 @opindex fno-defer-pop
4562 Always pop the arguments to each function call as soon as that function
4563 returns.  For machines which must pop arguments after a function call,
4564 the compiler normally lets arguments accumulate on the stack for several
4565 function calls and pops them all at once.
4567 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4569 @item -fforce-mem
4570 @opindex fforce-mem
4571 Force memory operands to be copied into registers before doing
4572 arithmetic on them.  This produces better code by making all memory
4573 references potential common subexpressions.  When they are not common
4574 subexpressions, instruction combination should eliminate the separate
4575 register-load. This option is now a nop and will be removed in 4.2.
4577 @item -fforce-addr
4578 @opindex fforce-addr
4579 Force memory address constants to be copied into registers before
4580 doing arithmetic on them.
4582 @item -fomit-frame-pointer
4583 @opindex fomit-frame-pointer
4584 Don't keep the frame pointer in a register for functions that
4585 don't need one.  This avoids the instructions to save, set up and
4586 restore frame pointers; it also makes an extra register available
4587 in many functions.  @strong{It also makes debugging impossible on
4588 some machines.}
4590 On some machines, such as the VAX, this flag has no effect, because
4591 the standard calling sequence automatically handles the frame pointer
4592 and nothing is saved by pretending it doesn't exist.  The
4593 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
4594 whether a target machine supports this flag.  @xref{Registers,,Register
4595 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
4597 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4599 @item -foptimize-sibling-calls
4600 @opindex foptimize-sibling-calls
4601 Optimize sibling and tail recursive calls.
4603 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4605 @item -fno-inline
4606 @opindex fno-inline
4607 Don't pay attention to the @code{inline} keyword.  Normally this option
4608 is used to keep the compiler from expanding any functions inline.
4609 Note that if you are not optimizing, no functions can be expanded inline.
4611 @item -finline-functions
4612 @opindex finline-functions
4613 Integrate all simple functions into their callers.  The compiler
4614 heuristically decides which functions are simple enough to be worth
4615 integrating in this way.
4617 If all calls to a given function are integrated, and the function is
4618 declared @code{static}, then the function is normally not output as
4619 assembler code in its own right.
4621 Enabled at level @option{-O3}.
4623 @item -finline-functions-called-once
4624 @opindex finline-functions-called-once
4625 Consider all @code{static} functions called once for inlining into their
4626 caller even if they are not marked @code{inline}.  If a call to a given
4627 function is integrated, then the function is not output as assembler code
4628 in its own right.
4630 Enabled if @option{-funit-at-a-time} is enabled.
4632 @item -fearly-inlining
4633 @opindex fearly-inlining
4634 Inline functions marked by @code{always_inline} and functions whose body seems
4635 smaller than the function call overhead early before doing
4636 @option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
4637 makes profiling significantly cheaper and usually inlining faster on programs
4638 having large chains of nested wrapper functions.
4640 Enabled by default.
4642 @item -finline-limit=@var{n}
4643 @opindex finline-limit
4644 By default, GCC limits the size of functions that can be inlined.  This flag
4645 allows the control of this limit for functions that are explicitly marked as
4646 inline (i.e., marked with the inline keyword or defined within the class
4647 definition in c++).  @var{n} is the size of functions that can be inlined in
4648 number of pseudo instructions (not counting parameter handling).  The default
4649 value of @var{n} is 600.
4650 Increasing this value can result in more inlined code at
4651 the cost of compilation time and memory consumption.  Decreasing usually makes
4652 the compilation faster and less code will be inlined (which presumably
4653 means slower programs).  This option is particularly useful for programs that
4654 use inlining heavily such as those based on recursive templates with C++.
4656 Inlining is actually controlled by a number of parameters, which may be
4657 specified individually by using @option{--param @var{name}=@var{value}}.
4658 The @option{-finline-limit=@var{n}} option sets some of these parameters
4659 as follows:
4661 @table @gcctabopt
4662  @item max-inline-insns-single
4663   is set to @var{n}/2.
4664  @item max-inline-insns-auto
4665   is set to @var{n}/2.
4666  @item min-inline-insns
4667   is set to 130 or @var{n}/4, whichever is smaller.
4668  @item max-inline-insns-rtl
4669   is set to @var{n}.
4670 @end table
4672 See below for a documentation of the individual
4673 parameters controlling inlining.
4675 @emph{Note:} pseudo instruction represents, in this particular context, an
4676 abstract measurement of function's size.  In no way does it represent a count
4677 of assembly instructions and as such its exact meaning might change from one
4678 release to an another.
4680 @item -fkeep-inline-functions
4681 @opindex fkeep-inline-functions
4682 In C, emit @code{static} functions that are declared @code{inline}
4683 into the object file, even if the function has been inlined into all
4684 of its callers.  This switch does not affect functions using the
4685 @code{extern inline} extension in GNU C@.  In C++, emit any and all
4686 inline functions into the object file.
4688 @item -fkeep-static-consts
4689 @opindex fkeep-static-consts
4690 Emit variables declared @code{static const} when optimization isn't turned
4691 on, even if the variables aren't referenced.
4693 GCC enables this option by default.  If you want to force the compiler to
4694 check if the variable was referenced, regardless of whether or not
4695 optimization is turned on, use the @option{-fno-keep-static-consts} option.
4697 @item -fmerge-constants
4698 Attempt to merge identical constants (string constants and floating point
4699 constants) across compilation units.
4701 This option is the default for optimized compilation if the assembler and
4702 linker support it.  Use @option{-fno-merge-constants} to inhibit this
4703 behavior.
4705 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4707 @item -fmerge-all-constants
4708 Attempt to merge identical constants and identical variables.
4710 This option implies @option{-fmerge-constants}.  In addition to
4711 @option{-fmerge-constants} this considers e.g.@: even constant initialized
4712 arrays or initialized constant variables with integral or floating point
4713 types.  Languages like C or C++ require each non-automatic variable to
4714 have distinct location, so using this option will result in non-conforming
4715 behavior.
4717 @item -fmodulo-sched
4718 @opindex fmodulo-sched
4719 Perform swing modulo scheduling immediately before the first scheduling
4720 pass.  This pass looks at innermost loops and reorders their
4721 instructions by overlapping different iterations.
4723 @item -fno-branch-count-reg
4724 @opindex fno-branch-count-reg
4725 Do not use ``decrement and branch'' instructions on a count register,
4726 but instead generate a sequence of instructions that decrement a
4727 register, compare it against zero, then branch based upon the result.
4728 This option is only meaningful on architectures that support such
4729 instructions, which include x86, PowerPC, IA-64 and S/390.
4731 The default is @option{-fbranch-count-reg}.
4733 @item -fno-function-cse
4734 @opindex fno-function-cse
4735 Do not put function addresses in registers; make each instruction that
4736 calls a constant function contain the function's address explicitly.
4738 This option results in less efficient code, but some strange hacks
4739 that alter the assembler output may be confused by the optimizations
4740 performed when this option is not used.
4742 The default is @option{-ffunction-cse}
4744 @item -fno-zero-initialized-in-bss
4745 @opindex fno-zero-initialized-in-bss
4746 If the target supports a BSS section, GCC by default puts variables that
4747 are initialized to zero into BSS@.  This can save space in the resulting
4748 code.
4750 This option turns off this behavior because some programs explicitly
4751 rely on variables going to the data section.  E.g., so that the
4752 resulting executable can find the beginning of that section and/or make
4753 assumptions based on that.
4755 The default is @option{-fzero-initialized-in-bss}.
4757 @item -fbounds-check
4758 @opindex fbounds-check
4759 For front-ends that support it, generate additional code to check that
4760 indices used to access arrays are within the declared range.  This is
4761 currently only supported by the Java and Fortran front-ends, where
4762 this option defaults to true and false respectively.
4764 @item -fmudflap -fmudflapth -fmudflapir
4765 @opindex fmudflap
4766 @opindex fmudflapth
4767 @opindex fmudflapir
4768 @cindex bounds checking
4769 @cindex mudflap
4770 For front-ends that support it (C and C++), instrument all risky
4771 pointer/array dereferencing operations, some standard library
4772 string/heap functions, and some other associated constructs with
4773 range/validity tests.  Modules so instrumented should be immune to
4774 buffer overflows, invalid heap use, and some other classes of C/C++
4775 programming errors.  The instrumentation relies on a separate runtime
4776 library (@file{libmudflap}), which will be linked into a program if
4777 @option{-fmudflap} is given at link time.  Run-time behavior of the
4778 instrumented program is controlled by the @env{MUDFLAP_OPTIONS}
4779 environment variable.  See @code{env MUDFLAP_OPTIONS=-help a.out}
4780 for its options.
4782 Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to
4783 link if your program is multi-threaded.  Use @option{-fmudflapir}, in
4784 addition to @option{-fmudflap} or @option{-fmudflapth}, if
4785 instrumentation should ignore pointer reads.  This produces less
4786 instrumentation (and therefore faster execution) and still provides
4787 some protection against outright memory corrupting writes, but allows
4788 erroneously read data to propagate within a program.
4790 @item -fthread-jumps
4791 @opindex fthread-jumps
4792 Perform optimizations where we check to see if a jump branches to a
4793 location where another comparison subsumed by the first is found.  If
4794 so, the first branch is redirected to either the destination of the
4795 second branch or a point immediately following it, depending on whether
4796 the condition is known to be true or false.
4798 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4800 @item -fcse-follow-jumps
4801 @opindex fcse-follow-jumps
4802 In common subexpression elimination, scan through jump instructions
4803 when the target of the jump is not reached by any other path.  For
4804 example, when CSE encounters an @code{if} statement with an
4805 @code{else} clause, CSE will follow the jump when the condition
4806 tested is false.
4808 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4810 @item -fcse-skip-blocks
4811 @opindex fcse-skip-blocks
4812 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
4813 follow jumps which conditionally skip over blocks.  When CSE
4814 encounters a simple @code{if} statement with no else clause,
4815 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
4816 body of the @code{if}.
4818 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4820 @item -frerun-cse-after-loop
4821 @opindex frerun-cse-after-loop
4822 Re-run common subexpression elimination after loop optimizations has been
4823 performed.
4825 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4827 @item -fgcse
4828 @opindex fgcse
4829 Perform a global common subexpression elimination pass.
4830 This pass also performs global constant and copy propagation.
4832 @emph{Note:} When compiling a program using computed gotos, a GCC
4833 extension, you may get better runtime performance if you disable
4834 the global common subexpression elimination pass by adding
4835 @option{-fno-gcse} to the command line.
4837 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4839 @item -fgcse-lm
4840 @opindex fgcse-lm
4841 When @option{-fgcse-lm} is enabled, global common subexpression elimination will
4842 attempt to move loads which are only killed by stores into themselves.  This
4843 allows a loop containing a load/store sequence to be changed to a load outside
4844 the loop, and a copy/store within the loop.
4846 Enabled by default when gcse is enabled.
4848 @item -fgcse-sm
4849 @opindex fgcse-sm
4850 When @option{-fgcse-sm} is enabled, a store motion pass is run after
4851 global common subexpression elimination.  This pass will attempt to move
4852 stores out of loops.  When used in conjunction with @option{-fgcse-lm},
4853 loops containing a load/store sequence can be changed to a load before
4854 the loop and a store after the loop.
4856 Not enabled at any optimization level.
4858 @item -fgcse-las
4859 @opindex fgcse-las
4860 When @option{-fgcse-las} is enabled, the global common subexpression
4861 elimination pass eliminates redundant loads that come after stores to the
4862 same memory location (both partial and full redundancies).
4864 Not enabled at any optimization level.
4866 @item -fgcse-after-reload
4867 @opindex fgcse-after-reload
4868 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
4869 pass is performed after reload.  The purpose of this pass is to cleanup
4870 redundant spilling.
4872 @item -funsafe-loop-optimizations
4873 @opindex funsafe-loop-optimizations
4874 If given, the loop optimizer will assume that loop indices do not
4875 overflow, and that the loops with nontrivial exit condition are not
4876 infinite.  This enables a wider range of loop optimizations even if
4877 the loop optimizer itself cannot prove that these assumptions are valid.
4878 Using @option{-Wunsafe-loop-optimizations}, the compiler will warn you
4879 if it finds this kind of loop.
4881 @item -fcrossjumping
4882 @opindex crossjumping
4883 Perform cross-jumping transformation.  This transformation unifies equivalent code and save code size.  The
4884 resulting code may or may not perform better than without cross-jumping.
4886 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4888 @item -fif-conversion
4889 @opindex if-conversion
4890 Attempt to transform conditional jumps into branch-less equivalents.  This
4891 include use of conditional moves, min, max, set flags and abs instructions, and
4892 some tricks doable by standard arithmetics.  The use of conditional execution
4893 on chips where it is available is controlled by @code{if-conversion2}.
4895 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4897 @item -fif-conversion2
4898 @opindex if-conversion2
4899 Use conditional execution (where available) to transform conditional jumps into
4900 branch-less equivalents.
4902 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4904 @item -fdelete-null-pointer-checks
4905 @opindex fdelete-null-pointer-checks
4906 Use global dataflow analysis to identify and eliminate useless checks
4907 for null pointers.  The compiler assumes that dereferencing a null
4908 pointer would have halted the program.  If a pointer is checked after
4909 it has already been dereferenced, it cannot be null.
4911 In some environments, this assumption is not true, and programs can
4912 safely dereference null pointers.  Use
4913 @option{-fno-delete-null-pointer-checks} to disable this optimization
4914 for programs which depend on that behavior.
4916 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4918 @item -fexpensive-optimizations
4919 @opindex fexpensive-optimizations
4920 Perform a number of minor optimizations that are relatively expensive.
4922 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4924 @item -foptimize-register-move
4925 @itemx -fregmove
4926 @opindex foptimize-register-move
4927 @opindex fregmove
4928 Attempt to reassign register numbers in move instructions and as
4929 operands of other simple instructions in order to maximize the amount of
4930 register tying.  This is especially helpful on machines with two-operand
4931 instructions.
4933 Note @option{-fregmove} and @option{-foptimize-register-move} are the same
4934 optimization.
4936 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4938 @item -fdelayed-branch
4939 @opindex fdelayed-branch
4940 If supported for the target machine, attempt to reorder instructions
4941 to exploit instruction slots available after delayed branch
4942 instructions.
4944 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4946 @item -fschedule-insns
4947 @opindex fschedule-insns
4948 If supported for the target machine, attempt to reorder instructions to
4949 eliminate execution stalls due to required data being unavailable.  This
4950 helps machines that have slow floating point or memory load instructions
4951 by allowing other instructions to be issued until the result of the load
4952 or floating point instruction is required.
4954 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4956 @item -fschedule-insns2
4957 @opindex fschedule-insns2
4958 Similar to @option{-fschedule-insns}, but requests an additional pass of
4959 instruction scheduling after register allocation has been done.  This is
4960 especially useful on machines with a relatively small number of
4961 registers and where memory load instructions take more than one cycle.
4963 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4965 @item -fno-sched-interblock
4966 @opindex fno-sched-interblock
4967 Don't schedule instructions across basic blocks.  This is normally
4968 enabled by default when scheduling before register allocation, i.e.@:
4969 with @option{-fschedule-insns} or at @option{-O2} or higher.
4971 @item -fno-sched-spec
4972 @opindex fno-sched-spec
4973 Don't allow speculative motion of non-load instructions.  This is normally
4974 enabled by default when scheduling before register allocation, i.e.@:
4975 with @option{-fschedule-insns} or at @option{-O2} or higher.
4977 @item -fsched-spec-load
4978 @opindex fsched-spec-load
4979 Allow speculative motion of some load instructions.  This only makes
4980 sense when scheduling before register allocation, i.e.@: with
4981 @option{-fschedule-insns} or at @option{-O2} or higher.
4983 @item -fsched-spec-load-dangerous
4984 @opindex fsched-spec-load-dangerous
4985 Allow speculative motion of more load instructions.  This only makes
4986 sense when scheduling before register allocation, i.e.@: with
4987 @option{-fschedule-insns} or at @option{-O2} or higher.
4989 @item -fsched-stalled-insns=@var{n}
4990 @opindex fsched-stalled-insns
4991 Define how many insns (if any) can be moved prematurely from the queue
4992 of stalled insns into the ready list, during the second scheduling pass.
4994 @item -fsched-stalled-insns-dep=@var{n}
4995 @opindex fsched-stalled-insns-dep
4996 Define how many insn groups (cycles) will be examined for a dependency
4997 on a stalled insn that is candidate for premature removal from the queue
4998 of stalled insns.  Has an effect only during the second scheduling pass,
4999 and only if @option{-fsched-stalled-insns} is used and its value is not zero.
5001 @item -fsched2-use-superblocks
5002 @opindex fsched2-use-superblocks
5003 When scheduling after register allocation, do use superblock scheduling
5004 algorithm.  Superblock scheduling allows motion across basic block boundaries
5005 resulting on faster schedules.  This option is experimental, as not all machine
5006 descriptions used by GCC model the CPU closely enough to avoid unreliable
5007 results from the algorithm.
5009 This only makes sense when scheduling after register allocation, i.e.@: with
5010 @option{-fschedule-insns2} or at @option{-O2} or higher.
5012 @item -fsched2-use-traces
5013 @opindex fsched2-use-traces
5014 Use @option{-fsched2-use-superblocks} algorithm when scheduling after register
5015 allocation and additionally perform code duplication in order to increase the
5016 size of superblocks using tracer pass.  See @option{-ftracer} for details on
5017 trace formation.
5019 This mode should produce faster but significantly longer programs.  Also
5020 without @option{-fbranch-probabilities} the traces constructed may not
5021 match the reality and hurt the performance.  This only makes
5022 sense when scheduling after register allocation, i.e.@: with
5023 @option{-fschedule-insns2} or at @option{-O2} or higher.
5025 @item -fsee
5026 @opindex fsee
5027 Eliminates redundant extension instructions and move the non redundant
5028 ones to optimal placement using LCM.
5030 @item -freschedule-modulo-scheduled-loops
5031 @opindex fscheduling-in-modulo-scheduled-loops
5032 The modulo scheduling comes before the traditional scheduling, if a loop was modulo scheduled
5033 we may want to prevent the later scheduling passes from changing its schedule, we use this
5034 option to control that.
5036 @item -fcaller-saves
5037 @opindex fcaller-saves
5038 Enable values to be allocated in registers that will be clobbered by
5039 function calls, by emitting extra instructions to save and restore the
5040 registers around such calls.  Such allocation is done only when it
5041 seems to result in better code than would otherwise be produced.
5043 This option is always enabled by default on certain machines, usually
5044 those which have no call-preserved registers to use instead.
5046 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5048 @item -ftree-pre
5049 Perform Partial Redundancy Elimination (PRE) on trees.  This flag is
5050 enabled by default at @option{-O2} and @option{-O3}.
5052 @item -ftree-fre
5053 Perform Full Redundancy Elimination (FRE) on trees.  The difference
5054 between FRE and PRE is that FRE only considers expressions
5055 that are computed on all paths leading to the redundant computation.
5056 This analysis faster than PRE, though it exposes fewer redundancies.
5057 This flag is enabled by default at @option{-O} and higher.
5059 @item -ftree-copy-prop
5060 Perform copy propagation on trees.  This pass eliminates unnecessary
5061 copy operations.  This flag is enabled by default at @option{-O} and
5062 higher.
5064 @item -ftree-store-copy-prop
5065 Perform copy propagation of memory loads and stores.  This pass
5066 eliminates unnecessary copy operations in memory references
5067 (structures, global variables, arrays, etc).  This flag is enabled by
5068 default at @option{-O2} and higher.
5070 @item -ftree-salias
5071 Perform structural alias analysis on trees.  This flag
5072 is enabled by default at @option{-O} and higher.
5074 @item -fipa-pta
5075 Perform interprocedural pointer analysis.
5077 @item -ftree-sink
5078 Perform forward store motion  on trees.  This flag is
5079 enabled by default at @option{-O} and higher.
5081 @item -ftree-ccp
5082 Perform sparse conditional constant propagation (CCP) on trees.  This
5083 pass only operates on local scalar variables and is enabled by default
5084 at @option{-O} and higher.
5086 @item -ftree-store-ccp
5087 Perform sparse conditional constant propagation (CCP) on trees.  This
5088 pass operates on both local scalar variables and memory stores and
5089 loads (global variables, structures, arrays, etc).  This flag is
5090 enabled by default at @option{-O2} and higher.
5092 @item -ftree-dce
5093 Perform dead code elimination (DCE) on trees.  This flag is enabled by
5094 default at @option{-O} and higher.
5096 @item -ftree-dominator-opts
5097 Perform a variety of simple scalar cleanups (constant/copy
5098 propagation, redundancy elimination, range propagation and expression
5099 simplification) based on a dominator tree traversal.  This also
5100 performs jump threading (to reduce jumps to jumps). This flag is
5101 enabled by default at @option{-O} and higher.
5103 @item -ftree-ch
5104 Perform loop header copying on trees.  This is beneficial since it increases
5105 effectiveness of code motion optimizations.  It also saves one jump.  This flag
5106 is enabled by default at @option{-O} and higher.  It is not enabled
5107 for @option{-Os}, since it usually increases code size.
5109 @item -ftree-loop-optimize
5110 Perform loop optimizations on trees.  This flag is enabled by default
5111 at @option{-O} and higher.
5113 @item -ftree-loop-linear
5114 Perform linear loop transformations on tree.  This flag can improve cache
5115 performance and allow further loop optimizations to take place.
5117 @item -ftree-loop-im
5118 Perform loop invariant motion on trees.  This pass moves only invariants that
5119 would be hard to handle at RTL level (function calls, operations that expand to
5120 nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
5121 operands of conditions that are invariant out of the loop, so that we can use
5122 just trivial invariantness analysis in loop unswitching.  The pass also includes
5123 store motion.
5125 @item -ftree-loop-ivcanon
5126 Create a canonical counter for number of iterations in the loop for that
5127 determining number of iterations requires complicated analysis.  Later
5128 optimizations then may determine the number easily.  Useful especially
5129 in connection with unrolling.
5131 @item -fivopts
5132 Perform induction variable optimizations (strength reduction, induction
5133 variable merging and induction variable elimination) on trees.
5135 @item -ftree-sra
5136 Perform scalar replacement of aggregates.  This pass replaces structure
5137 references with scalars to prevent committing structures to memory too
5138 early.  This flag is enabled by default at @option{-O} and higher.
5140 @item -ftree-copyrename
5141 Perform copy renaming on trees.  This pass attempts to rename compiler
5142 temporaries to other variables at copy locations, usually resulting in
5143 variable names which more closely resemble the original variables.  This flag
5144 is enabled by default at @option{-O} and higher.
5146 @item -ftree-ter
5147 Perform temporary expression replacement during the SSA->normal phase.  Single
5148 use/single def temporaries are replaced at their use location with their
5149 defining expression.  This results in non-GIMPLE code, but gives the expanders
5150 much more complex trees to work on resulting in better RTL generation.  This is
5151 enabled by default at @option{-O} and higher.
5153 @item -ftree-lrs
5154 Perform live range splitting during the SSA->normal phase.  Distinct live
5155 ranges of a variable are split into unique variables, allowing for better
5156 optimization later.  This is enabled by default at @option{-O} and higher.
5158 @item -ftree-vectorize
5159 Perform loop vectorization on trees.
5161 @item -ftree-vect-loop-version
5162 @opindex ftree-vect-loop-version
5163 Perform loop versioning when doing loop vectorization on trees.  When a loop
5164 appears to be vectorizable except that data alignment or data dependence cannot
5165 be determined at compile time then vectorized and non-vectorized versions of
5166 the loop are generated along with runtime checks for alignment or dependence
5167 to control which version is executed.  This option is enabled by default
5168 except at level @option{-Os} where it is disabled.
5170 @item -ftree-vrp
5171 Perform Value Range Propagation on trees.  This is similar to the
5172 constant propagation pass, but instead of values, ranges of values are
5173 propagated.  This allows the optimizers to remove unnecessary range
5174 checks like array bound checks and null pointer checks.  This is
5175 enabled by default at @option{-O2} and higher.  Null pointer check
5176 elimination is only done if @option{-fdelete-null-pointer-checks} is
5177 enabled.
5179 @item -ftracer
5180 @opindex ftracer
5181 Perform tail duplication to enlarge superblock size.  This transformation
5182 simplifies the control flow of the function allowing other optimizations to do
5183 better job.
5185 @item -funroll-loops
5186 @opindex funroll-loops
5187 Unroll loops whose number of iterations can be determined at compile
5188 time or upon entry to the loop.  @option{-funroll-loops} implies
5189 @option{-frerun-cse-after-loop}.  This option makes code larger,
5190 and may or may not make it run faster.
5192 @item -funroll-all-loops
5193 @opindex funroll-all-loops
5194 Unroll all loops, even if their number of iterations is uncertain when
5195 the loop is entered.  This usually makes programs run more slowly.
5196 @option{-funroll-all-loops} implies the same options as
5197 @option{-funroll-loops},
5199 @item -fsplit-ivs-in-unroller
5200 @opindex -fsplit-ivs-in-unroller
5201 Enables expressing of values of induction variables in later iterations
5202 of the unrolled loop using the value in the first iteration.  This breaks
5203 long dependency chains, thus improving efficiency of the scheduling passes.
5205 Combination of @option{-fweb} and CSE is often sufficient to obtain the
5206 same effect.  However in cases the loop body is more complicated than
5207 a single basic block, this is not reliable.  It also does not work at all
5208 on some of the architectures due to restrictions in the CSE pass.
5210 This optimization is enabled by default.
5212 @item -fvariable-expansion-in-unroller
5213 @opindex -fvariable-expansion-in-unroller
5214 With this option, the compiler will create multiple copies of some
5215 local variables when unrolling a loop which can result in superior code.
5217 @item -fprefetch-loop-arrays
5218 @opindex fprefetch-loop-arrays
5219 If supported by the target machine, generate instructions to prefetch
5220 memory to improve the performance of loops that access large arrays.
5222 This option may generate better or worse code; results are highly
5223 dependent on the structure of loops within the source code.
5225 Disabled at level @option{-Os}.
5227 @item -fno-peephole
5228 @itemx -fno-peephole2
5229 @opindex fno-peephole
5230 @opindex fno-peephole2
5231 Disable any machine-specific peephole optimizations.  The difference
5232 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
5233 are implemented in the compiler; some targets use one, some use the
5234 other, a few use both.
5236 @option{-fpeephole} is enabled by default.
5237 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5239 @item -fno-guess-branch-probability
5240 @opindex fno-guess-branch-probability
5241 Do not guess branch probabilities using heuristics.
5243 GCC will use heuristics to guess branch probabilities if they are
5244 not provided by profiling feedback (@option{-fprofile-arcs}).  These
5245 heuristics are based on the control flow graph.  If some branch probabilities
5246 are specified by @samp{__builtin_expect}, then the heuristics will be
5247 used to guess branch probabilities for the rest of the control flow graph,
5248 taking the @samp{__builtin_expect} info into account.  The interactions
5249 between the heuristics and @samp{__builtin_expect} can be complex, and in
5250 some cases, it may be useful to disable the heuristics so that the effects
5251 of @samp{__builtin_expect} are easier to understand.
5253 The default is @option{-fguess-branch-probability} at levels
5254 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5256 @item -freorder-blocks
5257 @opindex freorder-blocks
5258 Reorder basic blocks in the compiled function in order to reduce number of
5259 taken branches and improve code locality.
5261 Enabled at levels @option{-O2}, @option{-O3}.
5263 @item -freorder-blocks-and-partition
5264 @opindex freorder-blocks-and-partition
5265 In addition to reordering basic blocks in the compiled function, in order
5266 to reduce number of taken branches, partitions hot and cold basic blocks
5267 into separate sections of the assembly and .o files, to improve
5268 paging and cache locality performance.
5270 This optimization is automatically turned off in the presence of
5271 exception handling, for linkonce sections, for functions with a user-defined
5272 section attribute and on any architecture that does not support named
5273 sections.
5275 @item -freorder-functions
5276 @opindex freorder-functions
5277 Reorder functions in the object file in order to
5278 improve code locality.  This is implemented by using special
5279 subsections @code{.text.hot} for most frequently executed functions and
5280 @code{.text.unlikely} for unlikely executed functions.  Reordering is done by
5281 the linker so object file format must support named sections and linker must
5282 place them in a reasonable way.
5284 Also profile feedback must be available in to make this option effective.  See
5285 @option{-fprofile-arcs} for details.
5287 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5289 @item -fstrict-aliasing
5290 @opindex fstrict-aliasing
5291 Allows the compiler to assume the strictest aliasing rules applicable to
5292 the language being compiled.  For C (and C++), this activates
5293 optimizations based on the type of expressions.  In particular, an
5294 object of one type is assumed never to reside at the same address as an
5295 object of a different type, unless the types are almost the same.  For
5296 example, an @code{unsigned int} can alias an @code{int}, but not a
5297 @code{void*} or a @code{double}.  A character type may alias any other
5298 type.
5300 Pay special attention to code like this:
5301 @smallexample
5302 union a_union @{
5303   int i;
5304   double d;
5307 int f() @{
5308   a_union t;
5309   t.d = 3.0;
5310   return t.i;
5312 @end smallexample
5313 The practice of reading from a different union member than the one most
5314 recently written to (called ``type-punning'') is common.  Even with
5315 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
5316 is accessed through the union type.  So, the code above will work as
5317 expected.  However, this code might not:
5318 @smallexample
5319 int f() @{
5320   a_union t;
5321   int* ip;
5322   t.d = 3.0;
5323   ip = &t.i;
5324   return *ip;
5326 @end smallexample
5328 Every language that wishes to perform language-specific alias analysis
5329 should define a function that computes, given an @code{tree}
5330 node, an alias set for the node.  Nodes in different alias sets are not
5331 allowed to alias.  For an example, see the C front-end function
5332 @code{c_get_alias_set}.
5334 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5336 @item -falign-functions
5337 @itemx -falign-functions=@var{n}
5338 @opindex falign-functions
5339 Align the start of functions to the next power-of-two greater than
5340 @var{n}, skipping up to @var{n} bytes.  For instance,
5341 @option{-falign-functions=32} aligns functions to the next 32-byte
5342 boundary, but @option{-falign-functions=24} would align to the next
5343 32-byte boundary only if this can be done by skipping 23 bytes or less.
5345 @option{-fno-align-functions} and @option{-falign-functions=1} are
5346 equivalent and mean that functions will not be aligned.
5348 Some assemblers only support this flag when @var{n} is a power of two;
5349 in that case, it is rounded up.
5351 If @var{n} is not specified or is zero, use a machine-dependent default.
5353 Enabled at levels @option{-O2}, @option{-O3}.
5355 @item -falign-labels
5356 @itemx -falign-labels=@var{n}
5357 @opindex falign-labels
5358 Align all branch targets to a power-of-two boundary, skipping up to
5359 @var{n} bytes like @option{-falign-functions}.  This option can easily
5360 make code slower, because it must insert dummy operations for when the
5361 branch target is reached in the usual flow of the code.
5363 @option{-fno-align-labels} and @option{-falign-labels=1} are
5364 equivalent and mean that labels will not be aligned.
5366 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
5367 are greater than this value, then their values are used instead.
5369 If @var{n} is not specified or is zero, use a machine-dependent default
5370 which is very likely to be @samp{1}, meaning no alignment.
5372 Enabled at levels @option{-O2}, @option{-O3}.
5374 @item -falign-loops
5375 @itemx -falign-loops=@var{n}
5376 @opindex falign-loops
5377 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
5378 like @option{-falign-functions}.  The hope is that the loop will be
5379 executed many times, which will make up for any execution of the dummy
5380 operations.
5382 @option{-fno-align-loops} and @option{-falign-loops=1} are
5383 equivalent and mean that loops will not be aligned.
5385 If @var{n} is not specified or is zero, use a machine-dependent default.
5387 Enabled at levels @option{-O2}, @option{-O3}.
5389 @item -falign-jumps
5390 @itemx -falign-jumps=@var{n}
5391 @opindex falign-jumps
5392 Align branch targets to a power-of-two boundary, for branch targets
5393 where the targets can only be reached by jumping, skipping up to @var{n}
5394 bytes like @option{-falign-functions}.  In this case, no dummy operations
5395 need be executed.
5397 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
5398 equivalent and mean that loops will not be aligned.
5400 If @var{n} is not specified or is zero, use a machine-dependent default.
5402 Enabled at levels @option{-O2}, @option{-O3}.
5404 @item -funit-at-a-time
5405 @opindex funit-at-a-time
5406 Parse the whole compilation unit before starting to produce code.
5407 This allows some extra optimizations to take place but consumes
5408 more memory (in general).  There are some compatibility issues
5409 with @emph{unit-at-a-time} mode:
5410 @itemize @bullet
5411 @item
5412 enabling @emph{unit-at-a-time} mode may change the order
5413 in which functions, variables, and top-level @code{asm} statements
5414 are emitted, and will likely break code relying on some particular
5415 ordering.  The majority of such top-level @code{asm} statements,
5416 though, can be replaced by @code{section} attributes.  The
5417 @option{fno-toplevel-reorder} option may be used to keep the ordering
5418 used in the input file, at the cost of some optimizations.
5420 @item
5421 @emph{unit-at-a-time} mode removes unreferenced static variables
5422 and functions.  This may result in undefined references
5423 when an @code{asm} statement refers directly to variables or functions
5424 that are otherwise unused.  In that case either the variable/function
5425 shall be listed as an operand of the @code{asm} statement operand or,
5426 in the case of top-level @code{asm} statements the attribute @code{used}
5427 shall be used on the declaration.
5429 @item
5430 Static functions now can use non-standard passing conventions that
5431 may break @code{asm} statements calling functions directly.  Again,
5432 attribute @code{used} will prevent this behavior.
5433 @end itemize
5435 As a temporary workaround, @option{-fno-unit-at-a-time} can be used,
5436 but this scheme may not be supported by future releases of GCC@.
5438 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5440 @item -fno-toplevel-reorder
5441 Do not reorder top-level functions, variables, and @code{asm}
5442 statements.  Output them in the same order that they appear in the
5443 input file.  When this option is used, unreferenced static variables
5444 will not be removed.  This option is intended to support existing code
5445 which relies on a particular ordering.  For new code, it is better to
5446 use attributes.
5448 @item -fweb
5449 @opindex fweb
5450 Constructs webs as commonly used for register allocation purposes and assign
5451 each web individual pseudo register.  This allows the register allocation pass
5452 to operate on pseudos directly, but also strengthens several other optimization
5453 passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
5454 however, make debugging impossible, since variables will no longer stay in a
5455 ``home register''.
5457 Enabled by default with @option{-funroll-loops}.
5459 @item -fwhole-program
5460 @opindex fwhole-program
5461 Assume that the current compilation unit represents whole program being
5462 compiled.  All public functions and variables with the exception of @code{main}
5463 and those merged by attribute @code{externally_visible} become static functions
5464 and in a affect gets more aggressively optimized by interprocedural optimizers.
5465 While this option is equivalent to proper use of @code{static} keyword for
5466 programs consisting of single file, in combination with option
5467 @option{--combine} this flag can be used to compile most of smaller scale C
5468 programs since the functions and variables become local for the whole combined
5469 compilation unit, not for the single source file itself.
5472 @item -fno-cprop-registers
5473 @opindex fno-cprop-registers
5474 After register allocation and post-register allocation instruction splitting,
5475 we perform a copy-propagation pass to try to reduce scheduling dependencies
5476 and occasionally eliminate the copy.
5478 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5480 @item -fprofile-generate
5481 @opindex fprofile-generate
5483 Enable options usually used for instrumenting application to produce
5484 profile useful for later recompilation with profile feedback based
5485 optimization.  You must use @option{-fprofile-generate} both when
5486 compiling and when linking your program.
5488 The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
5490 @item -fprofile-use
5491 @opindex fprofile-use
5492 Enable profile feedback directed optimizations, and optimizations
5493 generally profitable only with profile feedback available.
5495 The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
5496 @code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}
5498 @end table
5500 The following options control compiler behavior regarding floating
5501 point arithmetic.  These options trade off between speed and
5502 correctness.  All must be specifically enabled.
5504 @table @gcctabopt
5505 @item -ffloat-store
5506 @opindex ffloat-store
5507 Do not store floating point variables in registers, and inhibit other
5508 options that might change whether a floating point value is taken from a
5509 register or memory.
5511 @cindex floating point precision
5512 This option prevents undesirable excess precision on machines such as
5513 the 68000 where the floating registers (of the 68881) keep more
5514 precision than a @code{double} is supposed to have.  Similarly for the
5515 x86 architecture.  For most programs, the excess precision does only
5516 good, but a few programs rely on the precise definition of IEEE floating
5517 point.  Use @option{-ffloat-store} for such programs, after modifying
5518 them to store all pertinent intermediate computations into variables.
5520 @item -ffast-math
5521 @opindex ffast-math
5522 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @*
5523 @option{-fno-trapping-math}, @option{-ffinite-math-only},
5524 @option{-fno-rounding-math}, @option{-fno-signaling-nans}
5525 and @option{fcx-limited-range}.
5527 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
5529 This option should never be turned on by any @option{-O} option since
5530 it can result in incorrect output for programs which depend on
5531 an exact implementation of IEEE or ISO rules/specifications for
5532 math functions.
5534 @item -fno-math-errno
5535 @opindex fno-math-errno
5536 Do not set ERRNO after calling math functions that are executed
5537 with a single instruction, e.g., sqrt.  A program that relies on
5538 IEEE exceptions for math error handling may want to use this flag
5539 for speed while maintaining IEEE arithmetic compatibility.
5541 This option should never be turned on by any @option{-O} option since
5542 it can result in incorrect output for programs which depend on
5543 an exact implementation of IEEE or ISO rules/specifications for
5544 math functions.
5546 The default is @option{-fmath-errno}.
5548 On Darwin systems, the math library never sets @code{errno}.  There is therefore
5549 no reason for the compiler to consider the possibility that it might,
5550 and @option{-fno-math-errno} is the default.
5552 @item -funsafe-math-optimizations
5553 @opindex funsafe-math-optimizations
5554 Allow optimizations for floating-point arithmetic that (a) assume
5555 that arguments and results are valid and (b) may violate IEEE or
5556 ANSI standards.  When used at link-time, it may include libraries
5557 or startup files that change the default FPU control word or other
5558 similar optimizations.
5560 This option should never be turned on by any @option{-O} option since
5561 it can result in incorrect output for programs which depend on
5562 an exact implementation of IEEE or ISO rules/specifications for
5563 math functions.
5565 The default is @option{-fno-unsafe-math-optimizations}.
5567 @item -ffinite-math-only
5568 @opindex ffinite-math-only
5569 Allow optimizations for floating-point arithmetic that assume
5570 that arguments and results are not NaNs or +-Infs.
5572 This option should never be turned on by any @option{-O} option since
5573 it can result in incorrect output for programs which depend on
5574 an exact implementation of IEEE or ISO rules/specifications.
5576 The default is @option{-fno-finite-math-only}.
5578 @item -fno-trapping-math
5579 @opindex fno-trapping-math
5580 Compile code assuming that floating-point operations cannot generate
5581 user-visible traps.  These traps include division by zero, overflow,
5582 underflow, inexact result and invalid operation.  This option implies
5583 @option{-fno-signaling-nans}.  Setting this option may allow faster
5584 code if one relies on ``non-stop'' IEEE arithmetic, for example.
5586 This option should never be turned on by any @option{-O} option since
5587 it can result in incorrect output for programs which depend on
5588 an exact implementation of IEEE or ISO rules/specifications for
5589 math functions.
5591 The default is @option{-ftrapping-math}.
5593 @item -frounding-math
5594 @opindex frounding-math
5595 Disable transformations and optimizations that assume default floating
5596 point rounding behavior.  This is round-to-zero for all floating point
5597 to integer conversions, and round-to-nearest for all other arithmetic
5598 truncations.  This option should be specified for programs that change
5599 the FP rounding mode dynamically, or that may be executed with a
5600 non-default rounding mode.  This option disables constant folding of
5601 floating point expressions at compile-time (which may be affected by
5602 rounding mode) and arithmetic transformations that are unsafe in the
5603 presence of sign-dependent rounding modes.
5605 The default is @option{-fno-rounding-math}.
5607 This option is experimental and does not currently guarantee to
5608 disable all GCC optimizations that are affected by rounding mode.
5609 Future versions of GCC may provide finer control of this setting
5610 using C99's @code{FENV_ACCESS} pragma.  This command line option
5611 will be used to specify the default state for @code{FENV_ACCESS}.
5613 @item -frtl-abstract-sequences
5614 @opindex frtl-abstract-sequences
5615 It is a size optimization method. This option is to find identical
5616 sequences of code, which can be turned into pseudo-procedures  and
5617 then  replace  all  occurrences with  calls to  the  newly created
5618 subroutine. It is kind of an opposite of @option{-finline-functions}.
5619 This optimization runs at RTL level.
5621 @item -fsignaling-nans
5622 @opindex fsignaling-nans
5623 Compile code assuming that IEEE signaling NaNs may generate user-visible
5624 traps during floating-point operations.  Setting this option disables
5625 optimizations that may change the number of exceptions visible with
5626 signaling NaNs.  This option implies @option{-ftrapping-math}.
5628 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
5629 be defined.
5631 The default is @option{-fno-signaling-nans}.
5633 This option is experimental and does not currently guarantee to
5634 disable all GCC optimizations that affect signaling NaN behavior.
5636 @item -fsingle-precision-constant
5637 @opindex fsingle-precision-constant
5638 Treat floating point constant as single precision constant instead of
5639 implicitly converting it to double precision constant.
5641 @item -fcx-limited-range
5642 @itemx -fno-cx-limited-range
5643 @opindex fcx-limited-range
5644 @opindex fno-cx-limited-range
5645 When enabled, this option states that a range reduction step is not
5646 needed when performing complex division.  The default is
5647 @option{-fno-cx-limited-range}, but is enabled by @option{-ffast-math}.
5649 This option controls the default setting of the ISO C99 
5650 @code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
5651 all languages.
5653 @end table
5655 The following options control optimizations that may improve
5656 performance, but are not enabled by any @option{-O} options.  This
5657 section includes experimental options that may produce broken code.
5659 @table @gcctabopt
5660 @item -fbranch-probabilities
5661 @opindex fbranch-probabilities
5662 After running a program compiled with @option{-fprofile-arcs}
5663 (@pxref{Debugging Options,, Options for Debugging Your Program or
5664 @command{gcc}}), you can compile it a second time using
5665 @option{-fbranch-probabilities}, to improve optimizations based on
5666 the number of times each branch was taken.  When the program
5667 compiled with @option{-fprofile-arcs} exits it saves arc execution
5668 counts to a file called @file{@var{sourcename}.gcda} for each source
5669 file  The information in this data file is very dependent on the
5670 structure of the generated code, so you must use the same source code
5671 and the same optimization options for both compilations.
5673 With @option{-fbranch-probabilities}, GCC puts a
5674 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
5675 These can be used to improve optimization.  Currently, they are only
5676 used in one place: in @file{reorg.c}, instead of guessing which path a
5677 branch is mostly to take, the @samp{REG_BR_PROB} values are used to
5678 exactly determine which path is taken more often.
5680 @item -fprofile-values
5681 @opindex fprofile-values
5682 If combined with @option{-fprofile-arcs}, it adds code so that some
5683 data about values of expressions in the program is gathered.
5685 With @option{-fbranch-probabilities}, it reads back the data gathered
5686 from profiling values of expressions and adds @samp{REG_VALUE_PROFILE}
5687 notes to instructions for their later usage in optimizations.
5689 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
5691 @item -fvpt
5692 @opindex fvpt
5693 If combined with @option{-fprofile-arcs}, it instructs the compiler to add
5694 a code to gather information about values of expressions.
5696 With @option{-fbranch-probabilities}, it reads back the data gathered
5697 and actually performs the optimizations based on them.
5698 Currently the optimizations include specialization of division operation
5699 using the knowledge about the value of the denominator.
5701 @item -frename-registers
5702 @opindex frename-registers
5703 Attempt to avoid false dependencies in scheduled code by making use
5704 of registers left over after register allocation.  This optimization
5705 will most benefit processors with lots of registers.  Depending on the
5706 debug information format adopted by the target, however, it can
5707 make debugging impossible, since variables will no longer stay in
5708 a ``home register''.
5710 Enabled by default with @option{-funroll-loops}.
5712 @item -ftracer
5713 @opindex ftracer
5714 Perform tail duplication to enlarge superblock size.  This transformation
5715 simplifies the control flow of the function allowing other optimizations to do
5716 better job.
5718 Enabled with @option{-fprofile-use}.
5720 @item -funroll-loops
5721 @opindex funroll-loops
5722 Unroll loops whose number of iterations can be determined at compile time or
5723 upon entry to the loop.  @option{-funroll-loops} implies
5724 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}. 
5725 It also turns on complete loop peeling (i.e.@: complete removal of loops with
5726 small constant number of iterations).  This option makes code larger, and may
5727 or may not make it run faster.
5729 Enabled with @option{-fprofile-use}.
5731 @item -funroll-all-loops
5732 @opindex funroll-all-loops
5733 Unroll all loops, even if their number of iterations is uncertain when
5734 the loop is entered.  This usually makes programs run more slowly.
5735 @option{-funroll-all-loops} implies the same options as
5736 @option{-funroll-loops}.
5738 @item -fpeel-loops
5739 @opindex fpeel-loops
5740 Peels the loops for that there is enough information that they do not
5741 roll much (from profile feedback).  It also turns on complete loop peeling
5742 (i.e.@: complete removal of loops with small constant number of iterations).
5744 Enabled with @option{-fprofile-use}.
5746 @item -fmove-loop-invariants
5747 @opindex fmove-loop-invariants
5748 Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
5749 at level @option{-O1}
5751 @item -funswitch-loops
5752 @opindex funswitch-loops
5753 Move branches with loop invariant conditions out of the loop, with duplicates
5754 of the loop on both branches (modified according to result of the condition).
5756 @item -ffunction-sections
5757 @itemx -fdata-sections
5758 @opindex ffunction-sections
5759 @opindex fdata-sections
5760 Place each function or data item into its own section in the output
5761 file if the target supports arbitrary sections.  The name of the
5762 function or the name of the data item determines the section's name
5763 in the output file.
5765 Use these options on systems where the linker can perform optimizations
5766 to improve locality of reference in the instruction space.  Most systems
5767 using the ELF object format and SPARC processors running Solaris 2 have
5768 linkers with such optimizations.  AIX may have these optimizations in
5769 the future.
5771 Only use these options when there are significant benefits from doing
5772 so.  When you specify these options, the assembler and linker will
5773 create larger object and executable files and will also be slower.
5774 You will not be able to use @code{gprof} on all systems if you
5775 specify this option and you may have problems with debugging if
5776 you specify both this option and @option{-g}.
5778 @item -fbranch-target-load-optimize
5779 @opindex fbranch-target-load-optimize
5780 Perform branch target register load optimization before prologue / epilogue
5781 threading.
5782 The use of target registers can typically be exposed only during reload,
5783 thus hoisting loads out of loops and doing inter-block scheduling needs
5784 a separate optimization pass.
5786 @item -fbranch-target-load-optimize2
5787 @opindex fbranch-target-load-optimize2
5788 Perform branch target register load optimization after prologue / epilogue
5789 threading.
5791 @item -fbtr-bb-exclusive
5792 @opindex fbtr-bb-exclusive
5793 When performing branch target register load optimization, don't reuse
5794 branch target registers in within any basic block.
5796 @item -fstack-protector
5797 Emit extra code to check for buffer overflows, such as stack smashing
5798 attacks.  This is done by adding a guard variable to functions with
5799 vulnerable objects.  This includes functions that call alloca, and
5800 functions with buffers larger than 8 bytes.  The guards are initialized
5801 when a function is entered and then checked when the function exits.
5802 If a guard check fails, an error message is printed and the program exits.
5804 @item -fstack-protector-all
5805 Like @option{-fstack-protector} except that all functions are protected.
5807 @item -fsection-anchors
5808 @opindex fsection-anchors
5809 Try to reduce the number of symbolic address calculations by using
5810 shared ``anchor'' symbols to address nearby objects.  This transformation
5811 can help to reduce the number of GOT entries and GOT accesses on some
5812 targets.
5814 For example, the implementation of the following function @code{foo}:
5816 @smallexample
5817 static int a, b, c;
5818 int foo (void) @{ return a + b + c; @}
5819 @end smallexample
5821 would usually calculate the addresses of all three variables, but if you
5822 compile it with @option{-fsection-anchors}, it will access the variables
5823 from a common anchor point instead.  The effect is similar to the
5824 following pseudocode (which isn't valid C):
5826 @smallexample
5827 int foo (void)
5829   register int *xr = &x;
5830   return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
5832 @end smallexample
5834 Not all targets support this option.
5836 @item --param @var{name}=@var{value}
5837 @opindex param
5838 In some places, GCC uses various constants to control the amount of
5839 optimization that is done.  For example, GCC will not inline functions
5840 that contain more that a certain number of instructions.  You can
5841 control some of these constants on the command-line using the
5842 @option{--param} option.
5844 The names of specific parameters, and the meaning of the values, are
5845 tied to the internals of the compiler, and are subject to change
5846 without notice in future releases.
5848 In each case, the @var{value} is an integer.  The allowable choices for
5849 @var{name} are given in the following table:
5851 @table @gcctabopt
5852 @item salias-max-implicit-fields
5853 The maximum number of fields in a variable without direct
5854 structure accesses for which structure aliasing will consider trying 
5855 to track each field.  The default is 5
5857 @item salias-max-array-elements
5858 The maximum number of elements an array can have and its elements
5859 still be tracked individually by structure aliasing. The default is 4
5861 @item sra-max-structure-size
5862 The maximum structure size, in bytes, at which the scalar replacement
5863 of aggregates (SRA) optimization will perform block copies.  The
5864 default value, 0, implies that GCC will select the most appropriate
5865 size itself.
5867 @item sra-field-structure-ratio
5868 The threshold ratio (as a percentage) between instantiated fields and
5869 the complete structure size.  We say that if the ratio of the number
5870 of bytes in instantiated fields to the number of bytes in the complete
5871 structure exceeds this parameter, then block copies are not used.  The
5872 default is 75.
5874 @item max-crossjump-edges
5875 The maximum number of incoming edges to consider for crossjumping.
5876 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
5877 the number of edges incoming to each block.  Increasing values mean
5878 more aggressive optimization, making the compile time increase with
5879 probably small improvement in executable size.
5881 @item min-crossjump-insns
5882 The minimum number of instructions which must be matched at the end
5883 of two blocks before crossjumping will be performed on them.  This
5884 value is ignored in the case where all instructions in the block being
5885 crossjumped from are matched.  The default value is 5.
5887 @item max-grow-copy-bb-insns
5888 The maximum code size expansion factor when copying basic blocks
5889 instead of jumping.  The expansion is relative to a jump instruction.
5890 The default value is 8.
5892 @item max-goto-duplication-insns
5893 The maximum number of instructions to duplicate to a block that jumps
5894 to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
5895 passes, GCC factors computed gotos early in the compilation process,
5896 and unfactors them as late as possible.  Only computed jumps at the
5897 end of a basic blocks with no more than max-goto-duplication-insns are
5898 unfactored.  The default value is 8.
5900 @item max-delay-slot-insn-search
5901 The maximum number of instructions to consider when looking for an
5902 instruction to fill a delay slot.  If more than this arbitrary number of
5903 instructions is searched, the time savings from filling the delay slot
5904 will be minimal so stop searching.  Increasing values mean more
5905 aggressive optimization, making the compile time increase with probably
5906 small improvement in executable run time.
5908 @item max-delay-slot-live-search
5909 When trying to fill delay slots, the maximum number of instructions to
5910 consider when searching for a block with valid live register
5911 information.  Increasing this arbitrarily chosen value means more
5912 aggressive optimization, increasing the compile time.  This parameter
5913 should be removed when the delay slot code is rewritten to maintain the
5914 control-flow graph.
5916 @item max-gcse-memory
5917 The approximate maximum amount of memory that will be allocated in
5918 order to perform the global common subexpression elimination
5919 optimization.  If more memory than specified is required, the
5920 optimization will not be done.
5922 @item max-gcse-passes
5923 The maximum number of passes of GCSE to run.  The default is 1.
5925 @item max-pending-list-length
5926 The maximum number of pending dependencies scheduling will allow
5927 before flushing the current state and starting over.  Large functions
5928 with few branches or calls can create excessively large lists which
5929 needlessly consume memory and resources.
5931 @item max-inline-insns-single
5932 Several parameters control the tree inliner used in gcc.
5933 This number sets the maximum number of instructions (counted in GCC's
5934 internal representation) in a single function that the tree inliner
5935 will consider for inlining.  This only affects functions declared
5936 inline and methods implemented in a class declaration (C++).
5937 The default value is 450.
5939 @item max-inline-insns-auto
5940 When you use @option{-finline-functions} (included in @option{-O3}),
5941 a lot of functions that would otherwise not be considered for inlining
5942 by the compiler will be investigated.  To those functions, a different
5943 (more restrictive) limit compared to functions declared inline can
5944 be applied.
5945 The default value is 90.
5947 @item large-function-insns
5948 The limit specifying really large functions.  For functions larger than this
5949 limit after inlining inlining is constrained by
5950 @option{--param large-function-growth}.  This parameter is useful primarily
5951 to avoid extreme compilation time caused by non-linear algorithms used by the
5952 backend.
5953 This parameter is ignored when @option{-funit-at-a-time} is not used.
5954 The default value is 2700.
5956 @item large-function-growth
5957 Specifies maximal growth of large function caused by inlining in percents.
5958 This parameter is ignored when @option{-funit-at-a-time} is not used.
5959 The default value is 100 which limits large function growth to 2.0 times
5960 the original size.
5962 @item large-unit-insns
5963 The limit specifying large translation unit.  Growth caused by inlining of
5964 units larger than this limit is limited by @option{--param inline-unit-growth}.
5965 For small units this might be too tight (consider unit consisting of function A
5966 that is inline and B that just calls A three time.  If B is small relative to
5967 A, the growth of unit is 300\% and yet such inlining is very sane.  For very
5968 large units consisting of small inlininable functions however the overall unit
5969 growth limit is needed to avoid exponential explosion of code size.  Thus for
5970 smaller units, the size is increased to @option{--param large-unit-insns}
5971 before applying @option{--param inline-unit-growth}.  The default is 10000
5973 @item inline-unit-growth
5974 Specifies maximal overall growth of the compilation unit caused by inlining.
5975 This parameter is ignored when @option{-funit-at-a-time} is not used.
5976 The default value is 50 which limits unit growth to 1.5 times the original
5977 size.
5979 @item max-inline-insns-recursive
5980 @itemx max-inline-insns-recursive-auto
5981 Specifies maximum number of instructions out-of-line copy of self recursive inline
5982 function can grow into by performing recursive inlining.
5984 For functions declared inline @option{--param max-inline-insns-recursive} is
5985 taken into acount.  For function not declared inline, recursive inlining
5986 happens only when @option{-finline-functions} (included in @option{-O3}) is
5987 enabled and @option{--param max-inline-insns-recursive-auto} is used.  The
5988 default value is 450.
5990 @item max-inline-recursive-depth
5991 @itemx max-inline-recursive-depth-auto
5992 Specifies maximum recursion depth used by the recursive inlining.
5994 For functions declared inline @option{--param max-inline-recursive-depth} is
5995 taken into acount.  For function not declared inline, recursive inlining
5996 happens only when @option{-finline-functions} (included in @option{-O3}) is
5997 enabled and @option{--param max-inline-recursive-depth-auto} is used.  The
5998 default value is 450.
6000 @item min-inline-recursive-probability
6001 Recursive inlining is profitable only for function having deep recursion
6002 in average and can hurt for function having little recursion depth by
6003 increasing the prologue size or complexity of function body to other
6004 optimizers.
6006 When profile feedback is available (see @option{-fprofile-generate}) the actual
6007 recursion depth can be guessed from probability that function will recurse via
6008 given call expression.  This parameter limits inlining only to call expression
6009 whose probability exceeds given threshold (in percents).  The default value is
6012 @item inline-call-cost
6013 Specify cost of call instruction relative to simple arithmetics operations
6014 (having cost of 1).  Increasing this cost disqualifies inlining of non-leaf
6015 functions and at the same time increases size of leaf function that is believed to
6016 reduce function size by being inlined.  In effect it increases amount of
6017 inlining for code having large abstraction penalty (many functions that just
6018 pass the arguments to other functions) and decrease inlining for code with low
6019 abstraction penalty.  The default value is 16.
6021 @item max-unrolled-insns
6022 The maximum number of instructions that a loop should have if that loop
6023 is unrolled, and if the loop is unrolled, it determines how many times
6024 the loop code is unrolled.
6026 @item max-average-unrolled-insns
6027 The maximum number of instructions biased by probabilities of their execution
6028 that a loop should have if that loop is unrolled, and if the loop is unrolled,
6029 it determines how many times the loop code is unrolled.
6031 @item max-unroll-times
6032 The maximum number of unrollings of a single loop.
6034 @item max-peeled-insns
6035 The maximum number of instructions that a loop should have if that loop
6036 is peeled, and if the loop is peeled, it determines how many times
6037 the loop code is peeled.
6039 @item max-peel-times
6040 The maximum number of peelings of a single loop.
6042 @item max-completely-peeled-insns
6043 The maximum number of insns of a completely peeled loop.
6045 @item max-completely-peel-times
6046 The maximum number of iterations of a loop to be suitable for complete peeling.
6048 @item max-unswitch-insns
6049 The maximum number of insns of an unswitched loop.
6051 @item max-unswitch-level
6052 The maximum number of branches unswitched in a single loop.
6054 @item lim-expensive
6055 The minimum cost of an expensive expression in the loop invariant motion.
6057 @item iv-consider-all-candidates-bound
6058 Bound on number of candidates for induction variables below that
6059 all candidates are considered for each use in induction variable
6060 optimizations.  Only the most relevant candidates are considered
6061 if there are more candidates, to avoid quadratic time complexity.
6063 @item iv-max-considered-uses
6064 The induction variable optimizations give up on loops that contain more
6065 induction variable uses.
6067 @item iv-always-prune-cand-set-bound
6068 If number of candidates in the set is smaller than this value,
6069 we always try to remove unnecessary ivs from the set during its
6070 optimization when a new iv is added to the set.
6072 @item scev-max-expr-size
6073 Bound on size of expressions used in the scalar evolutions analyzer.
6074 Large expressions slow the analyzer.
6076 @item vect-max-version-checks
6077 The maximum number of runtime checks that can be performed when doing
6078 loop versioning in the vectorizer.  See option ftree-vect-loop-version
6079 for more information.
6081 @item max-iterations-to-track
6083 The maximum number of iterations of a loop the brute force algorithm
6084 for analysis of # of iterations of the loop tries to evaluate.
6086 @item hot-bb-count-fraction
6087 Select fraction of the maximal count of repetitions of basic block in program
6088 given basic block needs to have to be considered hot.
6090 @item hot-bb-frequency-fraction
6091 Select fraction of the maximal frequency of executions of basic block in
6092 function given basic block needs to have to be considered hot
6094 @item max-predicted-iterations
6095 The maximum number of loop iterations we predict statically.  This is useful
6096 in cases where function contain single loop with known bound and other loop
6097 with unknown.  We predict the known number of iterations correctly, while
6098 the unknown number of iterations average to roughly 10.  This means that the
6099 loop without bounds would appear artificially cold relative to the other one.
6101 @item tracer-dynamic-coverage
6102 @itemx tracer-dynamic-coverage-feedback
6104 This value is used to limit superblock formation once the given percentage of
6105 executed instructions is covered.  This limits unnecessary code size
6106 expansion.
6108 The @option{tracer-dynamic-coverage-feedback} is used only when profile
6109 feedback is available.  The real profiles (as opposed to statically estimated
6110 ones) are much less balanced allowing the threshold to be larger value.
6112 @item tracer-max-code-growth
6113 Stop tail duplication once code growth has reached given percentage.  This is
6114 rather hokey argument, as most of the duplicates will be eliminated later in
6115 cross jumping, so it may be set to much higher values than is the desired code
6116 growth.
6118 @item tracer-min-branch-ratio
6120 Stop reverse growth when the reverse probability of best edge is less than this
6121 threshold (in percent).
6123 @item tracer-min-branch-ratio
6124 @itemx tracer-min-branch-ratio-feedback
6126 Stop forward growth if the best edge do have probability lower than this
6127 threshold.
6129 Similarly to @option{tracer-dynamic-coverage} two values are present, one for
6130 compilation for profile feedback and one for compilation without.  The value
6131 for compilation with profile feedback needs to be more conservative (higher) in
6132 order to make tracer effective.
6134 @item max-cse-path-length
6136 Maximum number of basic blocks on path that cse considers.  The default is 10.
6138 @item max-cse-insns
6139 The maximum instructions CSE process before flushing. The default is 1000.
6141 @item global-var-threshold
6143 Counts the number of function calls (@var{n}) and the number of
6144 call-clobbered variables (@var{v}).  If @var{n}x@var{v} is larger than this limit, a
6145 single artificial variable will be created to represent all the
6146 call-clobbered variables at function call sites.  This artificial
6147 variable will then be made to alias every call-clobbered variable.
6148 (done as @code{int * size_t} on the host machine; beware overflow).
6150 @item max-aliased-vops
6152 Maximum number of virtual operands allowed to represent aliases
6153 before triggering the alias grouping heuristic.  Alias grouping
6154 reduces compile times and memory consumption needed for aliasing at
6155 the expense of precision loss in alias information.
6157 @item ggc-min-expand
6159 GCC uses a garbage collector to manage its own memory allocation.  This
6160 parameter specifies the minimum percentage by which the garbage
6161 collector's heap should be allowed to expand between collections.
6162 Tuning this may improve compilation speed; it has no effect on code
6163 generation.
6165 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
6166 RAM >= 1GB@.  If @code{getrlimit} is available, the notion of "RAM" is
6167 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
6168 GCC is not able to calculate RAM on a particular platform, the lower
6169 bound of 30% is used.  Setting this parameter and
6170 @option{ggc-min-heapsize} to zero causes a full collection to occur at
6171 every opportunity.  This is extremely slow, but can be useful for
6172 debugging.
6174 @item ggc-min-heapsize
6176 Minimum size of the garbage collector's heap before it begins bothering
6177 to collect garbage.  The first collection occurs after the heap expands
6178 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
6179 tuning this may improve compilation speed, and has no effect on code
6180 generation.
6182 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit which
6183 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
6184 with a lower bound of 4096 (four megabytes) and an upper bound of
6185 131072 (128 megabytes).  If GCC is not able to calculate RAM on a
6186 particular platform, the lower bound is used.  Setting this parameter
6187 very large effectively disables garbage collection.  Setting this
6188 parameter and @option{ggc-min-expand} to zero causes a full collection
6189 to occur at every opportunity.
6191 @item max-reload-search-insns
6192 The maximum number of instruction reload should look backward for equivalent
6193 register.  Increasing values mean more aggressive optimization, making the
6194 compile time increase with probably slightly better performance.  The default
6195 value is 100.
6197 @item max-cselib-memory-locations
6198 The maximum number of memory locations cselib should take into acount.
6199 Increasing values mean more aggressive optimization, making the compile time
6200 increase with probably slightly better performance.  The default value is 500.
6202 @item max-flow-memory-locations
6203 Similar as @option{max-cselib-memory-locations} but for dataflow liveness.
6204 The default value is 100.
6206 @item reorder-blocks-duplicate
6207 @itemx reorder-blocks-duplicate-feedback
6209 Used by basic block reordering pass to decide whether to use unconditional
6210 branch or duplicate the code on its destination.  Code is duplicated when its
6211 estimated size is smaller than this value multiplied by the estimated size of
6212 unconditional jump in the hot spots of the program.
6214 The @option{reorder-block-duplicate-feedback} is used only when profile
6215 feedback is available and may be set to higher values than
6216 @option{reorder-block-duplicate} since information about the hot spots is more
6217 accurate.
6219 @item max-sched-ready-insns
6220 The maximum number of instructions ready to be issued the scheduler should
6221 consider at any given time during the first scheduling pass.  Increasing
6222 values mean more thorough searches, making the compilation time increase
6223 with probably little benefit.  The default value is 100.
6225 @item max-sched-region-blocks
6226 The maximum number of blocks in a region to be considered for
6227 interblock scheduling.  The default value is 10.
6229 @item max-sched-region-insns
6230 The maximum number of insns in a region to be considered for
6231 interblock scheduling.  The default value is 100.
6233 @item min-spec-prob
6234 The minimum probability (in percents) of reaching a source block
6235 for interblock speculative scheduling.  The default value is 40.
6237 @item max-sched-extend-regions-iters
6238 The maximum number of iterations through CFG to extend regions.
6239 0 - disable region extension,
6240 N - do at most N iterations.
6241 The default value is 0.
6243 @item max-sched-insn-conflict-delay
6244 The maximum conflict delay for an insn to be considered for speculative motion.
6245 The default value is 3.
6247 @item sched-spec-prob-cutoff
6248 The minimal probability of speculation success (in percents), so that
6249 speculative insn will be scheduled.
6250 The default value is 40.
6252 @item max-last-value-rtl
6254 The maximum size measured as number of RTLs that can be recorded in an expression
6255 in combiner for a pseudo register as last known value of that register.  The default
6256 is 10000.
6258 @item integer-share-limit
6259 Small integer constants can use a shared data structure, reducing the
6260 compiler's memory usage and increasing its speed.  This sets the maximum
6261 value of a shared integer constant's.  The default value is 256.
6263 @item min-virtual-mappings
6264 Specifies the minimum number of virtual mappings in the incremental
6265 SSA updater that should be registered to trigger the virtual mappings
6266 heuristic defined by virtual-mappings-ratio.  The default value is
6267 100.
6269 @item virtual-mappings-ratio
6270 If the number of virtual mappings is virtual-mappings-ratio bigger
6271 than the number of virtual symbols to be updated, then the incremental
6272 SSA updater switches to a full update for those symbols.  The default
6273 ratio is 3.
6275 @item ssp-buffer-size
6276 The minimum size of buffers (i.e. arrays) that will receive stack smashing
6277 protection when @option{-fstack-protection} is used.
6279 @item max-jump-thread-duplication-stmts
6280 Maximum number of statements allowed in a block that needs to be
6281 duplicated when threading jumps.
6283 @item max-fields-for-field-sensitive
6284 Maximum number of fields in a structure we will treat in
6285 a field sensitive manner during pointer analysis.
6287 @end table
6288 @end table
6290 @node Preprocessor Options
6291 @section Options Controlling the Preprocessor
6292 @cindex preprocessor options
6293 @cindex options, preprocessor
6295 These options control the C preprocessor, which is run on each C source
6296 file before actual compilation.
6298 If you use the @option{-E} option, nothing is done except preprocessing.
6299 Some of these options make sense only together with @option{-E} because
6300 they cause the preprocessor output to be unsuitable for actual
6301 compilation.
6303 @table @gcctabopt
6304 @opindex Wp
6305 You can use @option{-Wp,@var{option}} to bypass the compiler driver
6306 and pass @var{option} directly through to the preprocessor.  If
6307 @var{option} contains commas, it is split into multiple options at the
6308 commas.  However, many options are modified, translated or interpreted
6309 by the compiler driver before being passed to the preprocessor, and
6310 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
6311 interface is undocumented and subject to change, so whenever possible
6312 you should avoid using @option{-Wp} and let the driver handle the
6313 options instead.
6315 @item -Xpreprocessor @var{option}
6316 @opindex preprocessor
6317 Pass @var{option} as an option to the preprocessor.  You can use this to
6318 supply system-specific preprocessor options which GCC does not know how to
6319 recognize.
6321 If you want to pass an option that takes an argument, you must use
6322 @option{-Xpreprocessor} twice, once for the option and once for the argument.
6323 @end table
6325 @include cppopts.texi
6327 @node Assembler Options
6328 @section Passing Options to the Assembler
6330 @c prevent bad page break with this line
6331 You can pass options to the assembler.
6333 @table @gcctabopt
6334 @item -Wa,@var{option}
6335 @opindex Wa
6336 Pass @var{option} as an option to the assembler.  If @var{option}
6337 contains commas, it is split into multiple options at the commas.
6339 @item -Xassembler @var{option}
6340 @opindex Xassembler
6341 Pass @var{option} as an option to the assembler.  You can use this to
6342 supply system-specific assembler options which GCC does not know how to
6343 recognize.
6345 If you want to pass an option that takes an argument, you must use
6346 @option{-Xassembler} twice, once for the option and once for the argument.
6348 @end table
6350 @node Link Options
6351 @section Options for Linking
6352 @cindex link options
6353 @cindex options, linking
6355 These options come into play when the compiler links object files into
6356 an executable output file.  They are meaningless if the compiler is
6357 not doing a link step.
6359 @table @gcctabopt
6360 @cindex file names
6361 @item @var{object-file-name}
6362 A file name that does not end in a special recognized suffix is
6363 considered to name an object file or library.  (Object files are
6364 distinguished from libraries by the linker according to the file
6365 contents.)  If linking is done, these object files are used as input
6366 to the linker.
6368 @item -c
6369 @itemx -S
6370 @itemx -E
6371 @opindex c
6372 @opindex S
6373 @opindex E
6374 If any of these options is used, then the linker is not run, and
6375 object file names should not be used as arguments.  @xref{Overall
6376 Options}.
6378 @cindex Libraries
6379 @item -l@var{library}
6380 @itemx -l @var{library}
6381 @opindex l
6382 Search the library named @var{library} when linking.  (The second
6383 alternative with the library as a separate argument is only for
6384 POSIX compliance and is not recommended.)
6386 It makes a difference where in the command you write this option; the
6387 linker searches and processes libraries and object files in the order they
6388 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
6389 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
6390 to functions in @samp{z}, those functions may not be loaded.
6392 The linker searches a standard list of directories for the library,
6393 which is actually a file named @file{lib@var{library}.a}.  The linker
6394 then uses this file as if it had been specified precisely by name.
6396 The directories searched include several standard system directories
6397 plus any that you specify with @option{-L}.
6399 Normally the files found this way are library files---archive files
6400 whose members are object files.  The linker handles an archive file by
6401 scanning through it for members which define symbols that have so far
6402 been referenced but not defined.  But if the file that is found is an
6403 ordinary object file, it is linked in the usual fashion.  The only
6404 difference between using an @option{-l} option and specifying a file name
6405 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
6406 and searches several directories.
6408 @item -lobjc
6409 @opindex lobjc
6410 You need this special case of the @option{-l} option in order to
6411 link an Objective-C or Objective-C++ program.
6413 @item -nostartfiles
6414 @opindex nostartfiles
6415 Do not use the standard system startup files when linking.
6416 The standard system libraries are used normally, unless @option{-nostdlib}
6417 or @option{-nodefaultlibs} is used.
6419 @item -nodefaultlibs
6420 @opindex nodefaultlibs
6421 Do not use the standard system libraries when linking.
6422 Only the libraries you specify will be passed to the linker.
6423 The standard startup files are used normally, unless @option{-nostartfiles}
6424 is used.  The compiler may generate calls to @code{memcmp},
6425 @code{memset}, @code{memcpy} and @code{memmove}.
6426 These entries are usually resolved by entries in
6427 libc.  These entry points should be supplied through some other
6428 mechanism when this option is specified.
6430 @item -nostdlib
6431 @opindex nostdlib
6432 Do not use the standard system startup files or libraries when linking.
6433 No startup files and only the libraries you specify will be passed to
6434 the linker.  The compiler may generate calls to @code{memcmp}, @code{memset},
6435 @code{memcpy} and @code{memmove}.
6436 These entries are usually resolved by entries in
6437 libc.  These entry points should be supplied through some other
6438 mechanism when this option is specified.
6440 @cindex @option{-lgcc}, use with @option{-nostdlib}
6441 @cindex @option{-nostdlib} and unresolved references
6442 @cindex unresolved references and @option{-nostdlib}
6443 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
6444 @cindex @option{-nodefaultlibs} and unresolved references
6445 @cindex unresolved references and @option{-nodefaultlibs}
6446 One of the standard libraries bypassed by @option{-nostdlib} and
6447 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
6448 that GCC uses to overcome shortcomings of particular machines, or special
6449 needs for some languages.
6450 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
6451 Collection (GCC) Internals},
6452 for more discussion of @file{libgcc.a}.)
6453 In most cases, you need @file{libgcc.a} even when you want to avoid
6454 other standard libraries.  In other words, when you specify @option{-nostdlib}
6455 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
6456 This ensures that you have no unresolved references to internal GCC
6457 library subroutines.  (For example, @samp{__main}, used to ensure C++
6458 constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
6459 GNU Compiler Collection (GCC) Internals}.)
6461 @item -pie
6462 @opindex pie
6463 Produce a position independent executable on targets which support it.
6464 For predictable results, you must also specify the same set of options
6465 that were used to generate code (@option{-fpie}, @option{-fPIE},
6466 or model suboptions) when you specify this option.
6468 @item -rdynamic
6469 @opindex rdynamic
6470 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
6471 that support it. This instructs the linker to add all symbols, not
6472 only used ones, to the dynamic symbol table. This option is needed
6473 for some uses of @code{dlopen} or to allow obtaining backtraces
6474 from within a program.
6476 @item -s
6477 @opindex s
6478 Remove all symbol table and relocation information from the executable.
6480 @item -static
6481 @opindex static
6482 On systems that support dynamic linking, this prevents linking with the shared
6483 libraries.  On other systems, this option has no effect.
6485 @item -shared
6486 @opindex shared
6487 Produce a shared object which can then be linked with other objects to
6488 form an executable.  Not all systems support this option.  For predictable
6489 results, you must also specify the same set of options that were used to
6490 generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
6491 when you specify this option.@footnote{On some systems, @samp{gcc -shared}
6492 needs to build supplementary stub code for constructors to work.  On
6493 multi-libbed systems, @samp{gcc -shared} must select the correct support
6494 libraries to link against.  Failing to supply the correct flags may lead
6495 to subtle defects.  Supplying them in cases where they are not necessary
6496 is innocuous.}
6498 @item -shared-libgcc
6499 @itemx -static-libgcc
6500 @opindex shared-libgcc
6501 @opindex static-libgcc
6502 On systems that provide @file{libgcc} as a shared library, these options
6503 force the use of either the shared or static version respectively.
6504 If no shared version of @file{libgcc} was built when the compiler was
6505 configured, these options have no effect.
6507 There are several situations in which an application should use the
6508 shared @file{libgcc} instead of the static version.  The most common
6509 of these is when the application wishes to throw and catch exceptions
6510 across different shared libraries.  In that case, each of the libraries
6511 as well as the application itself should use the shared @file{libgcc}.
6513 Therefore, the G++ and GCJ drivers automatically add
6514 @option{-shared-libgcc} whenever you build a shared library or a main
6515 executable, because C++ and Java programs typically use exceptions, so
6516 this is the right thing to do.
6518 If, instead, you use the GCC driver to create shared libraries, you may
6519 find that they will not always be linked with the shared @file{libgcc}.
6520 If GCC finds, at its configuration time, that you have a non-GNU linker
6521 or a GNU linker that does not support option @option{--eh-frame-hdr},
6522 it will link the shared version of @file{libgcc} into shared libraries
6523 by default.  Otherwise, it will take advantage of the linker and optimize
6524 away the linking with the shared version of @file{libgcc}, linking with
6525 the static version of libgcc by default.  This allows exceptions to
6526 propagate through such shared libraries, without incurring relocation
6527 costs at library load time.
6529 However, if a library or main executable is supposed to throw or catch
6530 exceptions, you must link it using the G++ or GCJ driver, as appropriate
6531 for the languages used in the program, or using the option
6532 @option{-shared-libgcc}, such that it is linked with the shared
6533 @file{libgcc}.
6535 @item -symbolic
6536 @opindex symbolic
6537 Bind references to global symbols when building a shared object.  Warn
6538 about any unresolved references (unless overridden by the link editor
6539 option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
6540 this option.
6542 @item -Xlinker @var{option}
6543 @opindex Xlinker
6544 Pass @var{option} as an option to the linker.  You can use this to
6545 supply system-specific linker options which GCC does not know how to
6546 recognize.
6548 If you want to pass an option that takes an argument, you must use
6549 @option{-Xlinker} twice, once for the option and once for the argument.
6550 For example, to pass @option{-assert definitions}, you must write
6551 @samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
6552 @option{-Xlinker "-assert definitions"}, because this passes the entire
6553 string as a single argument, which is not what the linker expects.
6555 @item -Wl,@var{option}
6556 @opindex Wl
6557 Pass @var{option} as an option to the linker.  If @var{option} contains
6558 commas, it is split into multiple options at the commas.
6560 @item -u @var{symbol}
6561 @opindex u
6562 Pretend the symbol @var{symbol} is undefined, to force linking of
6563 library modules to define it.  You can use @option{-u} multiple times with
6564 different symbols to force loading of additional library modules.
6565 @end table
6567 @node Directory Options
6568 @section Options for Directory Search
6569 @cindex directory options
6570 @cindex options, directory search
6571 @cindex search path
6573 These options specify directories to search for header files, for
6574 libraries and for parts of the compiler:
6576 @table @gcctabopt
6577 @item -I@var{dir}
6578 @opindex I
6579 Add the directory @var{dir} to the head of the list of directories to be
6580 searched for header files.  This can be used to override a system header
6581 file, substituting your own version, since these directories are
6582 searched before the system header file directories.  However, you should
6583 not use this option to add directories that contain vendor-supplied
6584 system header files (use @option{-isystem} for that).  If you use more than
6585 one @option{-I} option, the directories are scanned in left-to-right
6586 order; the standard system directories come after.
6588 If a standard system include directory, or a directory specified with
6589 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
6590 option will be ignored.  The directory will still be searched but as a
6591 system directory at its normal position in the system include chain.
6592 This is to ensure that GCC's procedure to fix buggy system headers and
6593 the ordering for the include_next directive are not inadvertently changed.
6594 If you really need to change the search order for system directories,
6595 use the @option{-nostdinc} and/or @option{-isystem} options.
6597 @item -iquote@var{dir}
6598 @opindex iquote
6599 Add the directory @var{dir} to the head of the list of directories to
6600 be searched for header files only for the case of @samp{#include
6601 "@var{file}"}; they are not searched for @samp{#include <@var{file}>},
6602 otherwise just like @option{-I}.
6604 @item -L@var{dir}
6605 @opindex L
6606 Add directory @var{dir} to the list of directories to be searched
6607 for @option{-l}.
6609 @item -B@var{prefix}
6610 @opindex B
6611 This option specifies where to find the executables, libraries,
6612 include files, and data files of the compiler itself.
6614 The compiler driver program runs one or more of the subprograms
6615 @file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
6616 @var{prefix} as a prefix for each program it tries to run, both with and
6617 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
6619 For each subprogram to be run, the compiler driver first tries the
6620 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
6621 was not specified, the driver tries two standard prefixes, which are
6622 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
6623 those results in a file name that is found, the unmodified program
6624 name is searched for using the directories specified in your
6625 @env{PATH} environment variable.
6627 The compiler will check to see if the path provided by the @option{-B}
6628 refers to a directory, and if necessary it will add a directory
6629 separator character at the end of the path.
6631 @option{-B} prefixes that effectively specify directory names also apply
6632 to libraries in the linker, because the compiler translates these
6633 options into @option{-L} options for the linker.  They also apply to
6634 includes files in the preprocessor, because the compiler translates these
6635 options into @option{-isystem} options for the preprocessor.  In this case,
6636 the compiler appends @samp{include} to the prefix.
6638 The run-time support file @file{libgcc.a} can also be searched for using
6639 the @option{-B} prefix, if needed.  If it is not found there, the two
6640 standard prefixes above are tried, and that is all.  The file is left
6641 out of the link if it is not found by those means.
6643 Another way to specify a prefix much like the @option{-B} prefix is to use
6644 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
6645 Variables}.
6647 As a special kludge, if the path provided by @option{-B} is
6648 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
6649 9, then it will be replaced by @file{[dir/]include}.  This is to help
6650 with boot-strapping the compiler.
6652 @item -specs=@var{file}
6653 @opindex specs
6654 Process @var{file} after the compiler reads in the standard @file{specs}
6655 file, in order to override the defaults that the @file{gcc} driver
6656 program uses when determining what switches to pass to @file{cc1},
6657 @file{cc1plus}, @file{as}, @file{ld}, etc.  More than one
6658 @option{-specs=@var{file}} can be specified on the command line, and they
6659 are processed in order, from left to right.
6661 @item --sysroot=@var{dir}
6662 @opindex sysroot
6663 Use @var{dir} as the logical root directory for headers and libraries.
6664 For example, if the compiler would normally search for headers in
6665 @file{/usr/include} and libraries in @file{/usr/lib}, it will instead
6666 search @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.  
6668 If you use both this option and the @option{-isysroot} option, then
6669 the @option{--sysroot} option will apply to libraries, but the
6670 @option{-isysroot} option will apply to header files.
6672 The GNU linker (beginning with version 2.16) has the necessary support
6673 for this option.  If your linker does not support this option, the
6674 header file aspect of @option{--sysroot} will still work, but the
6675 library aspect will not.
6677 @item -I-
6678 @opindex I-
6679 This option has been deprecated.  Please use @option{-iquote} instead for
6680 @option{-I} directories before the @option{-I-} and remove the @option{-I-}.
6681 Any directories you specify with @option{-I} options before the @option{-I-}
6682 option are searched only for the case of @samp{#include "@var{file}"};
6683 they are not searched for @samp{#include <@var{file}>}.
6685 If additional directories are specified with @option{-I} options after
6686 the @option{-I-}, these directories are searched for all @samp{#include}
6687 directives.  (Ordinarily @emph{all} @option{-I} directories are used
6688 this way.)
6690 In addition, the @option{-I-} option inhibits the use of the current
6691 directory (where the current input file came from) as the first search
6692 directory for @samp{#include "@var{file}"}.  There is no way to
6693 override this effect of @option{-I-}.  With @option{-I.} you can specify
6694 searching the directory which was current when the compiler was
6695 invoked.  That is not exactly the same as what the preprocessor does
6696 by default, but it is often satisfactory.
6698 @option{-I-} does not inhibit the use of the standard system directories
6699 for header files.  Thus, @option{-I-} and @option{-nostdinc} are
6700 independent.
6701 @end table
6703 @c man end
6705 @node Spec Files
6706 @section Specifying subprocesses and the switches to pass to them
6707 @cindex Spec Files
6709 @command{gcc} is a driver program.  It performs its job by invoking a
6710 sequence of other programs to do the work of compiling, assembling and
6711 linking.  GCC interprets its command-line parameters and uses these to
6712 deduce which programs it should invoke, and which command-line options
6713 it ought to place on their command lines.  This behavior is controlled
6714 by @dfn{spec strings}.  In most cases there is one spec string for each
6715 program that GCC can invoke, but a few programs have multiple spec
6716 strings to control their behavior.  The spec strings built into GCC can
6717 be overridden by using the @option{-specs=} command-line switch to specify
6718 a spec file.
6720 @dfn{Spec files} are plaintext files that are used to construct spec
6721 strings.  They consist of a sequence of directives separated by blank
6722 lines.  The type of directive is determined by the first non-whitespace
6723 character on the line and it can be one of the following:
6725 @table @code
6726 @item %@var{command}
6727 Issues a @var{command} to the spec file processor.  The commands that can
6728 appear here are:
6730 @table @code
6731 @item %include <@var{file}>
6732 @cindex %include
6733 Search for @var{file} and insert its text at the current point in the
6734 specs file.
6736 @item %include_noerr <@var{file}>
6737 @cindex %include_noerr
6738 Just like @samp{%include}, but do not generate an error message if the include
6739 file cannot be found.
6741 @item %rename @var{old_name} @var{new_name}
6742 @cindex %rename
6743 Rename the spec string @var{old_name} to @var{new_name}.
6745 @end table
6747 @item *[@var{spec_name}]:
6748 This tells the compiler to create, override or delete the named spec
6749 string.  All lines after this directive up to the next directive or
6750 blank line are considered to be the text for the spec string.  If this
6751 results in an empty string then the spec will be deleted.  (Or, if the
6752 spec did not exist, then nothing will happened.)  Otherwise, if the spec
6753 does not currently exist a new spec will be created.  If the spec does
6754 exist then its contents will be overridden by the text of this
6755 directive, unless the first character of that text is the @samp{+}
6756 character, in which case the text will be appended to the spec.
6758 @item [@var{suffix}]:
6759 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
6760 and up to the next directive or blank line are considered to make up the
6761 spec string for the indicated suffix.  When the compiler encounters an
6762 input file with the named suffix, it will processes the spec string in
6763 order to work out how to compile that file.  For example:
6765 @smallexample
6766 .ZZ:
6767 z-compile -input %i
6768 @end smallexample
6770 This says that any input file whose name ends in @samp{.ZZ} should be
6771 passed to the program @samp{z-compile}, which should be invoked with the
6772 command-line switch @option{-input} and with the result of performing the
6773 @samp{%i} substitution.  (See below.)
6775 As an alternative to providing a spec string, the text that follows a
6776 suffix directive can be one of the following:
6778 @table @code
6779 @item @@@var{language}
6780 This says that the suffix is an alias for a known @var{language}.  This is
6781 similar to using the @option{-x} command-line switch to GCC to specify a
6782 language explicitly.  For example:
6784 @smallexample
6785 .ZZ:
6786 @@c++
6787 @end smallexample
6789 Says that .ZZ files are, in fact, C++ source files.
6791 @item #@var{name}
6792 This causes an error messages saying:
6794 @smallexample
6795 @var{name} compiler not installed on this system.
6796 @end smallexample
6797 @end table
6799 GCC already has an extensive list of suffixes built into it.
6800 This directive will add an entry to the end of the list of suffixes, but
6801 since the list is searched from the end backwards, it is effectively
6802 possible to override earlier entries using this technique.
6804 @end table
6806 GCC has the following spec strings built into it.  Spec files can
6807 override these strings or create their own.  Note that individual
6808 targets can also add their own spec strings to this list.
6810 @smallexample
6811 asm          Options to pass to the assembler
6812 asm_final    Options to pass to the assembler post-processor
6813 cpp          Options to pass to the C preprocessor
6814 cc1          Options to pass to the C compiler
6815 cc1plus      Options to pass to the C++ compiler
6816 endfile      Object files to include at the end of the link
6817 link         Options to pass to the linker
6818 lib          Libraries to include on the command line to the linker
6819 libgcc       Decides which GCC support library to pass to the linker
6820 linker       Sets the name of the linker
6821 predefines   Defines to be passed to the C preprocessor
6822 signed_char  Defines to pass to CPP to say whether @code{char} is signed
6823              by default
6824 startfile    Object files to include at the start of the link
6825 @end smallexample
6827 Here is a small example of a spec file:
6829 @smallexample
6830 %rename lib                 old_lib
6832 *lib:
6833 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
6834 @end smallexample
6836 This example renames the spec called @samp{lib} to @samp{old_lib} and
6837 then overrides the previous definition of @samp{lib} with a new one.
6838 The new definition adds in some extra command-line options before
6839 including the text of the old definition.
6841 @dfn{Spec strings} are a list of command-line options to be passed to their
6842 corresponding program.  In addition, the spec strings can contain
6843 @samp{%}-prefixed sequences to substitute variable text or to
6844 conditionally insert text into the command line.  Using these constructs
6845 it is possible to generate quite complex command lines.
6847 Here is a table of all defined @samp{%}-sequences for spec
6848 strings.  Note that spaces are not generated automatically around the
6849 results of expanding these sequences.  Therefore you can concatenate them
6850 together or combine them with constant text in a single argument.
6852 @table @code
6853 @item %%
6854 Substitute one @samp{%} into the program name or argument.
6856 @item %i
6857 Substitute the name of the input file being processed.
6859 @item %b
6860 Substitute the basename of the input file being processed.
6861 This is the substring up to (and not including) the last period
6862 and not including the directory.
6864 @item %B
6865 This is the same as @samp{%b}, but include the file suffix (text after
6866 the last period).
6868 @item %d
6869 Marks the argument containing or following the @samp{%d} as a
6870 temporary file name, so that that file will be deleted if GCC exits
6871 successfully.  Unlike @samp{%g}, this contributes no text to the
6872 argument.
6874 @item %g@var{suffix}
6875 Substitute a file name that has suffix @var{suffix} and is chosen
6876 once per compilation, and mark the argument in the same way as
6877 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
6878 name is now chosen in a way that is hard to predict even when previously
6879 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
6880 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
6881 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
6882 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
6883 was simply substituted with a file name chosen once per compilation,
6884 without regard to any appended suffix (which was therefore treated
6885 just like ordinary text), making such attacks more likely to succeed.
6887 @item %u@var{suffix}
6888 Like @samp{%g}, but generates a new temporary file name even if
6889 @samp{%u@var{suffix}} was already seen.
6891 @item %U@var{suffix}
6892 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
6893 new one if there is no such last file name.  In the absence of any
6894 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
6895 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
6896 would involve the generation of two distinct file names, one
6897 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
6898 simply substituted with a file name chosen for the previous @samp{%u},
6899 without regard to any appended suffix.
6901 @item %j@var{suffix}
6902 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
6903 writable, and if save-temps is off; otherwise, substitute the name
6904 of a temporary file, just like @samp{%u}.  This temporary file is not
6905 meant for communication between processes, but rather as a junk
6906 disposal mechanism.
6908 @item %|@var{suffix}
6909 @itemx %m@var{suffix}
6910 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
6911 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
6912 all.  These are the two most common ways to instruct a program that it
6913 should read from standard input or write to standard output.  If you
6914 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
6915 construct: see for example @file{f/lang-specs.h}.
6917 @item %.@var{SUFFIX}
6918 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
6919 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
6920 terminated by the next space or %.
6922 @item %w
6923 Marks the argument containing or following the @samp{%w} as the
6924 designated output file of this compilation.  This puts the argument
6925 into the sequence of arguments that @samp{%o} will substitute later.
6927 @item %o
6928 Substitutes the names of all the output files, with spaces
6929 automatically placed around them.  You should write spaces
6930 around the @samp{%o} as well or the results are undefined.
6931 @samp{%o} is for use in the specs for running the linker.
6932 Input files whose names have no recognized suffix are not compiled
6933 at all, but they are included among the output files, so they will
6934 be linked.
6936 @item %O
6937 Substitutes the suffix for object files.  Note that this is
6938 handled specially when it immediately follows @samp{%g, %u, or %U},
6939 because of the need for those to form complete file names.  The
6940 handling is such that @samp{%O} is treated exactly as if it had already
6941 been substituted, except that @samp{%g, %u, and %U} do not currently
6942 support additional @var{suffix} characters following @samp{%O} as they would
6943 following, for example, @samp{.o}.
6945 @item %p
6946 Substitutes the standard macro predefinitions for the
6947 current target machine.  Use this when running @code{cpp}.
6949 @item %P
6950 Like @samp{%p}, but puts @samp{__} before and after the name of each
6951 predefined macro, except for macros that start with @samp{__} or with
6952 @samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
6955 @item %I
6956 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
6957 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
6958 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
6959 and @option{-imultilib} as necessary.
6961 @item %s
6962 Current argument is the name of a library or startup file of some sort.
6963 Search for that file in a standard list of directories and substitute
6964 the full name found.
6966 @item %e@var{str}
6967 Print @var{str} as an error message.  @var{str} is terminated by a newline.
6968 Use this when inconsistent options are detected.
6970 @item %(@var{name})
6971 Substitute the contents of spec string @var{name} at this point.
6973 @item %[@var{name}]
6974 Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
6976 @item %x@{@var{option}@}
6977 Accumulate an option for @samp{%X}.
6979 @item %X
6980 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
6981 spec string.
6983 @item %Y
6984 Output the accumulated assembler options specified by @option{-Wa}.
6986 @item %Z
6987 Output the accumulated preprocessor options specified by @option{-Wp}.
6989 @item %a
6990 Process the @code{asm} spec.  This is used to compute the
6991 switches to be passed to the assembler.
6993 @item %A
6994 Process the @code{asm_final} spec.  This is a spec string for
6995 passing switches to an assembler post-processor, if such a program is
6996 needed.
6998 @item %l
6999 Process the @code{link} spec.  This is the spec for computing the
7000 command line passed to the linker.  Typically it will make use of the
7001 @samp{%L %G %S %D and %E} sequences.
7003 @item %D
7004 Dump out a @option{-L} option for each directory that GCC believes might
7005 contain startup files.  If the target supports multilibs then the
7006 current multilib directory will be prepended to each of these paths.
7008 @item %L
7009 Process the @code{lib} spec.  This is a spec string for deciding which
7010 libraries should be included on the command line to the linker.
7012 @item %G
7013 Process the @code{libgcc} spec.  This is a spec string for deciding
7014 which GCC support library should be included on the command line to the linker.
7016 @item %S
7017 Process the @code{startfile} spec.  This is a spec for deciding which
7018 object files should be the first ones passed to the linker.  Typically
7019 this might be a file named @file{crt0.o}.
7021 @item %E
7022 Process the @code{endfile} spec.  This is a spec string that specifies
7023 the last object files that will be passed to the linker.
7025 @item %C
7026 Process the @code{cpp} spec.  This is used to construct the arguments
7027 to be passed to the C preprocessor.
7029 @item %1
7030 Process the @code{cc1} spec.  This is used to construct the options to be
7031 passed to the actual C compiler (@samp{cc1}).
7033 @item %2
7034 Process the @code{cc1plus} spec.  This is used to construct the options to be
7035 passed to the actual C++ compiler (@samp{cc1plus}).
7037 @item %*
7038 Substitute the variable part of a matched option.  See below.
7039 Note that each comma in the substituted string is replaced by
7040 a single space.
7042 @item %<@code{S}
7043 Remove all occurrences of @code{-S} from the command line.  Note---this
7044 command is position dependent.  @samp{%} commands in the spec string
7045 before this one will see @code{-S}, @samp{%} commands in the spec string
7046 after this one will not.
7048 @item %:@var{function}(@var{args})
7049 Call the named function @var{function}, passing it @var{args}.
7050 @var{args} is first processed as a nested spec string, then split
7051 into an argument vector in the usual fashion.  The function returns
7052 a string which is processed as if it had appeared literally as part
7053 of the current spec.
7055 The following built-in spec functions are provided:
7057 @table @code
7058 @item @code{if-exists}
7059 The @code{if-exists} spec function takes one argument, an absolute
7060 pathname to a file.  If the file exists, @code{if-exists} returns the
7061 pathname.  Here is a small example of its usage:
7063 @smallexample
7064 *startfile:
7065 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
7066 @end smallexample
7068 @item @code{if-exists-else}
7069 The @code{if-exists-else} spec function is similar to the @code{if-exists}
7070 spec function, except that it takes two arguments.  The first argument is
7071 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
7072 returns the pathname.  If it does not exist, it returns the second argument.
7073 This way, @code{if-exists-else} can be used to select one file or another,
7074 based on the existence of the first.  Here is a small example of its usage:
7076 @smallexample
7077 *startfile:
7078 crt0%O%s %:if-exists(crti%O%s) \
7079 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
7080 @end smallexample
7082 @item @code{replace-outfile}
7083 The @code{replace-outfile} spec function takes two arguments.  It looks for the
7084 first argument in the outfiles array and replaces it with the second argument.  Here
7085 is a small example of its usage:
7087 @smallexample
7088 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
7089 @end smallexample
7091 @end table
7093 @item %@{@code{S}@}
7094 Substitutes the @code{-S} switch, if that switch was given to GCC@.
7095 If that switch was not specified, this substitutes nothing.  Note that
7096 the leading dash is omitted when specifying this option, and it is
7097 automatically inserted if the substitution is performed.  Thus the spec
7098 string @samp{%@{foo@}} would match the command-line option @option{-foo}
7099 and would output the command line option @option{-foo}.
7101 @item %W@{@code{S}@}
7102 Like %@{@code{S}@} but mark last argument supplied within as a file to be
7103 deleted on failure.
7105 @item %@{@code{S}*@}
7106 Substitutes all the switches specified to GCC whose names start
7107 with @code{-S}, but which also take an argument.  This is used for
7108 switches like @option{-o}, @option{-D}, @option{-I}, etc.
7109 GCC considers @option{-o foo} as being
7110 one switch whose names starts with @samp{o}.  %@{o*@} would substitute this
7111 text, including the space.  Thus two arguments would be generated.
7113 @item %@{@code{S}*&@code{T}*@}
7114 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
7115 (the order of @code{S} and @code{T} in the spec is not significant).
7116 There can be any number of ampersand-separated variables; for each the
7117 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
7119 @item %@{@code{S}:@code{X}@}
7120 Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
7122 @item %@{!@code{S}:@code{X}@}
7123 Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
7125 @item %@{@code{S}*:@code{X}@}
7126 Substitutes @code{X} if one or more switches whose names start with
7127 @code{-S} are specified to GCC@.  Normally @code{X} is substituted only
7128 once, no matter how many such switches appeared.  However, if @code{%*}
7129 appears somewhere in @code{X}, then @code{X} will be substituted once
7130 for each matching switch, with the @code{%*} replaced by the part of
7131 that switch that matched the @code{*}.
7133 @item %@{.@code{S}:@code{X}@}
7134 Substitutes @code{X}, if processing a file with suffix @code{S}.
7136 @item %@{!.@code{S}:@code{X}@}
7137 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
7139 @item %@{@code{S}|@code{P}:@code{X}@}
7140 Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@.
7141 This may be combined with @samp{!}, @samp{.}, and @code{*} sequences as well,
7142 although they have a stronger binding than the @samp{|}.  If @code{%*}
7143 appears in @code{X}, all of the alternatives must be starred, and only
7144 the first matching alternative is substituted.
7146 For example, a spec string like this:
7148 @smallexample
7149 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
7150 @end smallexample
7152 will output the following command-line options from the following input
7153 command-line options:
7155 @smallexample
7156 fred.c        -foo -baz
7157 jim.d         -bar -boggle
7158 -d fred.c     -foo -baz -boggle
7159 -d jim.d      -bar -baz -boggle
7160 @end smallexample
7162 @item %@{S:X; T:Y; :D@}
7164 If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
7165 given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
7166 be as many clauses as you need.  This may be combined with @code{.},
7167 @code{!}, @code{|}, and @code{*} as needed.
7170 @end table
7172 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
7173 construct may contain other nested @samp{%} constructs or spaces, or
7174 even newlines.  They are processed as usual, as described above.
7175 Trailing white space in @code{X} is ignored.  White space may also
7176 appear anywhere on the left side of the colon in these constructs,
7177 except between @code{.} or @code{*} and the corresponding word.
7179 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
7180 handled specifically in these constructs.  If another value of
7181 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
7182 @option{-W} switch is found later in the command line, the earlier
7183 switch value is ignored, except with @{@code{S}*@} where @code{S} is
7184 just one letter, which passes all matching options.
7186 The character @samp{|} at the beginning of the predicate text is used to
7187 indicate that a command should be piped to the following command, but
7188 only if @option{-pipe} is specified.
7190 It is built into GCC which switches take arguments and which do not.
7191 (You might think it would be useful to generalize this to allow each
7192 compiler's spec to say which switches take arguments.  But this cannot
7193 be done in a consistent fashion.  GCC cannot even decide which input
7194 files have been specified without knowing which switches take arguments,
7195 and it must know which input files to compile in order to tell which
7196 compilers to run).
7198 GCC also knows implicitly that arguments starting in @option{-l} are to be
7199 treated as compiler output files, and passed to the linker in their
7200 proper position among the other output files.
7202 @c man begin OPTIONS
7204 @node Target Options
7205 @section Specifying Target Machine and Compiler Version
7206 @cindex target options
7207 @cindex cross compiling
7208 @cindex specifying machine version
7209 @cindex specifying compiler version and target machine
7210 @cindex compiler version, specifying
7211 @cindex target machine, specifying
7213 The usual way to run GCC is to run the executable called @file{gcc}, or
7214 @file{<machine>-gcc} when cross-compiling, or
7215 @file{<machine>-gcc-<version>} to run a version other than the one that
7216 was installed last.  Sometimes this is inconvenient, so GCC provides
7217 options that will switch to another cross-compiler or version.
7219 @table @gcctabopt
7220 @item -b @var{machine}
7221 @opindex b
7222 The argument @var{machine} specifies the target machine for compilation.
7224 The value to use for @var{machine} is the same as was specified as the
7225 machine type when configuring GCC as a cross-compiler.  For
7226 example, if a cross-compiler was configured with @samp{configure
7227 arm-elf}, meaning to compile for an arm processor with elf binaries,
7228 then you would specify @option{-b arm-elf} to run that cross compiler.
7229 Because there are other options beginning with @option{-b}, the
7230 configuration must contain a hyphen. 
7232 @item -V @var{version}
7233 @opindex V
7234 The argument @var{version} specifies which version of GCC to run.
7235 This is useful when multiple versions are installed.  For example,
7236 @var{version} might be @samp{4.0}, meaning to run GCC version 4.0.
7237 @end table
7239 The @option{-V} and @option{-b} options work by running the
7240 @file{<machine>-gcc-<version>} executable, so there's no real reason to
7241 use them if you can just run that directly.
7243 @node Submodel Options
7244 @section Hardware Models and Configurations
7245 @cindex submodel options
7246 @cindex specifying hardware config
7247 @cindex hardware models and configurations, specifying
7248 @cindex machine dependent options
7250 Earlier we discussed the standard option @option{-b} which chooses among
7251 different installed compilers for completely different target
7252 machines, such as VAX vs.@: 68000 vs.@: 80386.
7254 In addition, each of these target machine types can have its own
7255 special options, starting with @samp{-m}, to choose among various
7256 hardware models or configurations---for example, 68010 vs 68020,
7257 floating coprocessor or none.  A single installed version of the
7258 compiler can compile for any model or configuration, according to the
7259 options specified.
7261 Some configurations of the compiler also support additional special
7262 options, usually for compatibility with other compilers on the same
7263 platform.
7265 @c This list is ordered alphanumerically by subsection name.
7266 @c It should be the same order and spelling as these options are listed
7267 @c in Machine Dependent Options
7269 @menu
7270 * ARC Options::
7271 * ARM Options::
7272 * AVR Options::
7273 * Blackfin Options::
7274 * CRIS Options::
7275 * CRX Options::
7276 * Darwin Options::
7277 * DEC Alpha Options::
7278 * DEC Alpha/VMS Options::
7279 * FRV Options::
7280 * GNU/Linux Options::
7281 * H8/300 Options::
7282 * HPPA Options::
7283 * i386 and x86-64 Options::
7284 * IA-64 Options::
7285 * M32C Options::
7286 * M32R/D Options::
7287 * M680x0 Options::
7288 * M68hc1x Options::
7289 * MCore Options::
7290 * MIPS Options::
7291 * MMIX Options::
7292 * MN10300 Options::
7293 * MT Options::
7294 * PDP-11 Options::
7295 * PowerPC Options::
7296 * RS/6000 and PowerPC Options::
7297 * S/390 and zSeries Options::
7298 * SH Options::
7299 * SPARC Options::
7300 * System V Options::
7301 * TMS320C3x/C4x Options::
7302 * V850 Options::
7303 * VAX Options::
7304 * x86-64 Options::
7305 * Xstormy16 Options::
7306 * Xtensa Options::
7307 * zSeries Options::
7308 @end menu
7310 @node ARC Options
7311 @subsection ARC Options
7312 @cindex ARC Options
7314 These options are defined for ARC implementations:
7316 @table @gcctabopt
7317 @item -EL
7318 @opindex EL
7319 Compile code for little endian mode.  This is the default.
7321 @item -EB
7322 @opindex EB
7323 Compile code for big endian mode.
7325 @item -mmangle-cpu
7326 @opindex mmangle-cpu
7327 Prepend the name of the cpu to all public symbol names.
7328 In multiple-processor systems, there are many ARC variants with different
7329 instruction and register set characteristics.  This flag prevents code
7330 compiled for one cpu to be linked with code compiled for another.
7331 No facility exists for handling variants that are ``almost identical''.
7332 This is an all or nothing option.
7334 @item -mcpu=@var{cpu}
7335 @opindex mcpu
7336 Compile code for ARC variant @var{cpu}.
7337 Which variants are supported depend on the configuration.
7338 All variants support @option{-mcpu=base}, this is the default.
7340 @item -mtext=@var{text-section}
7341 @itemx -mdata=@var{data-section}
7342 @itemx -mrodata=@var{readonly-data-section}
7343 @opindex mtext
7344 @opindex mdata
7345 @opindex mrodata
7346 Put functions, data, and readonly data in @var{text-section},
7347 @var{data-section}, and @var{readonly-data-section} respectively
7348 by default.  This can be overridden with the @code{section} attribute.
7349 @xref{Variable Attributes}.
7351 @end table
7353 @node ARM Options
7354 @subsection ARM Options
7355 @cindex ARM options
7357 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
7358 architectures:
7360 @table @gcctabopt
7361 @item -mabi=@var{name}
7362 @opindex mabi
7363 Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
7364 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
7366 @item -mapcs-frame
7367 @opindex mapcs-frame
7368 Generate a stack frame that is compliant with the ARM Procedure Call
7369 Standard for all functions, even if this is not strictly necessary for
7370 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
7371 with this option will cause the stack frames not to be generated for
7372 leaf functions.  The default is @option{-mno-apcs-frame}.
7374 @item -mapcs
7375 @opindex mapcs
7376 This is a synonym for @option{-mapcs-frame}.
7378 @ignore
7379 @c not currently implemented
7380 @item -mapcs-stack-check
7381 @opindex mapcs-stack-check
7382 Generate code to check the amount of stack space available upon entry to
7383 every function (that actually uses some stack space).  If there is
7384 insufficient space available then either the function
7385 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
7386 called, depending upon the amount of stack space required.  The run time
7387 system is required to provide these functions.  The default is
7388 @option{-mno-apcs-stack-check}, since this produces smaller code.
7390 @c not currently implemented
7391 @item -mapcs-float
7392 @opindex mapcs-float
7393 Pass floating point arguments using the float point registers.  This is
7394 one of the variants of the APCS@.  This option is recommended if the
7395 target hardware has a floating point unit or if a lot of floating point
7396 arithmetic is going to be performed by the code.  The default is
7397 @option{-mno-apcs-float}, since integer only code is slightly increased in
7398 size if @option{-mapcs-float} is used.
7400 @c not currently implemented
7401 @item -mapcs-reentrant
7402 @opindex mapcs-reentrant
7403 Generate reentrant, position independent code.  The default is
7404 @option{-mno-apcs-reentrant}.
7405 @end ignore
7407 @item -mthumb-interwork
7408 @opindex mthumb-interwork
7409 Generate code which supports calling between the ARM and Thumb
7410 instruction sets.  Without this option the two instruction sets cannot
7411 be reliably used inside one program.  The default is
7412 @option{-mno-thumb-interwork}, since slightly larger code is generated
7413 when @option{-mthumb-interwork} is specified.
7415 @item -mno-sched-prolog
7416 @opindex mno-sched-prolog
7417 Prevent the reordering of instructions in the function prolog, or the
7418 merging of those instruction with the instructions in the function's
7419 body.  This means that all functions will start with a recognizable set
7420 of instructions (or in fact one of a choice from a small set of
7421 different function prologues), and this information can be used to
7422 locate the start if functions inside an executable piece of code.  The
7423 default is @option{-msched-prolog}.
7425 @item -mhard-float
7426 @opindex mhard-float
7427 Generate output containing floating point instructions.  This is the
7428 default.
7430 @item -msoft-float
7431 @opindex msoft-float
7432 Generate output containing library calls for floating point.
7433 @strong{Warning:} the requisite libraries are not available for all ARM
7434 targets.  Normally the facilities of the machine's usual C compiler are
7435 used, but this cannot be done directly in cross-compilation.  You must make
7436 your own arrangements to provide suitable library functions for
7437 cross-compilation.
7439 @option{-msoft-float} changes the calling convention in the output file;
7440 therefore, it is only useful if you compile @emph{all} of a program with
7441 this option.  In particular, you need to compile @file{libgcc.a}, the
7442 library that comes with GCC, with @option{-msoft-float} in order for
7443 this to work.
7445 @item -mfloat-abi=@var{name}
7446 @opindex mfloat-abi
7447 Specifies which ABI to use for floating point values.  Permissible values
7448 are: @samp{soft}, @samp{softfp} and @samp{hard}.
7450 @samp{soft} and @samp{hard} are equivalent to @option{-msoft-float}
7451 and @option{-mhard-float} respectively.  @samp{softfp} allows the generation
7452 of floating point instructions, but still uses the soft-float calling
7453 conventions.
7455 @item -mlittle-endian
7456 @opindex mlittle-endian
7457 Generate code for a processor running in little-endian mode.  This is
7458 the default for all standard configurations.
7460 @item -mbig-endian
7461 @opindex mbig-endian
7462 Generate code for a processor running in big-endian mode; the default is
7463 to compile code for a little-endian processor.
7465 @item -mwords-little-endian
7466 @opindex mwords-little-endian
7467 This option only applies when generating code for big-endian processors.
7468 Generate code for a little-endian word order but a big-endian byte
7469 order.  That is, a byte order of the form @samp{32107654}.  Note: this
7470 option should only be used if you require compatibility with code for
7471 big-endian ARM processors generated by versions of the compiler prior to
7472 2.8.
7474 @item -mcpu=@var{name}
7475 @opindex mcpu
7476 This specifies the name of the target ARM processor.  GCC uses this name
7477 to determine what kind of instructions it can emit when generating
7478 assembly code.  Permissible names are: @samp{arm2}, @samp{arm250},
7479 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
7480 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
7481 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
7482 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
7483 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
7484 @samp{arm8}, @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
7485 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
7486 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
7487 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
7488 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
7489 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
7490 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
7491 @samp{arm1176jz-s}, @samp{arm1176jzf-s}, @samp{xscale}, @samp{iwmmxt},
7492 @samp{ep9312}.
7494 @itemx -mtune=@var{name}
7495 @opindex mtune
7496 This option is very similar to the @option{-mcpu=} option, except that
7497 instead of specifying the actual target processor type, and hence
7498 restricting which instructions can be used, it specifies that GCC should
7499 tune the performance of the code as if the target were of the type
7500 specified in this option, but still choosing the instructions that it
7501 will generate based on the cpu specified by a @option{-mcpu=} option.
7502 For some ARM implementations better performance can be obtained by using
7503 this option.
7505 @item -march=@var{name}
7506 @opindex march
7507 This specifies the name of the target ARM architecture.  GCC uses this
7508 name to determine what kind of instructions it can emit when generating
7509 assembly code.  This option can be used in conjunction with or instead
7510 of the @option{-mcpu=} option.  Permissible names are: @samp{armv2},
7511 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
7512 @samp{armv5}, @samp{armv5t}, @samp{armv5te}, @samp{armv6}, @samp{armv6j},
7513 @samp{iwmmxt}, @samp{ep9312}.
7515 @item -mfpu=@var{name}
7516 @itemx -mfpe=@var{number}
7517 @itemx -mfp=@var{number}
7518 @opindex mfpu
7519 @opindex mfpe
7520 @opindex mfp
7521 This specifies what floating point hardware (or hardware emulation) is
7522 available on the target.  Permissible names are: @samp{fpa}, @samp{fpe2},
7523 @samp{fpe3}, @samp{maverick}, @samp{vfp}.  @option{-mfp} and @option{-mfpe}
7524 are synonyms for @option{-mfpu}=@samp{fpe}@var{number}, for compatibility
7525 with older versions of GCC@.
7527 If @option{-msoft-float} is specified this specifies the format of
7528 floating point values.
7530 @item -mstructure-size-boundary=@var{n}
7531 @opindex mstructure-size-boundary
7532 The size of all structures and unions will be rounded up to a multiple
7533 of the number of bits set by this option.  Permissible values are 8, 32
7534 and 64.  The default value varies for different toolchains.  For the COFF
7535 targeted toolchain the default value is 8.  A value of 64 is only allowed
7536 if the underlying ABI supports it.
7538 Specifying the larger number can produce faster, more efficient code, but
7539 can also increase the size of the program.  Different values are potentially
7540 incompatible.  Code compiled with one value cannot necessarily expect to
7541 work with code or libraries compiled with another value, if they exchange
7542 information using structures or unions.
7544 @item -mabort-on-noreturn
7545 @opindex mabort-on-noreturn
7546 Generate a call to the function @code{abort} at the end of a
7547 @code{noreturn} function.  It will be executed if the function tries to
7548 return.
7550 @item -mlong-calls
7551 @itemx -mno-long-calls
7552 @opindex mlong-calls
7553 @opindex mno-long-calls
7554 Tells the compiler to perform function calls by first loading the
7555 address of the function into a register and then performing a subroutine
7556 call on this register.  This switch is needed if the target function
7557 will lie outside of the 64 megabyte addressing range of the offset based
7558 version of subroutine call instruction.
7560 Even if this switch is enabled, not all function calls will be turned
7561 into long calls.  The heuristic is that static functions, functions
7562 which have the @samp{short-call} attribute, functions that are inside
7563 the scope of a @samp{#pragma no_long_calls} directive and functions whose
7564 definitions have already been compiled within the current compilation
7565 unit, will not be turned into long calls.  The exception to this rule is
7566 that weak function definitions, functions with the @samp{long-call}
7567 attribute or the @samp{section} attribute, and functions that are within
7568 the scope of a @samp{#pragma long_calls} directive, will always be
7569 turned into long calls.
7571 This feature is not enabled by default.  Specifying
7572 @option{-mno-long-calls} will restore the default behavior, as will
7573 placing the function calls within the scope of a @samp{#pragma
7574 long_calls_off} directive.  Note these switches have no effect on how
7575 the compiler generates code to handle function calls via function
7576 pointers.
7578 @item -mnop-fun-dllimport
7579 @opindex mnop-fun-dllimport
7580 Disable support for the @code{dllimport} attribute.
7582 @item -msingle-pic-base
7583 @opindex msingle-pic-base
7584 Treat the register used for PIC addressing as read-only, rather than
7585 loading it in the prologue for each function.  The run-time system is
7586 responsible for initializing this register with an appropriate value
7587 before execution begins.
7589 @item -mpic-register=@var{reg}
7590 @opindex mpic-register
7591 Specify the register to be used for PIC addressing.  The default is R10
7592 unless stack-checking is enabled, when R9 is used.
7594 @item -mcirrus-fix-invalid-insns
7595 @opindex mcirrus-fix-invalid-insns
7596 @opindex mno-cirrus-fix-invalid-insns
7597 Insert NOPs into the instruction stream to in order to work around
7598 problems with invalid Maverick instruction combinations.  This option
7599 is only valid if the @option{-mcpu=ep9312} option has been used to
7600 enable generation of instructions for the Cirrus Maverick floating
7601 point co-processor.  This option is not enabled by default, since the
7602 problem is only present in older Maverick implementations.  The default
7603 can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
7604 switch.
7606 @item -mpoke-function-name
7607 @opindex mpoke-function-name
7608 Write the name of each function into the text section, directly
7609 preceding the function prologue.  The generated code is similar to this:
7611 @smallexample
7612      t0
7613          .ascii "arm_poke_function_name", 0
7614          .align
7615      t1
7616          .word 0xff000000 + (t1 - t0)
7617      arm_poke_function_name
7618          mov     ip, sp
7619          stmfd   sp!, @{fp, ip, lr, pc@}
7620          sub     fp, ip, #4
7621 @end smallexample
7623 When performing a stack backtrace, code can inspect the value of
7624 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
7625 location @code{pc - 12} and the top 8 bits are set, then we know that
7626 there is a function name embedded immediately preceding this location
7627 and has length @code{((pc[-3]) & 0xff000000)}.
7629 @item -mthumb
7630 @opindex mthumb
7631 Generate code for the 16-bit Thumb instruction set.  The default is to
7632 use the 32-bit ARM instruction set.
7634 @item -mtpcs-frame
7635 @opindex mtpcs-frame
7636 Generate a stack frame that is compliant with the Thumb Procedure Call
7637 Standard for all non-leaf functions.  (A leaf function is one that does
7638 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
7640 @item -mtpcs-leaf-frame
7641 @opindex mtpcs-leaf-frame
7642 Generate a stack frame that is compliant with the Thumb Procedure Call
7643 Standard for all leaf functions.  (A leaf function is one that does
7644 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
7646 @item -mcallee-super-interworking
7647 @opindex mcallee-super-interworking
7648 Gives all externally visible functions in the file being compiled an ARM
7649 instruction set header which switches to Thumb mode before executing the
7650 rest of the function.  This allows these functions to be called from
7651 non-interworking code.
7653 @item -mcaller-super-interworking
7654 @opindex mcaller-super-interworking
7655 Allows calls via function pointers (including virtual functions) to
7656 execute correctly regardless of whether the target code has been
7657 compiled for interworking or not.  There is a small overhead in the cost
7658 of executing a function pointer if this option is enabled.
7660 @item -mtp=@var{name}
7661 @opindex mtp
7662 Specify the access model for the thread local storage pointer.  The valid
7663 models are @option{soft}, which generates calls to @code{__aeabi_read_tp},
7664 @option{cp15}, which fetches the thread pointer from @code{cp15} directly
7665 (supported in the arm6k architecture), and @option{auto}, which uses the
7666 best available method for the selected processor.  The default setting is
7667 @option{auto}.
7669 @end table
7671 @node AVR Options
7672 @subsection AVR Options
7673 @cindex AVR Options
7675 These options are defined for AVR implementations:
7677 @table @gcctabopt
7678 @item -mmcu=@var{mcu}
7679 @opindex mmcu
7680 Specify ATMEL AVR instruction set or MCU type.
7682 Instruction set avr1 is for the minimal AVR core, not supported by the C
7683 compiler, only for assembler programs (MCU types: at90s1200, attiny10,
7684 attiny11, attiny12, attiny15, attiny28).
7686 Instruction set avr2 (default) is for the classic AVR core with up to
7687 8K program memory space (MCU types: at90s2313, at90s2323, attiny22,
7688 at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
7689 at90c8534, at90s8535).
7691 Instruction set avr3 is for the classic AVR core with up to 128K program
7692 memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
7694 Instruction set avr4 is for the enhanced AVR core with up to 8K program
7695 memory space (MCU types: atmega8, atmega83, atmega85).
7697 Instruction set avr5 is for the enhanced AVR core with up to 128K program
7698 memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
7699 atmega64, atmega128, at43usb355, at94k).
7701 @item -msize
7702 @opindex msize
7703 Output instruction sizes to the asm file.
7705 @item -minit-stack=@var{N}
7706 @opindex minit-stack
7707 Specify the initial stack address, which may be a symbol or numeric value,
7708 @samp{__stack} is the default.
7710 @item -mno-interrupts
7711 @opindex mno-interrupts
7712 Generated code is not compatible with hardware interrupts.
7713 Code size will be smaller.
7715 @item -mcall-prologues
7716 @opindex mcall-prologues
7717 Functions prologues/epilogues expanded as call to appropriate
7718 subroutines.  Code size will be smaller.
7720 @item -mno-tablejump
7721 @opindex mno-tablejump
7722 Do not generate tablejump insns which sometimes increase code size.
7724 @item -mtiny-stack
7725 @opindex mtiny-stack
7726 Change only the low 8 bits of the stack pointer.
7728 @item -mint8
7729 @opindex mint8
7730 Assume int to be 8 bit integer.  This affects the sizes of all types: A
7731 char will be 1 byte, an int will be 1 byte, an long will be 2 bytes
7732 and long long will be 4 bytes.  Please note that this option does not
7733 comply to the C standards, but it will provide you with smaller code
7734 size.
7735 @end table
7737 @node Blackfin Options
7738 @subsection Blackfin Options
7739 @cindex Blackfin Options
7741 @table @gcctabopt
7742 @item -momit-leaf-frame-pointer
7743 @opindex momit-leaf-frame-pointer
7744 Don't keep the frame pointer in a register for leaf functions.  This
7745 avoids the instructions to save, set up and restore frame pointers and
7746 makes an extra register available in leaf functions.  The option
7747 @option{-fomit-frame-pointer} removes the frame pointer for all functions
7748 which might make debugging harder.
7750 @item -mspecld-anomaly
7751 @opindex mspecld-anomaly
7752 When enabled, the compiler will ensure that the generated code does not
7753 contain speculative loads after jump instructions.  This option is enabled
7754 by default.
7756 @item -mno-specld-anomaly
7757 @opindex mno-specld-anomaly
7758 Don't generate extra code to prevent speculative loads from occurring.
7760 @item -mcsync-anomaly
7761 @opindex mcsync-anomaly
7762 When enabled, the compiler will ensure that the generated code does not
7763 contain CSYNC or SSYNC instructions too soon after conditional branches.
7764 This option is enabled by default.
7766 @item -mno-csync-anomaly
7767 @opindex mno-csync-anomaly
7768 Don't generate extra code to prevent CSYNC or SSYNC instructions from
7769 occurring too soon after a conditional branch.
7771 @item -mlow-64k
7772 @opindex mlow-64k
7773 When enabled, the compiler is free to take advantage of the knowledge that
7774 the entire program fits into the low 64k of memory.
7776 @item -mno-low-64k
7777 @opindex mno-low-64k
7778 Assume that the program is arbitrarily large.  This is the default.
7780 @item -mid-shared-library
7781 @opindex mid-shared-library
7782 Generate code that supports shared libraries via the library ID method.
7783 This allows for execute in place and shared libraries in an environment
7784 without virtual memory management.  This option implies @option{-fPIC}.
7786 @item -mno-id-shared-library
7787 @opindex mno-id-shared-library
7788 Generate code that doesn't assume ID based shared libraries are being used.
7789 This is the default.
7791 @item -mshared-library-id=n
7792 @opindex mshared-library-id
7793 Specified the identification number of the ID based shared library being
7794 compiled.  Specifying a value of 0 will generate more compact code, specifying
7795 other values will force the allocation of that number to the current
7796 library but is no more space or time efficient than omitting this option.
7798 @item -mlong-calls
7799 @itemx -mno-long-calls
7800 @opindex mlong-calls
7801 @opindex mno-long-calls
7802 Tells the compiler to perform function calls by first loading the
7803 address of the function into a register and then performing a subroutine
7804 call on this register.  This switch is needed if the target function
7805 will lie outside of the 24 bit addressing range of the offset based
7806 version of subroutine call instruction.
7808 This feature is not enabled by default.  Specifying
7809 @option{-mno-long-calls} will restore the default behavior.  Note these
7810 switches have no effect on how the compiler generates code to handle
7811 function calls via function pointers.
7812 @end table
7814 @node CRIS Options
7815 @subsection CRIS Options
7816 @cindex CRIS Options
7818 These options are defined specifically for the CRIS ports.
7820 @table @gcctabopt
7821 @item -march=@var{architecture-type}
7822 @itemx -mcpu=@var{architecture-type}
7823 @opindex march
7824 @opindex mcpu
7825 Generate code for the specified architecture.  The choices for
7826 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
7827 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
7828 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
7829 @samp{v10}.
7831 @item -mtune=@var{architecture-type}
7832 @opindex mtune
7833 Tune to @var{architecture-type} everything applicable about the generated
7834 code, except for the ABI and the set of available instructions.  The
7835 choices for @var{architecture-type} are the same as for
7836 @option{-march=@var{architecture-type}}.
7838 @item -mmax-stack-frame=@var{n}
7839 @opindex mmax-stack-frame
7840 Warn when the stack frame of a function exceeds @var{n} bytes.
7842 @item -melinux-stacksize=@var{n}
7843 @opindex melinux-stacksize
7844 Only available with the @samp{cris-axis-aout} target.  Arranges for
7845 indications in the program to the kernel loader that the stack of the
7846 program should be set to @var{n} bytes.
7848 @item -metrax4
7849 @itemx -metrax100
7850 @opindex metrax4
7851 @opindex metrax100
7852 The options @option{-metrax4} and @option{-metrax100} are synonyms for
7853 @option{-march=v3} and @option{-march=v8} respectively.
7855 @item -mmul-bug-workaround
7856 @itemx -mno-mul-bug-workaround
7857 @opindex mmul-bug-workaround
7858 @opindex mno-mul-bug-workaround
7859 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
7860 models where it applies.  This option is active by default.
7862 @item -mpdebug
7863 @opindex mpdebug
7864 Enable CRIS-specific verbose debug-related information in the assembly
7865 code.  This option also has the effect to turn off the @samp{#NO_APP}
7866 formatted-code indicator to the assembler at the beginning of the
7867 assembly file.
7869 @item -mcc-init
7870 @opindex mcc-init
7871 Do not use condition-code results from previous instruction; always emit
7872 compare and test instructions before use of condition codes.
7874 @item -mno-side-effects
7875 @opindex mno-side-effects
7876 Do not emit instructions with side-effects in addressing modes other than
7877 post-increment.
7879 @item -mstack-align
7880 @itemx -mno-stack-align
7881 @itemx -mdata-align
7882 @itemx -mno-data-align
7883 @itemx -mconst-align
7884 @itemx -mno-const-align
7885 @opindex mstack-align
7886 @opindex mno-stack-align
7887 @opindex mdata-align
7888 @opindex mno-data-align
7889 @opindex mconst-align
7890 @opindex mno-const-align
7891 These options (no-options) arranges (eliminate arrangements) for the
7892 stack-frame, individual data and constants to be aligned for the maximum
7893 single data access size for the chosen CPU model.  The default is to
7894 arrange for 32-bit alignment.  ABI details such as structure layout are
7895 not affected by these options.
7897 @item -m32-bit
7898 @itemx -m16-bit
7899 @itemx -m8-bit
7900 @opindex m32-bit
7901 @opindex m16-bit
7902 @opindex m8-bit
7903 Similar to the stack- data- and const-align options above, these options
7904 arrange for stack-frame, writable data and constants to all be 32-bit,
7905 16-bit or 8-bit aligned.  The default is 32-bit alignment.
7907 @item -mno-prologue-epilogue
7908 @itemx -mprologue-epilogue
7909 @opindex mno-prologue-epilogue
7910 @opindex mprologue-epilogue
7911 With @option{-mno-prologue-epilogue}, the normal function prologue and
7912 epilogue that sets up the stack-frame are omitted and no return
7913 instructions or return sequences are generated in the code.  Use this
7914 option only together with visual inspection of the compiled code: no
7915 warnings or errors are generated when call-saved registers must be saved,
7916 or storage for local variable needs to be allocated.
7918 @item -mno-gotplt
7919 @itemx -mgotplt
7920 @opindex mno-gotplt
7921 @opindex mgotplt
7922 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
7923 instruction sequences that load addresses for functions from the PLT part
7924 of the GOT rather than (traditional on other architectures) calls to the
7925 PLT@.  The default is @option{-mgotplt}.
7927 @item -maout
7928 @opindex maout
7929 Legacy no-op option only recognized with the cris-axis-aout target.
7931 @item -melf
7932 @opindex melf
7933 Legacy no-op option only recognized with the cris-axis-elf and
7934 cris-axis-linux-gnu targets.
7936 @item -melinux
7937 @opindex melinux
7938 Only recognized with the cris-axis-aout target, where it selects a
7939 GNU/linux-like multilib, include files and instruction set for
7940 @option{-march=v8}.
7942 @item -mlinux
7943 @opindex mlinux
7944 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
7946 @item -sim
7947 @opindex sim
7948 This option, recognized for the cris-axis-aout and cris-axis-elf arranges
7949 to link with input-output functions from a simulator library.  Code,
7950 initialized data and zero-initialized data are allocated consecutively.
7952 @item -sim2
7953 @opindex sim2
7954 Like @option{-sim}, but pass linker options to locate initialized data at
7955 0x40000000 and zero-initialized data at 0x80000000.
7956 @end table
7958 @node CRX Options
7959 @subsection CRX Options
7960 @cindex CRX Options
7962 These options are defined specifically for the CRX ports.
7964 @table @gcctabopt
7966 @item -mmac
7967 @opindex mmac
7968 Enable the use of multiply-accumulate instructions. Disabled by default.
7970 @item -mpush-args
7971 @opindex mpush-args
7972 Push instructions will be used to pass outgoing arguments when functions
7973 are called. Enabled by default.
7974 @end table
7976 @node Darwin Options
7977 @subsection Darwin Options
7978 @cindex Darwin options
7980 These options are defined for all architectures running the Darwin operating
7981 system.
7983 FSF GCC on Darwin does not create ``fat'' object files; it will create
7984 an object file for the single architecture that it was built to
7985 target.  Apple's GCC on Darwin does create ``fat'' files if multiple
7986 @option{-arch} options are used; it does so by running the compiler or
7987 linker multiple times and joining the results together with
7988 @file{lipo}.
7990 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
7991 @samp{i686}) is determined by the flags that specify the ISA
7992 that GCC is targetting, like @option{-mcpu} or @option{-march}.  The
7993 @option{-force_cpusubtype_ALL} option can be used to override this.
7995 The Darwin tools vary in their behavior when presented with an ISA
7996 mismatch.  The assembler, @file{as}, will only permit instructions to
7997 be used that are valid for the subtype of the file it is generating,
7998 so you cannot put 64-bit instructions in an @samp{ppc750} object file.
7999 The linker for shared libraries, @file{/usr/bin/libtool}, will fail
8000 and print an error if asked to create a shared library with a less
8001 restrictive subtype than its input files (for instance, trying to put
8002 a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
8003 for executables, @file{ld}, will quietly give the executable the most
8004 restrictive subtype of any of its input files.
8006 @table @gcctabopt
8007 @item -F@var{dir}
8008 @opindex F
8009 Add the framework directory @var{dir} to the head of the list of
8010 directories to be searched for header files.  These directories are
8011 interleaved with those specified by @option{-I} options and are
8012 scanned in a left-to-right order.
8014 A framework directory is a directory with frameworks in it.  A
8015 framework is a directory with a @samp{"Headers"} and/or
8016 @samp{"PrivateHeaders"} directory contained directly in it that ends
8017 in @samp{".framework"}.  The name of a framework is the name of this
8018 directory excluding the @samp{".framework"}.  Headers associated with
8019 the framework are found in one of those two directories, with
8020 @samp{"Headers"} being searched first.  A subframework is a framework
8021 directory that is in a framework's @samp{"Frameworks"} directory.
8022 Includes of subframework headers can only appear in a header of a
8023 framework that contains the subframework, or in a sibling subframework
8024 header.  Two subframeworks are siblings if they occur in the same
8025 framework.  A subframework should not have the same name as a
8026 framework, a warning will be issued if this is violated.  Currently a
8027 subframework cannot have subframeworks, in the future, the mechanism
8028 may be extended to support this.  The standard frameworks can be found
8029 in @samp{"/System/Library/Frameworks"} and
8030 @samp{"/Library/Frameworks"}.  An example include looks like
8031 @code{#include <Framework/header.h>}, where @samp{Framework} denotes
8032 the name of the framework and header.h is found in the
8033 @samp{"PrivateHeaders"} or @samp{"Headers"} directory.
8035 @item -gused
8036 @opindex -gused
8037 Emit debugging information for symbols that are used.  For STABS
8038 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
8039 This is by default ON@.
8041 @item -gfull
8042 @opindex -gfull
8043 Emit debugging information for all symbols and types.
8045 @item -mmacosx-version-min=@var{version}
8046 The earliest version of MacOS X that this executable will run on
8047 is @var{version}.  Typical values of @var{version} include @code{10.1},
8048 @code{10.2}, and @code{10.3.9}.
8050 The default for this option is to make choices that seem to be most
8051 useful.  
8053 @item -mone-byte-bool
8054 @opindex -mone-byte-bool
8055 Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}.
8056 By default @samp{sizeof(bool)} is @samp{4} when compiling for
8057 Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this
8058 option has no effect on x86.
8060 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
8061 to generate code that is not binary compatible with code generated
8062 without that switch.  Using this switch may require recompiling all
8063 other modules in a program, including system libraries.  Use this
8064 switch to conform to a non-default data model.
8066 @item -mfix-and-continue
8067 @itemx -ffix-and-continue
8068 @itemx -findirect-data
8069 @opindex mfix-and-continue
8070 @opindex ffix-and-continue
8071 @opindex findirect-data
8072 Generate code suitable for fast turn around development.  Needed to
8073 enable gdb to dynamically load @code{.o} files into already running
8074 programs.  @option{-findirect-data} and @option{-ffix-and-continue}
8075 are provided for backwards compatibility.
8077 @item -all_load
8078 @opindex all_load
8079 Loads all members of static archive libraries.
8080 See man ld(1) for more information.
8082 @item -arch_errors_fatal
8083 @opindex arch_errors_fatal
8084 Cause the errors having to do with files that have the wrong architecture
8085 to be fatal.
8087 @item -bind_at_load
8088 @opindex bind_at_load
8089 Causes the output file to be marked such that the dynamic linker will
8090 bind all undefined references when the file is loaded or launched.
8092 @item -bundle
8093 @opindex bundle
8094 Produce a Mach-o bundle format file.
8095 See man ld(1) for more information.
8097 @item -bundle_loader @var{executable}
8098 @opindex bundle_loader
8099 This option specifies the @var{executable} that will be loading the build
8100 output file being linked.  See man ld(1) for more information.
8102 @item -dynamiclib
8103 @opindex -dynamiclib
8104 When passed this option, GCC will produce a dynamic library instead of
8105 an executable when linking, using the Darwin @file{libtool} command.
8107 @item -force_cpusubtype_ALL
8108 @opindex -force_cpusubtype_ALL
8109 This causes GCC's output file to have the @var{ALL} subtype, instead of
8110 one controlled by the @option{-mcpu} or @option{-march} option.
8112 @item -allowable_client  @var{client_name}
8113 @itemx -client_name
8114 @itemx -compatibility_version
8115 @itemx -current_version
8116 @itemx -dead_strip
8117 @itemx -dependency-file
8118 @itemx -dylib_file
8119 @itemx -dylinker_install_name
8120 @itemx -dynamic
8121 @itemx -exported_symbols_list
8122 @itemx -filelist
8123 @itemx -flat_namespace
8124 @itemx -force_flat_namespace
8125 @itemx -headerpad_max_install_names
8126 @itemx -image_base
8127 @itemx -init
8128 @itemx -install_name
8129 @itemx -keep_private_externs
8130 @itemx -multi_module
8131 @itemx -multiply_defined
8132 @itemx -multiply_defined_unused
8133 @itemx -noall_load
8134 @itemx -no_dead_strip_inits_and_terms
8135 @itemx -nofixprebinding
8136 @itemx -nomultidefs
8137 @itemx -noprebind
8138 @itemx -noseglinkedit
8139 @itemx -pagezero_size
8140 @itemx -prebind
8141 @itemx -prebind_all_twolevel_modules
8142 @itemx -private_bundle
8143 @itemx -read_only_relocs
8144 @itemx -sectalign
8145 @itemx -sectobjectsymbols
8146 @itemx -whyload
8147 @itemx -seg1addr
8148 @itemx -sectcreate
8149 @itemx -sectobjectsymbols
8150 @itemx -sectorder
8151 @itemx -segaddr
8152 @itemx -segs_read_only_addr
8153 @itemx -segs_read_write_addr
8154 @itemx -seg_addr_table
8155 @itemx -seg_addr_table_filename
8156 @itemx -seglinkedit
8157 @itemx -segprot
8158 @itemx -segs_read_only_addr
8159 @itemx -segs_read_write_addr
8160 @itemx -single_module
8161 @itemx -static
8162 @itemx -sub_library
8163 @itemx -sub_umbrella
8164 @itemx -twolevel_namespace
8165 @itemx -umbrella
8166 @itemx -undefined
8167 @itemx -unexported_symbols_list
8168 @itemx -weak_reference_mismatches
8169 @itemx -whatsloaded
8171 @opindex allowable_client
8172 @opindex client_name
8173 @opindex compatibility_version
8174 @opindex current_version
8175 @opindex dead_strip
8176 @opindex dependency-file
8177 @opindex dylib_file
8178 @opindex dylinker_install_name
8179 @opindex dynamic
8180 @opindex exported_symbols_list
8181 @opindex filelist
8182 @opindex flat_namespace
8183 @opindex force_flat_namespace
8184 @opindex headerpad_max_install_names
8185 @opindex image_base
8186 @opindex init
8187 @opindex install_name
8188 @opindex keep_private_externs
8189 @opindex multi_module
8190 @opindex multiply_defined
8191 @opindex multiply_defined_unused
8192 @opindex noall_load
8193 @opindex no_dead_strip_inits_and_terms
8194 @opindex nofixprebinding
8195 @opindex nomultidefs
8196 @opindex noprebind
8197 @opindex noseglinkedit
8198 @opindex pagezero_size
8199 @opindex prebind
8200 @opindex prebind_all_twolevel_modules
8201 @opindex private_bundle
8202 @opindex read_only_relocs
8203 @opindex sectalign
8204 @opindex sectobjectsymbols
8205 @opindex whyload
8206 @opindex seg1addr
8207 @opindex sectcreate
8208 @opindex sectobjectsymbols
8209 @opindex sectorder
8210 @opindex segaddr
8211 @opindex segs_read_only_addr
8212 @opindex segs_read_write_addr
8213 @opindex seg_addr_table
8214 @opindex seg_addr_table_filename
8215 @opindex seglinkedit
8216 @opindex segprot
8217 @opindex segs_read_only_addr
8218 @opindex segs_read_write_addr
8219 @opindex single_module
8220 @opindex static
8221 @opindex sub_library
8222 @opindex sub_umbrella
8223 @opindex twolevel_namespace
8224 @opindex umbrella
8225 @opindex undefined
8226 @opindex unexported_symbols_list
8227 @opindex weak_reference_mismatches
8228 @opindex whatsloaded
8230 These options are passed to the Darwin linker.  The Darwin linker man page
8231 describes them in detail.
8232 @end table
8234 @node DEC Alpha Options
8235 @subsection DEC Alpha Options
8237 These @samp{-m} options are defined for the DEC Alpha implementations:
8239 @table @gcctabopt
8240 @item -mno-soft-float
8241 @itemx -msoft-float
8242 @opindex mno-soft-float
8243 @opindex msoft-float
8244 Use (do not use) the hardware floating-point instructions for
8245 floating-point operations.  When @option{-msoft-float} is specified,
8246 functions in @file{libgcc.a} will be used to perform floating-point
8247 operations.  Unless they are replaced by routines that emulate the
8248 floating-point operations, or compiled in such a way as to call such
8249 emulations routines, these routines will issue floating-point
8250 operations.   If you are compiling for an Alpha without floating-point
8251 operations, you must ensure that the library is built so as not to call
8252 them.
8254 Note that Alpha implementations without floating-point operations are
8255 required to have floating-point registers.
8257 @item -mfp-reg
8258 @itemx -mno-fp-regs
8259 @opindex mfp-reg
8260 @opindex mno-fp-regs
8261 Generate code that uses (does not use) the floating-point register set.
8262 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
8263 register set is not used, floating point operands are passed in integer
8264 registers as if they were integers and floating-point results are passed
8265 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
8266 so any function with a floating-point argument or return value called by code
8267 compiled with @option{-mno-fp-regs} must also be compiled with that
8268 option.
8270 A typical use of this option is building a kernel that does not use,
8271 and hence need not save and restore, any floating-point registers.
8273 @item -mieee
8274 @opindex mieee
8275 The Alpha architecture implements floating-point hardware optimized for
8276 maximum performance.  It is mostly compliant with the IEEE floating
8277 point standard.  However, for full compliance, software assistance is
8278 required.  This option generates code fully IEEE compliant code
8279 @emph{except} that the @var{inexact-flag} is not maintained (see below).
8280 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
8281 defined during compilation.  The resulting code is less efficient but is
8282 able to correctly support denormalized numbers and exceptional IEEE
8283 values such as not-a-number and plus/minus infinity.  Other Alpha
8284 compilers call this option @option{-ieee_with_no_inexact}.
8286 @item -mieee-with-inexact
8287 @opindex mieee-with-inexact
8288 This is like @option{-mieee} except the generated code also maintains
8289 the IEEE @var{inexact-flag}.  Turning on this option causes the
8290 generated code to implement fully-compliant IEEE math.  In addition to
8291 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
8292 macro.  On some Alpha implementations the resulting code may execute
8293 significantly slower than the code generated by default.  Since there is
8294 very little code that depends on the @var{inexact-flag}, you should
8295 normally not specify this option.  Other Alpha compilers call this
8296 option @option{-ieee_with_inexact}.
8298 @item -mfp-trap-mode=@var{trap-mode}
8299 @opindex mfp-trap-mode
8300 This option controls what floating-point related traps are enabled.
8301 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
8302 The trap mode can be set to one of four values:
8304 @table @samp
8305 @item n
8306 This is the default (normal) setting.  The only traps that are enabled
8307 are the ones that cannot be disabled in software (e.g., division by zero
8308 trap).
8310 @item u
8311 In addition to the traps enabled by @samp{n}, underflow traps are enabled
8312 as well.
8314 @item su
8315 Like @samp{su}, but the instructions are marked to be safe for software
8316 completion (see Alpha architecture manual for details).
8318 @item sui
8319 Like @samp{su}, but inexact traps are enabled as well.
8320 @end table
8322 @item -mfp-rounding-mode=@var{rounding-mode}
8323 @opindex mfp-rounding-mode
8324 Selects the IEEE rounding mode.  Other Alpha compilers call this option
8325 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
8328 @table @samp
8329 @item n
8330 Normal IEEE rounding mode.  Floating point numbers are rounded towards
8331 the nearest machine number or towards the even machine number in case
8332 of a tie.
8334 @item m
8335 Round towards minus infinity.
8337 @item c
8338 Chopped rounding mode.  Floating point numbers are rounded towards zero.
8340 @item d
8341 Dynamic rounding mode.  A field in the floating point control register
8342 (@var{fpcr}, see Alpha architecture reference manual) controls the
8343 rounding mode in effect.  The C library initializes this register for
8344 rounding towards plus infinity.  Thus, unless your program modifies the
8345 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
8346 @end table
8348 @item -mtrap-precision=@var{trap-precision}
8349 @opindex mtrap-precision
8350 In the Alpha architecture, floating point traps are imprecise.  This
8351 means without software assistance it is impossible to recover from a
8352 floating trap and program execution normally needs to be terminated.
8353 GCC can generate code that can assist operating system trap handlers
8354 in determining the exact location that caused a floating point trap.
8355 Depending on the requirements of an application, different levels of
8356 precisions can be selected:
8358 @table @samp
8359 @item p
8360 Program precision.  This option is the default and means a trap handler
8361 can only identify which program caused a floating point exception.
8363 @item f
8364 Function precision.  The trap handler can determine the function that
8365 caused a floating point exception.
8367 @item i
8368 Instruction precision.  The trap handler can determine the exact
8369 instruction that caused a floating point exception.
8370 @end table
8372 Other Alpha compilers provide the equivalent options called
8373 @option{-scope_safe} and @option{-resumption_safe}.
8375 @item -mieee-conformant
8376 @opindex mieee-conformant
8377 This option marks the generated code as IEEE conformant.  You must not
8378 use this option unless you also specify @option{-mtrap-precision=i} and either
8379 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
8380 is to emit the line @samp{.eflag 48} in the function prologue of the
8381 generated assembly file.  Under DEC Unix, this has the effect that
8382 IEEE-conformant math library routines will be linked in.
8384 @item -mbuild-constants
8385 @opindex mbuild-constants
8386 Normally GCC examines a 32- or 64-bit integer constant to
8387 see if it can construct it from smaller constants in two or three
8388 instructions.  If it cannot, it will output the constant as a literal and
8389 generate code to load it from the data segment at runtime.
8391 Use this option to require GCC to construct @emph{all} integer constants
8392 using code, even if it takes more instructions (the maximum is six).
8394 You would typically use this option to build a shared library dynamic
8395 loader.  Itself a shared library, it must relocate itself in memory
8396 before it can find the variables and constants in its own data segment.
8398 @item -malpha-as
8399 @itemx -mgas
8400 @opindex malpha-as
8401 @opindex mgas
8402 Select whether to generate code to be assembled by the vendor-supplied
8403 assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
8405 @item -mbwx
8406 @itemx -mno-bwx
8407 @itemx -mcix
8408 @itemx -mno-cix
8409 @itemx -mfix
8410 @itemx -mno-fix
8411 @itemx -mmax
8412 @itemx -mno-max
8413 @opindex mbwx
8414 @opindex mno-bwx
8415 @opindex mcix
8416 @opindex mno-cix
8417 @opindex mfix
8418 @opindex mno-fix
8419 @opindex mmax
8420 @opindex mno-max
8421 Indicate whether GCC should generate code to use the optional BWX,
8422 CIX, FIX and MAX instruction sets.  The default is to use the instruction
8423 sets supported by the CPU type specified via @option{-mcpu=} option or that
8424 of the CPU on which GCC was built if none was specified.
8426 @item -mfloat-vax
8427 @itemx -mfloat-ieee
8428 @opindex mfloat-vax
8429 @opindex mfloat-ieee
8430 Generate code that uses (does not use) VAX F and G floating point
8431 arithmetic instead of IEEE single and double precision.
8433 @item -mexplicit-relocs
8434 @itemx -mno-explicit-relocs
8435 @opindex mexplicit-relocs
8436 @opindex mno-explicit-relocs
8437 Older Alpha assemblers provided no way to generate symbol relocations
8438 except via assembler macros.  Use of these macros does not allow
8439 optimal instruction scheduling.  GNU binutils as of version 2.12
8440 supports a new syntax that allows the compiler to explicitly mark
8441 which relocations should apply to which instructions.  This option
8442 is mostly useful for debugging, as GCC detects the capabilities of
8443 the assembler when it is built and sets the default accordingly.
8445 @item -msmall-data
8446 @itemx -mlarge-data
8447 @opindex msmall-data
8448 @opindex mlarge-data
8449 When @option{-mexplicit-relocs} is in effect, static data is
8450 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
8451 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
8452 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
8453 16-bit relocations off of the @code{$gp} register.  This limits the
8454 size of the small data area to 64KB, but allows the variables to be
8455 directly accessed via a single instruction.
8457 The default is @option{-mlarge-data}.  With this option the data area
8458 is limited to just below 2GB@.  Programs that require more than 2GB of
8459 data must use @code{malloc} or @code{mmap} to allocate the data in the
8460 heap instead of in the program's data segment.
8462 When generating code for shared libraries, @option{-fpic} implies
8463 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
8465 @item -msmall-text
8466 @itemx -mlarge-text
8467 @opindex msmall-text
8468 @opindex mlarge-text
8469 When @option{-msmall-text} is used, the compiler assumes that the
8470 code of the entire program (or shared library) fits in 4MB, and is
8471 thus reachable with a branch instruction.  When @option{-msmall-data}
8472 is used, the compiler can assume that all local symbols share the
8473 same @code{$gp} value, and thus reduce the number of instructions
8474 required for a function call from 4 to 1.
8476 The default is @option{-mlarge-text}.
8478 @item -mcpu=@var{cpu_type}
8479 @opindex mcpu
8480 Set the instruction set and instruction scheduling parameters for
8481 machine type @var{cpu_type}.  You can specify either the @samp{EV}
8482 style name or the corresponding chip number.  GCC supports scheduling
8483 parameters for the EV4, EV5 and EV6 family of processors and will
8484 choose the default values for the instruction set from the processor
8485 you specify.  If you do not specify a processor type, GCC will default
8486 to the processor on which the compiler was built.
8488 Supported values for @var{cpu_type} are
8490 @table @samp
8491 @item ev4
8492 @itemx ev45
8493 @itemx 21064
8494 Schedules as an EV4 and has no instruction set extensions.
8496 @item ev5
8497 @itemx 21164
8498 Schedules as an EV5 and has no instruction set extensions.
8500 @item ev56
8501 @itemx 21164a
8502 Schedules as an EV5 and supports the BWX extension.
8504 @item pca56
8505 @itemx 21164pc
8506 @itemx 21164PC
8507 Schedules as an EV5 and supports the BWX and MAX extensions.
8509 @item ev6
8510 @itemx 21264
8511 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
8513 @item ev67
8514 @itemx 21264a
8515 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
8516 @end table
8518 @item -mtune=@var{cpu_type}
8519 @opindex mtune
8520 Set only the instruction scheduling parameters for machine type
8521 @var{cpu_type}.  The instruction set is not changed.
8523 @item -mmemory-latency=@var{time}
8524 @opindex mmemory-latency
8525 Sets the latency the scheduler should assume for typical memory
8526 references as seen by the application.  This number is highly
8527 dependent on the memory access patterns used by the application
8528 and the size of the external cache on the machine.
8530 Valid options for @var{time} are
8532 @table @samp
8533 @item @var{number}
8534 A decimal number representing clock cycles.
8536 @item L1
8537 @itemx L2
8538 @itemx L3
8539 @itemx main
8540 The compiler contains estimates of the number of clock cycles for
8541 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
8542 (also called Dcache, Scache, and Bcache), as well as to main memory.
8543 Note that L3 is only valid for EV5.
8545 @end table
8546 @end table
8548 @node DEC Alpha/VMS Options
8549 @subsection DEC Alpha/VMS Options
8551 These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
8553 @table @gcctabopt
8554 @item -mvms-return-codes
8555 @opindex mvms-return-codes
8556 Return VMS condition codes from main.  The default is to return POSIX
8557 style condition (e.g.@ error) codes.
8558 @end table
8560 @node FRV Options
8561 @subsection FRV Options
8562 @cindex FRV Options
8564 @table @gcctabopt
8565 @item -mgpr-32
8566 @opindex mgpr-32
8568 Only use the first 32 general purpose registers.
8570 @item -mgpr-64
8571 @opindex mgpr-64
8573 Use all 64 general purpose registers.
8575 @item -mfpr-32
8576 @opindex mfpr-32
8578 Use only the first 32 floating point registers.
8580 @item -mfpr-64
8581 @opindex mfpr-64
8583 Use all 64 floating point registers
8585 @item -mhard-float
8586 @opindex mhard-float
8588 Use hardware instructions for floating point operations.
8590 @item -msoft-float
8591 @opindex msoft-float
8593 Use library routines for floating point operations.
8595 @item -malloc-cc
8596 @opindex malloc-cc
8598 Dynamically allocate condition code registers.
8600 @item -mfixed-cc
8601 @opindex mfixed-cc
8603 Do not try to dynamically allocate condition code registers, only
8604 use @code{icc0} and @code{fcc0}.
8606 @item -mdword
8607 @opindex mdword
8609 Change ABI to use double word insns.
8611 @item -mno-dword
8612 @opindex mno-dword
8614 Do not use double word instructions.
8616 @item -mdouble
8617 @opindex mdouble
8619 Use floating point double instructions.
8621 @item -mno-double
8622 @opindex mno-double
8624 Do not use floating point double instructions.
8626 @item -mmedia
8627 @opindex mmedia
8629 Use media instructions.
8631 @item -mno-media
8632 @opindex mno-media
8634 Do not use media instructions.
8636 @item -mmuladd
8637 @opindex mmuladd
8639 Use multiply and add/subtract instructions.
8641 @item -mno-muladd
8642 @opindex mno-muladd
8644 Do not use multiply and add/subtract instructions.
8646 @item -mfdpic
8647 @opindex mfdpic
8649 Select the FDPIC ABI, that uses function descriptors to represent
8650 pointers to functions.  Without any PIC/PIE-related options, it
8651 implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
8652 assumes GOT entries and small data are within a 12-bit range from the
8653 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
8654 are computed with 32 bits.
8656 @item -minline-plt
8657 @opindex minline-plt
8659 Enable inlining of PLT entries in function calls to functions that are
8660 not known to bind locally.  It has no effect without @option{-mfdpic}.
8661 It's enabled by default if optimizing for speed and compiling for
8662 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
8663 optimization option such as @option{-O3} or above is present in the
8664 command line.
8666 @item -mTLS
8667 @opindex TLS
8669 Assume a large TLS segment when generating thread-local code.
8671 @item -mtls
8672 @opindex tls
8674 Do not assume a large TLS segment when generating thread-local code.
8676 @item -mgprel-ro
8677 @opindex mgprel-ro
8679 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
8680 that is known to be in read-only sections.  It's enabled by default,
8681 except for @option{-fpic} or @option{-fpie}: even though it may help
8682 make the global offset table smaller, it trades 1 instruction for 4.
8683 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
8684 one of which may be shared by multiple symbols, and it avoids the need
8685 for a GOT entry for the referenced symbol, so it's more likely to be a
8686 win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
8688 @item -multilib-library-pic
8689 @opindex multilib-library-pic
8691 Link with the (library, not FD) pic libraries.  It's implied by
8692 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
8693 @option{-fpic} without @option{-mfdpic}.  You should never have to use
8694 it explicitly.
8696 @item -mlinked-fp
8697 @opindex mlinked-fp
8699 Follow the EABI requirement of always creating a frame pointer whenever
8700 a stack frame is allocated.  This option is enabled by default and can
8701 be disabled with @option{-mno-linked-fp}.
8703 @item -mlong-calls
8704 @opindex mlong-calls
8706 Use indirect addressing to call functions outside the current
8707 compilation unit.  This allows the functions to be placed anywhere
8708 within the 32-bit address space.
8710 @item -malign-labels
8711 @opindex malign-labels
8713 Try to align labels to an 8-byte boundary by inserting nops into the
8714 previous packet.  This option only has an effect when VLIW packing
8715 is enabled.  It doesn't create new packets; it merely adds nops to
8716 existing ones.
8718 @item -mlibrary-pic
8719 @opindex mlibrary-pic
8721 Generate position-independent EABI code.
8723 @item -macc-4
8724 @opindex macc-4
8726 Use only the first four media accumulator registers.
8728 @item -macc-8
8729 @opindex macc-8
8731 Use all eight media accumulator registers.
8733 @item -mpack
8734 @opindex mpack
8736 Pack VLIW instructions.
8738 @item -mno-pack
8739 @opindex mno-pack
8741 Do not pack VLIW instructions.
8743 @item -mno-eflags
8744 @opindex mno-eflags
8746 Do not mark ABI switches in e_flags.
8748 @item -mcond-move
8749 @opindex mcond-move
8751 Enable the use of conditional-move instructions (default).
8753 This switch is mainly for debugging the compiler and will likely be removed
8754 in a future version.
8756 @item -mno-cond-move
8757 @opindex mno-cond-move
8759 Disable the use of conditional-move instructions.
8761 This switch is mainly for debugging the compiler and will likely be removed
8762 in a future version.
8764 @item -mscc
8765 @opindex mscc
8767 Enable the use of conditional set instructions (default).
8769 This switch is mainly for debugging the compiler and will likely be removed
8770 in a future version.
8772 @item -mno-scc
8773 @opindex mno-scc
8775 Disable the use of conditional set instructions.
8777 This switch is mainly for debugging the compiler and will likely be removed
8778 in a future version.
8780 @item -mcond-exec
8781 @opindex mcond-exec
8783 Enable the use of conditional execution (default).
8785 This switch is mainly for debugging the compiler and will likely be removed
8786 in a future version.
8788 @item -mno-cond-exec
8789 @opindex mno-cond-exec
8791 Disable the use of conditional execution.
8793 This switch is mainly for debugging the compiler and will likely be removed
8794 in a future version.
8796 @item -mvliw-branch
8797 @opindex mvliw-branch
8799 Run a pass to pack branches into VLIW instructions (default).
8801 This switch is mainly for debugging the compiler and will likely be removed
8802 in a future version.
8804 @item -mno-vliw-branch
8805 @opindex mno-vliw-branch
8807 Do not run a pass to pack branches into VLIW instructions.
8809 This switch is mainly for debugging the compiler and will likely be removed
8810 in a future version.
8812 @item -mmulti-cond-exec
8813 @opindex mmulti-cond-exec
8815 Enable optimization of @code{&&} and @code{||} in conditional execution
8816 (default).
8818 This switch is mainly for debugging the compiler and will likely be removed
8819 in a future version.
8821 @item -mno-multi-cond-exec
8822 @opindex mno-multi-cond-exec
8824 Disable optimization of @code{&&} and @code{||} in conditional execution.
8826 This switch is mainly for debugging the compiler and will likely be removed
8827 in a future version.
8829 @item -mnested-cond-exec
8830 @opindex mnested-cond-exec
8832 Enable nested conditional execution optimizations (default).
8834 This switch is mainly for debugging the compiler and will likely be removed
8835 in a future version.
8837 @item -mno-nested-cond-exec
8838 @opindex mno-nested-cond-exec
8840 Disable nested conditional execution optimizations.
8842 This switch is mainly for debugging the compiler and will likely be removed
8843 in a future version.
8845 @item -moptimize-membar
8846 @opindex moptimize-membar
8848 This switch removes redundant @code{membar} instructions from the
8849 compiler generated code.  It is enabled by default.
8851 @item -mno-optimize-membar
8852 @opindex mno-optimize-membar
8854 This switch disables the automatic removal of redundant @code{membar}
8855 instructions from the generated code.
8857 @item -mtomcat-stats
8858 @opindex mtomcat-stats
8860 Cause gas to print out tomcat statistics.
8862 @item -mcpu=@var{cpu}
8863 @opindex mcpu
8865 Select the processor type for which to generate code.  Possible values are
8866 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
8867 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
8869 @end table
8871 @node GNU/Linux Options
8872 @subsection GNU/Linux Options
8874 These @samp{-m} options are defined for GNU/Linux targets:
8876 @table @gcctabopt
8877 @item -mglibc
8878 @opindex mglibc
8879 Use the GNU C library instead of uClibc.  This is the default except
8880 on @samp{*-*-linux-*uclibc*} targets.
8882 @item -muclibc
8883 @opindex muclibc
8884 Use uClibc instead of the GNU C library.  This is the default on
8885 @samp{*-*-linux-*uclibc*} targets.
8886 @end table
8888 @node H8/300 Options
8889 @subsection H8/300 Options
8891 These @samp{-m} options are defined for the H8/300 implementations:
8893 @table @gcctabopt
8894 @item -mrelax
8895 @opindex mrelax
8896 Shorten some address references at link time, when possible; uses the
8897 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
8898 ld, Using ld}, for a fuller description.
8900 @item -mh
8901 @opindex mh
8902 Generate code for the H8/300H@.
8904 @item -ms
8905 @opindex ms
8906 Generate code for the H8S@.
8908 @item -mn
8909 @opindex mn
8910 Generate code for the H8S and H8/300H in the normal mode.  This switch
8911 must be used either with @option{-mh} or @option{-ms}.
8913 @item -ms2600
8914 @opindex ms2600
8915 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
8917 @item -mint32
8918 @opindex mint32
8919 Make @code{int} data 32 bits by default.
8921 @item -malign-300
8922 @opindex malign-300
8923 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
8924 The default for the H8/300H and H8S is to align longs and floats on 4
8925 byte boundaries.
8926 @option{-malign-300} causes them to be aligned on 2 byte boundaries.
8927 This option has no effect on the H8/300.
8928 @end table
8930 @node HPPA Options
8931 @subsection HPPA Options
8932 @cindex HPPA Options
8934 These @samp{-m} options are defined for the HPPA family of computers:
8936 @table @gcctabopt
8937 @item -march=@var{architecture-type}
8938 @opindex march
8939 Generate code for the specified architecture.  The choices for
8940 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
8941 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
8942 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
8943 architecture option for your machine.  Code compiled for lower numbered
8944 architectures will run on higher numbered architectures, but not the
8945 other way around.
8947 @item -mpa-risc-1-0
8948 @itemx -mpa-risc-1-1
8949 @itemx -mpa-risc-2-0
8950 @opindex mpa-risc-1-0
8951 @opindex mpa-risc-1-1
8952 @opindex mpa-risc-2-0
8953 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
8955 @item -mbig-switch
8956 @opindex mbig-switch
8957 Generate code suitable for big switch tables.  Use this option only if
8958 the assembler/linker complain about out of range branches within a switch
8959 table.
8961 @item -mjump-in-delay
8962 @opindex mjump-in-delay
8963 Fill delay slots of function calls with unconditional jump instructions
8964 by modifying the return pointer for the function call to be the target
8965 of the conditional jump.
8967 @item -mdisable-fpregs
8968 @opindex mdisable-fpregs
8969 Prevent floating point registers from being used in any manner.  This is
8970 necessary for compiling kernels which perform lazy context switching of
8971 floating point registers.  If you use this option and attempt to perform
8972 floating point operations, the compiler will abort.
8974 @item -mdisable-indexing
8975 @opindex mdisable-indexing
8976 Prevent the compiler from using indexing address modes.  This avoids some
8977 rather obscure problems when compiling MIG generated code under MACH@.
8979 @item -mno-space-regs
8980 @opindex mno-space-regs
8981 Generate code that assumes the target has no space registers.  This allows
8982 GCC to generate faster indirect calls and use unscaled index address modes.
8984 Such code is suitable for level 0 PA systems and kernels.
8986 @item -mfast-indirect-calls
8987 @opindex mfast-indirect-calls
8988 Generate code that assumes calls never cross space boundaries.  This
8989 allows GCC to emit code which performs faster indirect calls.
8991 This option will not work in the presence of shared libraries or nested
8992 functions.
8994 @item -mfixed-range=@var{register-range}
8995 @opindex mfixed-range
8996 Generate code treating the given register range as fixed registers.
8997 A fixed register is one that the register allocator can not use.  This is
8998 useful when compiling kernel code.  A register range is specified as
8999 two registers separated by a dash.  Multiple register ranges can be
9000 specified separated by a comma.
9002 @item -mlong-load-store
9003 @opindex mlong-load-store
9004 Generate 3-instruction load and store sequences as sometimes required by
9005 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
9006 the HP compilers.
9008 @item -mportable-runtime
9009 @opindex mportable-runtime
9010 Use the portable calling conventions proposed by HP for ELF systems.
9012 @item -mgas
9013 @opindex mgas
9014 Enable the use of assembler directives only GAS understands.
9016 @item -mschedule=@var{cpu-type}
9017 @opindex mschedule
9018 Schedule code according to the constraints for the machine type
9019 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
9020 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
9021 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
9022 proper scheduling option for your machine.  The default scheduling is
9023 @samp{8000}.
9025 @item -mlinker-opt
9026 @opindex mlinker-opt
9027 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
9028 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
9029 linkers in which they give bogus error messages when linking some programs.
9031 @item -msoft-float
9032 @opindex msoft-float
9033 Generate output containing library calls for floating point.
9034 @strong{Warning:} the requisite libraries are not available for all HPPA
9035 targets.  Normally the facilities of the machine's usual C compiler are
9036 used, but this cannot be done directly in cross-compilation.  You must make
9037 your own arrangements to provide suitable library functions for
9038 cross-compilation.  The embedded target @samp{hppa1.1-*-pro}
9039 does provide software floating point support.
9041 @option{-msoft-float} changes the calling convention in the output file;
9042 therefore, it is only useful if you compile @emph{all} of a program with
9043 this option.  In particular, you need to compile @file{libgcc.a}, the
9044 library that comes with GCC, with @option{-msoft-float} in order for
9045 this to work.
9047 @item -msio
9048 @opindex msio
9049 Generate the predefine, @code{_SIO}, for server IO@.  The default is
9050 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
9051 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
9052 options are available under HP-UX and HI-UX@.
9054 @item -mgnu-ld
9055 @opindex gnu-ld
9056 Use GNU ld specific options.  This passes @option{-shared} to ld when
9057 building a shared library.  It is the default when GCC is configured,
9058 explicitly or implicitly, with the GNU linker.  This option does not
9059 have any affect on which ld is called, it only changes what parameters
9060 are passed to that ld.  The ld that is called is determined by the
9061 @option{--with-ld} configure option, GCC's program search path, and
9062 finally by the user's @env{PATH}.  The linker used by GCC can be printed
9063 using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
9064 on the 64 bit HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}.
9066 @item -mhp-ld
9067 @opindex hp-ld
9068 Use HP ld specific options.  This passes @option{-b} to ld when building
9069 a shared library and passes @option{+Accept TypeMismatch} to ld on all
9070 links.  It is the default when GCC is configured, explicitly or
9071 implicitly, with the HP linker.  This option does not have any affect on
9072 which ld is called, it only changes what parameters are passed to that
9073 ld.  The ld that is called is determined by the @option{--with-ld}
9074 configure option, GCC's program search path, and finally by the user's
9075 @env{PATH}.  The linker used by GCC can be printed using @samp{which
9076 `gcc -print-prog-name=ld`}.  This option is only available on the 64 bit
9077 HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}.
9079 @item -mlong-calls
9080 @opindex mno-long-calls
9081 Generate code that uses long call sequences.  This ensures that a call
9082 is always able to reach linker generated stubs.  The default is to generate
9083 long calls only when the distance from the call site to the beginning
9084 of the function or translation unit, as the case may be, exceeds a
9085 predefined limit set by the branch type being used.  The limits for
9086 normal calls are 7,600,000 and 240,000 bytes, respectively for the
9087 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
9088 240,000 bytes.
9090 Distances are measured from the beginning of functions when using the
9091 @option{-ffunction-sections} option, or when using the @option{-mgas}
9092 and @option{-mno-portable-runtime} options together under HP-UX with
9093 the SOM linker.
9095 It is normally not desirable to use this option as it will degrade
9096 performance.  However, it may be useful in large applications,
9097 particularly when partial linking is used to build the application.
9099 The types of long calls used depends on the capabilities of the
9100 assembler and linker, and the type of code being generated.  The
9101 impact on systems that support long absolute calls, and long pic
9102 symbol-difference or pc-relative calls should be relatively small.
9103 However, an indirect call is used on 32-bit ELF systems in pic code
9104 and it is quite long.
9106 @item -munix=@var{unix-std}
9107 @opindex march
9108 Generate compiler predefines and select a startfile for the specified
9109 UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
9110 and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
9111 is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
9112 11.11 and later.  The default values are @samp{93} for HP-UX 10.00,
9113 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
9114 and later.
9116 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
9117 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
9118 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
9119 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
9120 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
9121 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
9123 It is @emph{important} to note that this option changes the interfaces
9124 for various library routines.  It also affects the operational behavior
9125 of the C library.  Thus, @emph{extreme} care is needed in using this
9126 option.
9128 Library code that is intended to operate with more than one UNIX
9129 standard must test, set and restore the variable @var{__xpg4_extended_mask}
9130 as appropriate.  Most GNU software doesn't provide this capability.
9132 @item -nolibdld
9133 @opindex nolibdld
9134 Suppress the generation of link options to search libdld.sl when the
9135 @option{-static} option is specified on HP-UX 10 and later.
9137 @item -static
9138 @opindex static
9139 The HP-UX implementation of setlocale in libc has a dependency on
9140 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
9141 when the @option{-static} option is specified, special link options
9142 are needed to resolve this dependency.
9144 On HP-UX 10 and later, the GCC driver adds the necessary options to
9145 link with libdld.sl when the @option{-static} option is specified.
9146 This causes the resulting binary to be dynamic.  On the 64-bit port,
9147 the linkers generate dynamic binaries by default in any case.  The
9148 @option{-nolibdld} option can be used to prevent the GCC driver from
9149 adding these link options.
9151 @item -threads
9152 @opindex threads
9153 Add support for multithreading with the @dfn{dce thread} library
9154 under HP-UX@.  This option sets flags for both the preprocessor and
9155 linker.
9156 @end table
9158 @node i386 and x86-64 Options
9159 @subsection Intel 386 and AMD x86-64 Options
9160 @cindex i386 Options
9161 @cindex x86-64 Options
9162 @cindex Intel 386 Options
9163 @cindex AMD x86-64 Options
9165 These @samp{-m} options are defined for the i386 and x86-64 family of
9166 computers:
9168 @table @gcctabopt
9169 @item -mtune=@var{cpu-type}
9170 @opindex mtune
9171 Tune to @var{cpu-type} everything applicable about the generated code, except
9172 for the ABI and the set of available instructions.  The choices for
9173 @var{cpu-type} are:
9174 @table @emph
9175 @item generic
9176 Produce code optimized for the most common IA32/AMD64/EM64T processors.
9177 If you know the CPU on which your code will run, then you should use
9178 the corresponding @option{-mtune} option instead of
9179 @option{-mtune=generic}.  But, if you do not know exactly what CPU users
9180 of your application will have, then you should use this option.
9182 As new processors are deployed in the marketplace, the behavior of this
9183 option will change.  Therefore, if you upgrade to a newer version of
9184 GCC, the code generated option will change to reflect the processors
9185 that were most common when that version of GCC was released.
9187 There is no @option{-march=generic} option because @option{-march}
9188 indicates the instruction set the compiler can use, and there is no
9189 generic instruction set applicable to all processors.  In contrast,
9190 @option{-mtune} indicates the processor (or, in this case, collection of
9191 processors) for which the code is optimized.
9192 @item native
9193 This selects the CPU to tune for at compilation time by determining
9194 the processor type of the compiling machine.  Using @option{-mtune=native}
9195 will produce code optimized for the local machine under the constraints
9196 of the selected instruction set.  Using @option{-march=native} will
9197 enable all instruction subsets supported by the local machine (hence
9198 the result might not run on different machines).
9199 @item i386
9200 Original Intel's i386 CPU@.
9201 @item i486
9202 Intel's i486 CPU@.  (No scheduling is implemented for this chip.)
9203 @item i586, pentium
9204 Intel Pentium CPU with no MMX support.
9205 @item pentium-mmx
9206 Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
9207 @item pentiumpro
9208 Intel PentiumPro CPU@.
9209 @item i686
9210 Same as @code{generic}, but when used as @code{march} option, PentiumPro
9211 instruction set will be used, so the code will run on all i686 family chips.
9212 @item pentium2
9213 Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
9214 @item pentium3, pentium3m
9215 Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
9216 support.
9217 @item pentium-m
9218 Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set
9219 support.  Used by Centrino notebooks.
9220 @item pentium4, pentium4m
9221 Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
9222 @item prescott
9223 Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction
9224 set support.
9225 @item nocona
9226 Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE,
9227 SSE2 and SSE3 instruction set support.
9228 @item k6
9229 AMD K6 CPU with MMX instruction set support.
9230 @item k6-2, k6-3
9231 Improved versions of AMD K6 CPU with MMX and 3dNOW! instruction set support.
9232 @item athlon, athlon-tbird
9233 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE prefetch instructions
9234 support.
9235 @item athlon-4, athlon-xp, athlon-mp
9236 Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and full SSE
9237 instruction set support.
9238 @item k8, opteron, athlon64, athlon-fx
9239 AMD K8 core based CPUs with x86-64 instruction set support.  (This supersets
9240 MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.)
9241 @item winchip-c6
9242 IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
9243 set support.
9244 @item winchip2
9245 IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW!
9246 instruction set support.
9247 @item c3
9248 Via C3 CPU with MMX and 3dNOW! instruction set support.  (No scheduling is
9249 implemented for this chip.)
9250 @item c3-2
9251 Via C3-2 CPU with MMX and SSE instruction set support.  (No scheduling is
9252 implemented for this chip.)
9253 @end table
9255 While picking a specific @var{cpu-type} will schedule things appropriately
9256 for that particular chip, the compiler will not generate any code that
9257 does not run on the i386 without the @option{-march=@var{cpu-type}} option
9258 being used.
9260 @item -march=@var{cpu-type}
9261 @opindex march
9262 Generate instructions for the machine type @var{cpu-type}.  The choices
9263 for @var{cpu-type} are the same as for @option{-mtune}.  Moreover,
9264 specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
9266 @item -mcpu=@var{cpu-type}
9267 @opindex mcpu
9268 A deprecated synonym for @option{-mtune}.
9270 @item -m386
9271 @itemx -m486
9272 @itemx -mpentium
9273 @itemx -mpentiumpro
9274 @opindex m386
9275 @opindex m486
9276 @opindex mpentium
9277 @opindex mpentiumpro
9278 These options are synonyms for @option{-mtune=i386}, @option{-mtune=i486},
9279 @option{-mtune=pentium}, and @option{-mtune=pentiumpro} respectively.
9280 These synonyms are deprecated.
9282 @item -mfpmath=@var{unit}
9283 @opindex march
9284 Generate floating point arithmetics for selected unit @var{unit}.  The choices
9285 for @var{unit} are:
9287 @table @samp
9288 @item 387
9289 Use the standard 387 floating point coprocessor present majority of chips and
9290 emulated otherwise.  Code compiled with this option will run almost everywhere.
9291 The temporary results are computed in 80bit precision instead of precision
9292 specified by the type resulting in slightly different results compared to most
9293 of other chips.  See @option{-ffloat-store} for more detailed description.
9295 This is the default choice for i386 compiler.
9297 @item sse
9298 Use scalar floating point instructions present in the SSE instruction set.
9299 This instruction set is supported by Pentium3 and newer chips, in the AMD line
9300 by Athlon-4, Athlon-xp and Athlon-mp chips.  The earlier version of SSE
9301 instruction set supports only single precision arithmetics, thus the double and
9302 extended precision arithmetics is still done using 387.  Later version, present
9303 only in Pentium4 and the future AMD x86-64 chips supports double precision
9304 arithmetics too.
9306 For the i386 compiler, you need to use @option{-march=@var{cpu-type}}, @option{-msse}
9307 or @option{-msse2} switches to enable SSE extensions and make this option
9308 effective.  For the x86-64 compiler, these extensions are enabled by default.
9310 The resulting code should be considerably faster in the majority of cases and avoid
9311 the numerical instability problems of 387 code, but may break some existing
9312 code that expects temporaries to be 80bit.
9314 This is the default choice for the x86-64 compiler.
9316 @item sse,387
9317 Attempt to utilize both instruction sets at once.  This effectively double the
9318 amount of available registers and on chips with separate execution units for
9319 387 and SSE the execution resources too.  Use this option with care, as it is
9320 still experimental, because the GCC register allocator does not model separate
9321 functional units well resulting in instable performance.
9322 @end table
9324 @item -masm=@var{dialect}
9325 @opindex masm=@var{dialect}
9326 Output asm instructions using selected @var{dialect}.  Supported
9327 choices are @samp{intel} or @samp{att} (the default one).  Darwin does
9328 not support @samp{intel}.
9330 @item -mieee-fp
9331 @itemx -mno-ieee-fp
9332 @opindex mieee-fp
9333 @opindex mno-ieee-fp
9334 Control whether or not the compiler uses IEEE floating point
9335 comparisons.  These handle correctly the case where the result of a
9336 comparison is unordered.
9338 @item -msoft-float
9339 @opindex msoft-float
9340 Generate output containing library calls for floating point.
9341 @strong{Warning:} the requisite libraries are not part of GCC@.
9342 Normally the facilities of the machine's usual C compiler are used, but
9343 this can't be done directly in cross-compilation.  You must make your
9344 own arrangements to provide suitable library functions for
9345 cross-compilation.
9347 On machines where a function returns floating point results in the 80387
9348 register stack, some floating point opcodes may be emitted even if
9349 @option{-msoft-float} is used.
9351 @item -mno-fp-ret-in-387
9352 @opindex mno-fp-ret-in-387
9353 Do not use the FPU registers for return values of functions.
9355 The usual calling convention has functions return values of types
9356 @code{float} and @code{double} in an FPU register, even if there
9357 is no FPU@.  The idea is that the operating system should emulate
9358 an FPU@.
9360 The option @option{-mno-fp-ret-in-387} causes such values to be returned
9361 in ordinary CPU registers instead.
9363 @item -mno-fancy-math-387
9364 @opindex mno-fancy-math-387
9365 Some 387 emulators do not support the @code{sin}, @code{cos} and
9366 @code{sqrt} instructions for the 387.  Specify this option to avoid
9367 generating those instructions.  This option is the default on FreeBSD,
9368 OpenBSD and NetBSD@.  This option is overridden when @option{-march}
9369 indicates that the target cpu will always have an FPU and so the
9370 instruction will not need emulation.  As of revision 2.6.1, these
9371 instructions are not generated unless you also use the
9372 @option{-funsafe-math-optimizations} switch.
9374 @item -malign-double
9375 @itemx -mno-align-double
9376 @opindex malign-double
9377 @opindex mno-align-double
9378 Control whether GCC aligns @code{double}, @code{long double}, and
9379 @code{long long} variables on a two word boundary or a one word
9380 boundary.  Aligning @code{double} variables on a two word boundary will
9381 produce code that runs somewhat faster on a @samp{Pentium} at the
9382 expense of more memory.
9384 @strong{Warning:} if you use the @option{-malign-double} switch,
9385 structures containing the above types will be aligned differently than
9386 the published application binary interface specifications for the 386
9387 and will not be binary compatible with structures in code compiled
9388 without that switch.
9390 @item -m96bit-long-double
9391 @itemx -m128bit-long-double
9392 @opindex m96bit-long-double
9393 @opindex m128bit-long-double
9394 These switches control the size of @code{long double} type.  The i386
9395 application binary interface specifies the size to be 96 bits,
9396 so @option{-m96bit-long-double} is the default in 32 bit mode.
9398 Modern architectures (Pentium and newer) would prefer @code{long double}
9399 to be aligned to an 8 or 16 byte boundary.  In arrays or structures
9400 conforming to the ABI, this would not be possible.  So specifying a
9401 @option{-m128bit-long-double} will align @code{long double}
9402 to a 16 byte boundary by padding the @code{long double} with an additional
9403 32 bit zero.
9405 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
9406 its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
9408 Notice that neither of these options enable any extra precision over the x87
9409 standard of 80 bits for a @code{long double}.
9411 @strong{Warning:} if you override the default value for your target ABI, the
9412 structures and arrays containing @code{long double} variables will change
9413 their size as well as function calling convention for function taking
9414 @code{long double} will be modified.  Hence they will not be binary
9415 compatible with arrays or structures in code compiled without that switch.
9417 @item -mmlarge-data-threshold=@var{number}
9418 @opindex mlarge-data-threshold=@var{number}
9419 When @option{-mcmodel=medium} is specified, the data greater than
9420 @var{threshold} are placed in large data section.  This value must be the
9421 same across all object linked into the binary and defaults to 65535.
9423 @item -msvr3-shlib
9424 @itemx -mno-svr3-shlib
9425 @opindex msvr3-shlib
9426 @opindex mno-svr3-shlib
9427 Control whether GCC places uninitialized local variables into the
9428 @code{bss} or @code{data} segments.  @option{-msvr3-shlib} places them
9429 into @code{bss}.  These options are meaningful only on System V Release 3.
9431 @item -mrtd
9432 @opindex mrtd
9433 Use a different function-calling convention, in which functions that
9434 take a fixed number of arguments return with the @code{ret} @var{num}
9435 instruction, which pops their arguments while returning.  This saves one
9436 instruction in the caller since there is no need to pop the arguments
9437 there.
9439 You can specify that an individual function is called with this calling
9440 sequence with the function attribute @samp{stdcall}.  You can also
9441 override the @option{-mrtd} option by using the function attribute
9442 @samp{cdecl}.  @xref{Function Attributes}.
9444 @strong{Warning:} this calling convention is incompatible with the one
9445 normally used on Unix, so you cannot use it if you need to call
9446 libraries compiled with the Unix compiler.
9448 Also, you must provide function prototypes for all functions that
9449 take variable numbers of arguments (including @code{printf});
9450 otherwise incorrect code will be generated for calls to those
9451 functions.
9453 In addition, seriously incorrect code will result if you call a
9454 function with too many arguments.  (Normally, extra arguments are
9455 harmlessly ignored.)
9457 @item -mregparm=@var{num}
9458 @opindex mregparm
9459 Control how many registers are used to pass integer arguments.  By
9460 default, no registers are used to pass arguments, and at most 3
9461 registers can be used.  You can control this behavior for a specific
9462 function by using the function attribute @samp{regparm}.
9463 @xref{Function Attributes}.
9465 @strong{Warning:} if you use this switch, and
9466 @var{num} is nonzero, then you must build all modules with the same
9467 value, including any libraries.  This includes the system libraries and
9468 startup modules.
9470 @item -msseregparm
9471 @opindex msseregparm
9472 Use SSE register passing conventions for float and double arguments
9473 and return values.  You can control this behavior for a specific
9474 function by using the function attribute @samp{sseregparm}.
9475 @xref{Function Attributes}.
9477 @strong{Warning:} if you use this switch then you must build all
9478 modules with the same value, including any libraries.  This includes
9479 the system libraries and startup modules.
9481 @item -mstackrealign
9482 @opindex mstackrealign
9483 Realign the stack at entry.  On the Intel x86, the
9484 @option{-mstackrealign} option will generate an alternate prologue and
9485 epilogue that realigns the runtime stack.  This supports mixing legacy
9486 codes that keep a 4-byte aligned stack with modern codes that keep a
9487 16-byte stack for SSE compatibility.  The alternate prologue and
9488 epilogue are slower and bigger than the regular ones, and the
9489 alternate prologue requires an extra scratch register; this lowers the
9490 number of registers available if used in conjunction with the
9491 @code{regparm} attribute.  The @option{-mstackrealign} option is
9492 incompatible with the nested function prologue; this is considered a
9493 hard error.  See also the attribute @code{force_align_arg_pointer},
9494 applicable to individual functions.
9496 @item -mpreferred-stack-boundary=@var{num}
9497 @opindex mpreferred-stack-boundary
9498 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
9499 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
9500 the default is 4 (16 bytes or 128 bits), except when optimizing for code
9501 size (@option{-Os}), in which case the default is the minimum correct
9502 alignment (4 bytes for x86, and 8 bytes for x86-64).
9504 On Pentium and PentiumPro, @code{double} and @code{long double} values
9505 should be aligned to an 8 byte boundary (see @option{-malign-double}) or
9506 suffer significant run time performance penalties.  On Pentium III, the
9507 Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar
9508 penalties if it is not 16 byte aligned.
9510 To ensure proper alignment of this values on the stack, the stack boundary
9511 must be as aligned as that required by any value stored on the stack.
9512 Further, every function must be generated such that it keeps the stack
9513 aligned.  Thus calling a function compiled with a higher preferred
9514 stack boundary from a function compiled with a lower preferred stack
9515 boundary will most likely misalign the stack.  It is recommended that
9516 libraries that use callbacks always use the default setting.
9518 This extra alignment does consume extra stack space, and generally
9519 increases code size.  Code that is sensitive to stack space usage, such
9520 as embedded systems and operating system kernels, may want to reduce the
9521 preferred alignment to @option{-mpreferred-stack-boundary=2}.
9523 @item -mmmx
9524 @itemx -mno-mmx
9525 @item -msse
9526 @itemx -mno-sse
9527 @item -msse2
9528 @itemx -mno-sse2
9529 @item -msse3
9530 @itemx -mno-sse3
9531 @item -m3dnow
9532 @itemx -mno-3dnow
9533 @opindex mmmx
9534 @opindex mno-mmx
9535 @opindex msse
9536 @opindex mno-sse
9537 @opindex m3dnow
9538 @opindex mno-3dnow
9539 These switches enable or disable the use of instructions in the MMX,
9540 SSE, SSE2 or 3DNow! extended instruction sets.  These extensions are
9541 also available as built-in functions: see @ref{X86 Built-in Functions},
9542 for details of the functions enabled and disabled by these switches.
9544 To have SSE/SSE2 instructions generated automatically from floating-point
9545 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
9547 These options will enable GCC to use these extended instructions in
9548 generated code, even without @option{-mfpmath=sse}.  Applications which
9549 perform runtime CPU detection must compile separate files for each
9550 supported architecture, using the appropriate flags.  In particular,
9551 the file containing the CPU detection code should be compiled without
9552 these options.
9554 @item -mpush-args
9555 @itemx -mno-push-args
9556 @opindex mpush-args
9557 @opindex mno-push-args
9558 Use PUSH operations to store outgoing parameters.  This method is shorter
9559 and usually equally fast as method using SUB/MOV operations and is enabled
9560 by default.  In some cases disabling it may improve performance because of
9561 improved scheduling and reduced dependencies.
9563 @item -maccumulate-outgoing-args
9564 @opindex maccumulate-outgoing-args
9565 If enabled, the maximum amount of space required for outgoing arguments will be
9566 computed in the function prologue.  This is faster on most modern CPUs
9567 because of reduced dependencies, improved scheduling and reduced stack usage
9568 when preferred stack boundary is not equal to 2.  The drawback is a notable
9569 increase in code size.  This switch implies @option{-mno-push-args}.
9571 @item -mthreads
9572 @opindex mthreads
9573 Support thread-safe exception handling on @samp{Mingw32}.  Code that relies
9574 on thread-safe exception handling must compile and link all code with the
9575 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
9576 @option{-D_MT}; when linking, it links in a special thread helper library
9577 @option{-lmingwthrd} which cleans up per thread exception handling data.
9579 @item -mno-align-stringops
9580 @opindex mno-align-stringops
9581 Do not align destination of inlined string operations.  This switch reduces
9582 code size and improves performance in case the destination is already aligned,
9583 but GCC doesn't know about it.
9585 @item -minline-all-stringops
9586 @opindex minline-all-stringops
9587 By default GCC inlines string operations only when destination is known to be
9588 aligned at least to 4 byte boundary.  This enables more inlining, increase code
9589 size, but may improve performance of code that depends on fast memcpy, strlen
9590 and memset for short lengths.
9592 @item -momit-leaf-frame-pointer
9593 @opindex momit-leaf-frame-pointer
9594 Don't keep the frame pointer in a register for leaf functions.  This
9595 avoids the instructions to save, set up and restore frame pointers and
9596 makes an extra register available in leaf functions.  The option
9597 @option{-fomit-frame-pointer} removes the frame pointer for all functions
9598 which might make debugging harder.
9600 @item -mtls-direct-seg-refs
9601 @itemx -mno-tls-direct-seg-refs
9602 @opindex mtls-direct-seg-refs
9603 Controls whether TLS variables may be accessed with offsets from the
9604 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
9605 or whether the thread base pointer must be added.  Whether or not this
9606 is legal depends on the operating system, and whether it maps the
9607 segment to cover the entire TLS area.
9609 For systems that use GNU libc, the default is on.
9610 @end table
9612 These @samp{-m} switches are supported in addition to the above
9613 on AMD x86-64 processors in 64-bit environments.
9615 @table @gcctabopt
9616 @item -m32
9617 @itemx -m64
9618 @opindex m32
9619 @opindex m64
9620 Generate code for a 32-bit or 64-bit environment.
9621 The 32-bit environment sets int, long and pointer to 32 bits and
9622 generates code that runs on any i386 system.
9623 The 64-bit environment sets int to 32 bits and long and pointer
9624 to 64 bits and generates code for AMD's x86-64 architecture.
9626 @item -mno-red-zone
9627 @opindex no-red-zone
9628 Do not use a so called red zone for x86-64 code.  The red zone is mandated
9629 by the x86-64 ABI, it is a 128-byte area beyond the location of the
9630 stack pointer that will not be modified by signal or interrupt handlers
9631 and therefore can be used for temporary data without adjusting the stack
9632 pointer.  The flag @option{-mno-red-zone} disables this red zone.
9634 @item -mcmodel=small
9635 @opindex mcmodel=small
9636 Generate code for the small code model: the program and its symbols must
9637 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
9638 Programs can be statically or dynamically linked.  This is the default
9639 code model.
9641 @item -mcmodel=kernel
9642 @opindex mcmodel=kernel
9643 Generate code for the kernel code model.  The kernel runs in the
9644 negative 2 GB of the address space.
9645 This model has to be used for Linux kernel code.
9647 @item -mcmodel=medium
9648 @opindex mcmodel=medium
9649 Generate code for the medium model: The program is linked in the lower 2
9650 GB of the address space but symbols can be located anywhere in the
9651 address space.  Programs can be statically or dynamically linked, but
9652 building of shared libraries are not supported with the medium model.
9654 @item -mcmodel=large
9655 @opindex mcmodel=large
9656 Generate code for the large model: This model makes no assumptions
9657 about addresses and sizes of sections.  Currently GCC does not implement
9658 this model.
9659 @end table
9661 @node IA-64 Options
9662 @subsection IA-64 Options
9663 @cindex IA-64 Options
9665 These are the @samp{-m} options defined for the Intel IA-64 architecture.
9667 @table @gcctabopt
9668 @item -mbig-endian
9669 @opindex mbig-endian
9670 Generate code for a big endian target.  This is the default for HP-UX@.
9672 @item -mlittle-endian
9673 @opindex mlittle-endian
9674 Generate code for a little endian target.  This is the default for AIX5
9675 and GNU/Linux.
9677 @item -mgnu-as
9678 @itemx -mno-gnu-as
9679 @opindex mgnu-as
9680 @opindex mno-gnu-as
9681 Generate (or don't) code for the GNU assembler.  This is the default.
9682 @c Also, this is the default if the configure option @option{--with-gnu-as}
9683 @c is used.
9685 @item -mgnu-ld
9686 @itemx -mno-gnu-ld
9687 @opindex mgnu-ld
9688 @opindex mno-gnu-ld
9689 Generate (or don't) code for the GNU linker.  This is the default.
9690 @c Also, this is the default if the configure option @option{--with-gnu-ld}
9691 @c is used.
9693 @item -mno-pic
9694 @opindex mno-pic
9695 Generate code that does not use a global pointer register.  The result
9696 is not position independent code, and violates the IA-64 ABI@.
9698 @item -mvolatile-asm-stop
9699 @itemx -mno-volatile-asm-stop
9700 @opindex mvolatile-asm-stop
9701 @opindex mno-volatile-asm-stop
9702 Generate (or don't) a stop bit immediately before and after volatile asm
9703 statements.
9705 @item -mregister-names
9706 @itemx -mno-register-names
9707 @opindex mregister-names
9708 @opindex mno-register-names
9709 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
9710 the stacked registers.  This may make assembler output more readable.
9712 @item -mno-sdata
9713 @itemx -msdata
9714 @opindex mno-sdata
9715 @opindex msdata
9716 Disable (or enable) optimizations that use the small data section.  This may
9717 be useful for working around optimizer bugs.
9719 @item -mconstant-gp
9720 @opindex mconstant-gp
9721 Generate code that uses a single constant global pointer value.  This is
9722 useful when compiling kernel code.
9724 @item -mauto-pic
9725 @opindex mauto-pic
9726 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
9727 This is useful when compiling firmware code.
9729 @item -minline-float-divide-min-latency
9730 @opindex minline-float-divide-min-latency
9731 Generate code for inline divides of floating point values
9732 using the minimum latency algorithm.
9734 @item -minline-float-divide-max-throughput
9735 @opindex minline-float-divide-max-throughput
9736 Generate code for inline divides of floating point values
9737 using the maximum throughput algorithm.
9739 @item -minline-int-divide-min-latency
9740 @opindex minline-int-divide-min-latency
9741 Generate code for inline divides of integer values
9742 using the minimum latency algorithm.
9744 @item -minline-int-divide-max-throughput
9745 @opindex minline-int-divide-max-throughput
9746 Generate code for inline divides of integer values
9747 using the maximum throughput algorithm.
9749 @item -minline-sqrt-min-latency
9750 @opindex minline-sqrt-min-latency
9751 Generate code for inline square roots
9752 using the minimum latency algorithm.
9754 @item -minline-sqrt-max-throughput
9755 @opindex minline-sqrt-max-throughput
9756 Generate code for inline square roots
9757 using the maximum throughput algorithm.
9759 @item -mno-dwarf2-asm
9760 @itemx -mdwarf2-asm
9761 @opindex mno-dwarf2-asm
9762 @opindex mdwarf2-asm
9763 Don't (or do) generate assembler code for the DWARF2 line number debugging
9764 info.  This may be useful when not using the GNU assembler.
9766 @item -mearly-stop-bits
9767 @itemx -mno-early-stop-bits
9768 @opindex mearly-stop-bits
9769 @opindex mno-early-stop-bits
9770 Allow stop bits to be placed earlier than immediately preceding the
9771 instruction that triggered the stop bit.  This can improve instruction
9772 scheduling, but does not always do so.
9774 @item -mfixed-range=@var{register-range}
9775 @opindex mfixed-range
9776 Generate code treating the given register range as fixed registers.
9777 A fixed register is one that the register allocator can not use.  This is
9778 useful when compiling kernel code.  A register range is specified as
9779 two registers separated by a dash.  Multiple register ranges can be
9780 specified separated by a comma.
9782 @item -mtls-size=@var{tls-size}
9783 @opindex mtls-size
9784 Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
9787 @item -mtune=@var{cpu-type}
9788 @opindex mtune
9789 Tune the instruction scheduling for a particular CPU, Valid values are
9790 itanium, itanium1, merced, itanium2, and mckinley.
9792 @item -mt
9793 @itemx -pthread
9794 @opindex mt
9795 @opindex pthread
9796 Add support for multithreading using the POSIX threads library.  This
9797 option sets flags for both the preprocessor and linker.  It does
9798 not affect the thread safety of object code produced by the compiler or
9799 that of libraries supplied with it.  These are HP-UX specific flags.
9801 @item -milp32
9802 @itemx -mlp64
9803 @opindex milp32
9804 @opindex mlp64
9805 Generate code for a 32-bit or 64-bit environment.
9806 The 32-bit environment sets int, long and pointer to 32 bits.
9807 The 64-bit environment sets int to 32 bits and long and pointer
9808 to 64 bits.  These are HP-UX specific flags.
9810 @item -mno-sched-br-data-spec
9811 @itemx -msched-br-data-spec
9812 @opindex -mno-sched-br-data-spec
9813 @opindex -msched-br-data-spec
9814 (Dis/En)able data speculative scheduling before reload.
9815 This will result in generation of the ld.a instructions and
9816 the corresponding check instructions (ld.c / chk.a).
9817 The default is 'disable'.
9819 @item -msched-ar-data-spec
9820 @itemx -mno-sched-ar-data-spec
9821 @opindex -msched-ar-data-spec
9822 @opindex -mno-sched-ar-data-spec
9823 (En/Dis)able data speculative scheduling after reload.
9824 This will result in generation of the ld.a instructions and
9825 the corresponding check instructions (ld.c / chk.a).
9826 The default is 'enable'.
9828 @item -mno-sched-control-spec
9829 @itemx -msched-control-spec
9830 @opindex -mno-sched-control-spec
9831 @opindex -msched-control-spec
9832 (Dis/En)able control speculative scheduling.  This feature is
9833 available only during region scheduling (i.e. before reload).
9834 This will result in generation of the ld.s instructions and
9835 the corresponding check instructions chk.s .
9836 The default is 'disable'.
9838 @item -msched-br-in-data-spec
9839 @itemx -mno-sched-br-in-data-spec
9840 @opindex -msched-br-in-data-spec
9841 @opindex -mno-sched-br-in-data-spec
9842 (En/Dis)able speculative scheduling of the instructions that
9843 are dependent on the data speculative loads before reload.
9844 This is effective only with @option{-msched-br-data-spec} enabled.
9845 The default is 'enable'.
9847 @item -msched-ar-in-data-spec
9848 @itemx -mno-sched-ar-in-data-spec
9849 @opindex -msched-ar-in-data-spec
9850 @opindex -mno-sched-ar-in-data-spec
9851 (En/Dis)able speculative scheduling of the instructions that
9852 are dependent on the data speculative loads after reload.
9853 This is effective only with @option{-msched-ar-data-spec} enabled.
9854 The default is 'enable'.
9856 @item -msched-in-control-spec
9857 @itemx -mno-sched-in-control-spec
9858 @opindex -msched-in-control-spec
9859 @opindex -mno-sched-in-control-spec
9860 (En/Dis)able speculative scheduling of the instructions that
9861 are dependent on the control speculative loads.
9862 This is effective only with @option{-msched-control-spec} enabled.
9863 The default is 'enable'.
9865 @item -msched-ldc
9866 @itemx -mno-sched-ldc
9867 @opindex -msched-ldc
9868 @opindex -mno-sched-ldc
9869 (En/Dis)able use of simple data speculation checks ld.c .
9870 If disabled, only chk.a instructions will be emitted to check
9871 data speculative loads.
9872 The default is 'enable'.
9874 @item -mno-sched-control-ldc
9875 @itemx -msched-control-ldc
9876 @opindex -mno-sched-control-ldc
9877 @opindex -msched-control-ldc 
9878 (Dis/En)able use of ld.c instructions to check control speculative loads.
9879 If enabled, in case of control speculative load with no speculatively
9880 scheduled dependent instructions this load will be emitted as ld.sa and
9881 ld.c will be used to check it.
9882 The default is 'disable'.
9884 @item -mno-sched-spec-verbose
9885 @itemx -msched-spec-verbose
9886 @opindex -mno-sched-spec-verbose
9887 @opindex -msched-spec-verbose
9888 (Dis/En)able printing of the information about speculative motions.
9890 @item -mno-sched-prefer-non-data-spec-insns
9891 @itemx -msched-prefer-non-data-spec-insns
9892 @opindex -mno-sched-prefer-non-data-spec-insns
9893 @opindex -msched-prefer-non-data-spec-insns
9894 If enabled, data speculative instructions will be chosen for schedule
9895 only if there are no other choices at the moment.  This will make
9896 the use of the data speculation much more conservative.
9897 The default is 'disable'.
9899 @item -mno-sched-prefer-non-control-spec-insns
9900 @itemx -msched-prefer-non-control-spec-insns
9901 @opindex -mno-sched-prefer-non-control-spec-insns
9902 @opindex -msched-prefer-non-control-spec-insns
9903 If enabled, control speculative instructions will be chosen for schedule
9904 only if there are no other choices at the moment.  This will make
9905 the use of the control speculation much more conservative.
9906 The default is 'disable'.
9908 @item -mno-sched-count-spec-in-critical-path
9909 @itemx -msched-count-spec-in-critical-path
9910 @opindex -mno-sched-count-spec-in-critical-path
9911 @opindex -msched-count-spec-in-critical-path
9912 If enabled, speculative dependencies will be considered during
9913 computation of the instructions priorities.  This will make the use of the
9914 speculation a bit more conservative.
9915 The default is 'disable'.
9917 @end table
9919 @node M32C Options
9920 @subsection M32C Options
9921 @cindex M32C options
9923 @table @gcctabopt
9924 @item -mcpu=@var{name}
9925 @opindex mcpu=
9926 Select the CPU for which code is generated.  @var{name} may be one of
9927 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
9928 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
9929 the M32C/80 series.
9931 @item -msim
9932 @opindex msim
9933 Specifies that the program will be run on the simulator.  This causes
9934 an alternate runtime library to be linked in which supports, for
9935 example, file I/O.  You must not use this option when generating
9936 programs that will run on real hardware; you must provide your own
9937 runtime library for whatever I/O functions are needed.
9939 @item -memregs=@var{number}
9940 @opindex memregs=
9941 Specifies the number of memory-based pseudo-registers GCC will use
9942 during code generation.  These pseudo-registers will be used like real
9943 registers, so there is a tradeoff between GCC's ability to fit the
9944 code into available registers, and the performance penalty of using
9945 memory instead of registers.  Note that all modules in a program must
9946 be compiled with the same value for this option.  Because of that, you
9947 must not use this option with the default runtime libraries gcc
9948 builds.
9950 @end table
9952 @node M32R/D Options
9953 @subsection M32R/D Options
9954 @cindex M32R/D options
9956 These @option{-m} options are defined for Renesas M32R/D architectures:
9958 @table @gcctabopt
9959 @item -m32r2
9960 @opindex m32r2
9961 Generate code for the M32R/2@.
9963 @item -m32rx
9964 @opindex m32rx
9965 Generate code for the M32R/X@.
9967 @item -m32r
9968 @opindex m32r
9969 Generate code for the M32R@.  This is the default.
9971 @item -mmodel=small
9972 @opindex mmodel=small
9973 Assume all objects live in the lower 16MB of memory (so that their addresses
9974 can be loaded with the @code{ld24} instruction), and assume all subroutines
9975 are reachable with the @code{bl} instruction.
9976 This is the default.
9978 The addressability of a particular object can be set with the
9979 @code{model} attribute.
9981 @item -mmodel=medium
9982 @opindex mmodel=medium
9983 Assume objects may be anywhere in the 32-bit address space (the compiler
9984 will generate @code{seth/add3} instructions to load their addresses), and
9985 assume all subroutines are reachable with the @code{bl} instruction.
9987 @item -mmodel=large
9988 @opindex mmodel=large
9989 Assume objects may be anywhere in the 32-bit address space (the compiler
9990 will generate @code{seth/add3} instructions to load their addresses), and
9991 assume subroutines may not be reachable with the @code{bl} instruction
9992 (the compiler will generate the much slower @code{seth/add3/jl}
9993 instruction sequence).
9995 @item -msdata=none
9996 @opindex msdata=none
9997 Disable use of the small data area.  Variables will be put into
9998 one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
9999 @code{section} attribute has been specified).
10000 This is the default.
10002 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
10003 Objects may be explicitly put in the small data area with the
10004 @code{section} attribute using one of these sections.
10006 @item -msdata=sdata
10007 @opindex msdata=sdata
10008 Put small global and static data in the small data area, but do not
10009 generate special code to reference them.
10011 @item -msdata=use
10012 @opindex msdata=use
10013 Put small global and static data in the small data area, and generate
10014 special instructions to reference them.
10016 @item -G @var{num}
10017 @opindex G
10018 @cindex smaller data references
10019 Put global and static objects less than or equal to @var{num} bytes
10020 into the small data or bss sections instead of the normal data or bss
10021 sections.  The default value of @var{num} is 8.
10022 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
10023 for this option to have any effect.
10025 All modules should be compiled with the same @option{-G @var{num}} value.
10026 Compiling with different values of @var{num} may or may not work; if it
10027 doesn't the linker will give an error message---incorrect code will not be
10028 generated.
10030 @item -mdebug
10031 @opindex mdebug
10032 Makes the M32R specific code in the compiler display some statistics
10033 that might help in debugging programs.
10035 @item -malign-loops
10036 @opindex malign-loops
10037 Align all loops to a 32-byte boundary.
10039 @item -mno-align-loops
10040 @opindex mno-align-loops
10041 Do not enforce a 32-byte alignment for loops.  This is the default.
10043 @item -missue-rate=@var{number}
10044 @opindex missue-rate=@var{number}
10045 Issue @var{number} instructions per cycle.  @var{number} can only be 1
10046 or 2.
10048 @item -mbranch-cost=@var{number}
10049 @opindex mbranch-cost=@var{number}
10050 @var{number} can only be 1 or 2.  If it is 1 then branches will be
10051 preferred over conditional code, if it is 2, then the opposite will
10052 apply.
10054 @item -mflush-trap=@var{number}
10055 @opindex mflush-trap=@var{number}
10056 Specifies the trap number to use to flush the cache.  The default is
10057 12.  Valid numbers are between 0 and 15 inclusive.
10059 @item -mno-flush-trap
10060 @opindex mno-flush-trap
10061 Specifies that the cache cannot be flushed by using a trap.
10063 @item -mflush-func=@var{name}
10064 @opindex mflush-func=@var{name}
10065 Specifies the name of the operating system function to call to flush
10066 the cache.  The default is @emph{_flush_cache}, but a function call
10067 will only be used if a trap is not available.
10069 @item -mno-flush-func
10070 @opindex mno-flush-func
10071 Indicates that there is no OS function for flushing the cache.
10073 @end table
10075 @node M680x0 Options
10076 @subsection M680x0 Options
10077 @cindex M680x0 options
10079 These are the @samp{-m} options defined for the 68000 series.  The default
10080 values for these options depends on which style of 68000 was selected when
10081 the compiler was configured; the defaults for the most common choices are
10082 given below.
10084 @table @gcctabopt
10085 @item -m68000
10086 @itemx -mc68000
10087 @opindex m68000
10088 @opindex mc68000
10089 Generate output for a 68000.  This is the default
10090 when the compiler is configured for 68000-based systems.
10092 Use this option for microcontrollers with a 68000 or EC000 core,
10093 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
10095 @item -m68020
10096 @itemx -mc68020
10097 @opindex m68020
10098 @opindex mc68020
10099 Generate output for a 68020.  This is the default
10100 when the compiler is configured for 68020-based systems.
10102 @item -m68881
10103 @opindex m68881
10104 Generate output containing 68881 instructions for floating point.
10105 This is the default for most 68020 systems unless @option{--nfp} was
10106 specified when the compiler was configured.
10108 @item -m68030
10109 @opindex m68030
10110 Generate output for a 68030.  This is the default when the compiler is
10111 configured for 68030-based systems.
10113 @item -m68040
10114 @opindex m68040
10115 Generate output for a 68040.  This is the default when the compiler is
10116 configured for 68040-based systems.
10118 This option inhibits the use of 68881/68882 instructions that have to be
10119 emulated by software on the 68040.  Use this option if your 68040 does not
10120 have code to emulate those instructions.
10122 @item -m68060
10123 @opindex m68060
10124 Generate output for a 68060.  This is the default when the compiler is
10125 configured for 68060-based systems.
10127 This option inhibits the use of 68020 and 68881/68882 instructions that
10128 have to be emulated by software on the 68060.  Use this option if your 68060
10129 does not have code to emulate those instructions.
10131 @item -mcpu32
10132 @opindex mcpu32
10133 Generate output for a CPU32.  This is the default
10134 when the compiler is configured for CPU32-based systems.
10136 Use this option for microcontrollers with a
10137 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
10138 68336, 68340, 68341, 68349 and 68360.
10140 @item -m5200
10141 @opindex m5200
10142 Generate output for a 520X ``coldfire'' family cpu.  This is the default
10143 when the compiler is configured for 520X-based systems.
10145 Use this option for microcontroller with a 5200 core, including
10146 the MCF5202, MCF5203, MCF5204 and MCF5202.
10148 @item -mcfv4e
10149 @opindex mcfv4e
10150 Generate output for a ColdFire V4e family cpu (e.g.@: 547x/548x).
10151 This includes use of hardware floating point instructions.
10153 @item -m68020-40
10154 @opindex m68020-40
10155 Generate output for a 68040, without using any of the new instructions.
10156 This results in code which can run relatively efficiently on either a
10157 68020/68881 or a 68030 or a 68040.  The generated code does use the
10158 68881 instructions that are emulated on the 68040.
10160 @item -m68020-60
10161 @opindex m68020-60
10162 Generate output for a 68060, without using any of the new instructions.
10163 This results in code which can run relatively efficiently on either a
10164 68020/68881 or a 68030 or a 68040.  The generated code does use the
10165 68881 instructions that are emulated on the 68060.
10167 @item -msoft-float
10168 @opindex msoft-float
10169 Generate output containing library calls for floating point.
10170 @strong{Warning:} the requisite libraries are not available for all m68k
10171 targets.  Normally the facilities of the machine's usual C compiler are
10172 used, but this can't be done directly in cross-compilation.  You must
10173 make your own arrangements to provide suitable library functions for
10174 cross-compilation.  The embedded targets @samp{m68k-*-aout} and
10175 @samp{m68k-*-coff} do provide software floating point support.
10177 @item -mshort
10178 @opindex mshort
10179 Consider type @code{int} to be 16 bits wide, like @code{short int}.
10180 Additionally, parameters passed on the stack are also aligned to a
10181 16-bit boundary even on targets whose API mandates promotion to 32-bit.
10183 @item -mnobitfield
10184 @opindex mnobitfield
10185 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
10186 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
10188 @item -mbitfield
10189 @opindex mbitfield
10190 Do use the bit-field instructions.  The @option{-m68020} option implies
10191 @option{-mbitfield}.  This is the default if you use a configuration
10192 designed for a 68020.
10194 @item -mrtd
10195 @opindex mrtd
10196 Use a different function-calling convention, in which functions
10197 that take a fixed number of arguments return with the @code{rtd}
10198 instruction, which pops their arguments while returning.  This
10199 saves one instruction in the caller since there is no need to pop
10200 the arguments there.
10202 This calling convention is incompatible with the one normally
10203 used on Unix, so you cannot use it if you need to call libraries
10204 compiled with the Unix compiler.
10206 Also, you must provide function prototypes for all functions that
10207 take variable numbers of arguments (including @code{printf});
10208 otherwise incorrect code will be generated for calls to those
10209 functions.
10211 In addition, seriously incorrect code will result if you call a
10212 function with too many arguments.  (Normally, extra arguments are
10213 harmlessly ignored.)
10215 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
10216 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
10218 @item -malign-int
10219 @itemx -mno-align-int
10220 @opindex malign-int
10221 @opindex mno-align-int
10222 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
10223 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
10224 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
10225 Aligning variables on 32-bit boundaries produces code that runs somewhat
10226 faster on processors with 32-bit busses at the expense of more memory.
10228 @strong{Warning:} if you use the @option{-malign-int} switch, GCC will
10229 align structures containing the above types  differently than
10230 most published application binary interface specifications for the m68k.
10232 @item -mpcrel
10233 @opindex mpcrel
10234 Use the pc-relative addressing mode of the 68000 directly, instead of
10235 using a global offset table.  At present, this option implies @option{-fpic},
10236 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
10237 not presently supported with @option{-mpcrel}, though this could be supported for
10238 68020 and higher processors.
10240 @item -mno-strict-align
10241 @itemx -mstrict-align
10242 @opindex mno-strict-align
10243 @opindex mstrict-align
10244 Do not (do) assume that unaligned memory references will be handled by
10245 the system.
10247 @item -msep-data
10248 Generate code that allows the data segment to be located in a different
10249 area of memory from the text segment.  This allows for execute in place in
10250 an environment without virtual memory management.  This option implies
10251 @option{-fPIC}.
10253 @item -mno-sep-data
10254 Generate code that assumes that the data segment follows the text segment.
10255 This is the default.
10257 @item -mid-shared-library
10258 Generate code that supports shared libraries via the library ID method.
10259 This allows for execute in place and shared libraries in an environment
10260 without virtual memory management.  This option implies @option{-fPIC}.
10262 @item -mno-id-shared-library
10263 Generate code that doesn't assume ID based shared libraries are being used.
10264 This is the default.
10266 @item -mshared-library-id=n
10267 Specified the identification number of the ID based shared library being
10268 compiled.  Specifying a value of 0 will generate more compact code, specifying
10269 other values will force the allocation of that number to the current
10270 library but is no more space or time efficient than omitting this option.
10272 @end table
10274 @node M68hc1x Options
10275 @subsection M68hc1x Options
10276 @cindex M68hc1x options
10278 These are the @samp{-m} options defined for the 68hc11 and 68hc12
10279 microcontrollers.  The default values for these options depends on
10280 which style of microcontroller was selected when the compiler was configured;
10281 the defaults for the most common choices are given below.
10283 @table @gcctabopt
10284 @item -m6811
10285 @itemx -m68hc11
10286 @opindex m6811
10287 @opindex m68hc11
10288 Generate output for a 68HC11.  This is the default
10289 when the compiler is configured for 68HC11-based systems.
10291 @item -m6812
10292 @itemx -m68hc12
10293 @opindex m6812
10294 @opindex m68hc12
10295 Generate output for a 68HC12.  This is the default
10296 when the compiler is configured for 68HC12-based systems.
10298 @item -m68S12
10299 @itemx -m68hcs12
10300 @opindex m68S12
10301 @opindex m68hcs12
10302 Generate output for a 68HCS12.
10304 @item -mauto-incdec
10305 @opindex mauto-incdec
10306 Enable the use of 68HC12 pre and post auto-increment and auto-decrement
10307 addressing modes.
10309 @item -minmax
10310 @itemx -nominmax
10311 @opindex minmax
10312 @opindex mnominmax
10313 Enable the use of 68HC12 min and max instructions.
10315 @item -mlong-calls
10316 @itemx -mno-long-calls
10317 @opindex mlong-calls
10318 @opindex mno-long-calls
10319 Treat all calls as being far away (near).  If calls are assumed to be
10320 far away, the compiler will use the @code{call} instruction to
10321 call a function and the @code{rtc} instruction for returning.
10323 @item -mshort
10324 @opindex mshort
10325 Consider type @code{int} to be 16 bits wide, like @code{short int}.
10327 @item -msoft-reg-count=@var{count}
10328 @opindex msoft-reg-count
10329 Specify the number of pseudo-soft registers which are used for the
10330 code generation.  The maximum number is 32.  Using more pseudo-soft
10331 register may or may not result in better code depending on the program.
10332 The default is 4 for 68HC11 and 2 for 68HC12.
10334 @end table
10336 @node MCore Options
10337 @subsection MCore Options
10338 @cindex MCore options
10340 These are the @samp{-m} options defined for the Motorola M*Core
10341 processors.
10343 @table @gcctabopt
10345 @item -mhardlit
10346 @itemx -mno-hardlit
10347 @opindex mhardlit
10348 @opindex mno-hardlit
10349 Inline constants into the code stream if it can be done in two
10350 instructions or less.
10352 @item -mdiv
10353 @itemx -mno-div
10354 @opindex mdiv
10355 @opindex mno-div
10356 Use the divide instruction.  (Enabled by default).
10358 @item -mrelax-immediate
10359 @itemx -mno-relax-immediate
10360 @opindex mrelax-immediate
10361 @opindex mno-relax-immediate
10362 Allow arbitrary sized immediates in bit operations.
10364 @item -mwide-bitfields
10365 @itemx -mno-wide-bitfields
10366 @opindex mwide-bitfields
10367 @opindex mno-wide-bitfields
10368 Always treat bit-fields as int-sized.
10370 @item -m4byte-functions
10371 @itemx -mno-4byte-functions
10372 @opindex m4byte-functions
10373 @opindex mno-4byte-functions
10374 Force all functions to be aligned to a four byte boundary.
10376 @item -mcallgraph-data
10377 @itemx -mno-callgraph-data
10378 @opindex mcallgraph-data
10379 @opindex mno-callgraph-data
10380 Emit callgraph information.
10382 @item -mslow-bytes
10383 @itemx -mno-slow-bytes
10384 @opindex mslow-bytes
10385 @opindex mno-slow-bytes
10386 Prefer word access when reading byte quantities.
10388 @item -mlittle-endian
10389 @itemx -mbig-endian
10390 @opindex mlittle-endian
10391 @opindex mbig-endian
10392 Generate code for a little endian target.
10394 @item -m210
10395 @itemx -m340
10396 @opindex m210
10397 @opindex m340
10398 Generate code for the 210 processor.
10399 @end table
10401 @node MIPS Options
10402 @subsection MIPS Options
10403 @cindex MIPS options
10405 @table @gcctabopt
10407 @item -EB
10408 @opindex EB
10409 Generate big-endian code.
10411 @item -EL
10412 @opindex EL
10413 Generate little-endian code.  This is the default for @samp{mips*el-*-*}
10414 configurations.
10416 @item -march=@var{arch}
10417 @opindex march
10418 Generate code that will run on @var{arch}, which can be the name of a
10419 generic MIPS ISA, or the name of a particular processor.
10420 The ISA names are:
10421 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
10422 @samp{mips32}, @samp{mips32r2}, and @samp{mips64}.
10423 The processor names are:
10424 @samp{4kc}, @samp{4km}, @samp{4kp},
10425 @samp{5kc}, @samp{5kf},
10426 @samp{20kc},
10427 @samp{24k}, @samp{24kc}, @samp{24kf}, @samp{24kx},
10428 @samp{m4k},
10429 @samp{orion},
10430 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
10431 @samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000},
10432 @samp{rm7000}, @samp{rm9000},
10433 @samp{sb1},
10434 @samp{sr71000},
10435 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
10436 @samp{vr5000}, @samp{vr5400} and @samp{vr5500}.
10437 The special value @samp{from-abi} selects the
10438 most compatible architecture for the selected ABI (that is,
10439 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
10441 In processor names, a final @samp{000} can be abbreviated as @samp{k}
10442 (for example, @samp{-march=r2k}).  Prefixes are optional, and
10443 @samp{vr} may be written @samp{r}.
10445 GCC defines two macros based on the value of this option.  The first
10446 is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
10447 a string.  The second has the form @samp{_MIPS_ARCH_@var{foo}},
10448 where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
10449 For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
10450 to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
10452 Note that the @samp{_MIPS_ARCH} macro uses the processor names given
10453 above.  In other words, it will have the full prefix and will not
10454 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
10455 the macro names the resolved architecture (either @samp{"mips1"} or
10456 @samp{"mips3"}).  It names the default architecture when no
10457 @option{-march} option is given.
10459 @item -mtune=@var{arch}
10460 @opindex mtune
10461 Optimize for @var{arch}.  Among other things, this option controls
10462 the way instructions are scheduled, and the perceived cost of arithmetic
10463 operations.  The list of @var{arch} values is the same as for
10464 @option{-march}.
10466 When this option is not used, GCC will optimize for the processor
10467 specified by @option{-march}.  By using @option{-march} and
10468 @option{-mtune} together, it is possible to generate code that will
10469 run on a family of processors, but optimize the code for one
10470 particular member of that family.
10472 @samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
10473 @samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
10474 @samp{-march} ones described above.
10476 @item -mips1
10477 @opindex mips1
10478 Equivalent to @samp{-march=mips1}.
10480 @item -mips2
10481 @opindex mips2
10482 Equivalent to @samp{-march=mips2}.
10484 @item -mips3
10485 @opindex mips3
10486 Equivalent to @samp{-march=mips3}.
10488 @item -mips4
10489 @opindex mips4
10490 Equivalent to @samp{-march=mips4}.
10492 @item -mips32
10493 @opindex mips32
10494 Equivalent to @samp{-march=mips32}.
10496 @item -mips32r2
10497 @opindex mips32r2
10498 Equivalent to @samp{-march=mips32r2}.
10500 @item -mips64
10501 @opindex mips64
10502 Equivalent to @samp{-march=mips64}.
10504 @item -mips16
10505 @itemx -mno-mips16
10506 @opindex mips16
10507 @opindex mno-mips16
10508 Generate (do not generate) MIPS16 code.  If GCC is targetting a
10509 MIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE@.
10511 @item -mabi=32
10512 @itemx -mabi=o64
10513 @itemx -mabi=n32
10514 @itemx -mabi=64
10515 @itemx -mabi=eabi
10516 @opindex mabi=32
10517 @opindex mabi=o64
10518 @opindex mabi=n32
10519 @opindex mabi=64
10520 @opindex mabi=eabi
10521 Generate code for the given ABI@.
10523 Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
10524 generates 64-bit code when you select a 64-bit architecture, but you
10525 can use @option{-mgp32} to get 32-bit code instead.
10527 For information about the O64 ABI, see
10528 @w{@uref{http://gcc.gnu.org/projects/mipso64-abi.html}}.
10530 @item -mabicalls
10531 @itemx -mno-abicalls
10532 @opindex mabicalls
10533 @opindex mno-abicalls
10534 Generate (do not generate) code that is suitable for SVR4-style
10535 dynamic objects.  @option{-mabicalls} is the default for SVR4-based
10536 systems.
10538 @item -mshared
10539 @itemx -mno-shared
10540 Generate (do not generate) code that is fully position-independent,
10541 and that can therefore be linked into shared libraries.  This option
10542 only affects @option{-mabicalls}.
10544 All @option{-mabicalls} code has traditionally been position-independent,
10545 regardless of options like @option{-fPIC} and @option{-fpic}.  However,
10546 as an extension, the GNU toolchain allows executables to use absolute
10547 accesses for locally-binding symbols.  It can also use shorter GP
10548 initialization sequences and generate direct calls to locally-defined
10549 functions.  This mode is selected by @option{-mno-shared}.
10551 @option{-mno-shared} depends on binutils 2.16 or higher and generates
10552 objects that can only be linked by the GNU linker.  However, the option
10553 does not affect the ABI of the final executable; it only affects the ABI
10554 of relocatable objects.  Using @option{-mno-shared} will generally make
10555 executables both smaller and quicker.
10557 @option{-mshared} is the default.
10559 @item -mxgot
10560 @itemx -mno-xgot
10561 @opindex mxgot
10562 @opindex mno-xgot
10563 Lift (do not lift) the usual restrictions on the size of the global
10564 offset table.
10566 GCC normally uses a single instruction to load values from the GOT@.
10567 While this is relatively efficient, it will only work if the GOT
10568 is smaller than about 64k.  Anything larger will cause the linker
10569 to report an error such as:
10571 @cindex relocation truncated to fit (MIPS)
10572 @smallexample
10573 relocation truncated to fit: R_MIPS_GOT16 foobar
10574 @end smallexample
10576 If this happens, you should recompile your code with @option{-mxgot}.
10577 It should then work with very large GOTs, although it will also be
10578 less efficient, since it will take three instructions to fetch the
10579 value of a global symbol.
10581 Note that some linkers can create multiple GOTs.  If you have such a
10582 linker, you should only need to use @option{-mxgot} when a single object
10583 file accesses more than 64k's worth of GOT entries.  Very few do.
10585 These options have no effect unless GCC is generating position
10586 independent code.
10588 @item -mgp32
10589 @opindex mgp32
10590 Assume that general-purpose registers are 32 bits wide.
10592 @item -mgp64
10593 @opindex mgp64
10594 Assume that general-purpose registers are 64 bits wide.
10596 @item -mfp32
10597 @opindex mfp32
10598 Assume that floating-point registers are 32 bits wide.
10600 @item -mfp64
10601 @opindex mfp64
10602 Assume that floating-point registers are 64 bits wide.
10604 @item -mhard-float
10605 @opindex mhard-float
10606 Use floating-point coprocessor instructions.
10608 @item -msoft-float
10609 @opindex msoft-float
10610 Do not use floating-point coprocessor instructions.  Implement
10611 floating-point calculations using library calls instead.
10613 @item -msingle-float
10614 @opindex msingle-float
10615 Assume that the floating-point coprocessor only supports single-precision
10616 operations.
10618 @itemx -mdouble-float
10619 @opindex mdouble-float
10620 Assume that the floating-point coprocessor supports double-precision
10621 operations.  This is the default.
10623 @itemx -mdsp
10624 @itemx -mno-dsp
10625 @opindex mdsp
10626 @opindex mno-dsp
10627 Use (do not use) the MIPS DSP ASE.  @xref{MIPS DSP Built-in Functions}.
10629 @itemx -mpaired-single
10630 @itemx -mno-paired-single
10631 @opindex mpaired-single
10632 @opindex mno-paired-single
10633 Use (do not use) paired-single floating-point instructions.
10634 @xref{MIPS Paired-Single Support}.  This option can only be used
10635 when generating 64-bit code and requires hardware floating-point
10636 support to be enabled.
10638 @itemx -mips3d
10639 @itemx -mno-mips3d
10640 @opindex mips3d
10641 @opindex mno-mips3d
10642 Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
10643 The option @option{-mips3d} implies @option{-mpaired-single}.
10645 @item -mlong64
10646 @opindex mlong64
10647 Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
10648 an explanation of the default and the way that the pointer size is
10649 determined.
10651 @item -mlong32
10652 @opindex mlong32
10653 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
10655 The default size of @code{int}s, @code{long}s and pointers depends on
10656 the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
10657 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
10658 32-bit @code{long}s.  Pointers are the same size as @code{long}s,
10659 or the same size as integer registers, whichever is smaller.
10661 @item -msym32
10662 @itemx -mno-sym32
10663 @opindex msym32
10664 @opindex mno-sym32
10665 Assume (do not assume) that all symbols have 32-bit values, regardless
10666 of the selected ABI@.  This option is useful in combination with
10667 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
10668 to generate shorter and faster references to symbolic addresses.
10670 @item -G @var{num}
10671 @opindex G
10672 @cindex smaller data references (MIPS)
10673 @cindex gp-relative references (MIPS)
10674 Put global and static items less than or equal to @var{num} bytes into
10675 the small data or bss section instead of the normal data or bss section.
10676 This allows the data to be accessed using a single instruction.
10678 All modules should be compiled with the same @option{-G @var{num}}
10679 value.
10681 @item -membedded-data
10682 @itemx -mno-embedded-data
10683 @opindex membedded-data
10684 @opindex mno-embedded-data
10685 Allocate variables to the read-only data section first if possible, then
10686 next in the small data section if possible, otherwise in data.  This gives
10687 slightly slower code than the default, but reduces the amount of RAM required
10688 when executing, and thus may be preferred for some embedded systems.
10690 @item -muninit-const-in-rodata
10691 @itemx -mno-uninit-const-in-rodata
10692 @opindex muninit-const-in-rodata
10693 @opindex mno-uninit-const-in-rodata
10694 Put uninitialized @code{const} variables in the read-only data section.
10695 This option is only meaningful in conjunction with @option{-membedded-data}.
10697 @item -msplit-addresses
10698 @itemx -mno-split-addresses
10699 @opindex msplit-addresses
10700 @opindex mno-split-addresses
10701 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
10702 relocation operators.  This option has been superseded by
10703 @option{-mexplicit-relocs} but is retained for backwards compatibility.
10705 @item -mexplicit-relocs
10706 @itemx -mno-explicit-relocs
10707 @opindex mexplicit-relocs
10708 @opindex mno-explicit-relocs
10709 Use (do not use) assembler relocation operators when dealing with symbolic
10710 addresses.  The alternative, selected by @option{-mno-explicit-relocs},
10711 is to use assembler macros instead.
10713 @option{-mexplicit-relocs} is the default if GCC was configured
10714 to use an assembler that supports relocation operators.
10716 @item -mcheck-zero-division
10717 @itemx -mno-check-zero-division
10718 @opindex mcheck-zero-division
10719 @opindex mno-check-zero-division
10720 Trap (do not trap) on integer division by zero.  The default is
10721 @option{-mcheck-zero-division}.
10723 @item -mdivide-traps
10724 @itemx -mdivide-breaks
10725 @opindex mdivide-traps
10726 @opindex mdivide-breaks
10727 MIPS systems check for division by zero by generating either a
10728 conditional trap or a break instruction.  Using traps results in
10729 smaller code, but is only supported on MIPS II and later.  Also, some
10730 versions of the Linux kernel have a bug that prevents trap from
10731 generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
10732 allow conditional traps on architectures that support them and
10733 @option{-mdivide-breaks} to force the use of breaks.
10735 The default is usually @option{-mdivide-traps}, but this can be
10736 overridden at configure time using @option{--with-divide=breaks}.
10737 Divide-by-zero checks can be completely disabled using
10738 @option{-mno-check-zero-division}.
10740 @item -mmemcpy
10741 @itemx -mno-memcpy
10742 @opindex mmemcpy
10743 @opindex mno-memcpy
10744 Force (do not force) the use of @code{memcpy()} for non-trivial block
10745 moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
10746 most constant-sized copies.
10748 @item -mlong-calls
10749 @itemx -mno-long-calls
10750 @opindex mlong-calls
10751 @opindex mno-long-calls
10752 Disable (do not disable) use of the @code{jal} instruction.  Calling
10753 functions using @code{jal} is more efficient but requires the caller
10754 and callee to be in the same 256 megabyte segment.
10756 This option has no effect on abicalls code.  The default is
10757 @option{-mno-long-calls}.
10759 @item -mmad
10760 @itemx -mno-mad
10761 @opindex mmad
10762 @opindex mno-mad
10763 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
10764 instructions, as provided by the R4650 ISA@.
10766 @item -mfused-madd
10767 @itemx -mno-fused-madd
10768 @opindex mfused-madd
10769 @opindex mno-fused-madd
10770 Enable (disable) use of the floating point multiply-accumulate
10771 instructions, when they are available.  The default is
10772 @option{-mfused-madd}.
10774 When multiply-accumulate instructions are used, the intermediate
10775 product is calculated to infinite precision and is not subject to
10776 the FCSR Flush to Zero bit.  This may be undesirable in some
10777 circumstances.
10779 @item -nocpp
10780 @opindex nocpp
10781 Tell the MIPS assembler to not run its preprocessor over user
10782 assembler files (with a @samp{.s} suffix) when assembling them.
10784 @item -mfix-r4000
10785 @itemx -mno-fix-r4000
10786 @opindex mfix-r4000
10787 @opindex mno-fix-r4000
10788 Work around certain R4000 CPU errata:
10789 @itemize @minus
10790 @item
10791 A double-word or a variable shift may give an incorrect result if executed
10792 immediately after starting an integer division.
10793 @item
10794 A double-word or a variable shift may give an incorrect result if executed
10795 while an integer multiplication is in progress.
10796 @item
10797 An integer division may give an incorrect result if started in a delay slot
10798 of a taken branch or a jump.
10799 @end itemize
10801 @item -mfix-r4400
10802 @itemx -mno-fix-r4400
10803 @opindex mfix-r4400
10804 @opindex mno-fix-r4400
10805 Work around certain R4400 CPU errata:
10806 @itemize @minus
10807 @item
10808 A double-word or a variable shift may give an incorrect result if executed
10809 immediately after starting an integer division.
10810 @end itemize
10812 @item -mfix-vr4120
10813 @itemx -mno-fix-vr4120
10814 @opindex mfix-vr4120
10815 Work around certain VR4120 errata:
10816 @itemize @minus
10817 @item
10818 @code{dmultu} does not always produce the correct result.
10819 @item
10820 @code{div} and @code{ddiv} do not always produce the correct result if one
10821 of the operands is negative.
10822 @end itemize
10823 The workarounds for the division errata rely on special functions in
10824 @file{libgcc.a}.  At present, these functions are only provided by
10825 the @code{mips64vr*-elf} configurations.
10827 Other VR4120 errata require a nop to be inserted between certain pairs of
10828 instructions.  These errata are handled by the assembler, not by GCC itself.
10830 @item -mfix-vr4130
10831 @opindex mfix-vr4130
10832 Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
10833 workarounds are implemented by the assembler rather than by GCC,
10834 although GCC will avoid using @code{mflo} and @code{mfhi} if the
10835 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
10836 instructions are available instead.
10838 @item -mfix-sb1
10839 @itemx -mno-fix-sb1
10840 @opindex mfix-sb1
10841 Work around certain SB-1 CPU core errata.
10842 (This flag currently works around the SB-1 revision 2
10843 ``F1'' and ``F2'' floating point errata.)
10845 @item -mflush-func=@var{func}
10846 @itemx -mno-flush-func
10847 @opindex mflush-func
10848 Specifies the function to call to flush the I and D caches, or to not
10849 call any such function.  If called, the function must take the same
10850 arguments as the common @code{_flush_func()}, that is, the address of the
10851 memory range for which the cache is being flushed, the size of the
10852 memory range, and the number 3 (to flush both caches).  The default
10853 depends on the target GCC was configured for, but commonly is either
10854 @samp{_flush_func} or @samp{__cpu_flush}.
10856 @item -mbranch-likely
10857 @itemx -mno-branch-likely
10858 @opindex mbranch-likely
10859 @opindex mno-branch-likely
10860 Enable or disable use of Branch Likely instructions, regardless of the
10861 default for the selected architecture.  By default, Branch Likely
10862 instructions may be generated if they are supported by the selected
10863 architecture.  An exception is for the MIPS32 and MIPS64 architectures
10864 and processors which implement those architectures; for those, Branch
10865 Likely instructions will not be generated by default because the MIPS32
10866 and MIPS64 architectures specifically deprecate their use.
10868 @item -mfp-exceptions
10869 @itemx -mno-fp-exceptions
10870 @opindex mfp-exceptions
10871 Specifies whether FP exceptions are enabled.  This affects how we schedule
10872 FP instructions for some processors.  The default is that FP exceptions are
10873 enabled.
10875 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
10876 64-bit code, then we can use both FP pipes.  Otherwise, we can only use one
10877 FP pipe.
10879 @item -mvr4130-align
10880 @itemx -mno-vr4130-align
10881 @opindex mvr4130-align
10882 The VR4130 pipeline is two-way superscalar, but can only issue two
10883 instructions together if the first one is 8-byte aligned.  When this
10884 option is enabled, GCC will align pairs of instructions that it
10885 thinks should execute in parallel.
10887 This option only has an effect when optimizing for the VR4130.
10888 It normally makes code faster, but at the expense of making it bigger.
10889 It is enabled by default at optimization level @option{-O3}.
10890 @end table
10892 @node MMIX Options
10893 @subsection MMIX Options
10894 @cindex MMIX Options
10896 These options are defined for the MMIX:
10898 @table @gcctabopt
10899 @item -mlibfuncs
10900 @itemx -mno-libfuncs
10901 @opindex mlibfuncs
10902 @opindex mno-libfuncs
10903 Specify that intrinsic library functions are being compiled, passing all
10904 values in registers, no matter the size.
10906 @item -mepsilon
10907 @itemx -mno-epsilon
10908 @opindex mepsilon
10909 @opindex mno-epsilon
10910 Generate floating-point comparison instructions that compare with respect
10911 to the @code{rE} epsilon register.
10913 @item -mabi=mmixware
10914 @itemx -mabi=gnu
10915 @opindex mabi-mmixware
10916 @opindex mabi=gnu
10917 Generate code that passes function parameters and return values that (in
10918 the called function) are seen as registers @code{$0} and up, as opposed to
10919 the GNU ABI which uses global registers @code{$231} and up.
10921 @item -mzero-extend
10922 @itemx -mno-zero-extend
10923 @opindex mzero-extend
10924 @opindex mno-zero-extend
10925 When reading data from memory in sizes shorter than 64 bits, use (do not
10926 use) zero-extending load instructions by default, rather than
10927 sign-extending ones.
10929 @item -mknuthdiv
10930 @itemx -mno-knuthdiv
10931 @opindex mknuthdiv
10932 @opindex mno-knuthdiv
10933 Make the result of a division yielding a remainder have the same sign as
10934 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
10935 remainder follows the sign of the dividend.  Both methods are
10936 arithmetically valid, the latter being almost exclusively used.
10938 @item -mtoplevel-symbols
10939 @itemx -mno-toplevel-symbols
10940 @opindex mtoplevel-symbols
10941 @opindex mno-toplevel-symbols
10942 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
10943 code can be used with the @code{PREFIX} assembly directive.
10945 @item -melf
10946 @opindex melf
10947 Generate an executable in the ELF format, rather than the default
10948 @samp{mmo} format used by the @command{mmix} simulator.
10950 @item -mbranch-predict
10951 @itemx -mno-branch-predict
10952 @opindex mbranch-predict
10953 @opindex mno-branch-predict
10954 Use (do not use) the probable-branch instructions, when static branch
10955 prediction indicates a probable branch.
10957 @item -mbase-addresses
10958 @itemx -mno-base-addresses
10959 @opindex mbase-addresses
10960 @opindex mno-base-addresses
10961 Generate (do not generate) code that uses @emph{base addresses}.  Using a
10962 base address automatically generates a request (handled by the assembler
10963 and the linker) for a constant to be set up in a global register.  The
10964 register is used for one or more base address requests within the range 0
10965 to 255 from the value held in the register.  The generally leads to short
10966 and fast code, but the number of different data items that can be
10967 addressed is limited.  This means that a program that uses lots of static
10968 data may require @option{-mno-base-addresses}.
10970 @item -msingle-exit
10971 @itemx -mno-single-exit
10972 @opindex msingle-exit
10973 @opindex mno-single-exit
10974 Force (do not force) generated code to have a single exit point in each
10975 function.
10976 @end table
10978 @node MN10300 Options
10979 @subsection MN10300 Options
10980 @cindex MN10300 options
10982 These @option{-m} options are defined for Matsushita MN10300 architectures:
10984 @table @gcctabopt
10985 @item -mmult-bug
10986 @opindex mmult-bug
10987 Generate code to avoid bugs in the multiply instructions for the MN10300
10988 processors.  This is the default.
10990 @item -mno-mult-bug
10991 @opindex mno-mult-bug
10992 Do not generate code to avoid bugs in the multiply instructions for the
10993 MN10300 processors.
10995 @item -mam33
10996 @opindex mam33
10997 Generate code which uses features specific to the AM33 processor.
10999 @item -mno-am33
11000 @opindex mno-am33
11001 Do not generate code which uses features specific to the AM33 processor.  This
11002 is the default.
11004 @item -mreturn-pointer-on-d0
11005 @opindex mreturn-pointer-on-d0
11006 When generating a function which returns a pointer, return the pointer
11007 in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
11008 only in a0, and attempts to call such functions without a prototype
11009 would result in errors.  Note that this option is on by default; use
11010 @option{-mno-return-pointer-on-d0} to disable it.
11012 @item -mno-crt0
11013 @opindex mno-crt0
11014 Do not link in the C run-time initialization object file.
11016 @item -mrelax
11017 @opindex mrelax
11018 Indicate to the linker that it should perform a relaxation optimization pass
11019 to shorten branches, calls and absolute memory addresses.  This option only
11020 has an effect when used on the command line for the final link step.
11022 This option makes symbolic debugging impossible.
11023 @end table
11025 @node MT Options
11026 @subsection MT Options
11027 @cindex MT options
11029 These @option{-m} options are defined for Morpho MT architectures:
11031 @table @gcctabopt
11033 @item -march=@var{cpu-type}
11034 @opindex march
11035 Generate code that will run on @var{cpu-type}, which is the name of a system
11036 representing a certain processor type.  Possible values for
11037 @var{cpu-type} are @samp{ms1-64-001}, @samp{ms1-16-002},
11038 @samp{ms1-16-003} and @samp{ms2}.
11040 When this option is not used, the default is @option{-march=ms1-16-002}.
11042 @item -mbacc
11043 @opindex mbacc
11044 Use byte loads and stores when generating code.
11046 @item -mno-bacc
11047 @opindex mno-bacc
11048 Do not use byte loads and stores when generating code.
11050 @item -msim
11051 @opindex msim
11052 Use simulator runtime
11054 @item -mno-crt0
11055 @opindex mno-crt0
11056 Do not link in the C run-time initialization object file
11057 @file{crti.o}.  Other run-time initialization and termination files
11058 such as @file{startup.o} and @file{exit.o} are still included on the
11059 linker command line.
11061 @end table
11063 @node PDP-11 Options
11064 @subsection PDP-11 Options
11065 @cindex PDP-11 Options
11067 These options are defined for the PDP-11:
11069 @table @gcctabopt
11070 @item -mfpu
11071 @opindex mfpu
11072 Use hardware FPP floating point.  This is the default.  (FIS floating
11073 point on the PDP-11/40 is not supported.)
11075 @item -msoft-float
11076 @opindex msoft-float
11077 Do not use hardware floating point.
11079 @item -mac0
11080 @opindex mac0
11081 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
11083 @item -mno-ac0
11084 @opindex mno-ac0
11085 Return floating-point results in memory.  This is the default.
11087 @item -m40
11088 @opindex m40
11089 Generate code for a PDP-11/40.
11091 @item -m45
11092 @opindex m45
11093 Generate code for a PDP-11/45.  This is the default.
11095 @item -m10
11096 @opindex m10
11097 Generate code for a PDP-11/10.
11099 @item -mbcopy-builtin
11100 @opindex bcopy-builtin
11101 Use inline @code{movmemhi} patterns for copying memory.  This is the
11102 default.
11104 @item -mbcopy
11105 @opindex mbcopy
11106 Do not use inline @code{movmemhi} patterns for copying memory.
11108 @item -mint16
11109 @itemx -mno-int32
11110 @opindex mint16
11111 @opindex mno-int32
11112 Use 16-bit @code{int}.  This is the default.
11114 @item -mint32
11115 @itemx -mno-int16
11116 @opindex mint32
11117 @opindex mno-int16
11118 Use 32-bit @code{int}.
11120 @item -mfloat64
11121 @itemx -mno-float32
11122 @opindex mfloat64
11123 @opindex mno-float32
11124 Use 64-bit @code{float}.  This is the default.
11126 @item -mfloat32
11127 @itemx -mno-float64
11128 @opindex mfloat32
11129 @opindex mno-float64
11130 Use 32-bit @code{float}.
11132 @item -mabshi
11133 @opindex mabshi
11134 Use @code{abshi2} pattern.  This is the default.
11136 @item -mno-abshi
11137 @opindex mno-abshi
11138 Do not use @code{abshi2} pattern.
11140 @item -mbranch-expensive
11141 @opindex mbranch-expensive
11142 Pretend that branches are expensive.  This is for experimenting with
11143 code generation only.
11145 @item -mbranch-cheap
11146 @opindex mbranch-cheap
11147 Do not pretend that branches are expensive.  This is the default.
11149 @item -msplit
11150 @opindex msplit
11151 Generate code for a system with split I&D@.
11153 @item -mno-split
11154 @opindex mno-split
11155 Generate code for a system without split I&D@.  This is the default.
11157 @item -munix-asm
11158 @opindex munix-asm
11159 Use Unix assembler syntax.  This is the default when configured for
11160 @samp{pdp11-*-bsd}.
11162 @item -mdec-asm
11163 @opindex mdec-asm
11164 Use DEC assembler syntax.  This is the default when configured for any
11165 PDP-11 target other than @samp{pdp11-*-bsd}.
11166 @end table
11168 @node PowerPC Options
11169 @subsection PowerPC Options
11170 @cindex PowerPC options
11172 These are listed under @xref{RS/6000 and PowerPC Options}.
11174 @node RS/6000 and PowerPC Options
11175 @subsection IBM RS/6000 and PowerPC Options
11176 @cindex RS/6000 and PowerPC Options
11177 @cindex IBM RS/6000 and PowerPC Options
11179 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
11180 @table @gcctabopt
11181 @item -mpower
11182 @itemx -mno-power
11183 @itemx -mpower2
11184 @itemx -mno-power2
11185 @itemx -mpowerpc
11186 @itemx -mno-powerpc
11187 @itemx -mpowerpc-gpopt
11188 @itemx -mno-powerpc-gpopt
11189 @itemx -mpowerpc-gfxopt
11190 @itemx -mno-powerpc-gfxopt
11191 @itemx -mpowerpc64
11192 @itemx -mno-powerpc64
11193 @itemx -mmfcrf
11194 @itemx -mno-mfcrf
11195 @itemx -mpopcntb
11196 @itemx -mno-popcntb
11197 @itemx -mfprnd
11198 @itemx -mno-fprnd
11199 @opindex mpower
11200 @opindex mno-power
11201 @opindex mpower2
11202 @opindex mno-power2
11203 @opindex mpowerpc
11204 @opindex mno-powerpc
11205 @opindex mpowerpc-gpopt
11206 @opindex mno-powerpc-gpopt
11207 @opindex mpowerpc-gfxopt
11208 @opindex mno-powerpc-gfxopt
11209 @opindex mpowerpc64
11210 @opindex mno-powerpc64
11211 @opindex mmfcrf
11212 @opindex mno-mfcrf
11213 @opindex mpopcntb
11214 @opindex mno-popcntb
11215 @opindex mfprnd
11216 @opindex mno-fprnd
11217 GCC supports two related instruction set architectures for the
11218 RS/6000 and PowerPC@.  The @dfn{POWER} instruction set are those
11219 instructions supported by the @samp{rios} chip set used in the original
11220 RS/6000 systems and the @dfn{PowerPC} instruction set is the
11221 architecture of the Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and
11222 the IBM 4xx, 6xx, and follow-on microprocessors.
11224 Neither architecture is a subset of the other.  However there is a
11225 large common subset of instructions supported by both.  An MQ
11226 register is included in processors supporting the POWER architecture.
11228 You use these options to specify which instructions are available on the
11229 processor you are using.  The default value of these options is
11230 determined when configuring GCC@.  Specifying the
11231 @option{-mcpu=@var{cpu_type}} overrides the specification of these
11232 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
11233 rather than the options listed above.
11235 The @option{-mpower} option allows GCC to generate instructions that
11236 are found only in the POWER architecture and to use the MQ register.
11237 Specifying @option{-mpower2} implies @option{-power} and also allows GCC
11238 to generate instructions that are present in the POWER2 architecture but
11239 not the original POWER architecture.
11241 The @option{-mpowerpc} option allows GCC to generate instructions that
11242 are found only in the 32-bit subset of the PowerPC architecture.
11243 Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
11244 GCC to use the optional PowerPC architecture instructions in the
11245 General Purpose group, including floating-point square root.  Specifying
11246 @option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
11247 use the optional PowerPC architecture instructions in the Graphics
11248 group, including floating-point select.
11250 The @option{-mmfcrf} option allows GCC to generate the move from
11251 condition register field instruction implemented on the POWER4
11252 processor and other processors that support the PowerPC V2.01
11253 architecture.
11254 The @option{-mpopcntb} option allows GCC to generate the popcount and
11255 double precision FP reciprocal estimate instruction implemented on the
11256 POWER5 processor and other processors that support the PowerPC V2.02
11257 architecture.
11258 The @option{-mfprnd} option allows GCC to generate the FP round to
11259 integer instructions implemented on the POWER5+ processor and other
11260 processors that support the PowerPC V2.03 architecture.
11262 The @option{-mpowerpc64} option allows GCC to generate the additional
11263 64-bit instructions that are found in the full PowerPC64 architecture
11264 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
11265 @option{-mno-powerpc64}.
11267 If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
11268 will use only the instructions in the common subset of both
11269 architectures plus some special AIX common-mode calls, and will not use
11270 the MQ register.  Specifying both @option{-mpower} and @option{-mpowerpc}
11271 permits GCC to use any instruction from either architecture and to
11272 allow use of the MQ register; specify this for the Motorola MPC601.
11274 @item -mnew-mnemonics
11275 @itemx -mold-mnemonics
11276 @opindex mnew-mnemonics
11277 @opindex mold-mnemonics
11278 Select which mnemonics to use in the generated assembler code.  With
11279 @option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
11280 the PowerPC architecture.  With @option{-mold-mnemonics} it uses the
11281 assembler mnemonics defined for the POWER architecture.  Instructions
11282 defined in only one architecture have only one mnemonic; GCC uses that
11283 mnemonic irrespective of which of these options is specified.
11285 GCC defaults to the mnemonics appropriate for the architecture in
11286 use.  Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
11287 value of these option.  Unless you are building a cross-compiler, you
11288 should normally not specify either @option{-mnew-mnemonics} or
11289 @option{-mold-mnemonics}, but should instead accept the default.
11291 @item -mcpu=@var{cpu_type}
11292 @opindex mcpu
11293 Set architecture type, register usage, choice of mnemonics, and
11294 instruction scheduling parameters for machine type @var{cpu_type}.
11295 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
11296 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{505},
11297 @samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604},
11298 @samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400},
11299 @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
11300 @samp{860}, @samp{970}, @samp{8540}, @samp{ec603e}, @samp{G3},
11301 @samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3},
11302 @samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6},
11303 @samp{common}, @samp{powerpc}, @samp{powerpc64},
11304 @samp{rios}, @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}.
11306 @option{-mcpu=common} selects a completely generic processor.  Code
11307 generated under this option will run on any POWER or PowerPC processor.
11308 GCC will use only the instructions in the common subset of both
11309 architectures, and will not use the MQ register.  GCC assumes a generic
11310 processor model for scheduling purposes.
11312 @option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
11313 @option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
11314 PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
11315 types, with an appropriate, generic processor model assumed for
11316 scheduling purposes.
11318 The other options specify a specific processor.  Code generated under
11319 those options will run best on that processor, and may not run at all on
11320 others.
11322 The @option{-mcpu} options automatically enable or disable the
11323 following options: @option{-maltivec}, @option{-mfprnd},
11324 @option{-mhard-float}, @option{-mmfcrf}, @option{-mmultiple},
11325 @option{-mnew-mnemonics}, @option{-mpopcntb}, @option{-mpower},
11326 @option{-mpower2}, @option{-mpowerpc64}, @option{-mpowerpc-gpopt},
11327 @option{-mpowerpc-gfxopt}, @option{-mstring}, @option{-mmulhw}, @option{dlmzb}.
11328 The particular options
11329 set for any particular CPU will vary between compiler versions,
11330 depending on what setting seems to produce optimal code for that CPU;
11331 it doesn't necessarily reflect the actual hardware's capabilities.  If
11332 you wish to set an individual option to a particular value, you may
11333 specify it after the @option{-mcpu} option, like @samp{-mcpu=970
11334 -mno-altivec}.
11336 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
11337 not enabled or disabled by the @option{-mcpu} option at present because
11338 AIX does not have full support for these options.  You may still
11339 enable or disable them individually if you're sure it'll work in your
11340 environment.
11342 @item -mtune=@var{cpu_type}
11343 @opindex mtune
11344 Set the instruction scheduling parameters for machine type
11345 @var{cpu_type}, but do not set the architecture type, register usage, or
11346 choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would.  The same
11347 values for @var{cpu_type} are used for @option{-mtune} as for
11348 @option{-mcpu}.  If both are specified, the code generated will use the
11349 architecture, registers, and mnemonics set by @option{-mcpu}, but the
11350 scheduling parameters set by @option{-mtune}.
11352 @item -mswdiv
11353 @itemx -mno-swdiv
11354 @opindex mswdiv
11355 @opindex mno-swdiv
11356 Generate code to compute division as reciprocal estimate and iterative
11357 refinement, creating opportunities for increased throughput.  This
11358 feature requires: optional PowerPC Graphics instruction set for single
11359 precision and FRE instruction for double precision, assuming divides
11360 cannot generate user-visible traps, and the domain values not include
11361 Infinities, denormals or zero denominator.
11363 @item -maltivec
11364 @itemx -mno-altivec
11365 @opindex maltivec
11366 @opindex mno-altivec
11367 Generate code that uses (does not use) AltiVec instructions, and also
11368 enable the use of built-in functions that allow more direct access to
11369 the AltiVec instruction set.  You may also need to set
11370 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
11371 enhancements.
11373 @item -mvrsave
11374 @item -mno-vrsave
11375 @opindex mvrsave
11376 @opindex mno-vrsave
11377 Generate VRSAVE instructions when generating AltiVec code.
11379 @item -msecure-plt
11380 @opindex msecure-plt
11381 Generate code that allows ld and ld.so to build executables and shared
11382 libraries with non-exec .plt and .got sections.  This is a PowerPC
11383 32-bit SYSV ABI option.
11385 @item -mbss-plt
11386 @opindex mbss-plt
11387 Generate code that uses a BSS .plt section that ld.so fills in, and
11388 requires .plt and .got sections that are both writable and executable.
11389 This is a PowerPC 32-bit SYSV ABI option.
11391 @item -misel
11392 @itemx -mno-isel
11393 @opindex misel
11394 @opindex mno-isel
11395 This switch enables or disables the generation of ISEL instructions.
11397 @item -misel=@var{yes/no}
11398 This switch has been deprecated.  Use @option{-misel} and
11399 @option{-mno-isel} instead.
11401 @item -mspe
11402 @itemx -mno-isel
11403 @opindex mspe
11404 @opindex mno-spe
11405 This switch enables or disables the generation of SPE simd
11406 instructions.
11408 @item -mspe=@var{yes/no}
11409 This option has been deprecated.  Use @option{-mspe} and
11410 @option{-mno-spe} instead.
11412 @item -mfloat-gprs=@var{yes/single/double/no}
11413 @itemx -mfloat-gprs
11414 @opindex mfloat-gprs
11415 This switch enables or disables the generation of floating point
11416 operations on the general purpose registers for architectures that
11417 support it.
11419 The argument @var{yes} or @var{single} enables the use of
11420 single-precision floating point operations.
11422 The argument @var{double} enables the use of single and
11423 double-precision floating point operations.
11425 The argument @var{no} disables floating point operations on the
11426 general purpose registers.
11428 This option is currently only available on the MPC854x.
11430 @item -m32
11431 @itemx -m64
11432 @opindex m32
11433 @opindex m64
11434 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
11435 targets (including GNU/Linux).  The 32-bit environment sets int, long
11436 and pointer to 32 bits and generates code that runs on any PowerPC
11437 variant.  The 64-bit environment sets int to 32 bits and long and
11438 pointer to 64 bits, and generates code for PowerPC64, as for
11439 @option{-mpowerpc64}.
11441 @item -mfull-toc
11442 @itemx -mno-fp-in-toc
11443 @itemx -mno-sum-in-toc
11444 @itemx -mminimal-toc
11445 @opindex mfull-toc
11446 @opindex mno-fp-in-toc
11447 @opindex mno-sum-in-toc
11448 @opindex mminimal-toc
11449 Modify generation of the TOC (Table Of Contents), which is created for
11450 every executable file.  The @option{-mfull-toc} option is selected by
11451 default.  In that case, GCC will allocate at least one TOC entry for
11452 each unique non-automatic variable reference in your program.  GCC
11453 will also place floating-point constants in the TOC@.  However, only
11454 16,384 entries are available in the TOC@.
11456 If you receive a linker error message that saying you have overflowed
11457 the available TOC space, you can reduce the amount of TOC space used
11458 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
11459 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
11460 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
11461 generate code to calculate the sum of an address and a constant at
11462 run-time instead of putting that sum into the TOC@.  You may specify one
11463 or both of these options.  Each causes GCC to produce very slightly
11464 slower and larger code at the expense of conserving TOC space.
11466 If you still run out of space in the TOC even when you specify both of
11467 these options, specify @option{-mminimal-toc} instead.  This option causes
11468 GCC to make only one TOC entry for every file.  When you specify this
11469 option, GCC will produce code that is slower and larger but which
11470 uses extremely little TOC space.  You may wish to use this option
11471 only on files that contain less frequently executed code.
11473 @item -maix64
11474 @itemx -maix32
11475 @opindex maix64
11476 @opindex maix32
11477 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
11478 @code{long} type, and the infrastructure needed to support them.
11479 Specifying @option{-maix64} implies @option{-mpowerpc64} and
11480 @option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
11481 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
11483 @item -mxl-compat
11484 @itemx -mno-xl-compat
11485 @opindex mxl-compat
11486 @opindex mno-xl-compat
11487 Produce code that conforms more closely to IBM XL compiler semantics
11488 when using AIX-compatible ABI.  Pass floating-point arguments to
11489 prototyped functions beyond the register save area (RSA) on the stack
11490 in addition to argument FPRs.  Do not assume that most significant
11491 double in 128-bit long double value is properly rounded when comparing
11492 values and converting to double.  Use XL symbol names for long double
11493 support routines.
11495 The AIX calling convention was extended but not initially documented to
11496 handle an obscure K&R C case of calling a function that takes the
11497 address of its arguments with fewer arguments than declared.  IBM XL
11498 compilers access floating point arguments which do not fit in the
11499 RSA from the stack when a subroutine is compiled without
11500 optimization.  Because always storing floating-point arguments on the
11501 stack is inefficient and rarely needed, this option is not enabled by
11502 default and only is necessary when calling subroutines compiled by IBM
11503 XL compilers without optimization.
11505 @item -mpe
11506 @opindex mpe
11507 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
11508 application written to use message passing with special startup code to
11509 enable the application to run.  The system must have PE installed in the
11510 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
11511 must be overridden with the @option{-specs=} option to specify the
11512 appropriate directory location.  The Parallel Environment does not
11513 support threads, so the @option{-mpe} option and the @option{-pthread}
11514 option are incompatible.
11516 @item -malign-natural
11517 @itemx -malign-power
11518 @opindex malign-natural
11519 @opindex malign-power
11520 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
11521 @option{-malign-natural} overrides the ABI-defined alignment of larger
11522 types, such as floating-point doubles, on their natural size-based boundary.
11523 The option @option{-malign-power} instructs GCC to follow the ABI-specified
11524 alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
11526 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
11527 is not supported.
11529 @item -msoft-float
11530 @itemx -mhard-float
11531 @opindex msoft-float
11532 @opindex mhard-float
11533 Generate code that does not use (uses) the floating-point register set.
11534 Software floating point emulation is provided if you use the
11535 @option{-msoft-float} option, and pass the option to GCC when linking.
11537 @item -mmultiple
11538 @itemx -mno-multiple
11539 @opindex mmultiple
11540 @opindex mno-multiple
11541 Generate code that uses (does not use) the load multiple word
11542 instructions and the store multiple word instructions.  These
11543 instructions are generated by default on POWER systems, and not
11544 generated on PowerPC systems.  Do not use @option{-mmultiple} on little
11545 endian PowerPC systems, since those instructions do not work when the
11546 processor is in little endian mode.  The exceptions are PPC740 and
11547 PPC750 which permit the instructions usage in little endian mode.
11549 @item -mstring
11550 @itemx -mno-string
11551 @opindex mstring
11552 @opindex mno-string
11553 Generate code that uses (does not use) the load string instructions
11554 and the store string word instructions to save multiple registers and
11555 do small block moves.  These instructions are generated by default on
11556 POWER systems, and not generated on PowerPC systems.  Do not use
11557 @option{-mstring} on little endian PowerPC systems, since those
11558 instructions do not work when the processor is in little endian mode.
11559 The exceptions are PPC740 and PPC750 which permit the instructions
11560 usage in little endian mode.
11562 @item -mupdate
11563 @itemx -mno-update
11564 @opindex mupdate
11565 @opindex mno-update
11566 Generate code that uses (does not use) the load or store instructions
11567 that update the base register to the address of the calculated memory
11568 location.  These instructions are generated by default.  If you use
11569 @option{-mno-update}, there is a small window between the time that the
11570 stack pointer is updated and the address of the previous frame is
11571 stored, which means code that walks the stack frame across interrupts or
11572 signals may get corrupted data.
11574 @item -mfused-madd
11575 @itemx -mno-fused-madd
11576 @opindex mfused-madd
11577 @opindex mno-fused-madd
11578 Generate code that uses (does not use) the floating point multiply and
11579 accumulate instructions.  These instructions are generated by default if
11580 hardware floating is used.
11582 @item -mmulhw
11583 @itemx -mno-mulhw
11584 @opindex mmulhw
11585 @opindex mno-mulhw
11586 Generate code that uses (does not use) the half-word multiply and
11587 multiply-accumulate instructions on the IBM 405 and 440 processors.
11588 These instructions are generated by default when targetting those
11589 processors.
11591 @item -mdlmzb
11592 @itemx -mno-dlmzb
11593 @opindex mdlmzb
11594 @opindex mno-dlmzb
11595 Generate code that uses (does not use) the string-search @samp{dlmzb}
11596 instruction on the IBM 405 and 440 processors.  This instruction is
11597 generated by default when targetting those processors.
11599 @item -mno-bit-align
11600 @itemx -mbit-align
11601 @opindex mno-bit-align
11602 @opindex mbit-align
11603 On System V.4 and embedded PowerPC systems do not (do) force structures
11604 and unions that contain bit-fields to be aligned to the base type of the
11605 bit-field.
11607 For example, by default a structure containing nothing but 8
11608 @code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
11609 boundary and have a size of 4 bytes.  By using @option{-mno-bit-align},
11610 the structure would be aligned to a 1 byte boundary and be one byte in
11611 size.
11613 @item -mno-strict-align
11614 @itemx -mstrict-align
11615 @opindex mno-strict-align
11616 @opindex mstrict-align
11617 On System V.4 and embedded PowerPC systems do not (do) assume that
11618 unaligned memory references will be handled by the system.
11620 @item -mrelocatable
11621 @itemx -mno-relocatable
11622 @opindex mrelocatable
11623 @opindex mno-relocatable
11624 On embedded PowerPC systems generate code that allows (does not allow)
11625 the program to be relocated to a different address at runtime.  If you
11626 use @option{-mrelocatable} on any module, all objects linked together must
11627 be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
11629 @item -mrelocatable-lib
11630 @itemx -mno-relocatable-lib
11631 @opindex mrelocatable-lib
11632 @opindex mno-relocatable-lib
11633 On embedded PowerPC systems generate code that allows (does not allow)
11634 the program to be relocated to a different address at runtime.  Modules
11635 compiled with @option{-mrelocatable-lib} can be linked with either modules
11636 compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
11637 with modules compiled with the @option{-mrelocatable} options.
11639 @item -mno-toc
11640 @itemx -mtoc
11641 @opindex mno-toc
11642 @opindex mtoc
11643 On System V.4 and embedded PowerPC systems do not (do) assume that
11644 register 2 contains a pointer to a global area pointing to the addresses
11645 used in the program.
11647 @item -mlittle
11648 @itemx -mlittle-endian
11649 @opindex mlittle
11650 @opindex mlittle-endian
11651 On System V.4 and embedded PowerPC systems compile code for the
11652 processor in little endian mode.  The @option{-mlittle-endian} option is
11653 the same as @option{-mlittle}.
11655 @item -mbig
11656 @itemx -mbig-endian
11657 @opindex mbig
11658 @opindex mbig-endian
11659 On System V.4 and embedded PowerPC systems compile code for the
11660 processor in big endian mode.  The @option{-mbig-endian} option is
11661 the same as @option{-mbig}.
11663 @item -mdynamic-no-pic
11664 @opindex mdynamic-no-pic
11665 On Darwin and Mac OS X systems, compile code so that it is not
11666 relocatable, but that its external references are relocatable.  The
11667 resulting code is suitable for applications, but not shared
11668 libraries.
11670 @item -mprioritize-restricted-insns=@var{priority}
11671 @opindex mprioritize-restricted-insns
11672 This option controls the priority that is assigned to
11673 dispatch-slot restricted instructions during the second scheduling
11674 pass.  The argument @var{priority} takes the value @var{0/1/2} to assign
11675 @var{no/highest/second-highest} priority to dispatch slot restricted
11676 instructions.
11678 @item -msched-costly-dep=@var{dependence_type}
11679 @opindex msched-costly-dep
11680 This option controls which dependences are considered costly
11681 by the target during instruction scheduling.  The argument
11682 @var{dependence_type} takes one of the following values:
11683 @var{no}: no dependence is costly,
11684 @var{all}: all dependences are costly,
11685 @var{true_store_to_load}: a true dependence from store to load is costly,
11686 @var{store_to_load}: any dependence from store to load is costly,
11687 @var{number}: any dependence which latency >= @var{number} is costly.
11689 @item -minsert-sched-nops=@var{scheme}
11690 @opindex minsert-sched-nops
11691 This option controls which nop insertion scheme will be used during
11692 the second scheduling pass.  The argument @var{scheme} takes one of the
11693 following values:
11694 @var{no}: Don't insert nops.
11695 @var{pad}: Pad with nops any dispatch group which has vacant issue slots,
11696 according to the scheduler's grouping.
11697 @var{regroup_exact}: Insert nops to force costly dependent insns into
11698 separate groups.  Insert exactly as many nops as needed to force an insn
11699 to a new group, according to the estimated processor grouping.
11700 @var{number}: Insert nops to force costly dependent insns into
11701 separate groups.  Insert @var{number} nops to force an insn to a new group.
11703 @item -mcall-sysv
11704 @opindex mcall-sysv
11705 On System V.4 and embedded PowerPC systems compile code using calling
11706 conventions that adheres to the March 1995 draft of the System V
11707 Application Binary Interface, PowerPC processor supplement.  This is the
11708 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
11710 @item -mcall-sysv-eabi
11711 @opindex mcall-sysv-eabi
11712 Specify both @option{-mcall-sysv} and @option{-meabi} options.
11714 @item -mcall-sysv-noeabi
11715 @opindex mcall-sysv-noeabi
11716 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
11718 @item -mcall-solaris
11719 @opindex mcall-solaris
11720 On System V.4 and embedded PowerPC systems compile code for the Solaris
11721 operating system.
11723 @item -mcall-linux
11724 @opindex mcall-linux
11725 On System V.4 and embedded PowerPC systems compile code for the
11726 Linux-based GNU system.
11728 @item -mcall-gnu
11729 @opindex mcall-gnu
11730 On System V.4 and embedded PowerPC systems compile code for the
11731 Hurd-based GNU system.
11733 @item -mcall-netbsd
11734 @opindex mcall-netbsd
11735 On System V.4 and embedded PowerPC systems compile code for the
11736 NetBSD operating system.
11738 @item -maix-struct-return
11739 @opindex maix-struct-return
11740 Return all structures in memory (as specified by the AIX ABI)@.
11742 @item -msvr4-struct-return
11743 @opindex msvr4-struct-return
11744 Return structures smaller than 8 bytes in registers (as specified by the
11745 SVR4 ABI)@.
11747 @item -mabi=@var{abi-type}
11748 @opindex mabi
11749 Extend the current ABI with a particular extension, or remove such extension.
11750 Valid values are @var{altivec}, @var{no-altivec}, @var{spe},
11751 @var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@.
11753 @item -mabi=spe
11754 @opindex mabi=spe
11755 Extend the current ABI with SPE ABI extensions.  This does not change
11756 the default ABI, instead it adds the SPE ABI extensions to the current
11757 ABI@.
11759 @item -mabi=no-spe
11760 @opindex mabi=no-spe
11761 Disable Booke SPE ABI extensions for the current ABI@.
11763 @item -mabi=ibmlongdouble
11764 @opindex mabi=ibmlongdouble
11765 Change the current ABI to use IBM extended precision long double.
11766 This is a PowerPC 32-bit SYSV ABI option.
11768 @item -mabi=ieeelongdouble
11769 @opindex mabi=ieeelongdouble
11770 Change the current ABI to use IEEE extended precision long double.
11771 This is a PowerPC 32-bit Linux ABI option.
11773 @item -mprototype
11774 @itemx -mno-prototype
11775 @opindex mprototype
11776 @opindex mno-prototype
11777 On System V.4 and embedded PowerPC systems assume that all calls to
11778 variable argument functions are properly prototyped.  Otherwise, the
11779 compiler must insert an instruction before every non prototyped call to
11780 set or clear bit 6 of the condition code register (@var{CR}) to
11781 indicate whether floating point values were passed in the floating point
11782 registers in case the function takes a variable arguments.  With
11783 @option{-mprototype}, only calls to prototyped variable argument functions
11784 will set or clear the bit.
11786 @item -msim
11787 @opindex msim
11788 On embedded PowerPC systems, assume that the startup module is called
11789 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
11790 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}.
11791 configurations.
11793 @item -mmvme
11794 @opindex mmvme
11795 On embedded PowerPC systems, assume that the startup module is called
11796 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
11797 @file{libc.a}.
11799 @item -mads
11800 @opindex mads
11801 On embedded PowerPC systems, assume that the startup module is called
11802 @file{crt0.o} and the standard C libraries are @file{libads.a} and
11803 @file{libc.a}.
11805 @item -myellowknife
11806 @opindex myellowknife
11807 On embedded PowerPC systems, assume that the startup module is called
11808 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
11809 @file{libc.a}.
11811 @item -mvxworks
11812 @opindex mvxworks
11813 On System V.4 and embedded PowerPC systems, specify that you are
11814 compiling for a VxWorks system.
11816 @item -mwindiss
11817 @opindex mwindiss
11818 Specify that you are compiling for the WindISS simulation environment.
11820 @item -memb
11821 @opindex memb
11822 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
11823 header to indicate that @samp{eabi} extended relocations are used.
11825 @item -meabi
11826 @itemx -mno-eabi
11827 @opindex meabi
11828 @opindex mno-eabi
11829 On System V.4 and embedded PowerPC systems do (do not) adhere to the
11830 Embedded Applications Binary Interface (eabi) which is a set of
11831 modifications to the System V.4 specifications.  Selecting @option{-meabi}
11832 means that the stack is aligned to an 8 byte boundary, a function
11833 @code{__eabi} is called to from @code{main} to set up the eabi
11834 environment, and the @option{-msdata} option can use both @code{r2} and
11835 @code{r13} to point to two separate small data areas.  Selecting
11836 @option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
11837 do not call an initialization function from @code{main}, and the
11838 @option{-msdata} option will only use @code{r13} to point to a single
11839 small data area.  The @option{-meabi} option is on by default if you
11840 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
11842 @item -msdata=eabi
11843 @opindex msdata=eabi
11844 On System V.4 and embedded PowerPC systems, put small initialized
11845 @code{const} global and static data in the @samp{.sdata2} section, which
11846 is pointed to by register @code{r2}.  Put small initialized
11847 non-@code{const} global and static data in the @samp{.sdata} section,
11848 which is pointed to by register @code{r13}.  Put small uninitialized
11849 global and static data in the @samp{.sbss} section, which is adjacent to
11850 the @samp{.sdata} section.  The @option{-msdata=eabi} option is
11851 incompatible with the @option{-mrelocatable} option.  The
11852 @option{-msdata=eabi} option also sets the @option{-memb} option.
11854 @item -msdata=sysv
11855 @opindex msdata=sysv
11856 On System V.4 and embedded PowerPC systems, put small global and static
11857 data in the @samp{.sdata} section, which is pointed to by register
11858 @code{r13}.  Put small uninitialized global and static data in the
11859 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
11860 The @option{-msdata=sysv} option is incompatible with the
11861 @option{-mrelocatable} option.
11863 @item -msdata=default
11864 @itemx -msdata
11865 @opindex msdata=default
11866 @opindex msdata
11867 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
11868 compile code the same as @option{-msdata=eabi}, otherwise compile code the
11869 same as @option{-msdata=sysv}.
11871 @item -msdata-data
11872 @opindex msdata-data
11873 On System V.4 and embedded PowerPC systems, put small global
11874 data in the @samp{.sdata} section.  Put small uninitialized global
11875 data in the @samp{.sbss} section.  Do not use register @code{r13}
11876 to address small data however.  This is the default behavior unless
11877 other @option{-msdata} options are used.
11879 @item -msdata=none
11880 @itemx -mno-sdata
11881 @opindex msdata=none
11882 @opindex mno-sdata
11883 On embedded PowerPC systems, put all initialized global and static data
11884 in the @samp{.data} section, and all uninitialized data in the
11885 @samp{.bss} section.
11887 @item -G @var{num}
11888 @opindex G
11889 @cindex smaller data references (PowerPC)
11890 @cindex .sdata/.sdata2 references (PowerPC)
11891 On embedded PowerPC systems, put global and static items less than or
11892 equal to @var{num} bytes into the small data or bss sections instead of
11893 the normal data or bss section.  By default, @var{num} is 8.  The
11894 @option{-G @var{num}} switch is also passed to the linker.
11895 All modules should be compiled with the same @option{-G @var{num}} value.
11897 @item -mregnames
11898 @itemx -mno-regnames
11899 @opindex mregnames
11900 @opindex mno-regnames
11901 On System V.4 and embedded PowerPC systems do (do not) emit register
11902 names in the assembly language output using symbolic forms.
11904 @item -mlongcall
11905 @itemx -mno-longcall
11906 @opindex mlongcall
11907 @opindex mno-longcall
11908 Default to making all function calls indirectly, using a register, so
11909 that functions which reside further than 32 megabytes (33,554,432
11910 bytes) from the current location can be called.  This setting can be
11911 overridden by the @code{shortcall} function attribute, or by
11912 @code{#pragma longcall(0)}.
11914 Some linkers are capable of detecting out-of-range calls and generating
11915 glue code on the fly.  On these systems, long calls are unnecessary and
11916 generate slower code.  As of this writing, the AIX linker can do this,
11917 as can the GNU linker for PowerPC/64.  It is planned to add this feature
11918 to the GNU linker for 32-bit PowerPC systems as well.
11920 On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr
11921 callee, L42'', plus a ``branch island'' (glue code).  The two target
11922 addresses represent the callee and the ``branch island''.  The
11923 Darwin/PPC linker will prefer the first address and generate a ``bl
11924 callee'' if the PPC ``bl'' instruction will reach the callee directly;
11925 otherwise, the linker will generate ``bl L42'' to call the ``branch
11926 island''.  The ``branch island'' is appended to the body of the
11927 calling function; it computes the full 32-bit address of the callee
11928 and jumps to it.
11930 On Mach-O (Darwin) systems, this option directs the compiler emit to
11931 the glue for every direct call, and the Darwin linker decides whether
11932 to use or discard it.
11934 In the future, we may cause GCC to ignore all longcall specifications
11935 when the linker is known to generate glue.
11937 @item -pthread
11938 @opindex pthread
11939 Adds support for multithreading with the @dfn{pthreads} library.
11940 This option sets flags for both the preprocessor and linker.
11942 @end table
11944 @node S/390 and zSeries Options
11945 @subsection S/390 and zSeries Options
11946 @cindex S/390 and zSeries Options
11948 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
11950 @table @gcctabopt
11951 @item -mhard-float
11952 @itemx -msoft-float
11953 @opindex mhard-float
11954 @opindex msoft-float
11955 Use (do not use) the hardware floating-point instructions and registers
11956 for floating-point operations.  When @option{-msoft-float} is specified,
11957 functions in @file{libgcc.a} will be used to perform floating-point
11958 operations.  When @option{-mhard-float} is specified, the compiler
11959 generates IEEE floating-point instructions.  This is the default.
11961 @item -mlong-double-64
11962 @itemx -mlong-double-128
11963 @opindex mlong-double-64
11964 @opindex mlong-double-128
11965 These switches control the size of @code{long double} type. A size
11966 of 64bit makes the @code{long double} type equivalent to the @code{double}
11967 type. This is the default.
11969 @item -mbackchain
11970 @itemx -mno-backchain
11971 @opindex mbackchain
11972 @opindex mno-backchain
11973 Store (do not store) the address of the caller's frame as backchain pointer
11974 into the callee's stack frame.
11975 A backchain may be needed to allow debugging using tools that do not understand
11976 DWARF-2 call frame information.
11977 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
11978 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
11979 the backchain is placed into the topmost word of the 96/160 byte register
11980 save area.
11982 In general, code compiled with @option{-mbackchain} is call-compatible with
11983 code compiled with @option{-mmo-backchain}; however, use of the backchain
11984 for debugging purposes usually requires that the whole binary is built with
11985 @option{-mbackchain}.  Note that the combination of @option{-mbackchain},
11986 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
11987 to build a linux kernel use @option{-msoft-float}.
11989 The default is to not maintain the backchain.
11991 @item -mpacked-stack
11992 @item -mno-packed-stack
11993 @opindex mpacked-stack
11994 @opindex mno-packed-stack
11995 Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
11996 specified, the compiler uses the all fields of the 96/160 byte register save
11997 area only for their default purpose; unused fields still take up stack space.
11998 When @option{-mpacked-stack} is specified, register save slots are densely
11999 packed at the top of the register save area; unused space is reused for other
12000 purposes, allowing for more efficient use of the available stack space.
12001 However, when @option{-mbackchain} is also in effect, the topmost word of
12002 the save area is always used to store the backchain, and the return address
12003 register is always saved two words below the backchain.
12005 As long as the stack frame backchain is not used, code generated with
12006 @option{-mpacked-stack} is call-compatible with code generated with
12007 @option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
12008 S/390 or zSeries generated code that uses the stack frame backchain at run
12009 time, not just for debugging purposes.  Such code is not call-compatible
12010 with code compiled with @option{-mpacked-stack}.  Also, note that the
12011 combination of @option{-mbackchain},
12012 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
12013 to build a linux kernel use @option{-msoft-float}.
12015 The default is to not use the packed stack layout.
12017 @item -msmall-exec
12018 @itemx -mno-small-exec
12019 @opindex msmall-exec
12020 @opindex mno-small-exec
12021 Generate (or do not generate) code using the @code{bras} instruction
12022 to do subroutine calls.
12023 This only works reliably if the total executable size does not
12024 exceed 64k.  The default is to use the @code{basr} instruction instead,
12025 which does not have this limitation.
12027 @item -m64
12028 @itemx -m31
12029 @opindex m64
12030 @opindex m31
12031 When @option{-m31} is specified, generate code compliant to the
12032 GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
12033 code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
12034 particular to generate 64-bit instructions.  For the @samp{s390}
12035 targets, the default is @option{-m31}, while the @samp{s390x}
12036 targets default to @option{-m64}.
12038 @item -mzarch
12039 @itemx -mesa
12040 @opindex mzarch
12041 @opindex mesa
12042 When @option{-mzarch} is specified, generate code using the
12043 instructions available on z/Architecture.
12044 When @option{-mesa} is specified, generate code using the
12045 instructions available on ESA/390.  Note that @option{-mesa} is
12046 not possible with @option{-m64}.
12047 When generating code compliant to the GNU/Linux for S/390 ABI,
12048 the default is @option{-mesa}.  When generating code compliant
12049 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
12051 @item -mmvcle
12052 @itemx -mno-mvcle
12053 @opindex mmvcle
12054 @opindex mno-mvcle
12055 Generate (or do not generate) code using the @code{mvcle} instruction
12056 to perform block moves.  When @option{-mno-mvcle} is specified,
12057 use a @code{mvc} loop instead.  This is the default unless optimizing for
12058 size.
12060 @item -mdebug
12061 @itemx -mno-debug
12062 @opindex mdebug
12063 @opindex mno-debug
12064 Print (or do not print) additional debug information when compiling.
12065 The default is to not print debug information.
12067 @item -march=@var{cpu-type}
12068 @opindex march
12069 Generate code that will run on @var{cpu-type}, which is the name of a system
12070 representing a certain processor type.  Possible values for
12071 @var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}.
12072 When generating code using the instructions available on z/Architecture,
12073 the default is @option{-march=z900}.  Otherwise, the default is
12074 @option{-march=g5}.
12076 @item -mtune=@var{cpu-type}
12077 @opindex mtune
12078 Tune to @var{cpu-type} everything applicable about the generated code,
12079 except for the ABI and the set of available instructions.
12080 The list of @var{cpu-type} values is the same as for @option{-march}.
12081 The default is the value used for @option{-march}.
12083 @item -mtpf-trace
12084 @itemx -mno-tpf-trace
12085 @opindex mtpf-trace
12086 @opindex mno-tpf-trace
12087 Generate code that adds (does not add) in TPF OS specific branches to trace
12088 routines in the operating system.  This option is off by default, even
12089 when compiling for the TPF OS@.
12091 @item -mfused-madd
12092 @itemx -mno-fused-madd
12093 @opindex mfused-madd
12094 @opindex mno-fused-madd
12095 Generate code that uses (does not use) the floating point multiply and
12096 accumulate instructions.  These instructions are generated by default if
12097 hardware floating point is used.
12099 @item -mwarn-framesize=@var{framesize}
12100 @opindex mwarn-framesize
12101 Emit a warning if the current function exceeds the given frame size.  Because
12102 this is a compile time check it doesn't need to be a real problem when the program
12103 runs.  It is intended to identify functions which most probably cause
12104 a stack overflow.  It is useful to be used in an environment with limited stack
12105 size e.g.@: the linux kernel.
12107 @item -mwarn-dynamicstack
12108 @opindex mwarn-dynamicstack
12109 Emit a warning if the function calls alloca or uses dynamically
12110 sized arrays.  This is generally a bad idea with a limited stack size.
12112 @item -mstack-guard=@var{stack-guard}
12113 @item -mstack-size=@var{stack-size}
12114 @opindex mstack-guard
12115 @opindex mstack-size
12116 These arguments always have to be used in conjunction.  If they are present the s390
12117 back end emits additional instructions in the function prologue which trigger a trap
12118 if the stack size is @var{stack-guard} bytes above the @var{stack-size}
12119 (remember that the stack on s390 grows downward).  These options are intended to
12120 be used to help debugging stack overflow problems.  The additionally emitted code
12121 causes only little overhead and hence can also be used in production like systems
12122 without greater performance degradation.  The given values have to be exact
12123 powers of 2 and @var{stack-size} has to be greater than @var{stack-guard} without
12124 exceeding 64k.
12125 In order to be efficient the extra code makes the assumption that the stack starts
12126 at an address aligned to the value given by @var{stack-size}.
12127 @end table
12129 @node SH Options
12130 @subsection SH Options
12132 These @samp{-m} options are defined for the SH implementations:
12134 @table @gcctabopt
12135 @item -m1
12136 @opindex m1
12137 Generate code for the SH1.
12139 @item -m2
12140 @opindex m2
12141 Generate code for the SH2.
12143 @item -m2e
12144 Generate code for the SH2e.
12146 @item -m3
12147 @opindex m3
12148 Generate code for the SH3.
12150 @item -m3e
12151 @opindex m3e
12152 Generate code for the SH3e.
12154 @item -m4-nofpu
12155 @opindex m4-nofpu
12156 Generate code for the SH4 without a floating-point unit.
12158 @item -m4-single-only
12159 @opindex m4-single-only
12160 Generate code for the SH4 with a floating-point unit that only
12161 supports single-precision arithmetic.
12163 @item -m4-single
12164 @opindex m4-single
12165 Generate code for the SH4 assuming the floating-point unit is in
12166 single-precision mode by default.
12168 @item -m4
12169 @opindex m4
12170 Generate code for the SH4.
12172 @item -m4a-nofpu
12173 @opindex m4a-nofpu
12174 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
12175 floating-point unit is not used.
12177 @item -m4a-single-only
12178 @opindex m4a-single-only
12179 Generate code for the SH4a, in such a way that no double-precision
12180 floating point operations are used.
12182 @item -m4a-single
12183 @opindex m4a-single
12184 Generate code for the SH4a assuming the floating-point unit is in
12185 single-precision mode by default.
12187 @item -m4a
12188 @opindex m4a
12189 Generate code for the SH4a.
12191 @item -m4al
12192 @opindex m4al
12193 Same as @option{-m4a-nofpu}, except that it implicitly passes
12194 @option{-dsp} to the assembler.  GCC doesn't generate any DSP
12195 instructions at the moment.
12197 @item -mb
12198 @opindex mb
12199 Compile code for the processor in big endian mode.
12201 @item -ml
12202 @opindex ml
12203 Compile code for the processor in little endian mode.
12205 @item -mdalign
12206 @opindex mdalign
12207 Align doubles at 64-bit boundaries.  Note that this changes the calling
12208 conventions, and thus some functions from the standard C library will
12209 not work unless you recompile it first with @option{-mdalign}.
12211 @item -mrelax
12212 @opindex mrelax
12213 Shorten some address references at link time, when possible; uses the
12214 linker option @option{-relax}.
12216 @item -mbigtable
12217 @opindex mbigtable
12218 Use 32-bit offsets in @code{switch} tables.  The default is to use
12219 16-bit offsets.
12221 @item -mfmovd
12222 @opindex mfmovd
12223 Enable the use of the instruction @code{fmovd}.
12225 @item -mhitachi
12226 @opindex mhitachi
12227 Comply with the calling conventions defined by Renesas.
12229 @item -mrenesas
12230 @opindex mhitachi
12231 Comply with the calling conventions defined by Renesas.
12233 @item -mno-renesas
12234 @opindex mhitachi
12235 Comply with the calling conventions defined for GCC before the Renesas
12236 conventions were available.  This option is the default for all
12237 targets of the SH toolchain except for @samp{sh-symbianelf}.
12239 @item -mnomacsave
12240 @opindex mnomacsave
12241 Mark the @code{MAC} register as call-clobbered, even if
12242 @option{-mhitachi} is given.
12244 @item -mieee
12245 @opindex mieee
12246 Increase IEEE-compliance of floating-point code.
12247 At the moment, this is equivalent to @option{-fno-finite-math-only}.
12248 When generating 16 bit SH opcodes, getting IEEE-conforming results for
12249 comparisons of NANs / infinities incurs extra overhead in every
12250 floating point comparison, therefore the default is set to
12251 @option{-ffinite-math-only}.
12253 @item -misize
12254 @opindex misize
12255 Dump instruction size and location in the assembly code.
12257 @item -mpadstruct
12258 @opindex mpadstruct
12259 This option is deprecated.  It pads structures to multiple of 4 bytes,
12260 which is incompatible with the SH ABI@.
12262 @item -mspace
12263 @opindex mspace
12264 Optimize for space instead of speed.  Implied by @option{-Os}.
12266 @item -mprefergot
12267 @opindex mprefergot
12268 When generating position-independent code, emit function calls using
12269 the Global Offset Table instead of the Procedure Linkage Table.
12271 @item -musermode
12272 @opindex musermode
12273 Generate a library function call to invalidate instruction cache
12274 entries, after fixing up a trampoline.  This library function call
12275 doesn't assume it can write to the whole memory address space.  This
12276 is the default when the target is @code{sh-*-linux*}.
12278 @item -multcost=@var{number}
12279 @opindex multcost=@var{number}
12280 Set the cost to assume for a multiply insn.
12282 @item -mdiv=@var{strategy}
12283 @opindex mdiv=@var{strategy}
12284 Set the division strategy to use for SHmedia code.  @var{strategy} must be
12285 one of: call, call2, fp, inv, inv:minlat, inv20u, inv20l, inv:call,
12286 inv:call2, inv:fp .
12287 "fp" performs the operation in floating point.  This has a very high latency,
12288 but needs only a few instructions, so it might be a good choice if
12289 your code has enough easily exploitable ILP to allow the compiler to
12290 schedule the floating point instructions together with other instructions.
12291 Division by zero causes a floating point exception.
12292 "inv" uses integer operations to calculate the inverse of the divisor,
12293 and then multiplies the dividend with the inverse.  This strategy allows
12294 cse and hoisting of the inverse calculation.  Division by zero calculates
12295 an unspecified result, but does not trap.
12296 "inv:minlat" is a variant of "inv" where if no cse / hoisting opportunities
12297 have been found, or if the entire operation has been hoisted to the same
12298 place, the last stages of the inverse calculation are intertwined with the
12299 final multiply to reduce the overall latency, at the expense of using a few
12300 more instructions, and thus offering fewer scheduling opportunities with
12301 other code.
12302 "call" calls a library function that usually implements the inv:minlat
12303 strategy.
12304 This gives high code density for m5-*media-nofpu compilations.
12305 "call2" uses a different entry point of the same library function, where it
12306 assumes that a pointer to a lookup table has already been set up, which
12307 exposes the pointer load to cse / code hoisting optimizations.
12308 "inv:call", "inv:call2" and "inv:fp" all use the "inv" algorithm for initial
12309 code generation, but if the code stays unoptimized, revert to the "call",
12310 "call2", or "fp" strategies, respectively.  Note that the
12311 potentially-trapping side effect of division by zero is carried by a
12312 separate instruction, so it is possible that all the integer instructions
12313 are hoisted out, but the marker for the side effect stays where it is.
12314 A recombination to fp operations or a call is not possible in that case.
12315 "inv20u" and "inv20l" are variants of the "inv:minlat" strategy.  In the case
12316 that the inverse calculation was nor separated from the multiply, they speed
12317 up division where the dividend fits into 20 bits (plus sign where applicable),
12318 by inserting a test to skip a number of operations in this case; this test
12319 slows down the case of larger dividends.  inv20u assumes the case of a such
12320 a small dividend to be unlikely, and inv20l assumes it to be likely.
12322 @item -mdivsi3_libfunc=@var{name}
12323 @opindex mdivsi3_libfunc=@var{name}
12324 Set the name of the library function used for 32 bit signed division to
12325 @var{name}.  This only affect the name used in the call and inv:call
12326 division strategies, and the compiler will still expect the same
12327 sets of input/output/clobbered registers as if this option was not present.
12329 @item -madjust-unroll
12330 @opindex madjust-unroll
12331 Throttle unrolling to avoid thrashing target registers.
12332 This option only has an effect if the gcc code base supports the
12333 TARGET_ADJUST_UNROLL_MAX target hook.
12335 @item -mindexed-addressing
12336 @opindex mindexed-addressing
12337 Enable the use of the indexed addressing mode for SHmedia32/SHcompact.
12338 This is only safe if the hardware and/or OS implement 32 bit wrap-around
12339 semantics for the indexed addressing mode.  The architecture allows the
12340 implementation of processors with 64 bit MMU, which the OS could use to
12341 get 32 bit addressing, but since no current hardware implementation supports
12342 this or any other way to make the indexed addressing mode safe to use in
12343 the 32 bit ABI, the default is -mno-indexed-addressing.
12345 @item -mgettrcost=@var{number}
12346 @opindex mgettrcost=@var{number}
12347 Set the cost assumed for the gettr instruction to @var{number}.
12348 The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise.
12350 @item -mpt-fixed
12351 @opindex mpt-fixed
12352 Assume pt* instructions won't trap.  This will generally generate better
12353 scheduled code, but is unsafe on current hardware.  The current architecture
12354 definition says that ptabs and ptrel trap when the target anded with 3 is 3.
12355 This has the unintentional effect of making it unsafe to schedule ptabs /
12356 ptrel before a branch, or hoist it out of a loop.  For example,
12357 __do_global_ctors, a part of libgcc that runs constructors at program
12358 startup, calls functions in a list which is delimited by -1.  With the
12359 -mpt-fixed option, the ptabs will be done before testing against -1.
12360 That means that all the constructors will be run a bit quicker, but when
12361 the loop comes to the end of the list, the program crashes because ptabs
12362 loads -1 into a target register.  Since this option is unsafe for any
12363 hardware implementing the current architecture specification, the default
12364 is -mno-pt-fixed.  Unless the user specifies a specific cost with
12365 @option{-mgettrcost}, -mno-pt-fixed also implies @option{-mgettrcost=100};
12366 this deters register allocation using target registers for storing
12367 ordinary integers.
12369 @item -minvalid-symbols
12370 @opindex minvalid-symbols
12371 Assume symbols might be invalid.  Ordinary function symbols generated by
12372 the compiler will always be valid to load with movi/shori/ptabs or
12373 movi/shori/ptrel, but with assembler and/or linker tricks it is possible
12374 to generate symbols that will cause ptabs / ptrel to trap.
12375 This option is only meaningful when @option{-mno-pt-fixed} is in effect.
12376 It will then prevent cross-basic-block cse, hoisting and most scheduling
12377 of symbol loads.  The default is @option{-mno-invalid-symbols}.
12378 @end table
12380 @node SPARC Options
12381 @subsection SPARC Options
12382 @cindex SPARC options
12384 These @samp{-m} options are supported on the SPARC:
12386 @table @gcctabopt
12387 @item -mno-app-regs
12388 @itemx -mapp-regs
12389 @opindex mno-app-regs
12390 @opindex mapp-regs
12391 Specify @option{-mapp-regs} to generate output using the global registers
12392 2 through 4, which the SPARC SVR4 ABI reserves for applications.  This
12393 is the default.
12395 To be fully SVR4 ABI compliant at the cost of some performance loss,
12396 specify @option{-mno-app-regs}.  You should compile libraries and system
12397 software with this option.
12399 @item -mfpu
12400 @itemx -mhard-float
12401 @opindex mfpu
12402 @opindex mhard-float
12403 Generate output containing floating point instructions.  This is the
12404 default.
12406 @item -mno-fpu
12407 @itemx -msoft-float
12408 @opindex mno-fpu
12409 @opindex msoft-float
12410 Generate output containing library calls for floating point.
12411 @strong{Warning:} the requisite libraries are not available for all SPARC
12412 targets.  Normally the facilities of the machine's usual C compiler are
12413 used, but this cannot be done directly in cross-compilation.  You must make
12414 your own arrangements to provide suitable library functions for
12415 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
12416 @samp{sparclite-*-*} do provide software floating point support.
12418 @option{-msoft-float} changes the calling convention in the output file;
12419 therefore, it is only useful if you compile @emph{all} of a program with
12420 this option.  In particular, you need to compile @file{libgcc.a}, the
12421 library that comes with GCC, with @option{-msoft-float} in order for
12422 this to work.
12424 @item -mhard-quad-float
12425 @opindex mhard-quad-float
12426 Generate output containing quad-word (long double) floating point
12427 instructions.
12429 @item -msoft-quad-float
12430 @opindex msoft-quad-float
12431 Generate output containing library calls for quad-word (long double)
12432 floating point instructions.  The functions called are those specified
12433 in the SPARC ABI@.  This is the default.
12435 As of this writing, there are no SPARC implementations that have hardware
12436 support for the quad-word floating point instructions.  They all invoke
12437 a trap handler for one of these instructions, and then the trap handler
12438 emulates the effect of the instruction.  Because of the trap handler overhead,
12439 this is much slower than calling the ABI library routines.  Thus the
12440 @option{-msoft-quad-float} option is the default.
12442 @item -mno-unaligned-doubles
12443 @itemx -munaligned-doubles
12444 @opindex mno-unaligned-doubles
12445 @opindex munaligned-doubles
12446 Assume that doubles have 8 byte alignment.  This is the default.
12448 With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
12449 alignment only if they are contained in another type, or if they have an
12450 absolute address.  Otherwise, it assumes they have 4 byte alignment.
12451 Specifying this option avoids some rare compatibility problems with code
12452 generated by other compilers.  It is not the default because it results
12453 in a performance loss, especially for floating point code.
12455 @item -mno-faster-structs
12456 @itemx -mfaster-structs
12457 @opindex mno-faster-structs
12458 @opindex mfaster-structs
12459 With @option{-mfaster-structs}, the compiler assumes that structures
12460 should have 8 byte alignment.  This enables the use of pairs of
12461 @code{ldd} and @code{std} instructions for copies in structure
12462 assignment, in place of twice as many @code{ld} and @code{st} pairs.
12463 However, the use of this changed alignment directly violates the SPARC
12464 ABI@.  Thus, it's intended only for use on targets where the developer
12465 acknowledges that their resulting code will not be directly in line with
12466 the rules of the ABI@.
12468 @item -mimpure-text
12469 @opindex mimpure-text
12470 @option{-mimpure-text}, used in addition to @option{-shared}, tells
12471 the compiler to not pass @option{-z text} to the linker when linking a
12472 shared object.  Using this option, you can link position-dependent
12473 code into a shared object.
12475 @option{-mimpure-text} suppresses the ``relocations remain against
12476 allocatable but non-writable sections'' linker error message.
12477 However, the necessary relocations will trigger copy-on-write, and the
12478 shared object is not actually shared across processes.  Instead of
12479 using @option{-mimpure-text}, you should compile all source code with
12480 @option{-fpic} or @option{-fPIC}.
12482 This option is only available on SunOS and Solaris.
12484 @item -mcpu=@var{cpu_type}
12485 @opindex mcpu
12486 Set the instruction set, register set, and instruction scheduling parameters
12487 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
12488 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
12489 @samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x},
12490 @samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc},
12491 @samp{ultrasparc3}, and @samp{niagara}.
12493 Default instruction scheduling parameters are used for values that select
12494 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
12495 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
12497 Here is a list of each supported architecture and their supported
12498 implementations.
12500 @smallexample
12501     v7:             cypress
12502     v8:             supersparc, hypersparc
12503     sparclite:      f930, f934, sparclite86x
12504     sparclet:       tsc701
12505     v9:             ultrasparc, ultrasparc3, niagara
12506 @end smallexample
12508 By default (unless configured otherwise), GCC generates code for the V7
12509 variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
12510 additionally optimizes it for the Cypress CY7C602 chip, as used in the
12511 SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
12512 SPARCStation 1, 2, IPX etc.
12514 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
12515 architecture.  The only difference from V7 code is that the compiler emits
12516 the integer multiply and integer divide instructions which exist in SPARC-V8
12517 but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
12518 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
12519 2000 series.
12521 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
12522 the SPARC architecture.  This adds the integer multiply, integer divide step
12523 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
12524 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
12525 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
12526 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
12527 MB86934 chip, which is the more recent SPARClite with FPU@.
12529 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
12530 the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
12531 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
12532 but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
12533 optimizes it for the TEMIC SPARClet chip.
12535 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
12536 architecture.  This adds 64-bit integer and floating-point move instructions,
12537 3 additional floating-point condition code registers and conditional move
12538 instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
12539 optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
12540 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
12541 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
12542 @option{-mcpu=niagara}, the compiler additionally optimizes it for
12543 Sun UltraSPARC T1 chips.
12545 @item -mtune=@var{cpu_type}
12546 @opindex mtune
12547 Set the instruction scheduling parameters for machine type
12548 @var{cpu_type}, but do not set the instruction set or register set that the
12549 option @option{-mcpu=@var{cpu_type}} would.
12551 The same values for @option{-mcpu=@var{cpu_type}} can be used for
12552 @option{-mtune=@var{cpu_type}}, but the only useful values are those
12553 that select a particular cpu implementation.  Those are @samp{cypress},
12554 @samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
12555 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
12556 @samp{ultrasparc3}, and @samp{niagara}.
12558 @item -mv8plus
12559 @itemx -mno-v8plus
12560 @opindex mv8plus
12561 @opindex mno-v8plus
12562 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
12563 difference from the V8 ABI is that the global and out registers are
12564 considered 64-bit wide.  This is enabled by default on Solaris in 32-bit
12565 mode for all SPARC-V9 processors.
12567 @item -mvis
12568 @itemx -mno-vis
12569 @opindex mvis
12570 @opindex mno-vis
12571 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
12572 Visual Instruction Set extensions.  The default is @option{-mno-vis}.
12573 @end table
12575 These @samp{-m} options are supported in addition to the above
12576 on SPARC-V9 processors in 64-bit environments:
12578 @table @gcctabopt
12579 @item -mlittle-endian
12580 @opindex mlittle-endian
12581 Generate code for a processor running in little-endian mode.  It is only
12582 available for a few configurations and most notably not on Solaris and Linux.
12584 @item -m32
12585 @itemx -m64
12586 @opindex m32
12587 @opindex m64
12588 Generate code for a 32-bit or 64-bit environment.
12589 The 32-bit environment sets int, long and pointer to 32 bits.
12590 The 64-bit environment sets int to 32 bits and long and pointer
12591 to 64 bits.
12593 @item -mcmodel=medlow
12594 @opindex mcmodel=medlow
12595 Generate code for the Medium/Low code model: 64-bit addresses, programs
12596 must be linked in the low 32 bits of memory.  Programs can be statically
12597 or dynamically linked.
12599 @item -mcmodel=medmid
12600 @opindex mcmodel=medmid
12601 Generate code for the Medium/Middle code model: 64-bit addresses, programs
12602 must be linked in the low 44 bits of memory, the text and data segments must
12603 be less than 2GB in size and the data segment must be located within 2GB of
12604 the text segment.
12606 @item -mcmodel=medany
12607 @opindex mcmodel=medany
12608 Generate code for the Medium/Anywhere code model: 64-bit addresses, programs
12609 may be linked anywhere in memory, the text and data segments must be less
12610 than 2GB in size and the data segment must be located within 2GB of the
12611 text segment.
12613 @item -mcmodel=embmedany
12614 @opindex mcmodel=embmedany
12615 Generate code for the Medium/Anywhere code model for embedded systems:
12616 64-bit addresses, the text and data segments must be less than 2GB in
12617 size, both starting anywhere in memory (determined at link time).  The
12618 global register %g4 points to the base of the data segment.  Programs
12619 are statically linked and PIC is not supported.
12621 @item -mstack-bias
12622 @itemx -mno-stack-bias
12623 @opindex mstack-bias
12624 @opindex mno-stack-bias
12625 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
12626 frame pointer if present, are offset by @minus{}2047 which must be added back
12627 when making stack frame references.  This is the default in 64-bit mode.
12628 Otherwise, assume no such offset is present.
12629 @end table
12631 These switches are supported in addition to the above on Solaris:
12633 @table @gcctabopt
12634 @item -threads
12635 @opindex threads
12636 Add support for multithreading using the Solaris threads library.  This
12637 option sets flags for both the preprocessor and linker.  This option does
12638 not affect the thread safety of object code produced by the compiler or
12639 that of libraries supplied with it.
12641 @item -pthreads
12642 @opindex pthreads
12643 Add support for multithreading using the POSIX threads library.  This
12644 option sets flags for both the preprocessor and linker.  This option does
12645 not affect the thread safety of object code produced  by the compiler or
12646 that of libraries supplied with it.
12648 @item -pthread
12649 @opindex pthread
12650 This is a synonym for @option{-pthreads}.
12651 @end table
12653 @node System V Options
12654 @subsection Options for System V
12656 These additional options are available on System V Release 4 for
12657 compatibility with other compilers on those systems:
12659 @table @gcctabopt
12660 @item -G
12661 @opindex G
12662 Create a shared object.
12663 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
12665 @item -Qy
12666 @opindex Qy
12667 Identify the versions of each tool used by the compiler, in a
12668 @code{.ident} assembler directive in the output.
12670 @item -Qn
12671 @opindex Qn
12672 Refrain from adding @code{.ident} directives to the output file (this is
12673 the default).
12675 @item -YP,@var{dirs}
12676 @opindex YP
12677 Search the directories @var{dirs}, and no others, for libraries
12678 specified with @option{-l}.
12680 @item -Ym,@var{dir}
12681 @opindex Ym
12682 Look in the directory @var{dir} to find the M4 preprocessor.
12683 The assembler uses this option.
12684 @c This is supposed to go with a -Yd for predefined M4 macro files, but
12685 @c the generic assembler that comes with Solaris takes just -Ym.
12686 @end table
12688 @node TMS320C3x/C4x Options
12689 @subsection TMS320C3x/C4x Options
12690 @cindex TMS320C3x/C4x Options
12692 These @samp{-m} options are defined for TMS320C3x/C4x implementations:
12694 @table @gcctabopt
12696 @item -mcpu=@var{cpu_type}
12697 @opindex mcpu
12698 Set the instruction set, register set, and instruction scheduling
12699 parameters for machine type @var{cpu_type}.  Supported values for
12700 @var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
12701 @samp{c44}.  The default is @samp{c40} to generate code for the
12702 TMS320C40.
12704 @item -mbig-memory
12705 @itemx -mbig
12706 @itemx -msmall-memory
12707 @itemx -msmall
12708 @opindex mbig-memory
12709 @opindex mbig
12710 @opindex msmall-memory
12711 @opindex msmall
12712 Generates code for the big or small memory model.  The small memory
12713 model assumed that all data fits into one 64K word page.  At run-time
12714 the data page (DP) register must be set to point to the 64K page
12715 containing the .bss and .data program sections.  The big memory model is
12716 the default and requires reloading of the DP register for every direct
12717 memory access.
12719 @item -mbk
12720 @itemx -mno-bk
12721 @opindex mbk
12722 @opindex mno-bk
12723 Allow (disallow) allocation of general integer operands into the block
12724 count register BK@.
12726 @item -mdb
12727 @itemx -mno-db
12728 @opindex mdb
12729 @opindex mno-db
12730 Enable (disable) generation of code using decrement and branch,
12731 DBcond(D), instructions.  This is enabled by default for the C4x.  To be
12732 on the safe side, this is disabled for the C3x, since the maximum
12733 iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than
12734 @math{2^{23}} times on the C3x?).  Note that GCC will try to reverse a loop so
12735 that it can utilize the decrement and branch instruction, but will give
12736 up if there is more than one memory reference in the loop.  Thus a loop
12737 where the loop counter is decremented can generate slightly more
12738 efficient code, in cases where the RPTB instruction cannot be utilized.
12740 @item -mdp-isr-reload
12741 @itemx -mparanoid
12742 @opindex mdp-isr-reload
12743 @opindex mparanoid
12744 Force the DP register to be saved on entry to an interrupt service
12745 routine (ISR), reloaded to point to the data section, and restored on
12746 exit from the ISR@.  This should not be required unless someone has
12747 violated the small memory model by modifying the DP register, say within
12748 an object library.
12750 @item -mmpyi
12751 @itemx -mno-mpyi
12752 @opindex mmpyi
12753 @opindex mno-mpyi
12754 For the C3x use the 24-bit MPYI instruction for integer multiplies
12755 instead of a library call to guarantee 32-bit results.  Note that if one
12756 of the operands is a constant, then the multiplication will be performed
12757 using shifts and adds.  If the @option{-mmpyi} option is not specified for the C3x,
12758 then squaring operations are performed inline instead of a library call.
12760 @item -mfast-fix
12761 @itemx -mno-fast-fix
12762 @opindex mfast-fix
12763 @opindex mno-fast-fix
12764 The C3x/C4x FIX instruction to convert a floating point value to an
12765 integer value chooses the nearest integer less than or equal to the
12766 floating point value rather than to the nearest integer.  Thus if the
12767 floating point number is negative, the result will be incorrectly
12768 truncated an additional code is necessary to detect and correct this
12769 case.  This option can be used to disable generation of the additional
12770 code required to correct the result.
12772 @item -mrptb
12773 @itemx -mno-rptb
12774 @opindex mrptb
12775 @opindex mno-rptb
12776 Enable (disable) generation of repeat block sequences using the RPTB
12777 instruction for zero overhead looping.  The RPTB construct is only used
12778 for innermost loops that do not call functions or jump across the loop
12779 boundaries.  There is no advantage having nested RPTB loops due to the
12780 overhead required to save and restore the RC, RS, and RE registers.
12781 This is enabled by default with @option{-O2}.
12783 @item -mrpts=@var{count}
12784 @itemx -mno-rpts
12785 @opindex mrpts
12786 @opindex mno-rpts
12787 Enable (disable) the use of the single instruction repeat instruction
12788 RPTS@.  If a repeat block contains a single instruction, and the loop
12789 count can be guaranteed to be less than the value @var{count}, GCC will
12790 emit a RPTS instruction instead of a RPTB@.  If no value is specified,
12791 then a RPTS will be emitted even if the loop count cannot be determined
12792 at compile time.  Note that the repeated instruction following RPTS does
12793 not have to be reloaded from memory each iteration, thus freeing up the
12794 CPU buses for operands.  However, since interrupts are blocked by this
12795 instruction, it is disabled by default.
12797 @item -mloop-unsigned
12798 @itemx -mno-loop-unsigned
12799 @opindex mloop-unsigned
12800 @opindex mno-loop-unsigned
12801 The maximum iteration count when using RPTS and RPTB (and DB on the C40)
12802 is @math{2^{31} + 1} since these instructions test if the iteration count is
12803 negative to terminate the loop.  If the iteration count is unsigned
12804 there is a possibility than the @math{2^{31} + 1} maximum iteration count may be
12805 exceeded.  This switch allows an unsigned iteration count.
12807 @item -mti
12808 @opindex mti
12809 Try to emit an assembler syntax that the TI assembler (asm30) is happy
12810 with.  This also enforces compatibility with the API employed by the TI
12811 C3x C compiler.  For example, long doubles are passed as structures
12812 rather than in floating point registers.
12814 @item -mregparm
12815 @itemx -mmemparm
12816 @opindex mregparm
12817 @opindex mmemparm
12818 Generate code that uses registers (stack) for passing arguments to functions.
12819 By default, arguments are passed in registers where possible rather
12820 than by pushing arguments on to the stack.
12822 @item -mparallel-insns
12823 @itemx -mno-parallel-insns
12824 @opindex mparallel-insns
12825 @opindex mno-parallel-insns
12826 Allow the generation of parallel instructions.  This is enabled by
12827 default with @option{-O2}.
12829 @item -mparallel-mpy
12830 @itemx -mno-parallel-mpy
12831 @opindex mparallel-mpy
12832 @opindex mno-parallel-mpy
12833 Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
12834 provided @option{-mparallel-insns} is also specified.  These instructions have
12835 tight register constraints which can pessimize the code generation
12836 of large functions.
12838 @end table
12840 @node V850 Options
12841 @subsection V850 Options
12842 @cindex V850 Options
12844 These @samp{-m} options are defined for V850 implementations:
12846 @table @gcctabopt
12847 @item -mlong-calls
12848 @itemx -mno-long-calls
12849 @opindex mlong-calls
12850 @opindex mno-long-calls
12851 Treat all calls as being far away (near).  If calls are assumed to be
12852 far away, the compiler will always load the functions address up into a
12853 register, and call indirect through the pointer.
12855 @item -mno-ep
12856 @itemx -mep
12857 @opindex mno-ep
12858 @opindex mep
12859 Do not optimize (do optimize) basic blocks that use the same index
12860 pointer 4 or more times to copy pointer into the @code{ep} register, and
12861 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
12862 option is on by default if you optimize.
12864 @item -mno-prolog-function
12865 @itemx -mprolog-function
12866 @opindex mno-prolog-function
12867 @opindex mprolog-function
12868 Do not use (do use) external functions to save and restore registers
12869 at the prologue and epilogue of a function.  The external functions
12870 are slower, but use less code space if more than one function saves
12871 the same number of registers.  The @option{-mprolog-function} option
12872 is on by default if you optimize.
12874 @item -mspace
12875 @opindex mspace
12876 Try to make the code as small as possible.  At present, this just turns
12877 on the @option{-mep} and @option{-mprolog-function} options.
12879 @item -mtda=@var{n}
12880 @opindex mtda
12881 Put static or global variables whose size is @var{n} bytes or less into
12882 the tiny data area that register @code{ep} points to.  The tiny data
12883 area can hold up to 256 bytes in total (128 bytes for byte references).
12885 @item -msda=@var{n}
12886 @opindex msda
12887 Put static or global variables whose size is @var{n} bytes or less into
12888 the small data area that register @code{gp} points to.  The small data
12889 area can hold up to 64 kilobytes.
12891 @item -mzda=@var{n}
12892 @opindex mzda
12893 Put static or global variables whose size is @var{n} bytes or less into
12894 the first 32 kilobytes of memory.
12896 @item -mv850
12897 @opindex mv850
12898 Specify that the target processor is the V850.
12900 @item -mbig-switch
12901 @opindex mbig-switch
12902 Generate code suitable for big switch tables.  Use this option only if
12903 the assembler/linker complain about out of range branches within a switch
12904 table.
12906 @item -mapp-regs
12907 @opindex mapp-regs
12908 This option will cause r2 and r5 to be used in the code generated by
12909 the compiler.  This setting is the default.
12911 @item -mno-app-regs
12912 @opindex mno-app-regs
12913 This option will cause r2 and r5 to be treated as fixed registers.
12915 @item -mv850e1
12916 @opindex mv850e1
12917 Specify that the target processor is the V850E1.  The preprocessor
12918 constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
12919 this option is used.
12921 @item -mv850e
12922 @opindex mv850e
12923 Specify that the target processor is the V850E@.  The preprocessor
12924 constant @samp{__v850e__} will be defined if this option is used.
12926 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
12927 are defined then a default target processor will be chosen and the
12928 relevant @samp{__v850*__} preprocessor constant will be defined.
12930 The preprocessor constants @samp{__v850} and @samp{__v851__} are always
12931 defined, regardless of which processor variant is the target.
12933 @item -mdisable-callt
12934 @opindex mdisable-callt
12935 This option will suppress generation of the CALLT instruction for the
12936 v850e and v850e1 flavors of the v850 architecture.  The default is
12937 @option{-mno-disable-callt} which allows the CALLT instruction to be used.
12939 @end table
12941 @node VAX Options
12942 @subsection VAX Options
12943 @cindex VAX options
12945 These @samp{-m} options are defined for the VAX:
12947 @table @gcctabopt
12948 @item -munix
12949 @opindex munix
12950 Do not output certain jump instructions (@code{aobleq} and so on)
12951 that the Unix assembler for the VAX cannot handle across long
12952 ranges.
12954 @item -mgnu
12955 @opindex mgnu
12956 Do output those jump instructions, on the assumption that you
12957 will assemble with the GNU assembler.
12959 @item -mg
12960 @opindex mg
12961 Output code for g-format floating point numbers instead of d-format.
12962 @end table
12964 @node x86-64 Options
12965 @subsection x86-64 Options
12966 @cindex x86-64 options
12968 These are listed under @xref{i386 and x86-64 Options}.
12970 @node Xstormy16 Options
12971 @subsection Xstormy16 Options
12972 @cindex Xstormy16 Options
12974 These options are defined for Xstormy16:
12976 @table @gcctabopt
12977 @item -msim
12978 @opindex msim
12979 Choose startup files and linker script suitable for the simulator.
12980 @end table
12982 @node Xtensa Options
12983 @subsection Xtensa Options
12984 @cindex Xtensa Options
12986 These options are supported for Xtensa targets:
12988 @table @gcctabopt
12989 @item -mconst16
12990 @itemx -mno-const16
12991 @opindex mconst16
12992 @opindex mno-const16
12993 Enable or disable use of @code{CONST16} instructions for loading
12994 constant values.  The @code{CONST16} instruction is currently not a
12995 standard option from Tensilica.  When enabled, @code{CONST16}
12996 instructions are always used in place of the standard @code{L32R}
12997 instructions.  The use of @code{CONST16} is enabled by default only if
12998 the @code{L32R} instruction is not available.
13000 @item -mfused-madd
13001 @itemx -mno-fused-madd
13002 @opindex mfused-madd
13003 @opindex mno-fused-madd
13004 Enable or disable use of fused multiply/add and multiply/subtract
13005 instructions in the floating-point option.  This has no effect if the
13006 floating-point option is not also enabled.  Disabling fused multiply/add
13007 and multiply/subtract instructions forces the compiler to use separate
13008 instructions for the multiply and add/subtract operations.  This may be
13009 desirable in some cases where strict IEEE 754-compliant results are
13010 required: the fused multiply add/subtract instructions do not round the
13011 intermediate result, thereby producing results with @emph{more} bits of
13012 precision than specified by the IEEE standard.  Disabling fused multiply
13013 add/subtract instructions also ensures that the program output is not
13014 sensitive to the compiler's ability to combine multiply and add/subtract
13015 operations.
13017 @item -mtext-section-literals
13018 @itemx -mno-text-section-literals
13019 @opindex mtext-section-literals
13020 @opindex mno-text-section-literals
13021 Control the treatment of literal pools.  The default is
13022 @option{-mno-text-section-literals}, which places literals in a separate
13023 section in the output file.  This allows the literal pool to be placed
13024 in a data RAM/ROM, and it also allows the linker to combine literal
13025 pools from separate object files to remove redundant literals and
13026 improve code size.  With @option{-mtext-section-literals}, the literals
13027 are interspersed in the text section in order to keep them as close as
13028 possible to their references.  This may be necessary for large assembly
13029 files.
13031 @item -mtarget-align
13032 @itemx -mno-target-align
13033 @opindex mtarget-align
13034 @opindex mno-target-align
13035 When this option is enabled, GCC instructs the assembler to
13036 automatically align instructions to reduce branch penalties at the
13037 expense of some code density.  The assembler attempts to widen density
13038 instructions to align branch targets and the instructions following call
13039 instructions.  If there are not enough preceding safe density
13040 instructions to align a target, no widening will be performed.  The
13041 default is @option{-mtarget-align}.  These options do not affect the
13042 treatment of auto-aligned instructions like @code{LOOP}, which the
13043 assembler will always align, either by widening density instructions or
13044 by inserting no-op instructions.
13046 @item -mlongcalls
13047 @itemx -mno-longcalls
13048 @opindex mlongcalls
13049 @opindex mno-longcalls
13050 When this option is enabled, GCC instructs the assembler to translate
13051 direct calls to indirect calls unless it can determine that the target
13052 of a direct call is in the range allowed by the call instruction.  This
13053 translation typically occurs for calls to functions in other source
13054 files.  Specifically, the assembler translates a direct @code{CALL}
13055 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
13056 The default is @option{-mno-longcalls}.  This option should be used in
13057 programs where the call target can potentially be out of range.  This
13058 option is implemented in the assembler, not the compiler, so the
13059 assembly code generated by GCC will still show direct call
13060 instructions---look at the disassembled object code to see the actual
13061 instructions.  Note that the assembler will use an indirect call for
13062 every cross-file call, not just those that really will be out of range.
13063 @end table
13065 @node zSeries Options
13066 @subsection zSeries Options
13067 @cindex zSeries options
13069 These are listed under @xref{S/390 and zSeries Options}.
13071 @node Code Gen Options
13072 @section Options for Code Generation Conventions
13073 @cindex code generation conventions
13074 @cindex options, code generation
13075 @cindex run-time options
13077 These machine-independent options control the interface conventions
13078 used in code generation.
13080 Most of them have both positive and negative forms; the negative form
13081 of @option{-ffoo} would be @option{-fno-foo}.  In the table below, only
13082 one of the forms is listed---the one which is not the default.  You
13083 can figure out the other form by either removing @samp{no-} or adding
13086 @table @gcctabopt
13087 @item -fbounds-check
13088 @opindex fbounds-check
13089 For front-ends that support it, generate additional code to check that
13090 indices used to access arrays are within the declared range.  This is
13091 currently only supported by the Java and Fortran 77 front-ends, where
13092 this option defaults to true and false respectively.
13094 @item -ftrapv
13095 @opindex ftrapv
13096 This option generates traps for signed overflow on addition, subtraction,
13097 multiplication operations.
13099 @item -fwrapv
13100 @opindex fwrapv
13101 This option instructs the compiler to assume that signed arithmetic
13102 overflow of addition, subtraction and multiplication wraps around
13103 using twos-complement representation.  This flag enables some optimizations
13104 and disables others.  This option is enabled by default for the Java
13105 front-end, as required by the Java language specification.
13107 @item -fexceptions
13108 @opindex fexceptions
13109 Enable exception handling.  Generates extra code needed to propagate
13110 exceptions.  For some targets, this implies GCC will generate frame
13111 unwind information for all functions, which can produce significant data
13112 size overhead, although it does not affect execution.  If you do not
13113 specify this option, GCC will enable it by default for languages like
13114 C++ which normally require exception handling, and disable it for
13115 languages like C that do not normally require it.  However, you may need
13116 to enable this option when compiling C code that needs to interoperate
13117 properly with exception handlers written in C++.  You may also wish to
13118 disable this option if you are compiling older C++ programs that don't
13119 use exception handling.
13121 @item -fnon-call-exceptions
13122 @opindex fnon-call-exceptions
13123 Generate code that allows trapping instructions to throw exceptions.
13124 Note that this requires platform-specific runtime support that does
13125 not exist everywhere.  Moreover, it only allows @emph{trapping}
13126 instructions to throw exceptions, i.e.@: memory references or floating
13127 point instructions.  It does not allow exceptions to be thrown from
13128 arbitrary signal handlers such as @code{SIGALRM}.
13130 @item -funwind-tables
13131 @opindex funwind-tables
13132 Similar to @option{-fexceptions}, except that it will just generate any needed
13133 static data, but will not affect the generated code in any other way.
13134 You will normally not enable this option; instead, a language processor
13135 that needs this handling would enable it on your behalf.
13137 @item -fasynchronous-unwind-tables
13138 @opindex fasynchronous-unwind-tables
13139 Generate unwind table in dwarf2 format, if supported by target machine.  The
13140 table is exact at each instruction boundary, so it can be used for stack
13141 unwinding from asynchronous events (such as debugger or garbage collector).
13143 @item -fpcc-struct-return
13144 @opindex fpcc-struct-return
13145 Return ``short'' @code{struct} and @code{union} values in memory like
13146 longer ones, rather than in registers.  This convention is less
13147 efficient, but it has the advantage of allowing intercallability between
13148 GCC-compiled files and files compiled with other compilers, particularly
13149 the Portable C Compiler (pcc).
13151 The precise convention for returning structures in memory depends
13152 on the target configuration macros.
13154 Short structures and unions are those whose size and alignment match
13155 that of some integer type.
13157 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13158 switch is not binary compatible with code compiled with the
13159 @option{-freg-struct-return} switch.
13160 Use it to conform to a non-default application binary interface.
13162 @item -freg-struct-return
13163 @opindex freg-struct-return
13164 Return @code{struct} and @code{union} values in registers when possible.
13165 This is more efficient for small structures than
13166 @option{-fpcc-struct-return}.
13168 If you specify neither @option{-fpcc-struct-return} nor
13169 @option{-freg-struct-return}, GCC defaults to whichever convention is
13170 standard for the target.  If there is no standard convention, GCC
13171 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13172 the principal compiler.  In those cases, we can choose the standard, and
13173 we chose the more efficient register return alternative.
13175 @strong{Warning:} code compiled with the @option{-freg-struct-return}
13176 switch is not binary compatible with code compiled with the
13177 @option{-fpcc-struct-return} switch.
13178 Use it to conform to a non-default application binary interface.
13180 @item -fshort-enums
13181 @opindex fshort-enums
13182 Allocate to an @code{enum} type only as many bytes as it needs for the
13183 declared range of possible values.  Specifically, the @code{enum} type
13184 will be equivalent to the smallest integer type which has enough room.
13186 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13187 code that is not binary compatible with code generated without that switch.
13188 Use it to conform to a non-default application binary interface.
13190 @item -fshort-double
13191 @opindex fshort-double
13192 Use the same size for @code{double} as for @code{float}.
13194 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
13195 code that is not binary compatible with code generated without that switch.
13196 Use it to conform to a non-default application binary interface.
13198 @item -fshort-wchar
13199 @opindex fshort-wchar
13200 Override the underlying type for @samp{wchar_t} to be @samp{short
13201 unsigned int} instead of the default for the target.  This option is
13202 useful for building programs to run under WINE@.
13204 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13205 code that is not binary compatible with code generated without that switch.
13206 Use it to conform to a non-default application binary interface.
13208 @item -fno-common
13209 @opindex fno-common
13210 In C, allocate even uninitialized global variables in the data section of the
13211 object file, rather than generating them as common blocks.  This has the
13212 effect that if the same variable is declared (without @code{extern}) in
13213 two different compilations, you will get an error when you link them.
13214 The only reason this might be useful is if you wish to verify that the
13215 program will work on other systems which always work this way.
13217 @item -fno-ident
13218 @opindex fno-ident
13219 Ignore the @samp{#ident} directive.
13221 @item -finhibit-size-directive
13222 @opindex finhibit-size-directive
13223 Don't output a @code{.size} assembler directive, or anything else that
13224 would cause trouble if the function is split in the middle, and the
13225 two halves are placed at locations far apart in memory.  This option is
13226 used when compiling @file{crtstuff.c}; you should not need to use it
13227 for anything else.
13229 @item -fverbose-asm
13230 @opindex fverbose-asm
13231 Put extra commentary information in the generated assembly code to
13232 make it more readable.  This option is generally only of use to those
13233 who actually need to read the generated assembly code (perhaps while
13234 debugging the compiler itself).
13236 @option{-fno-verbose-asm}, the default, causes the
13237 extra information to be omitted and is useful when comparing two assembler
13238 files.
13240 @item -fpic
13241 @opindex fpic
13242 @cindex global offset table
13243 @cindex PIC
13244 Generate position-independent code (PIC) suitable for use in a shared
13245 library, if supported for the target machine.  Such code accesses all
13246 constant addresses through a global offset table (GOT)@.  The dynamic
13247 loader resolves the GOT entries when the program starts (the dynamic
13248 loader is not part of GCC; it is part of the operating system).  If
13249 the GOT size for the linked executable exceeds a machine-specific
13250 maximum size, you get an error message from the linker indicating that
13251 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
13252 instead.  (These maximums are 8k on the SPARC and 32k
13253 on the m68k and RS/6000.  The 386 has no such limit.)
13255 Position-independent code requires special support, and therefore works
13256 only on certain machines.  For the 386, GCC supports PIC for System V
13257 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
13258 position-independent.
13260 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13261 are defined to 1.
13263 @item -fPIC
13264 @opindex fPIC
13265 If supported for the target machine, emit position-independent code,
13266 suitable for dynamic linking and avoiding any limit on the size of the
13267 global offset table.  This option makes a difference on the m68k,
13268 PowerPC and SPARC@.
13270 Position-independent code requires special support, and therefore works
13271 only on certain machines.
13273 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13274 are defined to 2.
13276 @item -fpie
13277 @itemx -fPIE
13278 @opindex fpie
13279 @opindex fPIE
13280 These options are similar to @option{-fpic} and @option{-fPIC}, but
13281 generated position independent code can be only linked into executables.
13282 Usually these options are used when @option{-pie} GCC option will be
13283 used during linking.
13285 @item -fno-jump-tables
13286 @opindex fno-jump-tables
13287 Do not use jump tables for switch statements even where it would be
13288 more efficient than other code generation strategies.  This option is
13289 of use in conjunction with @option{-fpic} or @option{-fPIC} for
13290 building code which forms part of a dynamic linker and cannot
13291 reference the address of a jump table.  On some targets, jump tables
13292 do not require a GOT and this option is not needed.
13294 @item -ffixed-@var{reg}
13295 @opindex ffixed
13296 Treat the register named @var{reg} as a fixed register; generated code
13297 should never refer to it (except perhaps as a stack pointer, frame
13298 pointer or in some other fixed role).
13300 @var{reg} must be the name of a register.  The register names accepted
13301 are machine-specific and are defined in the @code{REGISTER_NAMES}
13302 macro in the machine description macro file.
13304 This flag does not have a negative form, because it specifies a
13305 three-way choice.
13307 @item -fcall-used-@var{reg}
13308 @opindex fcall-used
13309 Treat the register named @var{reg} as an allocable register that is
13310 clobbered by function calls.  It may be allocated for temporaries or
13311 variables that do not live across a call.  Functions compiled this way
13312 will not save and restore the register @var{reg}.
13314 It is an error to used this flag with the frame pointer or stack pointer.
13315 Use of this flag for other registers that have fixed pervasive roles in
13316 the machine's execution model will produce disastrous results.
13318 This flag does not have a negative form, because it specifies a
13319 three-way choice.
13321 @item -fcall-saved-@var{reg}
13322 @opindex fcall-saved
13323 Treat the register named @var{reg} as an allocable register saved by
13324 functions.  It may be allocated even for temporaries or variables that
13325 live across a call.  Functions compiled this way will save and restore
13326 the register @var{reg} if they use it.
13328 It is an error to used this flag with the frame pointer or stack pointer.
13329 Use of this flag for other registers that have fixed pervasive roles in
13330 the machine's execution model will produce disastrous results.
13332 A different sort of disaster will result from the use of this flag for
13333 a register in which function values may be returned.
13335 This flag does not have a negative form, because it specifies a
13336 three-way choice.
13338 @item -fpack-struct[=@var{n}]
13339 @opindex fpack-struct
13340 Without a value specified, pack all structure members together without
13341 holes.  When a value is specified (which must be a small power of two), pack
13342 structure members according to this value, representing the maximum
13343 alignment (that is, objects with default alignment requirements larger than
13344 this will be output potentially unaligned at the next fitting location.
13346 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
13347 code that is not binary compatible with code generated without that switch.
13348 Additionally, it makes the code suboptimal.
13349 Use it to conform to a non-default application binary interface.
13351 @item -finstrument-functions
13352 @opindex finstrument-functions
13353 Generate instrumentation calls for entry and exit to functions.  Just
13354 after function entry and just before function exit, the following
13355 profiling functions will be called with the address of the current
13356 function and its call site.  (On some platforms,
13357 @code{__builtin_return_address} does not work beyond the current
13358 function, so the call site information may not be available to the
13359 profiling functions otherwise.)
13361 @smallexample
13362 void __cyg_profile_func_enter (void *this_fn,
13363                                void *call_site);
13364 void __cyg_profile_func_exit  (void *this_fn,
13365                                void *call_site);
13366 @end smallexample
13368 The first argument is the address of the start of the current function,
13369 which may be looked up exactly in the symbol table.
13371 This instrumentation is also done for functions expanded inline in other
13372 functions.  The profiling calls will indicate where, conceptually, the
13373 inline function is entered and exited.  This means that addressable
13374 versions of such functions must be available.  If all your uses of a
13375 function are expanded inline, this may mean an additional expansion of
13376 code size.  If you use @samp{extern inline} in your C code, an
13377 addressable version of such functions must be provided.  (This is
13378 normally the case anyways, but if you get lucky and the optimizer always
13379 expands the functions inline, you might have gotten away without
13380 providing static copies.)
13382 A function may be given the attribute @code{no_instrument_function}, in
13383 which case this instrumentation will not be done.  This can be used, for
13384 example, for the profiling functions listed above, high-priority
13385 interrupt routines, and any functions from which the profiling functions
13386 cannot safely be called (perhaps signal handlers, if the profiling
13387 routines generate output or allocate memory).
13389 @item -fstack-check
13390 @opindex fstack-check
13391 Generate code to verify that you do not go beyond the boundary of the
13392 stack.  You should specify this flag if you are running in an
13393 environment with multiple threads, but only rarely need to specify it in
13394 a single-threaded environment since stack overflow is automatically
13395 detected on nearly all systems if there is only one stack.
13397 Note that this switch does not actually cause checking to be done; the
13398 operating system must do that.  The switch causes generation of code
13399 to ensure that the operating system sees the stack being extended.
13401 @item -fstack-limit-register=@var{reg}
13402 @itemx -fstack-limit-symbol=@var{sym}
13403 @itemx -fno-stack-limit
13404 @opindex fstack-limit-register
13405 @opindex fstack-limit-symbol
13406 @opindex fno-stack-limit
13407 Generate code to ensure that the stack does not grow beyond a certain value,
13408 either the value of a register or the address of a symbol.  If the stack
13409 would grow beyond the value, a signal is raised.  For most targets,
13410 the signal is raised before the stack overruns the boundary, so
13411 it is possible to catch the signal without taking special precautions.
13413 For instance, if the stack starts at absolute address @samp{0x80000000}
13414 and grows downwards, you can use the flags
13415 @option{-fstack-limit-symbol=__stack_limit} and
13416 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
13417 of 128KB@.  Note that this may only work with the GNU linker.
13419 @cindex aliasing of parameters
13420 @cindex parameters, aliased
13421 @item -fargument-alias
13422 @itemx -fargument-noalias
13423 @itemx -fargument-noalias-global
13424 @itemx -fargument-noalias-anything
13425 @opindex fargument-alias
13426 @opindex fargument-noalias
13427 @opindex fargument-noalias-global
13428 @opindex fargument-noalias-anything
13429 Specify the possible relationships among parameters and between
13430 parameters and global data.
13432 @option{-fargument-alias} specifies that arguments (parameters) may
13433 alias each other and may alias global storage.@*
13434 @option{-fargument-noalias} specifies that arguments do not alias
13435 each other, but may alias global storage.@*
13436 @option{-fargument-noalias-global} specifies that arguments do not
13437 alias each other and do not alias global storage.
13438 @option{-fargument-noalias-anything} specifies that arguments do not
13439 alias any other storage.
13441 Each language will automatically use whatever option is required by
13442 the language standard.  You should not need to use these options yourself.
13444 @item -fleading-underscore
13445 @opindex fleading-underscore
13446 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
13447 change the way C symbols are represented in the object file.  One use
13448 is to help link with legacy assembly code.
13450 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
13451 generate code that is not binary compatible with code generated without that
13452 switch.  Use it to conform to a non-default application binary interface.
13453 Not all targets provide complete support for this switch.
13455 @item -ftls-model=@var{model}
13456 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
13457 The @var{model} argument should be one of @code{global-dynamic},
13458 @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
13460 The default without @option{-fpic} is @code{initial-exec}; with
13461 @option{-fpic} the default is @code{global-dynamic}.
13463 @item -fvisibility=@var{default|internal|hidden|protected}
13464 @opindex fvisibility
13465 Set the default ELF image symbol visibility to the specified option---all
13466 symbols will be marked with this unless overridden within the code.
13467 Using this feature can very substantially improve linking and
13468 load times of shared object libraries, produce more optimized
13469 code, provide near-perfect API export and prevent symbol clashes.
13470 It is @strong{strongly} recommended that you use this in any shared objects
13471 you distribute.
13473 Despite the nomenclature, @code{default} always means public ie;
13474 available to be linked against from outside the shared object.
13475 @code{protected} and @code{internal} are pretty useless in real-world
13476 usage so the only other commonly used option will be @code{hidden}.
13477 The default if @option{-fvisibility} isn't specified is
13478 @code{default}, i.e., make every
13479 symbol public---this causes the same behavior as previous versions of
13480 GCC@.
13482 A good explanation of the benefits offered by ensuring ELF
13483 symbols have the correct visibility is given by ``How To Write
13484 Shared Libraries'' by Ulrich Drepper (which can be found at
13485 @w{@uref{http://people.redhat.com/~drepper/}})---however a superior
13486 solution made possible by this option to marking things hidden when
13487 the default is public is to make the default hidden and mark things
13488 public.  This is the norm with DLL's on Windows and with @option{-fvisibility=hidden}
13489 and @code{__attribute__ ((visibility("default")))} instead of
13490 @code{__declspec(dllexport)} you get almost identical semantics with
13491 identical syntax.  This is a great boon to those working with
13492 cross-platform projects.
13494 For those adding visibility support to existing code, you may find
13495 @samp{#pragma GCC visibility} of use.  This works by you enclosing
13496 the declarations you wish to set visibility for with (for example)
13497 @samp{#pragma GCC visibility push(hidden)} and
13498 @samp{#pragma GCC visibility pop}.
13499 Bear in mind that symbol visibility should be viewed @strong{as
13500 part of the API interface contract} and thus all new code should
13501 always specify visibility when it is not the default ie; declarations
13502 only for use within the local DSO should @strong{always} be marked explicitly
13503 as hidden as so to avoid PLT indirection overheads---making this
13504 abundantly clear also aids readability and self-documentation of the code.
13505 Note that due to ISO C++ specification requirements, operator new and
13506 operator delete must always be of default visibility.
13508 Be aware that headers from outside your project, in particular system
13509 headers and headers from any other library you use, may not be
13510 expecting to be compiled with visibility other than the default.  You
13511 may need to explicitly say @samp{#pragma GCC visibility push(default)}
13512 before including any such headers.
13514 @samp{extern} declarations are not affected by @samp{-fvisibility}, so
13515 a lot of code can be recompiled with @samp{-fvisibility=hidden} with
13516 no modifications.  However, this means that calls to @samp{extern}
13517 functions with no explicit visibility will use the PLT, so it is more
13518 effective to use @samp{__attribute ((visibility))} and/or
13519 @samp{#pragma GCC visibility} to tell the compiler which @samp{extern}
13520 declarations should be treated as hidden.
13522 Note that @samp{-fvisibility} does affect C++ vague linkage
13523 entities. This means that, for instance, an exception class that will
13524 be thrown between DSOs must be explicitly marked with default
13525 visibility so that the @samp{type_info} nodes will be unified between
13526 the DSOs.
13528 An overview of these techniques, their benefits and how to use them
13529 is at @w{@uref{http://gcc.gnu.org/wiki/Visibility}}.
13531 @end table
13533 @c man end
13535 @node Environment Variables
13536 @section Environment Variables Affecting GCC
13537 @cindex environment variables
13539 @c man begin ENVIRONMENT
13540 This section describes several environment variables that affect how GCC
13541 operates.  Some of them work by specifying directories or prefixes to use
13542 when searching for various kinds of files.  Some are used to specify other
13543 aspects of the compilation environment.
13545 Note that you can also specify places to search using options such as
13546 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
13547 take precedence over places specified using environment variables, which
13548 in turn take precedence over those specified by the configuration of GCC@.
13549 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
13550 GNU Compiler Collection (GCC) Internals}.
13552 @table @env
13553 @item LANG
13554 @itemx LC_CTYPE
13555 @c @itemx LC_COLLATE
13556 @itemx LC_MESSAGES
13557 @c @itemx LC_MONETARY
13558 @c @itemx LC_NUMERIC
13559 @c @itemx LC_TIME
13560 @itemx LC_ALL
13561 @findex LANG
13562 @findex LC_CTYPE
13563 @c @findex LC_COLLATE
13564 @findex LC_MESSAGES
13565 @c @findex LC_MONETARY
13566 @c @findex LC_NUMERIC
13567 @c @findex LC_TIME
13568 @findex LC_ALL
13569 @cindex locale
13570 These environment variables control the way that GCC uses
13571 localization information that allow GCC to work with different
13572 national conventions.  GCC inspects the locale categories
13573 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
13574 so.  These locale categories can be set to any value supported by your
13575 installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
13576 Kingdom encoded in UTF-8.
13578 The @env{LC_CTYPE} environment variable specifies character
13579 classification.  GCC uses it to determine the character boundaries in
13580 a string; this is needed for some multibyte encodings that contain quote
13581 and escape characters that would otherwise be interpreted as a string
13582 end or escape.
13584 The @env{LC_MESSAGES} environment variable specifies the language to
13585 use in diagnostic messages.
13587 If the @env{LC_ALL} environment variable is set, it overrides the value
13588 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
13589 and @env{LC_MESSAGES} default to the value of the @env{LANG}
13590 environment variable.  If none of these variables are set, GCC
13591 defaults to traditional C English behavior.
13593 @item TMPDIR
13594 @findex TMPDIR
13595 If @env{TMPDIR} is set, it specifies the directory to use for temporary
13596 files.  GCC uses temporary files to hold the output of one stage of
13597 compilation which is to be used as input to the next stage: for example,
13598 the output of the preprocessor, which is the input to the compiler
13599 proper.
13601 @item GCC_EXEC_PREFIX
13602 @findex GCC_EXEC_PREFIX
13603 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
13604 names of the subprograms executed by the compiler.  No slash is added
13605 when this prefix is combined with the name of a subprogram, but you can
13606 specify a prefix that ends with a slash if you wish.
13608 If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
13609 an appropriate prefix to use based on the pathname it was invoked with.
13611 If GCC cannot find the subprogram using the specified prefix, it
13612 tries looking in the usual places for the subprogram.
13614 The default value of @env{GCC_EXEC_PREFIX} is
13615 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the value
13616 of @code{prefix} when you ran the @file{configure} script.
13618 Other prefixes specified with @option{-B} take precedence over this prefix.
13620 This prefix is also used for finding files such as @file{crt0.o} that are
13621 used for linking.
13623 In addition, the prefix is used in an unusual way in finding the
13624 directories to search for header files.  For each of the standard
13625 directories whose name normally begins with @samp{/usr/local/lib/gcc}
13626 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
13627 replacing that beginning with the specified prefix to produce an
13628 alternate directory name.  Thus, with @option{-Bfoo/}, GCC will search
13629 @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
13630 These alternate directories are searched first; the standard directories
13631 come next.
13633 @item COMPILER_PATH
13634 @findex COMPILER_PATH
13635 The value of @env{COMPILER_PATH} is a colon-separated list of
13636 directories, much like @env{PATH}.  GCC tries the directories thus
13637 specified when searching for subprograms, if it can't find the
13638 subprograms using @env{GCC_EXEC_PREFIX}.
13640 @item LIBRARY_PATH
13641 @findex LIBRARY_PATH
13642 The value of @env{LIBRARY_PATH} is a colon-separated list of
13643 directories, much like @env{PATH}.  When configured as a native compiler,
13644 GCC tries the directories thus specified when searching for special
13645 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}.  Linking
13646 using GCC also uses these directories when searching for ordinary
13647 libraries for the @option{-l} option (but directories specified with
13648 @option{-L} come first).
13650 @item LANG
13651 @findex LANG
13652 @cindex locale definition
13653 This variable is used to pass locale information to the compiler.  One way in
13654 which this information is used is to determine the character set to be used
13655 when character literals, string literals and comments are parsed in C and C++.
13656 When the compiler is configured to allow multibyte characters,
13657 the following values for @env{LANG} are recognized:
13659 @table @samp
13660 @item C-JIS
13661 Recognize JIS characters.
13662 @item C-SJIS
13663 Recognize SJIS characters.
13664 @item C-EUCJP
13665 Recognize EUCJP characters.
13666 @end table
13668 If @env{LANG} is not defined, or if it has some other value, then the
13669 compiler will use mblen and mbtowc as defined by the default locale to
13670 recognize and translate multibyte characters.
13671 @end table
13673 @noindent
13674 Some additional environments variables affect the behavior of the
13675 preprocessor.
13677 @include cppenv.texi
13679 @c man end
13681 @node Precompiled Headers
13682 @section Using Precompiled Headers
13683 @cindex precompiled headers
13684 @cindex speed of compilation
13686 Often large projects have many header files that are included in every
13687 source file.  The time the compiler takes to process these header files
13688 over and over again can account for nearly all of the time required to
13689 build the project.  To make builds faster, GCC allows users to
13690 `precompile' a header file; then, if builds can use the precompiled
13691 header file they will be much faster.
13693 To create a precompiled header file, simply compile it as you would any
13694 other file, if necessary using the @option{-x} option to make the driver
13695 treat it as a C or C++ header file.  You will probably want to use a
13696 tool like @command{make} to keep the precompiled header up-to-date when
13697 the headers it contains change.
13699 A precompiled header file will be searched for when @code{#include} is
13700 seen in the compilation.  As it searches for the included file
13701 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
13702 compiler looks for a precompiled header in each directory just before it
13703 looks for the include file in that directory.  The name searched for is
13704 the name specified in the @code{#include} with @samp{.gch} appended.  If
13705 the precompiled header file can't be used, it is ignored.
13707 For instance, if you have @code{#include "all.h"}, and you have
13708 @file{all.h.gch} in the same directory as @file{all.h}, then the
13709 precompiled header file will be used if possible, and the original
13710 header will be used otherwise.
13712 Alternatively, you might decide to put the precompiled header file in a
13713 directory and use @option{-I} to ensure that directory is searched
13714 before (or instead of) the directory containing the original header.
13715 Then, if you want to check that the precompiled header file is always
13716 used, you can put a file of the same name as the original header in this
13717 directory containing an @code{#error} command.
13719 This also works with @option{-include}.  So yet another way to use
13720 precompiled headers, good for projects not designed with precompiled
13721 header files in mind, is to simply take most of the header files used by
13722 a project, include them from another header file, precompile that header
13723 file, and @option{-include} the precompiled header.  If the header files
13724 have guards against multiple inclusion, they will be skipped because
13725 they've already been included (in the precompiled header).
13727 If you need to precompile the same header file for different
13728 languages, targets, or compiler options, you can instead make a
13729 @emph{directory} named like @file{all.h.gch}, and put each precompiled
13730 header in the directory, perhaps using @option{-o}.  It doesn't matter
13731 what you call the files in the directory, every precompiled header in
13732 the directory will be considered.  The first precompiled header
13733 encountered in the directory that is valid for this compilation will
13734 be used; they're searched in no particular order.
13736 There are many other possibilities, limited only by your imagination,
13737 good sense, and the constraints of your build system.
13739 A precompiled header file can be used only when these conditions apply:
13741 @itemize
13742 @item
13743 Only one precompiled header can be used in a particular compilation.
13745 @item
13746 A precompiled header can't be used once the first C token is seen.  You
13747 can have preprocessor directives before a precompiled header; you can
13748 even include a precompiled header from inside another header, so long as
13749 there are no C tokens before the @code{#include}.
13751 @item
13752 The precompiled header file must be produced for the same language as
13753 the current compilation.  You can't use a C precompiled header for a C++
13754 compilation.
13756 @item
13757 The precompiled header file must have been produced by the same compiler
13758 binary as the current compilation is using.
13760 @item
13761 Any macros defined before the precompiled header is included must
13762 either be defined in the same way as when the precompiled header was
13763 generated, or must not affect the precompiled header, which usually
13764 means that they don't appear in the precompiled header at all.
13766 The @option{-D} option is one way to define a macro before a
13767 precompiled header is included; using a @code{#define} can also do it.
13768 There are also some options that define macros implicitly, like
13769 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
13770 defined this way.
13772 @item If debugging information is output when using the precompiled
13773 header, using @option{-g} or similar, the same kind of debugging information
13774 must have been output when building the precompiled header.  However,
13775 a precompiled header built using @option{-g} can be used in a compilation
13776 when no debugging information is being output.
13778 @item The same @option{-m} options must generally be used when building
13779 and using the precompiled header.  @xref{Submodel Options},
13780 for any cases where this rule is relaxed.
13782 @item Each of the following options must be the same when building and using
13783 the precompiled header:
13785 @gccoptlist{-fexceptions -funit-at-a-time}
13787 @item
13788 Some other command-line options starting with @option{-f},
13789 @option{-p}, or @option{-O} must be defined in the same way as when
13790 the precompiled header was generated.  At present, it's not clear
13791 which options are safe to change and which are not; the safest choice
13792 is to use exactly the same options when generating and using the
13793 precompiled header.  The following are known to be safe:
13795 @gccoptlist{-fmessage-length= -fpreprocessed
13796 -fsched-interblock -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous
13797 -fsched-verbose=<number> -fschedule-insns -fvisibility=
13798 -pedantic-errors}
13800 @end itemize
13802 For all of these except the last, the compiler will automatically
13803 ignore the precompiled header if the conditions aren't met.  If you
13804 find an option combination that doesn't work and doesn't cause the
13805 precompiled header to be ignored, please consider filing a bug report,
13806 see @ref{Bugs}.
13808 If you do use differing options when generating and using the
13809 precompiled header, the actual behavior will be a mixture of the
13810 behavior for the options.  For instance, if you use @option{-g} to
13811 generate the precompiled header but not when using it, you may or may
13812 not get debugging information for routines in the precompiled header.
13814 @node Running Protoize
13815 @section Running Protoize
13817 The program @code{protoize} is an optional part of GCC@.  You can use
13818 it to add prototypes to a program, thus converting the program to ISO
13819 C in one respect.  The companion program @code{unprotoize} does the
13820 reverse: it removes argument types from any prototypes that are found.
13822 When you run these programs, you must specify a set of source files as
13823 command line arguments.  The conversion programs start out by compiling
13824 these files to see what functions they define.  The information gathered
13825 about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
13827 After scanning comes actual conversion.  The specified files are all
13828 eligible to be converted; any files they include (whether sources or
13829 just headers) are eligible as well.
13831 But not all the eligible files are converted.  By default,
13832 @code{protoize} and @code{unprotoize} convert only source and header
13833 files in the current directory.  You can specify additional directories
13834 whose files should be converted with the @option{-d @var{directory}}
13835 option.  You can also specify particular files to exclude with the
13836 @option{-x @var{file}} option.  A file is converted if it is eligible, its
13837 directory name matches one of the specified directory names, and its
13838 name within the directory has not been excluded.
13840 Basic conversion with @code{protoize} consists of rewriting most
13841 function definitions and function declarations to specify the types of
13842 the arguments.  The only ones not rewritten are those for varargs
13843 functions.
13845 @code{protoize} optionally inserts prototype declarations at the
13846 beginning of the source file, to make them available for any calls that
13847 precede the function's definition.  Or it can insert prototype
13848 declarations with block scope in the blocks where undeclared functions
13849 are called.
13851 Basic conversion with @code{unprotoize} consists of rewriting most
13852 function declarations to remove any argument types, and rewriting
13853 function definitions to the old-style pre-ISO form.
13855 Both conversion programs print a warning for any function declaration or
13856 definition that they can't convert.  You can suppress these warnings
13857 with @option{-q}.
13859 The output from @code{protoize} or @code{unprotoize} replaces the
13860 original source file.  The original file is renamed to a name ending
13861 with @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
13862 without the original @samp{.c} suffix).  If the @samp{.save} (@samp{.sav}
13863 for DOS) file already exists, then the source file is simply discarded.
13865 @code{protoize} and @code{unprotoize} both depend on GCC itself to
13866 scan the program and collect information about the functions it uses.
13867 So neither of these programs will work until GCC is installed.
13869 Here is a table of the options you can use with @code{protoize} and
13870 @code{unprotoize}.  Each option works with both programs unless
13871 otherwise stated.
13873 @table @code
13874 @item -B @var{directory}
13875 Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
13876 usual directory (normally @file{/usr/local/lib}).  This file contains
13877 prototype information about standard system functions.  This option
13878 applies only to @code{protoize}.
13880 @item -c @var{compilation-options}
13881 Use @var{compilation-options} as the options when running @command{gcc} to
13882 produce the @samp{.X} files.  The special option @option{-aux-info} is
13883 always passed in addition, to tell @command{gcc} to write a @samp{.X} file.
13885 Note that the compilation options must be given as a single argument to
13886 @code{protoize} or @code{unprotoize}.  If you want to specify several
13887 @command{gcc} options, you must quote the entire set of compilation options
13888 to make them a single word in the shell.
13890 There are certain @command{gcc} arguments that you cannot use, because they
13891 would produce the wrong kind of output.  These include @option{-g},
13892 @option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
13893 the @var{compilation-options}, they are ignored.
13895 @item -C
13896 Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file
13897 systems) instead of @samp{.c}.  This is convenient if you are converting
13898 a C program to C++.  This option applies only to @code{protoize}.
13900 @item -g
13901 Add explicit global declarations.  This means inserting explicit
13902 declarations at the beginning of each source file for each function
13903 that is called in the file and was not declared.  These declarations
13904 precede the first function definition that contains a call to an
13905 undeclared function.  This option applies only to @code{protoize}.
13907 @item -i @var{string}
13908 Indent old-style parameter declarations with the string @var{string}.
13909 This option applies only to @code{protoize}.
13911 @code{unprotoize} converts prototyped function definitions to old-style
13912 function definitions, where the arguments are declared between the
13913 argument list and the initial @samp{@{}.  By default, @code{unprotoize}
13914 uses five spaces as the indentation.  If you want to indent with just
13915 one space instead, use @option{-i " "}.
13917 @item -k
13918 Keep the @samp{.X} files.  Normally, they are deleted after conversion
13919 is finished.
13921 @item -l
13922 Add explicit local declarations.  @code{protoize} with @option{-l} inserts
13923 a prototype declaration for each function in each block which calls the
13924 function without any declaration.  This option applies only to
13925 @code{protoize}.
13927 @item -n
13928 Make no real changes.  This mode just prints information about the conversions
13929 that would have been done without @option{-n}.
13931 @item -N
13932 Make no @samp{.save} files.  The original files are simply deleted.
13933 Use this option with caution.
13935 @item -p @var{program}
13936 Use the program @var{program} as the compiler.  Normally, the name
13937 @file{gcc} is used.
13939 @item -q
13940 Work quietly.  Most warnings are suppressed.
13942 @item -v
13943 Print the version number, just like @option{-v} for @command{gcc}.
13944 @end table
13946 If you need special compiler options to compile one of your program's
13947 source files, then you should generate that file's @samp{.X} file
13948 specially, by running @command{gcc} on that source file with the
13949 appropriate options and the option @option{-aux-info}.  Then run
13950 @code{protoize} on the entire set of files.  @code{protoize} will use
13951 the existing @samp{.X} file because it is newer than the source file.
13952 For example:
13954 @smallexample
13955 gcc -Dfoo=bar file1.c -aux-info file1.X
13956 protoize *.c
13957 @end smallexample
13959 @noindent
13960 You need to include the special files along with the rest in the
13961 @code{protoize} command, even though their @samp{.X} files already
13962 exist, because otherwise they won't get converted.
13964 @xref{Protoize Caveats}, for more information on how to use
13965 @code{protoize} successfully.