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.
5
6@ignore
7@c man begin INCLUDE
8@include gcc-vers.texi
9@c man end
10
11@c man begin COPYRIGHT
12Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
131999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
14
15Permission is granted to copy, distribute and/or modify this document
16under the terms of the GNU Free Documentation License, Version 1.2 or
17any later version published by the Free Software Foundation; with the
18Invariant Sections being ``GNU General Public License'' and ``Funding
19Free Software'', the Front-Cover texts being (a) (see below), and with
20the Back-Cover Texts being (b) (see below).  A copy of the license is
21included in the gfdl(7) man page.
22
23(a) The FSF's Front-Cover Text is:
24
25     A GNU Manual
26
27(b) The FSF's Back-Cover Text is:
28
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
37gcc [@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{}
44
45Only the most useful options are listed here; see below for the
46remainder.  @samp{g++} accepts mostly the same options as @samp{gcc}.
47@c man end
48@c man begin SEEALSO
49gpl(7), gfdl(7), fsf-funding(7),
50cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
51and 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
55For instructions on reporting bugs, see
56@w{@uref{http://gcc.gnu.org/bugs.html}}.
57@c man end
58@c man begin AUTHOR
59See the Info entry for @command{gcc}, or
60@w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
61for contributors to GCC@.
62@c man end
63@end ignore
64
65@node Invoking GCC
66@chapter GCC Command Options
67@cindex GCC command options
68@cindex command options
69@cindex options, GCC command
70
71@c man begin DESCRIPTION
72When you invoke GCC, it normally does preprocessing, compilation,
73assembly and linking.  The ``overall options'' allow you to stop this
74process at an intermediate stage.  For example, the @option{-c} option
75says not to run the linker.  Then the output consists of object files
76output by the assembler.
77
78Other options are passed on to one stage of processing.  Some options
79control the preprocessor and others the compiler itself.  Yet other
80options control the assembler and linker; most of these are not
81documented here, since you rarely need to use any of them.
82
83@cindex C compilation options
84Most of the command line options that you can use with GCC are useful
85for C programs; when an option is only useful with another language
86(usually C++), the explanation says so explicitly.  If the description
87for a particular option does not mention a source language, you can use
88that option with all supported languages.
89
90@cindex C++ compilation options
91@xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
92options for compiling C++ programs.
93
94@cindex grouping options
95@cindex options, grouping
96The @command{gcc} program accepts options and file names as operands.  Many
97options have multi-letter names; therefore multiple single-letter options
98may @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d
99-r}}.
100
101@cindex order of options
102@cindex options, order
103You can mix options and other arguments.  For the most part, the order
104you use doesn't matter.  Order does matter when you use several options
105of the same kind; for example, if you specify @option{-L} more than once,
106the directories are searched in the order specified.
107
108Many 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
111these have both positive and negative forms; the negative form of
112@option{-ffoo} would be @option{-fno-foo}.  This manual documents
113only one of these two forms, whichever one is not the default.
114
115@c man end
116
117@xref{Option Index}, for an index to GCC's options.
118
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* Language Independent Options:: Controlling how diagnostics should be
128                        formatted.
129* Warning Options::     How picky should the compiler be?
130* Debugging Options::   Symbol tables, measurements, and debugging dumps.
131* Optimize Options::    How much optimization?
132* Preprocessor Options:: Controlling header files and macro definitions.
133                         Also, getting dependency information for Make.
134* Assembler Options::   Passing options to the assembler.
135* Link Options::        Specifying libraries and so on.
136* Directory Options::   Where to find header files and libraries.
137                        Where to find the compiler executable files.
138* Spec Files::          How to pass switches to sub-processes.
139* Target Options::      Running a cross-compiler, or an old version of GCC.
140* Submodel Options::    Specifying minor hardware or convention variations,
141                        such as 68010 vs 68020.
142* Code Gen Options::    Specifying conventions for function calls, data layout
143                        and register usage.
144* Environment Variables:: Env vars that affect GCC.
145* Precompiled Headers:: Compiling a header once, and using it many times.
146* Running Protoize::    Automatically adding or removing function prototypes.
147@end menu
148
149@c man begin OPTIONS
150
151@node Option Summary
152@section Option Summary
153
154Here is a summary of all the options, grouped by type.  Explanations are
155in the following sections.
156
157@table @emph
158@item Overall Options
159@xref{Overall Options,,Options Controlling the Kind of Output}.
160@gccoptlist{-c  -S  -E  -o @var{file}  -combine -pipe  -pass-exit-codes  @gol
161-x @var{language}  -v  -###  --help  --target-help  --version @@@var{file}}
162
163@item C Language Options
164@xref{C Dialect Options,,Options Controlling C Dialect}.
165@gccoptlist{-ansi  -std=@var{standard}  -fgnu89-inline @gol
166-aux-info @var{filename} @gol
167@c APPLE LOCAL blocks 7205047 5811887
168-fno-asm  -fno-blocks -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 -flax-vector-conversions @gol
172@c APPLE LOCAL nested functions 4357979 */
173-fno-nested-functions @gol
174-fsigned-bitfields  -fsigned-char @gol
175@c APPLE LOCAL -Wnewline-eof 2001-08-23 --sts **
176-Wnewline-eof (Apple compatible) @gol
177-funsigned-bitfields  -funsigned-char}
178
179@item C++ Language Options
180@xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
181@gccoptlist{-fabi-version=@var{n}  -fno-access-control  -fcheck-new @gol
182-fconserve-space  -ffriend-injection @gol
183-fno-elide-constructors @gol
184-fno-enforce-eh-specs @gol
185-ffor-scope  -fno-for-scope  -fno-gnu-keywords @gol
186-fno-implicit-templates @gol
187-fno-implicit-inline-templates @gol
188-fno-implement-inlines  -fms-extensions @gol
189-fno-nonansi-builtins  -fno-operator-names @gol
190-fno-optional-diags  -fpermissive @gol
191-frepo  -fno-rtti  -fstats  -ftemplate-depth-@var{n} @gol
192-fno-threadsafe-statics -fuse-cxa-atexit  -fno-weak  -nostdinc++ @gol
193-fno-default-inline  -fvisibility-inlines-hidden @gol
194-fvisibility-ms-compat @gol
195-Wabi  -Wctor-dtor-privacy @gol
196-Wnon-virtual-dtor  -Wreorder @gol
197-Weffc++  -Wno-deprecated  -Wstrict-null-sentinel @gol
198-Wno-non-template-friend  -Wold-style-cast @gol
199-Woverloaded-virtual  -Wno-pmf-conversions @gol
200-Wsign-promo}
201
202@item Language Independent Options
203@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
204@gccoptlist{-fmessage-length=@var{n}  @gol
205-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}  @gol
206-fdiagnostics-show-option}
207
208@item Warning Options
209@xref{Warning Options,,Options to Request or Suppress Warnings}.
210@gccoptlist{-fsyntax-only  -pedantic  -pedantic-errors @gol
211-w  -Wextra  -Wall  -Waddress  -Waggregate-return -Wno-attributes @gol
212-Wc++-compat -Wcast-align  -Wcast-qual  -Wchar-subscripts  -Wcomment @gol
213-Wconversion  -Wno-deprecated-declarations @gol
214-Wdisabled-optimization  -Wno-div-by-zero  -Wno-endif-labels @gol
215-Werror  -Werror=* -Werror-implicit-function-declaration @gol
216-Wfatal-errors  -Wfloat-equal  -Wformat  -Wformat=2 @gol
217-Wno-format-extra-args -Wformat-nonliteral @gol
218-Wformat-security  -Wformat-y2k @gol
219-Wimplicit  -Wimplicit-function-declaration  -Wimplicit-int @gol
220-Wimport  -Wno-import  -Winit-self  -Winline @gol
221-Wno-int-to-pointer-cast @gol
222-Wno-invalid-offsetof  -Winvalid-pch @gol
223-Wlarger-than-@var{len}  -Wframe-larger-than-@var{len} @gol
224-Wunsafe-loop-optimizations  -Wlong-long @gol
225-Wmain  -Wmissing-braces  -Wmissing-field-initializers @gol
226-Wmissing-format-attribute  -Wmissing-include-dirs @gol
227-Wmissing-noreturn @gol
228@c APPLE LOCAL warn missing prototype 6261539
229-Wmissing-prototypes @gol
230@c APPLE LOCAL -Wmost
231-Wmost (APPLE ONLY) @gol
232-Wno-multichar  -Wnonnull  -Wno-overflow @gol
233-Woverlength-strings  -Wpacked  -Wpadded @gol
234-Wparentheses  -Wpointer-arith  -Wno-pointer-to-int-cast @gol
235-Wredundant-decls @gol
236-Wreturn-type  -Wsequence-point  -Wshadow @gol
237-Wsign-compare  -Wstack-protector @gol
238-Wstrict-aliasing -Wstrict-aliasing=2 @gol
239-Wstrict-overflow -Wstrict-overflow=@var{n} @gol
240-Wswitch  -Wswitch-default  -Wswitch-enum @gol
241-Wsystem-headers  -Wtrigraphs  -Wundef  -Wuninitialized @gol
242-Wunknown-pragmas  -Wno-pragmas -Wunreachable-code @gol
243-Wunused  -Wunused-function  -Wunused-label  -Wunused-parameter @gol
244-Wunused-value  -Wunused-variable @gol
245-Wvariadic-macros -Wvla @gol
246-Wvolatile-register-var  -Wwrite-strings}
247
248@item C-only Warning Options
249@gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
250@c APPLE LOCAL warn missing prototype 6261539
251-Wnested-externs  -Wold-style-definition @gol
252-Wstrict-prototypes  -Wtraditional @gol
253-Wdeclaration-after-statement -Wpointer-sign}
254
255@item Debugging Options
256@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
257@gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
258-fdump-noaddr -fdump-unnumbered  -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
259-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
260-fdump-ipa-all -fdump-ipa-cgraph @gol
261-fdump-tree-all @gol
262-fdump-tree-original@r{[}-@var{n}@r{]}  @gol
263-fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
264-fdump-tree-inlined@r{[}-@var{n}@r{]} @gol
265-fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol
266-fdump-tree-ch @gol
267-fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
268-fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
269-fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
270-fdump-tree-dom@r{[}-@var{n}@r{]} @gol
271-fdump-tree-dse@r{[}-@var{n}@r{]} @gol
272-fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
273-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
274-fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
275-fdump-tree-nrv -fdump-tree-vect @gol
276-fdump-tree-sink @gol
277-fdump-tree-sra@r{[}-@var{n}@r{]} @gol
278-fdump-tree-salias @gol
279-fdump-tree-fre@r{[}-@var{n}@r{]} @gol
280-fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
281-ftree-vectorizer-verbose=@var{n} @gol
282-fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
283-feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
284-feliminate-unused-debug-symbols -femit-class-debug-always @gol
285-fmem-report -fprofile-arcs @gol
286-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
287-ftest-coverage  -ftime-report -fvar-tracking @gol
288-g  -g@var{level}  -gcoff -gdwarf-2 @gol
289-ggdb  -gstabs  -gstabs+  -gvms  -gxcoff  -gxcoff+ @gol
290-femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
291-femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
292-p  -pg  -print-file-name=@var{library}  -print-libgcc-file-name @gol
293-print-multi-directory  -print-multi-lib @gol
294-print-prog-name=@var{program}  -print-search-dirs  -Q @gol
295-save-temps  -time}
296
297@item Optimization Options
298@xref{Optimize Options,,Options that Control Optimization}.
299@gccoptlist{-falign-functions=@var{n}  -falign-jumps=@var{n} @gol
300-falign-labels=@var{n}  -falign-loops=@var{n}  @gol
301-fbounds-check -fmudflap -fmudflapth -fmudflapir @gol
302-fbranch-probabilities -fprofile-values -fvpt -fbranch-target-load-optimize @gol
303-fbranch-target-load-optimize2 -fbtr-bb-exclusive @gol
304-fcaller-saves  -fcprop-registers  -fcse-follow-jumps @gol
305-fcse-skip-blocks  -fcx-limited-range  -fdata-sections @gol
306-fdelayed-branch  -fdelete-null-pointer-checks -fearly-inlining @gol
307-fexpensive-optimizations  -ffast-math  -ffloat-store @gol
308-fforce-addr  -ffunction-sections @gol
309-fgcse  -fgcse-lm  -fgcse-sm  -fgcse-las  -fgcse-after-reload @gol
310-fcrossjumping  -fif-conversion  -fif-conversion2 @gol
311-finline-functions  -finline-functions-called-once @gol
312-finline-limit=@var{n}  -fkeep-inline-functions @gol
313-fkeep-static-consts  -fmerge-constants  -fmerge-all-constants @gol
314-fmodulo-sched -fno-branch-count-reg @gol
315-fno-default-inline  -fno-defer-pop -fmove-loop-invariants @gol
316-fno-function-cse  -fno-guess-branch-probability @gol
317-fno-inline  -fno-math-errno  -fno-peephole  -fno-peephole2 @gol
318-funsafe-math-optimizations  -funsafe-loop-optimizations  -ffinite-math-only @gol
319-fno-toplevel-reorder -fno-trapping-math  -fno-zero-initialized-in-bss @gol
320-fomit-frame-pointer  -foptimize-register-move @gol
321-foptimize-sibling-calls  -fprefetch-loop-arrays @gol
322-fprofile-generate -fprofile-use @gol
323-fregmove  -frename-registers @gol
324-freorder-blocks  -freorder-blocks-and-partition -freorder-functions @gol
325-frerun-cse-after-loop @gol
326-frounding-math -frtl-abstract-sequences @gol
327-fschedule-insns  -fschedule-insns2 @gol
328-fno-sched-interblock  -fno-sched-spec  -fsched-spec-load @gol
329-fsched-spec-load-dangerous  @gol
330-fsched-stalled-insns=@var{n} -fsched-stalled-insns-dep=@var{n} @gol
331-fsched2-use-superblocks @gol
332-fsched2-use-traces -fsee -freschedule-modulo-scheduled-loops @gol
333-fsection-anchors  -fsignaling-nans  -fsingle-precision-constant @gol
334-fstack-protector  -fstack-protector-all @gol
335-fstrict-aliasing  -fstrict-overflow  -ftracer  -fthread-jumps @gol
336-funroll-all-loops  -funroll-loops  -fpeel-loops @gol
337-fsplit-ivs-in-unroller -funswitch-loops @gol
338-fvariable-expansion-in-unroller @gol
339-ftree-pre  -ftree-ccp  -ftree-dce -ftree-loop-optimize @gol
340-ftree-loop-linear -ftree-loop-im -ftree-loop-ivcanon -fivopts @gol
341-ftree-dominator-opts -ftree-dse -ftree-copyrename -ftree-sink @gol
342-ftree-ch -ftree-sra -ftree-ter -ftree-lrs -ftree-fre -ftree-vectorize @gol
343-ftree-vect-loop-version -ftree-salias -fipa-pta -fweb @gol
344-ftree-copy-prop -ftree-store-ccp -ftree-store-copy-prop -fwhole-program @gol
345--param @var{name}=@var{value}
346-O  -O0  -O1  -O2  -O3  -Os}
347
348@item Preprocessor Options
349@xref{Preprocessor Options,,Options Controlling the Preprocessor}.
350@gccoptlist{-A@var{question}=@var{answer} @gol
351-A-@var{question}@r{[}=@var{answer}@r{]} @gol
352-C  -dD  -dI  -dM  -dN @gol
353-D@var{macro}@r{[}=@var{defn}@r{]}  -E  -H @gol
354-idirafter @var{dir} @gol
355-include @var{file}  -imacros @var{file} @gol
356-iprefix @var{file}  -iwithprefix @var{dir} @gol
357-iwithprefixbefore @var{dir}  -isystem @var{dir} @gol
358-imultilib @var{dir} -isysroot @var{dir} @gol
359-M  -MM  -MF  -MG  -MP  -MQ  -MT  -nostdinc  @gol
360-P  -fworking-directory  -remap @gol
361-trigraphs  -undef  -U@var{macro}  -Wp,@var{option} @gol
362-Xpreprocessor @var{option}}
363
364@item Assembler Option
365@xref{Assembler Options,,Passing Options to the Assembler}.
366@gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
367
368@item Linker Options
369@xref{Link Options,,Options for Linking}.
370@gccoptlist{@var{object-file-name}  -l@var{library} @gol
371-nostartfiles  -nodefaultlibs  -nostdlib -pie -rdynamic @gol
372-s  -static  -static-libgcc  -shared  -shared-libgcc  -symbolic @gol
373-Wl,@var{option}  -Xlinker @var{option} @gol
374-u @var{symbol}}
375
376@item Directory Options
377@xref{Directory Options,,Options for Directory Search}.
378@gccoptlist{-B@var{prefix}  -I@var{dir}  -iquote@var{dir}  -L@var{dir}
379-specs=@var{file}  -I- --sysroot=@var{dir}}
380
381@item Target Options
382@c I wrote this xref this way to avoid overfull hbox. -- rms
383@xref{Target Options}.
384@gccoptlist{-V @var{version}  -b @var{machine}}
385
386@item Machine Dependent Options
387@xref{Submodel Options,,Hardware Models and Configurations}.
388@c This list is ordered alphanumerically by subsection name.
389@c Try and put the significant identifier (CPU or system) first,
390@c so users have a clue at guessing where the ones they want will be.
391
392@emph{ARC Options}
393@gccoptlist{-EB  -EL @gol
394-mmangle-cpu  -mcpu=@var{cpu}  -mtext=@var{text-section} @gol
395-mdata=@var{data-section}  -mrodata=@var{readonly-data-section}}
396
397@emph{ARM Options}
398@gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
399-mabi=@var{name} @gol
400-mapcs-stack-check  -mno-apcs-stack-check @gol
401-mapcs-float  -mno-apcs-float @gol
402-mapcs-reentrant  -mno-apcs-reentrant @gol
403-msched-prolog  -mno-sched-prolog @gol
404-mlittle-endian  -mbig-endian  -mwords-little-endian @gol
405-mfloat-abi=@var{name}  -msoft-float  -mhard-float  -mfpe @gol
406-mthumb-interwork  -mno-thumb-interwork @gol
407-mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
408-mstructure-size-boundary=@var{n} @gol
409-mabort-on-noreturn @gol
410-mlong-calls  -mno-long-calls @gol
411-msingle-pic-base  -mno-single-pic-base @gol
412-mpic-register=@var{reg} @gol
413-mnop-fun-dllimport @gol
414-mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
415-mpoke-function-name @gol
416-mthumb  -marm @gol
417-mtpcs-frame  -mtpcs-leaf-frame @gol
418-mcaller-super-interworking  -mcallee-super-interworking @gol
419-mtp=@var{name}}
420
421@emph{AVR Options}
422@gccoptlist{-mmcu=@var{mcu}  -msize  -minit-stack=@var{n}  -mno-interrupts @gol
423-mcall-prologues  -mno-tablejump  -mtiny-stack  -mint8}
424
425@emph{Blackfin Options}
426@gccoptlist{-momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
427-mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
428-mlow-64k -mno-low64k -mid-shared-library @gol
429-mno-id-shared-library -mshared-library-id=@var{n} @gol
430-mlong-calls  -mno-long-calls}
431
432@emph{CRIS Options}
433@gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}  -mtune=@var{cpu} @gol
434-mmax-stack-frame=@var{n}  -melinux-stacksize=@var{n} @gol
435-metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
436-mstack-align  -mdata-align  -mconst-align @gol
437-m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue  -mno-gotplt @gol
438-melf  -maout  -melinux  -mlinux  -sim  -sim2 @gol
439-mmul-bug-workaround  -mno-mul-bug-workaround}
440
441@emph{CRX Options}
442@gccoptlist{-mmac -mpush-args}
443
444@emph{Darwin Options}
445@gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal @gol
446-arch_only  -bind_at_load  -bundle  -bundle_loader @gol
447-client_name  -compatibility_version  -current_version @gol
448-dead_strip @gol
449-dependency-file  -dylib_file  -dylinker_install_name @gol
450-dynamic  -dynamiclib  -exported_symbols_list @gol
451-filelist  -flat_namespace  -force_cpusubtype_ALL @gol
452-force_flat_namespace  -headerpad_max_install_names @gol
453-image_base  -init  -install_name  -keep_private_externs @gol
454-multi_module  -multiply_defined  -multiply_defined_unused @gol
455-noall_load   -no_dead_strip_inits_and_terms @gol
456-nofixprebinding -nomultidefs  -noprebind  -noseglinkedit @gol
457-pagezero_size  -prebind  -prebind_all_twolevel_modules @gol
458-private_bundle  -read_only_relocs  -sectalign @gol
459-sectobjectsymbols  -whyload  -seg1addr @gol
460-sectcreate  -sectobjectsymbols  -sectorder @gol
461-segaddr -segs_read_only_addr -segs_read_write_addr @gol
462-seg_addr_table  -seg_addr_table_filename  -seglinkedit @gol
463-segprot  -segs_read_only_addr  -segs_read_write_addr @gol
464-single_module  -static  -sub_library  -sub_umbrella @gol
465-twolevel_namespace  -umbrella  -undefined @gol
466-unexported_symbols_list  -weak_reference_mismatches @gol
467-whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
468-mkernel -mone-byte-bool}
469
470@emph{DEC Alpha Options}
471@gccoptlist{-mno-fp-regs  -msoft-float  -malpha-as  -mgas @gol
472-mieee  -mieee-with-inexact  -mieee-conformant @gol
473-mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
474-mtrap-precision=@var{mode}  -mbuild-constants @gol
475-mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
476-mbwx  -mmax  -mfix  -mcix @gol
477-mfloat-vax  -mfloat-ieee @gol
478-mexplicit-relocs  -msmall-data  -mlarge-data @gol
479-msmall-text  -mlarge-text @gol
480-mmemory-latency=@var{time}}
481
482@emph{DEC Alpha/VMS Options}
483@gccoptlist{-mvms-return-codes}
484
485@emph{FRV Options}
486@gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
487-mhard-float  -msoft-float @gol
488-malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
489-mdouble  -mno-double @gol
490-mmedia  -mno-media  -mmuladd  -mno-muladd @gol
491-mfdpic  -minline-plt -mgprel-ro  -multilib-library-pic @gol
492-mlinked-fp  -mlong-calls  -malign-labels @gol
493-mlibrary-pic  -macc-4  -macc-8 @gol
494-mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
495-moptimize-membar -mno-optimize-membar @gol
496-mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
497-mvliw-branch  -mno-vliw-branch @gol
498-mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
499-mno-nested-cond-exec  -mtomcat-stats @gol
500-mTLS -mtls @gol
501-mcpu=@var{cpu}}
502
503@emph{GNU/Linux Options}
504@gccoptlist{-muclibc}
505
506@emph{H8/300 Options}
507@gccoptlist{-mrelax  -mh  -ms  -mn  -mint32  -malign-300}
508
509@emph{HPPA Options}
510@gccoptlist{-march=@var{architecture-type} @gol
511-mbig-switch  -mdisable-fpregs  -mdisable-indexing @gol
512-mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
513-mfixed-range=@var{register-range} @gol
514-mjump-in-delay -mlinker-opt -mlong-calls @gol
515-mlong-load-store  -mno-big-switch  -mno-disable-fpregs @gol
516-mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
517-mno-jump-in-delay  -mno-long-load-store @gol
518-mno-portable-runtime  -mno-soft-float @gol
519-mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
520-mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
521-mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
522-munix=@var{unix-std}  -nolibdld  -static  -threads}
523
524@emph{i386 and x86-64 Options}
525@gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
526-mfpmath=@var{unit} @gol
527-masm=@var{dialect}  -mno-fancy-math-387 @gol
528-mno-fp-ret-in-387  -msoft-float  -msvr3-shlib @gol
529-mno-wide-multiply  -mrtd  -malign-double @gol
530-mpreferred-stack-boundary=@var{num} @gol
531-mmmx  -msse  -msse2 -msse3 -mssse3 -msse4a -m3dnow -mpopcnt -mabm -maes @gol
532-mthreads  -mno-align-stringops  -minline-all-stringops @gol
533-mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
534-m96bit-long-double  -mregparm=@var{num}  -msseregparm @gol
535-mstackrealign @gol
536-momit-leaf-frame-pointer  -mno-red-zone -mno-tls-direct-seg-refs @gol
537-mcmodel=@var{code-model} @gol
538-m32  -m64 -mlarge-data-threshold=@var{num}}
539
540@emph{IA-64 Options}
541@gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
542-mvolatile-asm-stop  -mregister-names  -mno-sdata @gol
543-mconstant-gp  -mauto-pic  -minline-float-divide-min-latency @gol
544-minline-float-divide-max-throughput @gol
545-minline-int-divide-min-latency @gol
546-minline-int-divide-max-throughput  @gol
547-minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
548-mno-dwarf2-asm -mearly-stop-bits @gol
549-mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
550-mtune=@var{cpu-type} -mt -pthread -milp32 -mlp64 @gol
551-mno-sched-br-data-spec -msched-ar-data-spec -mno-sched-control-spec @gol
552-msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
553-msched-ldc -mno-sched-control-ldc -mno-sched-spec-verbose @gol
554-mno-sched-prefer-non-data-spec-insns @gol
555-mno-sched-prefer-non-control-spec-insns @gol
556-mno-sched-count-spec-in-critical-path}
557
558@emph{M32R/D Options}
559@gccoptlist{-m32r2 -m32rx -m32r @gol
560-mdebug @gol
561-malign-loops -mno-align-loops @gol
562-missue-rate=@var{number} @gol
563-mbranch-cost=@var{number} @gol
564-mmodel=@var{code-size-model-type} @gol
565-msdata=@var{sdata-type} @gol
566-mno-flush-func -mflush-func=@var{name} @gol
567-mno-flush-trap -mflush-trap=@var{number} @gol
568-G @var{num}}
569
570@emph{M32C Options}
571@gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
572
573@emph{M680x0 Options}
574@gccoptlist{-m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
575-m68060  -mcpu32  -m5200  -mcfv4e -m68881  -mbitfield  @gol
576-mc68000  -mc68020   @gol
577-mnobitfield  -mrtd  -mshort  -msoft-float  -mpcrel @gol
578-malign-int  -mstrict-align  -msep-data  -mno-sep-data @gol
579-mshared-library-id=n  -mid-shared-library  -mno-id-shared-library}
580
581@emph{M68hc1x Options}
582@gccoptlist{-m6811  -m6812  -m68hc11  -m68hc12   -m68hcs12 @gol
583-mauto-incdec  -minmax  -mlong-calls  -mshort @gol
584-msoft-reg-count=@var{count}}
585
586@emph{MCore Options}
587@gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
588-mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
589-m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
590-mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
591-mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
592
593@emph{MIPS Options}
594@gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
595-mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips64 @gol
596-mips16  -mno-mips16  -mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
597-mshared  -mno-shared  -mxgot  -mno-xgot  -mgp32  -mgp64  @gol
598-mfp32  -mfp64  -mhard-float  -msoft-float  @gol
599-msingle-float  -mdouble-float  -mdsp  -mpaired-single  -mips3d @gol
600-mlong64  -mlong32  -msym32  -mno-sym32 @gol
601-G@var{num}  -membedded-data  -mno-embedded-data @gol
602-muninit-const-in-rodata  -mno-uninit-const-in-rodata @gol
603-msplit-addresses  -mno-split-addresses  @gol
604-mexplicit-relocs  -mno-explicit-relocs  @gol
605-mcheck-zero-division  -mno-check-zero-division @gol
606-mdivide-traps  -mdivide-breaks @gol
607-mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls @gol
608-mmad  -mno-mad  -mfused-madd  -mno-fused-madd  -nocpp @gol
609-mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400 @gol
610-mfix-vr4120  -mno-fix-vr4120  -mfix-vr4130 @gol
611-mfix-sb1  -mno-fix-sb1 @gol
612-mflush-func=@var{func}  -mno-flush-func @gol
613-mbranch-likely  -mno-branch-likely @gol
614-mfp-exceptions -mno-fp-exceptions @gol
615-mvr4130-align -mno-vr4130-align}
616
617@emph{MMIX Options}
618@gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
619-mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
620-melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
621-mno-base-addresses  -msingle-exit  -mno-single-exit}
622
623@emph{MN10300 Options}
624@gccoptlist{-mmult-bug  -mno-mult-bug @gol
625-mam33  -mno-am33 @gol
626-mam33-2  -mno-am33-2 @gol
627-mreturn-pointer-on-d0 @gol
628-mno-crt0  -mrelax}
629
630@emph{MT Options}
631@gccoptlist{-mno-crt0 -mbacc -msim @gol
632-march=@var{cpu-type} }
633
634@emph{PDP-11 Options}
635@gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
636-mbcopy  -mbcopy-builtin  -mint32  -mno-int16 @gol
637-mint16  -mno-int32  -mfloat32  -mno-float64 @gol
638-mfloat64  -mno-float32  -mabshi  -mno-abshi @gol
639-mbranch-expensive  -mbranch-cheap @gol
640-msplit  -mno-split  -munix-asm  -mdec-asm}
641
642@emph{PowerPC Options}
643See RS/6000 and PowerPC Options.
644
645@emph{RS/6000 and PowerPC Options}
646@gccoptlist{-mcpu=@var{cpu-type} @gol
647-mtune=@var{cpu-type} @gol
648-mpower  -mno-power  -mpower2  -mno-power2 @gol
649-mpowerpc  -mpowerpc64  -mno-powerpc @gol
650-maltivec  -mno-altivec @gol
651-mpowerpc-gpopt  -mno-powerpc-gpopt @gol
652-mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
653-mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb  -mfprnd  -mno-fprnd @gol
654-mnew-mnemonics  -mold-mnemonics @gol
655-mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
656-m64  -m32  -mxl-compat  -mno-xl-compat  -mpe @gol
657-malign-power  -malign-natural @gol
658-msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
659-mstring  -mno-string  -mupdate  -mno-update @gol
660-mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
661-mstrict-align  -mno-strict-align  -mrelocatable @gol
662-mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
663-mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
664-mdynamic-no-pic  -maltivec  -mswdiv @gol
665-mprioritize-restricted-insns=@var{priority} @gol
666-msched-costly-dep=@var{dependence_type} @gol
667-minsert-sched-nops=@var{scheme} @gol
668-mcall-sysv  -mcall-netbsd @gol
669-maix-struct-return  -msvr4-struct-return @gol
670-mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
671-misel -mno-isel @gol
672-misel=yes  -misel=no @gol
673-mspe -mno-spe @gol
674-mspe=yes  -mspe=no @gol
675-mvrsave -mno-vrsave @gol
676-mmulhw -mno-mulhw @gol
677-mdlmzb -mno-dlmzb @gol
678-mfloat-gprs=yes  -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
679-mprototype  -mno-prototype @gol
680-msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
681-msdata=@var{opt}  -mvxworks  -mwindiss  -G @var{num}  -pthread}
682
683@emph{S/390 and zSeries Options}
684@gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
685-mhard-float  -msoft-float -mlong-double-64 -mlong-double-128 @gol
686-mbackchain  -mno-backchain -mpacked-stack  -mno-packed-stack @gol
687-msmall-exec  -mno-small-exec  -mmvcle -mno-mvcle @gol
688-m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch @gol
689-mtpf-trace -mno-tpf-trace  -mfused-madd  -mno-fused-madd @gol
690-mwarn-framesize  -mwarn-dynamicstack  -mstack-size -mstack-guard}
691
692@emph{Score Options}
693@gccoptlist{-meb -mel @gol
694-mnhwloop @gol
695-muls @gol
696-mmac @gol
697-mscore5 -mscore5u -mscore7 -mscore7d}
698 
699@emph{SH Options}
700@gccoptlist{-m1  -m2  -m2e  -m3  -m3e @gol
701-m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
702-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
703-m5-64media  -m5-64media-nofpu @gol
704-m5-32media  -m5-32media-nofpu @gol
705-m5-compact  -m5-compact-nofpu @gol
706-mb  -ml  -mdalign  -mrelax @gol
707-mbigtable  -mfmovd  -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
708-mieee  -misize  -mpadstruct  -mspace @gol
709-mprefergot  -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
710-mdivsi3_libfunc=@var{name}  @gol
711-madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
712 -minvalid-symbols}
713
714@emph{SPARC Options}
715@gccoptlist{-mcpu=@var{cpu-type} @gol
716-mtune=@var{cpu-type} @gol
717-mcmodel=@var{code-model} @gol
718-m32  -m64  -mapp-regs  -mno-app-regs @gol
719-mfaster-structs  -mno-faster-structs @gol
720-mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
721-mhard-quad-float  -msoft-quad-float @gol
722-mimpure-text  -mno-impure-text  -mlittle-endian @gol
723-mstack-bias  -mno-stack-bias @gol
724-munaligned-doubles  -mno-unaligned-doubles @gol
725-mv8plus  -mno-v8plus  -mvis  -mno-vis
726-threads -pthreads -pthread}
727
728@emph{System V Options}
729@gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
730
731@emph{TMS320C3x/C4x Options}
732@gccoptlist{-mcpu=@var{cpu}  -mbig  -msmall  -mregparm  -mmemparm @gol
733-mfast-fix  -mmpyi  -mbk  -mti  -mdp-isr-reload @gol
734-mrpts=@var{count}  -mrptb  -mdb  -mloop-unsigned @gol
735-mparallel-insns  -mparallel-mpy  -mpreserve-float}
736
737@emph{V850 Options}
738@gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
739-mprolog-function  -mno-prolog-function  -mspace @gol
740-mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
741-mapp-regs  -mno-app-regs @gol
742-mdisable-callt  -mno-disable-callt @gol
743-mv850e1 @gol
744-mv850e @gol
745-mv850  -mbig-switch}
746
747@emph{VAX Options}
748@gccoptlist{-mg  -mgnu  -munix}
749
750@emph{x86-64 Options}
751See i386 and x86-64 Options.
752
753@emph{Xstormy16 Options}
754@gccoptlist{-msim}
755
756@emph{Xtensa Options}
757@gccoptlist{-mconst16 -mno-const16 @gol
758-mfused-madd  -mno-fused-madd @gol
759-mtext-section-literals  -mno-text-section-literals @gol
760-mtarget-align  -mno-target-align @gol
761-mlongcalls  -mno-longcalls}
762
763@emph{zSeries Options}
764See S/390 and zSeries Options.
765
766@item Code Generation Options
767@xref{Code Gen Options,,Options for Code Generation Conventions}.
768@gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
769-ffixed-@var{reg}  -fexceptions @gol
770-fnon-call-exceptions  -funwind-tables @gol
771-fasynchronous-unwind-tables @gol
772-finhibit-size-directive  -finstrument-functions @gol
773-finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
774-finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol
775-fno-common  -fno-ident @gol
776-fpcc-struct-return  -fpic  -fPIC -fpie -fPIE @gol
777-fno-jump-tables @gol
778-freg-struct-return  -fshort-enums @gol
779-fshort-double  -fshort-wchar @gol
780-fverbose-asm  -fpack-struct[=@var{n}]  -fstack-check @gol
781-fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
782-fargument-alias  -fargument-noalias @gol
783-fargument-noalias-global  -fargument-noalias-anything
784-fleading-underscore  -ftls-model=@var{model} @gol
785-ftrapv  -fwrapv  -fbounds-check @gol
786-fvisibility}
787@end table
788
789@menu
790* Overall Options::     Controlling the kind of output:
791                        an executable, object files, assembler files,
792                        or preprocessed source.
793* C Dialect Options::   Controlling the variant of C language compiled.
794* C++ Dialect Options:: Variations on C++.
795* Language Independent Options:: Controlling how diagnostics should be
796                        formatted.
797* Warning Options::     How picky should the compiler be?
798* Debugging Options::   Symbol tables, measurements, and debugging dumps.
799* Optimize Options::    How much optimization?
800* Preprocessor Options:: Controlling header files and macro definitions.
801                         Also, getting dependency information for Make.
802* Assembler Options::   Passing options to the assembler.
803* Link Options::        Specifying libraries and so on.
804* Directory Options::   Where to find header files and libraries.
805                        Where to find the compiler executable files.
806* Spec Files::          How to pass switches to sub-processes.
807* Target Options::      Running a cross-compiler, or an old version of GCC.
808@end menu
809
810@node Overall Options
811@section Options Controlling the Kind of Output
812
813Compilation can involve up to four stages: preprocessing, compilation
814proper, assembly and linking, always in that order.  GCC is capable of
815preprocessing and compiling several files either into several
816assembler input files, or into one assembler input file; then each
817assembler input file produces an object file, and linking combines all
818the object files (those newly compiled, and those specified as input)
819into an executable file.
820
821@cindex file name suffix
822For any given input file, the file name suffix determines what kind of
823compilation is done:
824
825@table @gcctabopt
826@item @var{file}.c
827C source code which must be preprocessed.
828
829@item @var{file}.i
830C source code which should not be preprocessed.
831
832@item @var{file}.ii
833C++ source code which should not be preprocessed.
834
835@item @var{file}.h
836C, or C++ header file to be turned into a precompiled header.
837
838@item @var{file}.cc
839@itemx @var{file}.cp
840@itemx @var{file}.cxx
841@itemx @var{file}.cpp
842@itemx @var{file}.CPP
843@itemx @var{file}.c++
844@itemx @var{file}.C
845C++ source code which must be preprocessed.  Note that in @samp{.cxx},
846the last two letters must both be literally @samp{x}.  Likewise,
847@samp{.C} refers to a literal capital C@.
848
849@item @var{file}.hh
850@itemx @var{file}.H
851C++ header file to be turned into a precompiled header.
852
853@item @var{file}.f
854@itemx @var{file}.for
855@itemx @var{file}.FOR
856Fixed form Fortran source code which should not be preprocessed.
857
858@item @var{file}.F
859@itemx @var{file}.fpp
860@itemx @var{file}.FPP
861Fixed form Fortran source code which must be preprocessed (with the traditional
862preprocessor).
863
864@item @var{file}.f90
865@itemx @var{file}.f95
866Free form Fortran source code which should not be preprocessed.
867
868@item @var{file}.F90
869@itemx @var{file}.F95
870Free form Fortran source code which must be preprocessed (with the
871traditional preprocessor).
872
873@c FIXME: Descriptions of Java file types.
874@c @var{file}.java
875@c @var{file}.class
876@c @var{file}.zip
877@c @var{file}.jar
878
879@item @var{file}.ads
880Ada source code file which contains a library unit declaration (a
881declaration of a package, subprogram, or generic, or a generic
882instantiation), or a library unit renaming declaration (a package,
883generic, or subprogram renaming declaration).  Such files are also
884called @dfn{specs}.
885
886@itemx @var{file}.adb
887Ada source code file containing a library unit body (a subprogram or
888package body).  Such files are also called @dfn{bodies}.
889
890@c GCC also knows about some suffixes for languages not yet included:
891@c Pascal:
892@c @var{file}.p
893@c @var{file}.pas
894@c Ratfor:
895@c @var{file}.r
896
897@item @var{file}.s
898Assembler code.
899
900@item @var{file}.S
901Assembler code which must be preprocessed.
902
903@item @var{other}
904An object file to be fed straight into linking.
905Any file name with no recognized suffix is treated this way.
906@end table
907
908@opindex x
909You can specify the input language explicitly with the @option{-x} option:
910
911@table @gcctabopt
912@item -x @var{language}
913Specify explicitly the @var{language} for the following input files
914(rather than letting the compiler choose a default based on the file
915name suffix).  This option applies to all following input files until
916the next @option{-x} option.  Possible values for @var{language} are:
917@smallexample
918c  c-header  c-cpp-output
919c++  c++-header  c++-cpp-output
920assembler  assembler-with-cpp
921ada
922f95  f95-cpp-input
923java
924treelang
925@end smallexample
926
927@item -x none
928Turn off any specification of a language, so that subsequent files are
929handled according to their file name suffixes (as they are if @option{-x}
930has not been used at all).
931
932@item -pass-exit-codes
933@opindex pass-exit-codes
934Normally the @command{gcc} program will exit with the code of 1 if any
935phase of the compiler returns a non-success return code.  If you specify
936@option{-pass-exit-codes}, the @command{gcc} program will instead return with
937numerically highest error produced by any phase that returned an error
938indication.  The C, C++, and Fortran frontends return 4, if an internal
939compiler error is encountered.
940@end table
941
942If you only want some of the stages of compilation, you can use
943@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
944one of the options @option{-c}, @option{-S}, or @option{-E} to say where
945@command{gcc} is to stop.  Note that some combinations (for example,
946@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
947
948@table @gcctabopt
949@item -c
950@opindex c
951Compile or assemble the source files, but do not link.  The linking
952stage simply is not done.  The ultimate output is in the form of an
953object file for each source file.
954
955By default, the object file name for a source file is made by replacing
956the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
957
958Unrecognized input files, not requiring compilation or assembly, are
959ignored.
960
961@item -S
962@opindex S
963Stop after the stage of compilation proper; do not assemble.  The output
964is in the form of an assembler code file for each non-assembler input
965file specified.
966
967By default, the assembler file name for a source file is made by
968replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
969
970Input files that don't require compilation are ignored.
971
972@item -E
973@opindex E
974Stop after the preprocessing stage; do not run the compiler proper.  The
975output is in the form of preprocessed source code, which is sent to the
976standard output.
977
978Input files which don't require preprocessing are ignored.
979
980@cindex output file option
981@item -o @var{file}
982@opindex o
983Place output in file @var{file}.  This applies regardless to whatever
984sort of output is being produced, whether it be an executable file,
985an object file, an assembler file or preprocessed C code.
986
987If @option{-o} is not specified, the default is to put an executable
988file in @file{a.out}, the object file for
989@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
990assembler file in @file{@var{source}.s}, a precompiled header file in
991@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
992standard output.
993
994@item -v
995@opindex v
996Print (on standard error output) the commands executed to run the stages
997of compilation.  Also print the version number of the compiler driver
998program and of the preprocessor and the compiler proper.
999
1000@item -###
1001@opindex ###
1002Like @option{-v} except the commands are not executed and all command
1003arguments are quoted.  This is useful for shell scripts to capture the
1004driver-generated command lines.
1005
1006@item -pipe
1007@opindex pipe
1008Use pipes rather than temporary files for communication between the
1009various stages of compilation.  This fails to work on some systems where
1010the assembler is unable to read from a pipe; but the GNU assembler has
1011no trouble.
1012
1013@item -combine
1014@opindex combine
1015If you are compiling multiple source files, this option tells the driver
1016to pass all the source files to the compiler at once (for those
1017languages for which the compiler can handle this).  This will allow
1018intermodule analysis (IMA) to be performed by the compiler.  Currently the only
1019language for which this is supported is C@.  If you pass source files for
1020multiple languages to the driver, using this option, the driver will invoke
1021the compiler(s) that support IMA once each, passing each compiler all the
1022source files appropriate for it.  For those languages that do not support
1023IMA this option will be ignored, and the compiler will be invoked once for
1024each source file in that language.  If you use this option in conjunction
1025with @option{-save-temps}, the compiler will generate multiple
1026pre-processed files
1027(one for each source file), but only one (combined) @file{.o} or
1028@file{.s} file.
1029
1030@item --help
1031@opindex help
1032Print (on the standard output) a description of the command line options
1033understood by @command{gcc}.  If the @option{-v} option is also specified
1034then @option{--help} will also be passed on to the various processes
1035invoked by @command{gcc}, so that they can display the command line options
1036they accept.  If the @option{-Wextra} option is also specified then command
1037line options which have no documentation associated with them will also
1038be displayed.
1039
1040@item --target-help
1041@opindex target-help
1042Print (on the standard output) a description of target specific command
1043line options for each tool.
1044
1045@item --version
1046@opindex version
1047Display the version number and copyrights of the invoked GCC@.
1048
1049@include @value{srcdir}/../libiberty/at-file.texi
1050@end table
1051
1052@node Invoking G++
1053@section Compiling C++ Programs
1054
1055@cindex suffixes for C++ source
1056@cindex C++ source file suffixes
1057C++ source files conventionally use one of the suffixes @samp{.C},
1058@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1059@samp{.cxx}; C++ header files often use @samp{.hh} or @samp{.H}; and
1060preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
1061files with these names and compiles them as C++ programs even if you
1062call the compiler the same way as for compiling C programs (usually
1063with the name @command{gcc}).
1064
1065@findex g++
1066@findex c++
1067However, the use of @command{gcc} does not add the C++ library.
1068@command{g++} is a program that calls GCC and treats @samp{.c},
1069@samp{.h} and @samp{.i} files as C++ source files instead of C source
1070files unless @option{-x} is used, and automatically specifies linking
1071against the C++ library.  This program is also useful when
1072precompiling a C header file with a @samp{.h} extension for use in C++
1073compilations.  On many systems, @command{g++} is also installed with
1074the name @command{c++}.
1075
1076@cindex invoking @command{g++}
1077When you compile C++ programs, you may specify many of the same
1078command-line options that you use for compiling programs in any
1079language; or command-line options meaningful for C and related
1080languages; or options that are meaningful only for C++ programs.
1081@xref{C Dialect Options,,Options Controlling C Dialect}, for
1082explanations of options for languages related to C@.
1083@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1084explanations of options that are meaningful only for C++ programs.
1085
1086@node C Dialect Options
1087@section Options Controlling C Dialect
1088@cindex dialect options
1089@cindex language dialect options
1090@cindex options, dialect
1091
1092The following options control the dialect of C (or languages derived
1093from C, such as C++) that the compiler accepts:
1094
1095@table @gcctabopt
1096@cindex ANSI support
1097@cindex ISO support
1098@item -ansi
1099@opindex ansi
1100In C mode, support all ISO C90 programs.  In C++ mode,
1101remove GNU extensions that conflict with ISO C++.
1102
1103This turns off certain features of GCC that are incompatible with ISO
1104C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1105such as the @code{asm} and @code{typeof} keywords, and
1106predefined macros such as @code{unix} and @code{vax} that identify the
1107type of system you are using.  It also enables the undesirable and
1108rarely used ISO trigraph feature.  For the C compiler,
1109it disables recognition of C++ style @samp{//} comments as well as
1110the @code{inline} keyword.
1111
1112The alternate keywords @code{__asm__}, @code{__extension__},
1113@code{__inline__} and @code{__typeof__} continue to work despite
1114@option{-ansi}.  You would not want to use them in an ISO C program, of
1115course, but it is useful to put them in header files that might be included
1116in compilations done with @option{-ansi}.  Alternate predefined macros
1117such as @code{__unix__} and @code{__vax__} are also available, with or
1118without @option{-ansi}.
1119
1120The @option{-ansi} option does not cause non-ISO programs to be
1121rejected gratuitously.  For that, @option{-pedantic} is required in
1122addition to @option{-ansi}.  @xref{Warning Options}.
1123
1124The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1125option is used.  Some header files may notice this macro and refrain
1126from declaring certain functions or defining certain macros that the
1127ISO standard doesn't call for; this is to avoid interfering with any
1128programs that might use these names for other things.
1129
1130Functions which would normally be built in but do not have semantics
1131defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1132functions with @option{-ansi} is used.  @xref{Other Builtins,,Other
1133built-in functions provided by GCC}, for details of the functions
1134affected.
1135
1136@item -std=
1137@opindex std
1138Determine the language standard.  This option is currently only
1139supported when compiling C or C++.  A value for this option must be
1140provided; possible values are
1141
1142@table @samp
1143@item c89
1144@itemx iso9899:1990
1145ISO C90 (same as @option{-ansi}).
1146
1147@item iso9899:199409
1148ISO C90 as modified in amendment 1.
1149
1150@item c99
1151@itemx c9x
1152@itemx iso9899:1999
1153@itemx iso9899:199x
1154ISO C99.  Note that this standard is not yet fully supported; see
1155@w{@uref{http://gcc.gnu.org/gcc-4.2/c99status.html}} for more information.  The
1156names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1157
1158@item gnu89
1159Default, ISO C90 plus GNU extensions (including some C99 features).
1160
1161@item gnu99
1162@itemx gnu9x
1163ISO C99 plus GNU extensions.  When ISO C99 is fully implemented in GCC,
1164this will become the default.  The name @samp{gnu9x} is deprecated.
1165
1166@item c++98
1167The 1998 ISO C++ standard plus amendments.
1168
1169@item gnu++98
1170The same as @option{-std=c++98} plus GNU extensions.  This is the
1171default for C++ code.
1172@end table
1173
1174Even when this option is not specified, you can still use some of the
1175features of newer standards in so far as they do not conflict with
1176previous C standards.  For example, you may use @code{__restrict__} even
1177when @option{-std=c99} is not specified.
1178
1179The @option{-std} options specifying some version of ISO C have the same
1180effects as @option{-ansi}, except that features that were not in ISO C90
1181but are in the specified version (for example, @samp{//} comments and
1182the @code{inline} keyword in ISO C99) are not disabled.
1183
1184@xref{Standards,,Language Standards Supported by GCC}, for details of
1185these standard versions.
1186
1187@item -fgnu89-inline
1188@opindex fgnu89-inline
1189The option @option{-fgnu89-inline} tells GCC to use the traditional
1190GNU semantics for @code{inline} functions when in C99 mode.
1191@xref{Inline,,An Inline Function is As Fast As a Macro}.  Using this
1192option is roughly equivalent to adding the @code{gnu_inline} function
1193attribute to all inline functions (@pxref{Function Attributes}).
1194
1195This option is accepted by GCC versions 4.1.3 and up.  In GCC versions
1196prior to 4.3, C99 inline semantics are not supported, and thus this
1197option is effectively assumed to be present regardless of whether or not
1198it is specified; the only effect of specifying it explicitly is to
1199disable warnings about using inline functions in C99 mode.  Likewise,
1200the option @option{-fno-gnu89-inline} is not supported in versions of
1201GCC before 4.3.  It will be supported only in C99 or gnu99 mode, not in
1202C89 or gnu89 mode.
1203
1204The preprocesor macros @code{__GNUC_GNU_INLINE__} and
1205@code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1206in effect for @code{inline} functions.  @xref{Common Predefined
1207Macros,,,cpp,The C Preprocessor}.
1208
1209@item -aux-info @var{filename}
1210@opindex aux-info
1211Output to the given filename prototyped declarations for all functions
1212declared and/or defined in a translation unit, including those in header
1213files.  This option is silently ignored in any language other than C@.
1214
1215Besides declarations, the file indicates, in comments, the origin of
1216each declaration (source file and line), whether the declaration was
1217implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1218@samp{O} for old, respectively, in the first character after the line
1219number and the colon), and whether it came from a declaration or a
1220definition (@samp{C} or @samp{F}, respectively, in the following
1221character).  In the case of function definitions, a K&R-style list of
1222arguments followed by their declarations is also provided, inside
1223comments, after the declaration.
1224
1225@item -fno-asm
1226@opindex fno-asm
1227Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1228keyword, so that code can use these words as identifiers.  You can use
1229the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1230instead.  @option{-ansi} implies @option{-fno-asm}.
1231
1232In C++, this switch only affects the @code{typeof} keyword, since
1233@code{asm} and @code{inline} are standard keywords.  You may want to
1234use the @option{-fno-gnu-keywords} flag instead, which has the same
1235effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1236switch only affects the @code{asm} and @code{typeof} keywords, since
1237@code{inline} is a standard keyword in ISO C99.
1238
1239@c APPLE LOCAL begin blocks 7205047 5811887
1240@item -fno-blocks
1241@opindex fno-blocks
1242Disable the use of blocks.  In @option{-std=c99} mode, blocks are
1243turned off by default.  @option{-fblocks} can be used to re-enable the
1244feature, if off.  Runtime support for blocks first appeared in Mac OS
1245X 10.6.  When targeting 10.6 (see @option{-mmacosx-version-min}) and
1246later, the extension is on by default.
1247@c APPLE LOCAL end blocks 7205047 5811887
1248
1249@item -fno-builtin
1250@itemx -fno-builtin-@var{function}
1251@opindex fno-builtin
1252@cindex built-in functions
1253Don't recognize built-in functions that do not begin with
1254@samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
1255functions provided by GCC}, for details of the functions affected,
1256including those which are not built-in functions when @option{-ansi} or
1257@option{-std} options for strict ISO C conformance are used because they
1258do not have an ISO standard meaning.
1259
1260GCC normally generates special code to handle certain built-in functions
1261more efficiently; for instance, calls to @code{alloca} may become single
1262instructions that adjust the stack directly, and calls to @code{memcpy}
1263may become inline copy loops.  The resulting code is often both smaller
1264and faster, but since the function calls no longer appear as such, you
1265cannot set a breakpoint on those calls, nor can you change the behavior
1266of the functions by linking with a different library.  In addition,
1267when a function is recognized as a built-in function, GCC may use
1268information about that function to warn about problems with calls to
1269that function, or to generate more efficient code, even if the
1270resulting code still contains calls to that function.  For example,
1271warnings are given with @option{-Wformat} for bad calls to
1272@code{printf}, when @code{printf} is built in, and @code{strlen} is
1273known not to modify global memory.
1274
1275With the @option{-fno-builtin-@var{function}} option
1276only the built-in function @var{function} is
1277disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
1278function is named this is not built-in in this version of GCC, this
1279option is ignored.  There is no corresponding
1280@option{-fbuiltin-@var{function}} option; if you wish to enable
1281built-in functions selectively when using @option{-fno-builtin} or
1282@option{-ffreestanding}, you may define macros such as:
1283
1284@smallexample
1285#define abs(n)          __builtin_abs ((n))
1286#define strcpy(d, s)    __builtin_strcpy ((d), (s))
1287@end smallexample
1288
1289@item -fhosted
1290@opindex fhosted
1291@cindex hosted environment
1292
1293Assert that compilation takes place in a hosted environment.  This implies
1294@option{-fbuiltin}.  A hosted environment is one in which the
1295entire standard library is available, and in which @code{main} has a return
1296type of @code{int}.  Examples are nearly everything except a kernel.
1297This is equivalent to @option{-fno-freestanding}.
1298
1299@item -ffreestanding
1300@opindex ffreestanding
1301@cindex hosted environment
1302
1303Assert that compilation takes place in a freestanding environment.  This
1304implies @option{-fno-builtin}.  A freestanding environment
1305is one in which the standard library may not exist, and program startup may
1306not necessarily be at @code{main}.  The most obvious example is an OS kernel.
1307This is equivalent to @option{-fno-hosted}.
1308
1309@xref{Standards,,Language Standards Supported by GCC}, for details of
1310freestanding and hosted environments.
1311
1312@item -fopenmp
1313@opindex fopenmp
1314@cindex openmp parallel
1315Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1316@code{!$omp} in Fortran.  When @option{-fopenmp} is specified, the
1317compiler generates parallel code according to the OpenMP Application
1318Program Interface v2.5 @w{@uref{http://www.openmp.org/}}.
1319
1320@item -fms-extensions
1321@opindex fms-extensions
1322Accept some non-standard constructs used in Microsoft header files.
1323
1324Some cases of unnamed fields in structures and unions are only
1325accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
1326fields within structs/unions}, for details.
1327
1328@item -trigraphs
1329@opindex trigraphs
1330Support ISO C trigraphs.  The @option{-ansi} option (and @option{-std}
1331options for strict ISO C conformance) implies @option{-trigraphs}.
1332
1333@item -no-integrated-cpp
1334@opindex no-integrated-cpp
1335Performs a compilation in two passes: preprocessing and compiling.  This
1336option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1337@option{-B} option.  The user supplied compilation step can then add in
1338an additional preprocessing step after normal preprocessing but before
1339compiling.  The default is to use the integrated cpp (internal cpp)
1340
1341The semantics of this option will change if "cc1", "cc1plus", and
1342"cc1obj" are merged.
1343
1344@cindex traditional C language
1345@cindex C language, traditional
1346@item -traditional
1347@itemx -traditional-cpp
1348@opindex traditional-cpp
1349@opindex traditional
1350Formerly, these options caused GCC to attempt to emulate a pre-standard
1351C compiler.  They are now only supported with the @option{-E} switch.
1352The preprocessor continues to support a pre-standard mode.  See the GNU
1353CPP manual for details.
1354
1355@c APPLE LOCAL begin nested functions 4357979
1356@item -fno-nested-functions
1357@opindex fno-nested-functions
1358Disable nested functions.  This option is not supported for C++ or
1359Objective-C++.  On FreeBSD, nested functions are disabled by default.
1360@c APPLE LOCAL end nested functions 4357979
1361
1362@item -fcond-mismatch
1363@opindex fcond-mismatch
1364Allow conditional expressions with mismatched types in the second and
1365third arguments.  The value of such an expression is void.  This option
1366is not supported for C++.
1367
1368@item -flax-vector-conversions
1369@opindex flax-vector-conversions
1370Allow implicit conversions between vectors with differing numbers of
1371elements and/or incompatible element types.  This option should not be
1372used for new code.
1373
1374@item -funsigned-char
1375@opindex funsigned-char
1376Let the type @code{char} be unsigned, like @code{unsigned char}.
1377
1378Each kind of machine has a default for what @code{char} should
1379be.  It is either like @code{unsigned char} by default or like
1380@code{signed char} by default.
1381
1382Ideally, a portable program should always use @code{signed char} or
1383@code{unsigned char} when it depends on the signedness of an object.
1384But many programs have been written to use plain @code{char} and
1385expect it to be signed, or expect it to be unsigned, depending on the
1386machines they were written for.  This option, and its inverse, let you
1387make such a program work with the opposite default.
1388
1389The type @code{char} is always a distinct type from each of
1390@code{signed char} or @code{unsigned char}, even though its behavior
1391is always just like one of those two.
1392
1393@item -fsigned-char
1394@opindex fsigned-char
1395Let the type @code{char} be signed, like @code{signed char}.
1396
1397Note that this is equivalent to @option{-fno-unsigned-char}, which is
1398the negative form of @option{-funsigned-char}.  Likewise, the option
1399@option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1400
1401@item -fsigned-bitfields
1402@itemx -funsigned-bitfields
1403@itemx -fno-signed-bitfields
1404@itemx -fno-unsigned-bitfields
1405@opindex fsigned-bitfields
1406@opindex funsigned-bitfields
1407@opindex fno-signed-bitfields
1408@opindex fno-unsigned-bitfields
1409These options control whether a bit-field is signed or unsigned, when the
1410declaration does not use either @code{signed} or @code{unsigned}.  By
1411default, such a bit-field is signed, because this is consistent: the
1412basic integer types such as @code{int} are signed types.
1413@end table
1414
1415@node C++ Dialect Options
1416@section Options Controlling C++ Dialect
1417
1418@cindex compiler options, C++
1419@cindex C++ options, command line
1420@cindex options, C++
1421This section describes the command-line options that are only meaningful
1422for C++ programs; but you can also use most of the GNU compiler options
1423regardless of what language your program is in.  For example, you
1424might compile a file @code{firstClass.C} like this:
1425
1426@smallexample
1427g++ -g -frepo -O -c firstClass.C
1428@end smallexample
1429
1430@noindent
1431In this example, only @option{-frepo} is an option meant
1432only for C++ programs; you can use the other options with any
1433language supported by GCC@.
1434
1435Here is a list of options that are @emph{only} for compiling C++ programs:
1436
1437@table @gcctabopt
1438
1439@item -fabi-version=@var{n}
1440@opindex fabi-version
1441Use version @var{n} of the C++ ABI@.  Version 2 is the version of the
1442C++ ABI that first appeared in G++ 3.4.  Version 1 is the version of
1443the C++ ABI that first appeared in G++ 3.2.  Version 0 will always be
1444the version that conforms most closely to the C++ ABI specification.
1445Therefore, the ABI obtained using version 0 will change as ABI bugs
1446are fixed.
1447
1448The default is version 2.
1449
1450@item -fno-access-control
1451@opindex fno-access-control
1452Turn off all access checking.  This switch is mainly useful for working
1453around bugs in the access control code.
1454
1455@item -fcheck-new
1456@opindex fcheck-new
1457Check that the pointer returned by @code{operator new} is non-null
1458before attempting to modify the storage allocated.  This check is
1459normally unnecessary because the C++ standard specifies that
1460@code{operator new} will only return @code{0} if it is declared
1461@samp{throw()}, in which case the compiler will always check the
1462return value even without this option.  In all other cases, when
1463@code{operator new} has a non-empty exception specification, memory
1464exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
1465@samp{new (nothrow)}.
1466
1467@item -fconserve-space
1468@opindex fconserve-space
1469Put uninitialized or runtime-initialized global variables into the
1470common segment, as C does.  This saves space in the executable at the
1471cost of not diagnosing duplicate definitions.  If you compile with this
1472flag and your program mysteriously crashes after @code{main()} has
1473completed, you may have an object that is being destroyed twice because
1474two definitions were merged.
1475
1476This option is no longer useful on most targets, now that support has
1477been added for putting variables into BSS without making them common.
1478
1479@item -ffriend-injection
1480@opindex ffriend-injection
1481Inject friend functions into the enclosing namespace, so that they are
1482visible outside the scope of the class in which they are declared.
1483Friend functions were documented to work this way in the old Annotated
1484C++ Reference Manual, and versions of G++ before 4.1 always worked
1485that way.  However, in ISO C++ a friend function which is not declared
1486in an enclosing scope can only be found using argument dependent
1487lookup.  This option causes friends to be injected as they were in
1488earlier releases.
1489
1490This option is for compatibility, and may be removed in a future
1491release of G++.
1492
1493@item -fno-elide-constructors
1494@opindex fno-elide-constructors
1495The C++ standard allows an implementation to omit creating a temporary
1496which is only used to initialize another object of the same type.
1497Specifying this option disables that optimization, and forces G++ to
1498call the copy constructor in all cases.
1499
1500@item -fno-enforce-eh-specs
1501@opindex fno-enforce-eh-specs
1502Don't generate code to check for violation of exception specifications
1503at runtime.  This option violates the C++ standard, but may be useful
1504for reducing code size in production builds, much like defining
1505@samp{NDEBUG}.  This does not give user code permission to throw
1506exceptions in violation of the exception specifications; the compiler
1507will still optimize based on the specifications, so throwing an
1508unexpected exception will result in undefined behavior.
1509
1510@item -ffor-scope
1511@itemx -fno-for-scope
1512@opindex ffor-scope
1513@opindex fno-for-scope
1514If @option{-ffor-scope} is specified, the scope of variables declared in
1515a @i{for-init-statement} is limited to the @samp{for} loop itself,
1516as specified by the C++ standard.
1517If @option{-fno-for-scope} is specified, the scope of variables declared in
1518a @i{for-init-statement} extends to the end of the enclosing scope,
1519as was the case in old versions of G++, and other (traditional)
1520implementations of C++.
1521
1522The default if neither flag is given to follow the standard,
1523but to allow and give a warning for old-style code that would
1524otherwise be invalid, or have different behavior.
1525
1526@item -fno-gnu-keywords
1527@opindex fno-gnu-keywords
1528Do not recognize @code{typeof} as a keyword, so that code can use this
1529word as an identifier.  You can use the keyword @code{__typeof__} instead.
1530@option{-ansi} implies @option{-fno-gnu-keywords}.
1531
1532@item -fno-implicit-templates
1533@opindex fno-implicit-templates
1534Never emit code for non-inline templates which are instantiated
1535implicitly (i.e.@: by use); only emit code for explicit instantiations.
1536@xref{Template Instantiation}, for more information.
1537
1538@item -fno-implicit-inline-templates
1539@opindex fno-implicit-inline-templates
1540Don't emit code for implicit instantiations of inline templates, either.
1541The default is to handle inlines differently so that compiles with and
1542without optimization will need the same set of explicit instantiations.
1543
1544@item -fno-implement-inlines
1545@opindex fno-implement-inlines
1546To save space, do not emit out-of-line copies of inline functions
1547controlled by @samp{#pragma implementation}.  This will cause linker
1548errors if these functions are not inlined everywhere they are called.
1549
1550@item -fms-extensions
1551@opindex fms-extensions
1552Disable pedantic warnings about constructs used in MFC, such as implicit
1553int and getting a pointer to member function via non-standard syntax.
1554
1555@item -fno-nonansi-builtins
1556@opindex fno-nonansi-builtins
1557Disable built-in declarations of functions that are not mandated by
1558ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
1559@code{index}, @code{bzero}, @code{conjf}, and other related functions.
1560
1561@item -fno-operator-names
1562@opindex fno-operator-names
1563Do not treat the operator name keywords @code{and}, @code{bitand},
1564@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1565synonyms as keywords.
1566
1567@item -fno-optional-diags
1568@opindex fno-optional-diags
1569Disable diagnostics that the standard says a compiler does not need to
1570issue.  Currently, the only such diagnostic issued by G++ is the one for
1571a name having multiple meanings within a class.
1572
1573@item -fpermissive
1574@opindex fpermissive
1575Downgrade some diagnostics about nonconformant code from errors to
1576warnings.  Thus, using @option{-fpermissive} will allow some
1577nonconforming code to compile.
1578
1579@item -frepo
1580@opindex frepo
1581Enable automatic template instantiation at link time.  This option also
1582implies @option{-fno-implicit-templates}.  @xref{Template
1583Instantiation}, for more information.
1584
1585@item -fno-rtti
1586@opindex fno-rtti
1587Disable generation of information about every class with virtual
1588functions for use by the C++ runtime type identification features
1589(@samp{dynamic_cast} and @samp{typeid}).  If you don't use those parts
1590of the language, you can save some space by using this flag.  Note that
1591exception handling uses the same information, but it will generate it as
1592needed. The @samp{dynamic_cast} operator can still be used for casts that
1593do not require runtime type information, i.e. casts to @code{void *} or to
1594unambiguous base classes.
1595
1596@item -fstats
1597@opindex fstats
1598Emit statistics about front-end processing at the end of the compilation.
1599This information is generally only useful to the G++ development team.
1600
1601@item -ftemplate-depth-@var{n}
1602@opindex ftemplate-depth
1603Set the maximum instantiation depth for template classes to @var{n}.
1604A limit on the template instantiation depth is needed to detect
1605endless recursions during template class instantiation.  ANSI/ISO C++
1606conforming programs must not rely on a maximum depth greater than 17.
1607
1608@item -fno-threadsafe-statics
1609@opindex fno-threadsafe-statics
1610Do not emit the extra code to use the routines specified in the C++
1611ABI for thread-safe initialization of local statics.  You can use this
1612option to reduce code size slightly in code that doesn't need to be
1613thread-safe.
1614
1615@item -fuse-cxa-atexit
1616@opindex fuse-cxa-atexit
1617Register destructors for objects with static storage duration with the
1618@code{__cxa_atexit} function rather than the @code{atexit} function.
1619This option is required for fully standards-compliant handling of static
1620destructors, but will only work if your C library supports
1621@code{__cxa_atexit}.
1622
1623@item -fno-use-cxa-get-exception-ptr
1624@opindex fno-use-cxa-get-exception-ptr
1625Don't use the @code{__cxa_get_exception_ptr} runtime routine.  This
1626will cause @code{std::uncaught_exception} to be incorrect, but is necessary
1627if the runtime routine is not available.
1628
1629@item -fvisibility-inlines-hidden
1630@opindex fvisibility-inlines-hidden
1631This switch declares that the user does not attempt to compare
1632pointers to inline methods where the addresses of the two functions
1633were taken in different shared objects.
1634
1635The effect of this is that GCC may, effectively, mark inline methods with
1636@code{__attribute__ ((visibility ("hidden")))} so that they do not
1637appear in the export table of a DSO and do not require a PLT indirection
1638when used within the DSO@.  Enabling this option can have a dramatic effect
1639on load and link times of a DSO as it massively reduces the size of the
1640dynamic export table when the library makes heavy use of templates.
1641
1642The behaviour of this switch is not quite the same as marking the
1643methods as hidden directly, because it does not affect static variables
1644local to the function or cause the compiler to deduce that
1645the function is defined in only one shared object.
1646
1647You may mark a method as having a visibility explicitly to negate the
1648effect of the switch for that method.  For example, if you do want to
1649compare pointers to a particular inline method, you might mark it as
1650having default visibility.  Marking the enclosing class with explicit
1651visibility will have no effect.
1652
1653Explicitly instantiated inline methods are unaffected by this option
1654as their linkage might otherwise cross a shared library boundary.
1655@xref{Template Instantiation}.
1656
1657@item -fvisibility-ms-compat
1658@opindex fvisibility-ms-compat
1659This flag attempts to use visibility settings to make GCC's C++
1660linkage model compatible with that of Microsoft Visual Studio.
1661
1662The flag makes these changes to GCC's linkage model:
1663
1664@enumerate
1665@item
1666It sets the default visibility to @code{hidden}, like
1667@option{-fvisibility=hidden}.
1668
1669@item
1670Types, but not their members, are not hidden by default.
1671
1672@item
1673The One Definition Rule is relaxed for types without explicit
1674visibility specifications which are defined in more than one different
1675shared object: those declarations are permitted if they would have
1676been permitted when this option was not used.
1677@end enumerate
1678
1679In new code it is better to use @option{-fvisibility=hidden} and
1680export those classes which are intended to be externally visible.
1681Unfortunately it is possible for code to rely, perhaps accidentally,
1682on the Visual Studio behaviour.
1683
1684Among the consequences of these changes are that static data members
1685of the same type with the same name but defined in different shared
1686objects will be different, so changing one will not change the other;
1687and that pointers to function members defined in different shared
1688objects may not compare equal.  When this flag is given, it is a
1689violation of the ODR to define types with the same name differently.
1690
1691@item -fno-weak
1692@opindex fno-weak
1693Do not use weak symbol support, even if it is provided by the linker.
1694By default, G++ will use weak symbols if they are available.  This
1695option exists only for testing, and should not be used by end-users;
1696it will result in inferior code and has no benefits.  This option may
1697be removed in a future release of G++.
1698
1699@item -nostdinc++
1700@opindex nostdinc++
1701Do not search for header files in the standard directories specific to
1702C++, but do still search the other standard directories.  (This option
1703is used when building the C++ library.)
1704@end table
1705
1706In addition, these optimization, warning, and code generation options
1707have meanings only for C++ programs:
1708
1709@table @gcctabopt
1710@item -fno-default-inline
1711@opindex fno-default-inline
1712Do not assume @samp{inline} for functions defined inside a class scope.
1713@xref{Optimize Options,,Options That Control Optimization}.  Note that these
1714functions will have linkage like inline functions; they just won't be
1715inlined by default.
1716
1717@item -Wabi @r{(C++ only)}
1718@opindex Wabi
1719Warn when G++ generates code that is probably not compatible with the
1720vendor-neutral C++ ABI@.  Although an effort has been made to warn about
1721all such cases, there are probably some cases that are not warned about,
1722even though G++ is generating incompatible code.  There may also be
1723cases where warnings are emitted even though the code that is generated
1724will be compatible.
1725
1726You should rewrite your code to avoid these warnings if you are
1727concerned about the fact that code generated by G++ may not be binary
1728compatible with code generated by other compilers.
1729
1730The known incompatibilities at this point include:
1731
1732@itemize @bullet
1733
1734@item
1735Incorrect handling of tail-padding for bit-fields.  G++ may attempt to
1736pack data into the same byte as a base class.  For example:
1737
1738@smallexample
1739struct A @{ virtual void f(); int f1 : 1; @};
1740struct B : public A @{ int f2 : 1; @};
1741@end smallexample
1742
1743@noindent
1744In this case, G++ will place @code{B::f2} into the same byte
1745as@code{A::f1}; other compilers will not.  You can avoid this problem
1746by explicitly padding @code{A} so that its size is a multiple of the
1747byte size on your platform; that will cause G++ and other compilers to
1748layout @code{B} identically.
1749
1750@item
1751Incorrect handling of tail-padding for virtual bases.  G++ does not use
1752tail padding when laying out virtual bases.  For example:
1753
1754@smallexample
1755struct A @{ virtual void f(); char c1; @};
1756struct B @{ B(); char c2; @};
1757struct C : public A, public virtual B @{@};
1758@end smallexample
1759
1760@noindent
1761In this case, G++ will not place @code{B} into the tail-padding for
1762@code{A}; other compilers will.  You can avoid this problem by
1763explicitly padding @code{A} so that its size is a multiple of its
1764alignment (ignoring virtual base classes); that will cause G++ and other
1765compilers to layout @code{C} identically.
1766
1767@item
1768Incorrect handling of bit-fields with declared widths greater than that
1769of their underlying types, when the bit-fields appear in a union.  For
1770example:
1771
1772@smallexample
1773union U @{ int i : 4096; @};
1774@end smallexample
1775
1776@noindent
1777Assuming that an @code{int} does not have 4096 bits, G++ will make the
1778union too small by the number of bits in an @code{int}.
1779
1780@item
1781Empty classes can be placed at incorrect offsets.  For example:
1782
1783@smallexample
1784struct A @{@};
1785
1786struct B @{
1787  A a;
1788  virtual void f ();
1789@};
1790
1791struct C : public B, public A @{@};
1792@end smallexample
1793
1794@noindent
1795G++ will place the @code{A} base class of @code{C} at a nonzero offset;
1796it should be placed at offset zero.  G++ mistakenly believes that the
1797@code{A} data member of @code{B} is already at offset zero.
1798
1799@item
1800Names of template functions whose types involve @code{typename} or
1801template template parameters can be mangled incorrectly.
1802
1803@smallexample
1804template <typename Q>
1805void f(typename Q::X) @{@}
1806
1807template <template <typename> class Q>
1808void f(typename Q<int>::X) @{@}
1809@end smallexample
1810
1811@noindent
1812Instantiations of these templates may be mangled incorrectly.
1813
1814@end itemize
1815
1816@item -Wctor-dtor-privacy @r{(C++ only)}
1817@opindex Wctor-dtor-privacy
1818Warn when a class seems unusable because all the constructors or
1819destructors in that class are private, and it has neither friends nor
1820public static member functions.
1821
1822@item -Wnon-virtual-dtor @r{(C++ only)}
1823@opindex Wnon-virtual-dtor
1824Warn when a class appears to be polymorphic, thereby requiring a virtual
1825destructor, yet it declares a non-virtual one.  This warning is also
1826enabled if -Weffc++ is specified.
1827
1828@item -Wreorder @r{(C++ only)}
1829@opindex Wreorder
1830@cindex reordering, warning
1831@cindex warning for reordering of member initializers
1832Warn when the order of member initializers given in the code does not
1833match the order in which they must be executed.  For instance:
1834
1835@smallexample
1836struct A @{
1837  int i;
1838  int j;
1839  A(): j (0), i (1) @{ @}
1840@};
1841@end smallexample
1842
1843The compiler will rearrange the member initializers for @samp{i}
1844and @samp{j} to match the declaration order of the members, emitting
1845a warning to that effect.  This warning is enabled by @option{-Wall}.
1846@end table
1847
1848The following @option{-W@dots{}} options are not affected by @option{-Wall}.
1849
1850@table @gcctabopt
1851@item -Weffc++ @r{(C++ only)}
1852@opindex Weffc++
1853Warn about violations of the following style guidelines from Scott Meyers'
1854@cite{Effective C++} book:
1855
1856@itemize @bullet
1857@item
1858Item 11:  Define a copy constructor and an assignment operator for classes
1859with dynamically allocated memory.
1860
1861@item
1862Item 12:  Prefer initialization to assignment in constructors.
1863
1864@item
1865Item 14:  Make destructors virtual in base classes.
1866
1867@item
1868Item 15:  Have @code{operator=} return a reference to @code{*this}.
1869
1870@item
1871Item 23:  Don't try to return a reference when you must return an object.
1872
1873@end itemize
1874
1875Also warn about violations of the following style guidelines from
1876Scott Meyers' @cite{More Effective C++} book:
1877
1878@itemize @bullet
1879@item
1880Item 6:  Distinguish between prefix and postfix forms of increment and
1881decrement operators.
1882
1883@item
1884Item 7:  Never overload @code{&&}, @code{||}, or @code{,}.
1885
1886@end itemize
1887
1888When selecting this option, be aware that the standard library
1889headers do not obey all of these guidelines; use @samp{grep -v}
1890to filter out those warnings.
1891
1892@item -Wno-deprecated @r{(C++ only)}
1893@opindex Wno-deprecated
1894Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
1895
1896@item -Wstrict-null-sentinel @r{(C++ only)}
1897@opindex Wstrict-null-sentinel
1898Warn also about the use of an uncasted @code{NULL} as sentinel.  When
1899compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
1900to @code{__null}.  Although it is a null pointer constant not a null pointer,
1901it is guaranteed to of the same size as a pointer.  But this use is
1902not portable across different compilers.
1903
1904@item -Wno-non-template-friend @r{(C++ only)}
1905@opindex Wno-non-template-friend
1906Disable warnings when non-templatized friend functions are declared
1907within a template.  Since the advent of explicit template specification
1908support in G++, if the name of the friend is an unqualified-id (i.e.,
1909@samp{friend foo(int)}), the C++ language specification demands that the
1910friend declare or define an ordinary, nontemplate function.  (Section
191114.5.3).  Before G++ implemented explicit specification, unqualified-ids
1912could be interpreted as a particular specialization of a templatized
1913function.  Because this non-conforming behavior is no longer the default
1914behavior for G++, @option{-Wnon-template-friend} allows the compiler to
1915check existing code for potential trouble spots and is on by default.
1916This new compiler behavior can be turned off with
1917@option{-Wno-non-template-friend} which keeps the conformant compiler code
1918but disables the helpful warning.
1919
1920@item -Wold-style-cast @r{(C++ only)}
1921@opindex Wold-style-cast
1922Warn if an old-style (C-style) cast to a non-void type is used within
1923a C++ program.  The new-style casts (@samp{dynamic_cast},
1924@samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are
1925less vulnerable to unintended effects and much easier to search for.
1926
1927@item -Woverloaded-virtual @r{(C++ only)}
1928@opindex Woverloaded-virtual
1929@cindex overloaded virtual fn, warning
1930@cindex warning for overloaded virtual fn
1931Warn when a function declaration hides virtual functions from a
1932base class.  For example, in:
1933
1934@smallexample
1935struct A @{
1936  virtual void f();
1937@};
1938
1939struct B: public A @{
1940  void f(int);
1941@};
1942@end smallexample
1943
1944the @code{A} class version of @code{f} is hidden in @code{B}, and code
1945like:
1946
1947@smallexample
1948B* b;
1949b->f();
1950@end smallexample
1951
1952will fail to compile.
1953
1954@item -Wno-pmf-conversions @r{(C++ only)}
1955@opindex Wno-pmf-conversions
1956Disable the diagnostic for converting a bound pointer to member function
1957to a plain pointer.
1958
1959@item -Wsign-promo @r{(C++ only)}
1960@opindex Wsign-promo
1961Warn when overload resolution chooses a promotion from unsigned or
1962enumerated type to a signed type, over a conversion to an unsigned type of
1963the same size.  Previous versions of G++ would try to preserve
1964unsignedness, but the standard mandates the current behavior.
1965
1966@smallexample
1967struct A @{
1968  operator int ();
1969  A& operator = (int);
1970@};
1971
1972main ()
1973@{
1974  A a,b;
1975  a = b;
1976@}
1977@end smallexample
1978
1979In this example, G++ will synthesize a default @samp{A& operator =
1980(const A&);}, while cfront will use the user-defined @samp{operator =}.
1981@end table
1982
1983@node Language Independent Options
1984@section Options to Control Diagnostic Messages Formatting
1985@cindex options to control diagnostics formatting
1986@cindex diagnostic messages
1987@cindex message formatting
1988
1989Traditionally, diagnostic messages have been formatted irrespective of
1990the output device's aspect (e.g.@: its width, @dots{}).  The options described
1991below can be used to control the diagnostic messages formatting
1992algorithm, e.g.@: how many characters per line, how often source location
1993information should be reported.  Right now, only the C++ front end can
1994honor these options.  However it is expected, in the near future, that
1995the remaining front ends would be able to digest them correctly.
1996
1997@table @gcctabopt
1998@item -fmessage-length=@var{n}
1999@opindex fmessage-length
2000Try to format error messages so that they fit on lines of about @var{n}
2001characters.  The default is 72 characters for @command{g++} and 0 for the rest of
2002the front ends supported by GCC@.  If @var{n} is zero, then no
2003line-wrapping will be done; each error message will appear on a single
2004line.
2005
2006@opindex fdiagnostics-show-location
2007@item -fdiagnostics-show-location=once
2008Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
2009reporter to emit @emph{once} source location information; that is, in
2010case the message is too long to fit on a single physical line and has to
2011be wrapped, the source location won't be emitted (as prefix) again,
2012over and over, in subsequent continuation lines.  This is the default
2013behavior.
2014
2015@item -fdiagnostics-show-location=every-line
2016Only meaningful in line-wrapping mode.  Instructs the diagnostic
2017messages reporter to emit the same source location information (as
2018prefix) for physical lines that result from the process of breaking
2019a message which is too long to fit on a single line.
2020
2021@item -fdiagnostics-show-option
2022@opindex fdiagnostics-show-option
2023This option instructs the diagnostic machinery to add text to each
2024diagnostic emitted, which indicates which command line option directly
2025controls that diagnostic, when such an option is known to the
2026diagnostic machinery.
2027
2028@end table
2029
2030@node Warning Options
2031@section Options to Request or Suppress Warnings
2032@cindex options to control warnings
2033@cindex warning messages
2034@cindex messages, warning
2035@cindex suppressing warnings
2036
2037Warnings are diagnostic messages that report constructions which
2038are not inherently erroneous but which are risky or suggest there
2039may have been an error.
2040
2041You can request many specific warnings with options beginning @samp{-W},
2042for example @option{-Wimplicit} to request warnings on implicit
2043declarations.  Each of these specific warning options also has a
2044negative form beginning @samp{-Wno-} to turn off warnings;
2045for example, @option{-Wno-implicit}.  This manual lists only one of the
2046two forms, whichever is not the default.
2047
2048The following options control the amount and kinds of warnings produced
2049by GCC; for further, language-specific options also refer to
2050@ref{C++ Dialect Options}.
2051
2052@table @gcctabopt
2053@cindex syntax checking
2054@item -fsyntax-only
2055@opindex fsyntax-only
2056Check the code for syntax errors, but don't do anything beyond that.
2057
2058@item -pedantic
2059@opindex pedantic
2060Issue all the warnings demanded by strict ISO C and ISO C++;
2061reject all programs that use forbidden extensions, and some other
2062programs that do not follow ISO C and ISO C++.  For ISO C, follows the
2063version of the ISO C standard specified by any @option{-std} option used.
2064
2065Valid ISO C and ISO C++ programs should compile properly with or without
2066this option (though a rare few will require @option{-ansi} or a
2067@option{-std} option specifying the required version of ISO C)@.  However,
2068without this option, certain GNU extensions and traditional C and C++
2069features are supported as well.  With this option, they are rejected.
2070
2071@option{-pedantic} does not cause warning messages for use of the
2072alternate keywords whose names begin and end with @samp{__}.  Pedantic
2073warnings are also disabled in the expression that follows
2074@code{__extension__}.  However, only system header files should use
2075these escape routes; application programs should avoid them.
2076@xref{Alternate Keywords}.
2077
2078Some users try to use @option{-pedantic} to check programs for strict ISO
2079C conformance.  They soon find that it does not do quite what they want:
2080it finds some non-ISO practices, but not all---only those for which
2081ISO C @emph{requires} a diagnostic, and some others for which
2082diagnostics have been added.
2083
2084A feature to report any failure to conform to ISO C might be useful in
2085some instances, but would require considerable additional work and would
2086be quite different from @option{-pedantic}.  We don't have plans to
2087support such a feature in the near future.
2088
2089Where the standard specified with @option{-std} represents a GNU
2090extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
2091corresponding @dfn{base standard}, the version of ISO C on which the GNU
2092extended dialect is based.  Warnings from @option{-pedantic} are given
2093where they are required by the base standard.  (It would not make sense
2094for such warnings to be given only for features not in the specified GNU
2095C dialect, since by definition the GNU dialects of C include all
2096features the compiler supports with the given option, and there would be
2097nothing to warn about.)
2098
2099@item -pedantic-errors
2100@opindex pedantic-errors
2101Like @option{-pedantic}, except that errors are produced rather than
2102warnings.
2103
2104@item -w
2105@opindex w
2106Inhibit all warning messages.
2107
2108@item -Wno-import
2109@opindex Wno-import
2110Inhibit warning messages about the use of @samp{#import}.
2111
2112@c APPLE LOCAL begin -Wnewline-eof 2001-08-23 --sts **
2113@item -Wnewline-eof
2114@opindex Wnewline-eof
2115Warn about files missing a newline at the end of the file.  (Apple compatible)
2116@c APPLE LOCAL end -Wnewline-eof 2001-08-23 --sts **
2117
2118@item -Wchar-subscripts
2119@opindex Wchar-subscripts
2120Warn if an array subscript has type @code{char}.  This is a common cause
2121of error, as programmers often forget that this type is signed on some
2122machines.
2123This warning is enabled by @option{-Wall}.
2124
2125@item -Wcomment
2126@opindex Wcomment
2127Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
2128comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
2129This warning is enabled by @option{-Wall}.
2130
2131@item -Wfatal-errors
2132@opindex Wfatal-errors
2133This option causes the compiler to abort compilation on the first error
2134occurred rather than trying to keep going and printing further error
2135messages.
2136
2137@item -Wformat
2138@opindex Wformat
2139@opindex ffreestanding
2140@opindex fno-builtin
2141Check calls to @code{printf} and @code{scanf}, etc., to make sure that
2142the arguments supplied have types appropriate to the format string
2143specified, and that the conversions specified in the format string make
2144sense.  This includes standard functions, and others specified by format
2145attributes (@pxref{Function Attributes}), in the @code{printf},
2146@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
2147not in the C standard) families (or other target-specific families).
2148Which functions are checked without format attributes having been
2149specified depends on the standard version selected, and such checks of
2150functions without the attribute specified are disabled by
2151@option{-ffreestanding} or @option{-fno-builtin}.
2152
2153The formats are checked against the format features supported by GNU
2154libc version 2.2.  These include all ISO C90 and C99 features, as well
2155as features from the Single Unix Specification and some BSD and GNU
2156extensions.  Other library implementations may not support all these
2157features; GCC does not support warning about features that go beyond a
2158particular library's limitations.  However, if @option{-pedantic} is used
2159with @option{-Wformat}, warnings will be given about format features not
2160in the selected standard version (but not for @code{strfmon} formats,
2161since those are not in any version of the C standard).  @xref{C Dialect
2162Options,,Options Controlling C Dialect}.
2163
2164Since @option{-Wformat} also checks for null format arguments for
2165several functions, @option{-Wformat} also implies @option{-Wnonnull}.
2166
2167@option{-Wformat} is included in @option{-Wall}.  For more control over some
2168aspects of format checking, the options @option{-Wformat-y2k},
2169@option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
2170@option{-Wformat-nonliteral}, @option{-Wformat-security}, and
2171@option{-Wformat=2} are available, but are not included in @option{-Wall}.
2172
2173@item -Wformat-y2k
2174@opindex Wformat-y2k
2175If @option{-Wformat} is specified, also warn about @code{strftime}
2176formats which may yield only a two-digit year.
2177
2178@item -Wno-format-extra-args
2179@opindex Wno-format-extra-args
2180If @option{-Wformat} is specified, do not warn about excess arguments to a
2181@code{printf} or @code{scanf} format function.  The C standard specifies
2182that such arguments are ignored.
2183
2184Where the unused arguments lie between used arguments that are
2185specified with @samp{$} operand number specifications, normally
2186warnings are still given, since the implementation could not know what
2187type to pass to @code{va_arg} to skip the unused arguments.  However,
2188in the case of @code{scanf} formats, this option will suppress the
2189warning if the unused arguments are all pointers, since the Single
2190Unix Specification says that such unused arguments are allowed.
2191
2192@item -Wno-format-zero-length
2193@opindex Wno-format-zero-length
2194If @option{-Wformat} is specified, do not warn about zero-length formats.
2195The C standard specifies that zero-length formats are allowed.
2196
2197@item -Wformat-nonliteral
2198@opindex Wformat-nonliteral
2199If @option{-Wformat} is specified, also warn if the format string is not a
2200string literal and so cannot be checked, unless the format function
2201takes its format arguments as a @code{va_list}.
2202
2203@item -Wformat-security
2204@opindex Wformat-security
2205If @option{-Wformat} is specified, also warn about uses of format
2206functions that represent possible security problems.  At present, this
2207warns about calls to @code{printf} and @code{scanf} functions where the
2208format string is not a string literal and there are no format arguments,
2209as in @code{printf (foo);}.  This may be a security hole if the format
2210string came from untrusted input and contains @samp{%n}.  (This is
2211currently a subset of what @option{-Wformat-nonliteral} warns about, but
2212in future warnings may be added to @option{-Wformat-security} that are not
2213included in @option{-Wformat-nonliteral}.)
2214
2215@item -Wformat=2
2216@opindex Wformat=2
2217Enable @option{-Wformat} plus format checks not included in
2218@option{-Wformat}.  Currently equivalent to @samp{-Wformat
2219-Wformat-nonliteral -Wformat-security -Wformat-y2k}.
2220
2221@item -Wnonnull
2222@opindex Wnonnull
2223Warn about passing a null pointer for arguments marked as
2224requiring a non-null value by the @code{nonnull} function attribute.
2225
2226@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
2227can be disabled with the @option{-Wno-nonnull} option.
2228
2229@item -Winit-self @r{(C and C++ only)}
2230@opindex Winit-self
2231Warn about uninitialized variables which are initialized with themselves.
2232Note this option can only be used with the @option{-Wuninitialized} option,
2233which in turn only works with @option{-O1} and above.
2234
2235For example, GCC will warn about @code{i} being uninitialized in the
2236following snippet only when @option{-Winit-self} has been specified:
2237@smallexample
2238@group
2239int f()
2240@{
2241  int i = i;
2242  return i;
2243@}
2244@end group
2245@end smallexample
2246
2247@item -Wimplicit-int
2248@opindex Wimplicit-int
2249Warn when a declaration does not specify a type.
2250This warning is enabled by @option{-Wall}.
2251
2252@item -Wimplicit-function-declaration
2253@itemx -Werror-implicit-function-declaration
2254@opindex Wimplicit-function-declaration
2255@opindex Werror-implicit-function-declaration
2256Give a warning (or error) whenever a function is used before being
2257declared.  The form @option{-Wno-error-implicit-function-declaration}
2258is not supported.
2259This warning is enabled by @option{-Wall} (as a warning, not an error).
2260
2261@item -Wimplicit
2262@opindex Wimplicit
2263Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
2264This warning is enabled by @option{-Wall}.
2265
2266@item -Wmain
2267@opindex Wmain
2268Warn if the type of @samp{main} is suspicious.  @samp{main} should be a
2269function with external linkage, returning int, taking either zero
2270arguments, two, or three arguments of appropriate types.
2271This warning is enabled by @option{-Wall}.
2272
2273@item -Wmissing-braces
2274@opindex Wmissing-braces
2275Warn if an aggregate or union initializer is not fully bracketed.  In
2276the following example, the initializer for @samp{a} is not fully
2277bracketed, but that for @samp{b} is fully bracketed.
2278
2279@smallexample
2280int a[2][2] = @{ 0, 1, 2, 3 @};
2281int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
2282@end smallexample
2283
2284This warning is enabled by @option{-Wall}.
2285
2286@item -Wmissing-include-dirs @r{(C and C++ only)}
2287@opindex Wmissing-include-dirs
2288Warn if a user-supplied include directory does not exist.
2289
2290@item -Wparentheses
2291@opindex Wparentheses
2292Warn if parentheses are omitted in certain contexts, such
2293as when there is an assignment in a context where a truth value
2294is expected, or when operators are nested whose precedence people
2295often get confused about.
2296
2297Also warn if a comparison like @samp{x<=y<=z} appears; this is
2298equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
2299interpretation from that of ordinary mathematical notation.
2300
2301Also warn about constructions where there may be confusion to which
2302@code{if} statement an @code{else} branch belongs.  Here is an example of
2303such a case:
2304
2305@smallexample
2306@group
2307@{
2308  if (a)
2309    if (b)
2310      foo ();
2311  else
2312    bar ();
2313@}
2314@end group
2315@end smallexample
2316
2317In C/C++, every @code{else} branch belongs to the innermost possible
2318@code{if} statement, which in this example is @code{if (b)}.  This is
2319often not what the programmer expected, as illustrated in the above
2320example by indentation the programmer chose.  When there is the
2321potential for this confusion, GCC will issue a warning when this flag
2322is specified.  To eliminate the warning, add explicit braces around
2323the innermost @code{if} statement so there is no way the @code{else}
2324could belong to the enclosing @code{if}.  The resulting code would
2325look like this:
2326
2327@smallexample
2328@group
2329@{
2330  if (a)
2331    @{
2332      if (b)
2333        foo ();
2334      else
2335        bar ();
2336    @}
2337@}
2338@end group
2339@end smallexample
2340
2341This warning is enabled by @option{-Wall}.
2342
2343@item -Wsequence-point
2344@opindex Wsequence-point
2345Warn about code that may have undefined semantics because of violations
2346of sequence point rules in the C and C++ standards.
2347
2348The C and C++ standards defines the order in which expressions in a C/C++
2349program are evaluated in terms of @dfn{sequence points}, which represent
2350a partial ordering between the execution of parts of the program: those
2351executed before the sequence point, and those executed after it.  These
2352occur after the evaluation of a full expression (one which is not part
2353of a larger expression), after the evaluation of the first operand of a
2354@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
2355function is called (but after the evaluation of its arguments and the
2356expression denoting the called function), and in certain other places.
2357Other than as expressed by the sequence point rules, the order of
2358evaluation of subexpressions of an expression is not specified.  All
2359these rules describe only a partial order rather than a total order,
2360since, for example, if two functions are called within one expression
2361with no sequence point between them, the order in which the functions
2362are called is not specified.  However, the standards committee have
2363ruled that function calls do not overlap.
2364
2365It is not specified when between sequence points modifications to the
2366values of objects take effect.  Programs whose behavior depends on this
2367have undefined behavior; the C and C++ standards specify that ``Between
2368the previous and next sequence point an object shall have its stored
2369value modified at most once by the evaluation of an expression.  
2370Furthermore, the prior value shall be read only to determine the value
2371to be stored.''.  If a program breaks these rules, the results on any
2372particular implementation are entirely unpredictable.
2373
2374Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
2375= b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
2376diagnosed by this option, and it may give an occasional false positive
2377result, but in general it has been found fairly effective at detecting
2378this sort of problem in programs.
2379
2380The standard is worded confusingly, therefore there is some debate
2381over the precise meaning of the sequence point rules in subtle cases.
2382Links to discussions of the problem, including proposed formal
2383definitions, may be found on the GCC readings page, at
2384@w{@uref{http://gcc.gnu.org/readings.html}}.
2385
2386This warning is enabled by @option{-Wall} for C and C++.
2387
2388@item -Wreturn-type
2389@opindex Wreturn-type
2390Warn whenever a function is defined with a return-type that defaults to
2391@code{int}.  Also warn about any @code{return} statement with no
2392return-value in a function whose return-type is not @code{void}.
2393
2394For C, also warn if the return type of a function has a type qualifier
2395such as @code{const}.  Such a type qualifier has no effect, since the
2396value returned by a function is not an lvalue.  ISO C prohibits
2397qualified @code{void} return types on function definitions, so such
2398return types always receive a warning even without this option.
2399
2400For C++, a function without return type always produces a diagnostic
2401message, even when @option{-Wno-return-type} is specified.  The only
2402exceptions are @samp{main} and functions defined in system headers.
2403
2404This warning is enabled by @option{-Wall}.
2405
2406@item -Wswitch
2407@opindex Wswitch
2408Warn whenever a @code{switch} statement has an index of enumerated type
2409and lacks a @code{case} for one or more of the named codes of that
2410enumeration.  (The presence of a @code{default} label prevents this
2411warning.)  @code{case} labels outside the enumeration range also
2412provoke warnings when this option is used.
2413This warning is enabled by @option{-Wall}.
2414
2415@item -Wswitch-default
2416@opindex Wswitch-switch
2417Warn whenever a @code{switch} statement does not have a @code{default}
2418case.
2419
2420@item -Wswitch-enum
2421@opindex Wswitch-enum
2422Warn whenever a @code{switch} statement has an index of enumerated type
2423and lacks a @code{case} for one or more of the named codes of that
2424enumeration.  @code{case} labels outside the enumeration range also
2425provoke warnings when this option is used.
2426
2427@item -Wtrigraphs
2428@opindex Wtrigraphs
2429Warn if any trigraphs are encountered that might change the meaning of
2430the program (trigraphs within comments are not warned about).
2431This warning is enabled by @option{-Wall}.
2432
2433@item -Wunused-function
2434@opindex Wunused-function
2435Warn whenever a static function is declared but not defined or a
2436non-inline static function is unused.
2437This warning is enabled by @option{-Wall}.
2438
2439@item -Wunused-label
2440@opindex Wunused-label
2441Warn whenever a label is declared but not used.
2442This warning is enabled by @option{-Wall}.
2443
2444To suppress this warning use the @samp{unused} attribute
2445(@pxref{Variable Attributes}).
2446
2447@item -Wunused-parameter
2448@opindex Wunused-parameter
2449Warn whenever a function parameter is unused aside from its declaration.
2450
2451To suppress this warning use the @samp{unused} attribute
2452(@pxref{Variable Attributes}).
2453
2454@item -Wunused-variable
2455@opindex Wunused-variable
2456Warn whenever a local variable or non-constant static variable is unused
2457aside from its declaration.
2458This warning is enabled by @option{-Wall}.
2459
2460To suppress this warning use the @samp{unused} attribute
2461(@pxref{Variable Attributes}).
2462
2463@item -Wunused-value
2464@opindex Wunused-value
2465Warn whenever a statement computes a result that is explicitly not used.
2466This warning is enabled by @option{-Wall}.
2467
2468To suppress this warning cast the expression to @samp{void}.
2469
2470@item -Wunused
2471@opindex Wunused
2472All the above @option{-Wunused} options combined.
2473
2474In order to get a warning about an unused function parameter, you must
2475either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
2476@samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
2477
2478@item -Wuninitialized
2479@opindex Wuninitialized
2480Warn if an automatic variable is used without first being initialized or
2481if a variable may be clobbered by a @code{setjmp} call.
2482
2483These warnings are possible only in optimizing compilation,
2484because they require data flow information that is computed only
2485when optimizing.  If you do not specify @option{-O}, you will not get 
2486these warnings. Instead, GCC will issue a warning about @option{-Wuninitialized}
2487requiring @option{-O}.
2488
2489If you want to warn about code which uses the uninitialized value of the
2490variable in its own initializer, use the @option{-Winit-self} option.
2491
2492These warnings occur for individual uninitialized or clobbered
2493elements of structure, union or array variables as well as for
2494variables which are uninitialized or clobbered as a whole.  They do
2495not occur for variables or elements declared @code{volatile}.  Because
2496these warnings depend on optimization, the exact variables or elements
2497for which there are warnings will depend on the precise optimization
2498options and version of GCC used.
2499
2500Note that there may be no warning about a variable that is used only
2501to compute a value that itself is never used, because such
2502computations may be deleted by data flow analysis before the warnings
2503are printed.
2504
2505These warnings are made optional because GCC is not smart
2506enough to see all the reasons why the code might be correct
2507despite appearing to have an error.  Here is one example of how
2508this can happen:
2509
2510@smallexample
2511@group
2512@{
2513  int x;
2514  switch (y)
2515    @{
2516    case 1: x = 1;
2517      break;
2518    case 2: x = 4;
2519      break;
2520    case 3: x = 5;
2521    @}
2522  foo (x);
2523@}
2524@end group
2525@end smallexample
2526
2527@noindent
2528If the value of @code{y} is always 1, 2 or 3, then @code{x} is
2529always initialized, but GCC doesn't know this.  Here is
2530another common case:
2531
2532@smallexample
2533@{
2534  int save_y;
2535  if (change_y) save_y = y, y = new_y;
2536  @dots{}
2537  if (change_y) y = save_y;
2538@}
2539@end smallexample
2540
2541@noindent
2542This has no bug because @code{save_y} is used only if it is set.
2543
2544@cindex @code{longjmp} warnings
2545This option also warns when a non-volatile automatic variable might be
2546changed by a call to @code{longjmp}.  These warnings as well are possible
2547only in optimizing compilation.
2548
2549The compiler sees only the calls to @code{setjmp}.  It cannot know
2550where @code{longjmp} will be called; in fact, a signal handler could
2551call it at any point in the code.  As a result, you may get a warning
2552even when there is in fact no problem because @code{longjmp} cannot
2553in fact be called at the place which would cause a problem.
2554
2555Some spurious warnings can be avoided if you declare all the functions
2556you use that never return as @code{noreturn}.  @xref{Function
2557Attributes}.
2558
2559This warning is enabled by @option{-Wall}.
2560
2561@item -Wunknown-pragmas
2562@opindex Wunknown-pragmas
2563@cindex warning for unknown pragmas
2564@cindex unknown pragmas, warning
2565@cindex pragmas, warning of unknown
2566Warn when a #pragma directive is encountered which is not understood by
2567GCC@.  If this command line option is used, warnings will even be issued
2568for unknown pragmas in system header files.  This is not the case if
2569the warnings were only enabled by the @option{-Wall} command line option.
2570
2571@item -Wno-pragmas
2572@opindex Wno-pragmas
2573@opindex Wpragmas
2574Do not warn about misuses of pragmas, such as incorrect parameters,
2575invalid syntax, or conflicts between pragmas.  See also
2576@samp{-Wunknown-pragmas}.
2577
2578@item -Wstrict-aliasing
2579@opindex Wstrict-aliasing
2580This option is only active when @option{-fstrict-aliasing} is active.
2581It warns about code which might break the strict aliasing rules that the
2582compiler is using for optimization.  The warning does not catch all
2583cases, but does attempt to catch the more common pitfalls.  It is
2584included in @option{-Wall}.
2585It is equivalent to -Wstrict-aliasing=3
2586
2587@item -Wstrict-aliasing=n
2588@opindex Wstrict-aliasing=n
2589This option is only active when @option{-fstrict-aliasing} is active.
2590It warns about code which might break the strict aliasing rules that the
2591compiler is using for optimization.
2592Higher levels correspond to higher accuracy (fewer false positives).
2593Higher levels also correspond to more effort, similar to the way -O works.
2594@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=n},
2595with n=3.
2596
2597Level 1: Most aggressive, quick, least accurate.
2598Possibly useful when higher levels
2599do not warn but -fstrict-aliasing still breaks the code, as it has very few 
2600false negatives.  However, it has many false positives.
2601Warns for all pointer conversions between possibly incompatible types, 
2602even if never dereferenced.  Runs in the frontend only.
2603
2604Level 2: Aggressive, quick, not too precise.
2605May still have many false positives (not as many as level 1 though),
2606and few false negatives (but possibly more than level 1).
2607Unlike level 1, it only warns when an address is taken.  Warns about
2608incomplete types.  Runs in the frontend only.
2609
2610Level 3 (default for @option{-Wstrict-aliasing}): 
2611Should have very few false positives and few false 
2612negatives.  Slightly slower than levels 1 or 2 when optimization is enabled.
2613Takes care of the common punn+dereference pattern in the frontend:
2614@code{*(int*)&some_float}.
2615If optimization is enabled, it also runs in the backend, where it deals 
2616with multiple statement cases using flow-sensitive points-to information.
2617Only warns when the converted pointer is dereferenced.
2618Does not warn about incomplete types.
2619
2620@item -Wstrict-overflow
2621@item -Wstrict-overflow=@var{n}
2622@opindex Wstrict-overflow
2623This option is only active when @option{-fstrict-overflow} is active.
2624It warns about cases where the compiler optimizes based on the
2625assumption that signed overflow does not occur.  Note that it does not
2626warn about all cases where the code might overflow: it only warns
2627about cases where the compiler implements some optimization.  Thus
2628this warning depends on the optimization level.
2629
2630An optimization which assumes that signed overflow does not occur is
2631perfectly safe if the values of the variables involved are such that
2632overflow never does, in fact, occur.  Therefore this warning can
2633easily give a false positive: a warning about code which is not
2634actually a problem.  To help focus on important issues, several
2635warning levels are defined.  No warnings are issued for the use of
2636undefined signed overflow when estimating how many iterations a loop
2637will require, in particular when determining whether a loop will be
2638executed at all.
2639
2640@table @option
2641@item -Wstrict-overflow=1
2642Warn about cases which are both questionable and easy to avoid.  For
2643example: @code{x + 1 > x}; with @option{-fstrict-overflow}, the
2644compiler will simplify this to @code{1}.  This level of
2645@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
2646are not, and must be explicitly requested.
2647
2648@item -Wstrict-overflow=2
2649Also warn about other cases where a comparison is simplified to a
2650constant.  For example: @code{abs (x) >= 0}.  This can only be
2651simplified when @option{-fstrict-overflow} is in effect, because
2652@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
2653zero.  @option{-Wstrict-overflow} (with no level) is the same as
2654@option{-Wstrict-overflow=2}.
2655
2656@item -Wstrict-overflow=3
2657Also warn about other cases where a comparison is simplified.  For
2658example: @code{x + 1 > 1} will be simplified to @code{x > 0}.
2659
2660@item -Wstrict-overflow=4
2661Also warn about other simplifications not covered by the above cases.
2662For example: @code{(x * 10) / 5} will be simplified to @code{x * 2}.
2663
2664@item -Wstrict-overflow=5
2665Also warn about cases where the compiler reduces the magnitude of a
2666constant involved in a comparison.  For example: @code{x + 2 > y} will
2667be simplified to @code{x + 1 >= y}.  This is reported only at the
2668highest warning level because this simplification applies to many
2669comparisons, so this warning level will give a very large number of
2670false positives.
2671@end table
2672
2673@item -Wall
2674@opindex Wall
2675All of the above @samp{-W} options combined.  This enables all the
2676warnings about constructions that some users consider questionable, and
2677that are easy to avoid (or modify to prevent the warning), even in
2678conjunction with macros.  This also enables some language-specific
2679warnings described in @ref{C++ Dialect Options}.
2680@c APPLE LOCAL begin -Wmost
2681@item -Wmost
2682@opindex Wmost
2683This is equivalent to -Wall -Wno-parentheses.  (Apple compatible)
2684@end table
2685@c APPLE LOCAL end -Wmost
2686
2687The following @option{-W@dots{}} options are not implied by @option{-Wall}.
2688Some of them warn about constructions that users generally do not
2689consider questionable, but which occasionally you might wish to check
2690for; others warn about constructions that are necessary or hard to avoid
2691in some cases, and there is no simple way to modify the code to suppress
2692the warning.
2693
2694@table @gcctabopt
2695@item -Wextra
2696@opindex W
2697@opindex Wextra
2698(This option used to be called @option{-W}.  The older name is still
2699supported, but the newer name is more descriptive.)  Print extra warning
2700messages for these events:
2701
2702@itemize @bullet
2703@item
2704A function can return either with or without a value.  (Falling
2705off the end of the function body is considered returning without
2706a value.)  For example, this function would evoke such a
2707warning:
2708
2709@smallexample
2710@group
2711foo (a)
2712@{
2713  if (a > 0)
2714    return a;
2715@}
2716@end group
2717@end smallexample
2718
2719@item
2720An expression-statement or the left-hand side of a comma expression
2721contains no side effects.
2722To suppress the warning, cast the unused expression to void.
2723For example, an expression such as @samp{x[i,j]} will cause a warning,
2724but @samp{x[(void)i,j]} will not.
2725
2726@item
2727An unsigned value is compared against zero with @samp{<} or @samp{>=}.
2728
2729@item
2730Storage-class specifiers like @code{static} are not the first things in
2731a declaration.  According to the C Standard, this usage is obsolescent.
2732
2733@item
2734If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
2735arguments.
2736
2737@item
2738A comparison between signed and unsigned values could produce an
2739incorrect result when the signed value is converted to unsigned.
2740(But don't warn if @option{-Wno-sign-compare} is also specified.)
2741
2742@item
2743An aggregate has an initializer which does not initialize all members.
2744This warning can be independently controlled by
2745@option{-Wmissing-field-initializers}.
2746
2747@item
2748An initialized field without side effects is overridden when using
2749designated initializers (@pxref{Designated Inits, , Designated
2750Initializers}).  This warning can be independently controlled by
2751@option{-Woverride-init}.
2752
2753@item
2754A function parameter is declared without a type specifier in K&R-style
2755functions:
2756
2757@smallexample
2758void foo(bar) @{ @}
2759@end smallexample
2760
2761@item
2762An empty body occurs in an @samp{if} or @samp{else} statement.
2763
2764@item
2765A pointer is compared against integer zero with @samp{<}, @samp{<=},
2766@samp{>}, or @samp{>=}.
2767
2768@item
2769A variable might be changed by @samp{longjmp} or @samp{vfork}.
2770
2771@item @r{(C++ only)}
2772An enumerator and a non-enumerator both appear in a conditional expression.
2773
2774@item @r{(C++ only)}
2775A non-static reference or non-static @samp{const} member appears in a
2776class without constructors.
2777
2778@item @r{(C++ only)}
2779Ambiguous virtual bases.
2780
2781@item @r{(C++ only)}
2782Subscripting an array which has been declared @samp{register}.
2783
2784@item @r{(C++ only)}
2785Taking the address of a variable which has been declared @samp{register}.
2786
2787@item @r{(C++ only)}
2788A base class is not initialized in a derived class' copy constructor.
2789@end itemize
2790
2791@item -Wno-div-by-zero
2792@opindex Wno-div-by-zero
2793@opindex Wdiv-by-zero
2794Do not warn about compile-time integer division by zero.  Floating point
2795division by zero is not warned about, as it can be a legitimate way of
2796obtaining infinities and NaNs.
2797
2798@item -Wsystem-headers
2799@opindex Wsystem-headers
2800@cindex warnings from system headers
2801@cindex system headers, warnings from
2802Print warning messages for constructs found in system header files.
2803Warnings from system headers are normally suppressed, on the assumption
2804that they usually do not indicate real problems and would only make the
2805compiler output harder to read.  Using this command line option tells
2806GCC to emit warnings from system headers as if they occurred in user
2807code.  However, note that using @option{-Wall} in conjunction with this
2808option will @emph{not} warn about unknown pragmas in system
2809headers---for that, @option{-Wunknown-pragmas} must also be used.
2810
2811@item -Wfloat-equal
2812@opindex Wfloat-equal
2813Warn if floating point values are used in equality comparisons.
2814
2815The idea behind this is that sometimes it is convenient (for the
2816programmer) to consider floating-point values as approximations to
2817infinitely precise real numbers.  If you are doing this, then you need
2818to compute (by analyzing the code, or in some other way) the maximum or
2819likely maximum error that the computation introduces, and allow for it
2820when performing comparisons (and when producing output, but that's a
2821different problem).  In particular, instead of testing for equality, you
2822would check to see whether the two values have ranges that overlap; and
2823this is done with the relational operators, so equality comparisons are
2824probably mistaken.
2825
2826@item -Wtraditional @r{(C only)}
2827@opindex Wtraditional
2828Warn about certain constructs that behave differently in traditional and
2829ISO C@.  Also warn about ISO C constructs that have no traditional C
2830equivalent, and/or problematic constructs which should be avoided.
2831
2832@itemize @bullet
2833@item
2834Macro parameters that appear within string literals in the macro body.
2835In traditional C macro replacement takes place within string literals,
2836but does not in ISO C@.
2837
2838@item
2839In traditional C, some preprocessor directives did not exist.
2840Traditional preprocessors would only consider a line to be a directive
2841if the @samp{#} appeared in column 1 on the line.  Therefore
2842@option{-Wtraditional} warns about directives that traditional C
2843understands but would ignore because the @samp{#} does not appear as the
2844first character on the line.  It also suggests you hide directives like
2845@samp{#pragma} not understood by traditional C by indenting them.  Some
2846traditional implementations would not recognize @samp{#elif}, so it
2847suggests avoiding it altogether.
2848
2849@item
2850A function-like macro that appears without arguments.
2851
2852@item
2853The unary plus operator.
2854
2855@item
2856The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
2857constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
2858constants.)  Note, these suffixes appear in macros defined in the system
2859headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
2860Use of these macros in user code might normally lead to spurious
2861warnings, however GCC's integrated preprocessor has enough context to
2862avoid warning in these cases.
2863
2864@item
2865A function declared external in one block and then used after the end of
2866the block.
2867
2868@item
2869A @code{switch} statement has an operand of type @code{long}.
2870
2871@item
2872A non-@code{static} function declaration follows a @code{static} one.
2873This construct is not accepted by some traditional C compilers.
2874
2875@item
2876The ISO type of an integer constant has a different width or
2877signedness from its traditional type.  This warning is only issued if
2878the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
2879typically represent bit patterns, are not warned about.
2880
2881@item
2882Usage of ISO string concatenation is detected.
2883
2884@item
2885Initialization of automatic aggregates.
2886
2887@item
2888Identifier conflicts with labels.  Traditional C lacks a separate
2889namespace for labels.
2890
2891@item
2892Initialization of unions.  If the initializer is zero, the warning is
2893omitted.  This is done under the assumption that the zero initializer in
2894user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
2895initializer warnings and relies on default initialization to zero in the
2896traditional C case.
2897
2898@item
2899Conversions by prototypes between fixed/floating point values and vice
2900versa.  The absence of these prototypes when compiling with traditional
2901C would cause serious problems.  This is a subset of the possible
2902conversion warnings, for the full set use @option{-Wconversion}.
2903
2904@item
2905Use of ISO C style function definitions.  This warning intentionally is
2906@emph{not} issued for prototype declarations or variadic functions
2907because these ISO C features will appear in your code when using
2908libiberty's traditional C compatibility macros, @code{PARAMS} and
2909@code{VPARAMS}.  This warning is also bypassed for nested functions
2910because that feature is already a GCC extension and thus not relevant to
2911traditional C compatibility.
2912@end itemize
2913
2914@item -Wdeclaration-after-statement @r{(C only)}
2915@opindex Wdeclaration-after-statement
2916Warn when a declaration is found after a statement in a block.  This
2917construct, known from C++, was introduced with ISO C99 and is by default
2918allowed in GCC@.  It is not supported by ISO C90 and was not supported by
2919GCC versions before GCC 3.0.  @xref{Mixed Declarations}.
2920
2921@item -Wundef
2922@opindex Wundef
2923Warn if an undefined identifier is evaluated in an @samp{#if} directive.
2924
2925@item -Wno-endif-labels
2926@opindex Wno-endif-labels
2927@opindex Wendif-labels
2928Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
2929
2930@item -Wshadow
2931@opindex Wshadow
2932Warn whenever a local variable shadows another local variable, parameter or
2933global variable or whenever a built-in function is shadowed.
2934
2935@item -Wlarger-than-@var{len}
2936@opindex Wlarger-than
2937Warn whenever an object of larger than @var{len} bytes is defined.
2938
2939@item -Wframe-larger-than-@var{len}
2940@opindex Wframe-larger-than
2941Warn whenever the frame size of a function is larger than @var{len} bytes.
2942
2943@item -Wunsafe-loop-optimizations
2944@opindex Wunsafe-loop-optimizations
2945Warn if the loop cannot be optimized because the compiler could not
2946assume anything on the bounds of the loop indices.  With
2947@option{-funsafe-loop-optimizations} warn if the compiler made
2948such assumptions.
2949
2950@item -Wpointer-arith
2951@opindex Wpointer-arith
2952Warn about anything that depends on the ``size of'' a function type or
2953of @code{void}.  GNU C assigns these types a size of 1, for
2954convenience in calculations with @code{void *} pointers and pointers
2955to functions.
2956
2957@item -Wbad-function-cast @r{(C only)}
2958@opindex Wbad-function-cast
2959Warn whenever a function call is cast to a non-matching type.
2960For example, warn if @code{int malloc()} is cast to @code{anything *}.
2961
2962@item -Wc++-compat
2963Warn about ISO C constructs that are outside of the common subset of
2964ISO C and ISO C++, e.g.@: request for implicit conversion from
2965@code{void *} to a pointer to non-@code{void} type.
2966
2967@item -Wcast-qual
2968@opindex Wcast-qual
2969Warn whenever a pointer is cast so as to remove a type qualifier from
2970the target type.  For example, warn if a @code{const char *} is cast
2971to an ordinary @code{char *}.
2972
2973@item -Wcast-align
2974@opindex Wcast-align
2975Warn whenever a pointer is cast such that the required alignment of the
2976target is increased.  For example, warn if a @code{char *} is cast to
2977an @code{int *} on machines where integers can only be accessed at
2978two- or four-byte boundaries.
2979
2980@item -Wwrite-strings
2981@opindex Wwrite-strings
2982When compiling C, give string constants the type @code{const
2983char[@var{length}]} so that
2984copying the address of one into a non-@code{const} @code{char *}
2985pointer will get a warning; when compiling C++, warn about the
2986deprecated conversion from string literals to @code{char *}.  This
2987warning, by default, is enabled for C++ programs.
2988These warnings will help you find at
2989compile time code that can try to write into a string constant, but
2990only if you have been very careful about using @code{const} in
2991declarations and prototypes.  Otherwise, it will just be a nuisance;
2992this is why we did not make @option{-Wall} request these warnings.
2993
2994@item -Wconversion
2995@opindex Wconversion
2996Warn if a prototype causes a type conversion that is different from what
2997would happen to the same argument in the absence of a prototype.  This
2998includes conversions of fixed point to floating and vice versa, and
2999conversions changing the width or signedness of a fixed point argument
3000except when the same as the default promotion.
3001
3002Also, warn if a negative integer constant expression is implicitly
3003converted to an unsigned type.  For example, warn about the assignment
3004@code{x = -1} if @code{x} is unsigned.  But do not warn about explicit
3005casts like @code{(unsigned) -1}.
3006
3007@item -Wsign-compare
3008@opindex Wsign-compare
3009@cindex warning for comparison of signed and unsigned values
3010@cindex comparison of signed and unsigned values, warning
3011@cindex signed and unsigned values, comparison warning
3012Warn when a comparison between signed and unsigned values could produce
3013an incorrect result when the signed value is converted to unsigned.
3014This warning is also enabled by @option{-Wextra}; to get the other warnings
3015of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
3016
3017@item -Waddress
3018@opindex Waddress
3019@opindex Wno-address
3020Warn about suspicious uses of memory addresses. These include using
3021the address of a function in a conditional expression, such as
3022@code{void func(void); if (func)}, and comparisons against the memory
3023address of a string literal, such as @code{if (x == "abc")}.  Such
3024uses typically indicate a programmer error: the address of a function
3025always evaluates to true, so their use in a conditional usually
3026indicate that the programmer forgot the parentheses in a function
3027call; and comparisons against string literals result in unspecified
3028behavior and are not portable in C, so they usually indicate that the
3029programmer intended to use @code{strcmp}.  This warning is enabled by
3030@option{-Wall}.
3031
3032@item -Waggregate-return
3033@opindex Waggregate-return
3034Warn if any functions that return structures or unions are defined or
3035called.  (In languages where you can return an array, this also elicits
3036a warning.)
3037
3038@item -Wno-attributes
3039@opindex Wno-attributes
3040@opindex Wattributes
3041Do not warn if an unexpected @code{__attribute__} is used, such as
3042unrecognized attributes, function attributes applied to variables,
3043etc.  This will not stop errors for incorrect use of supported
3044attributes.
3045
3046@item -Wstrict-prototypes @r{(C only)}
3047@opindex Wstrict-prototypes
3048Warn if a function is declared or defined without specifying the
3049argument types.  (An old-style function definition is permitted without
3050a warning if preceded by a declaration which specifies the argument
3051types.)
3052
3053@item -Wold-style-definition @r{(C only)}
3054@opindex Wold-style-definition
3055Warn if an old-style function definition is used.  A warning is given
3056even if there is a previous prototype.
3057
3058@c APPLE LOCAL warn missing prototype 6261539
3059@item -Wmissing-prototypes
3060@opindex Wmissing-prototypes
3061Warn if a global function is defined without a previous prototype
3062declaration.  This warning is issued even if the definition itself
3063provides a prototype.  The aim is to detect global functions that fail
3064to be declared in header files.
3065
3066@item -Wmissing-declarations @r{(C only)}
3067@opindex Wmissing-declarations
3068Warn if a global function is defined without a previous declaration.
3069Do so even if the definition itself provides a prototype.
3070Use this option to detect global functions that are not declared in
3071header files.
3072
3073@item -Wmissing-field-initializers
3074@opindex Wmissing-field-initializers
3075@opindex W
3076@opindex Wextra
3077Warn if a structure's initializer has some fields missing.  For
3078example, the following code would cause such a warning, because
3079@code{x.h} is implicitly zero:
3080
3081@smallexample
3082struct s @{ int f, g, h; @};
3083struct s x = @{ 3, 4 @};
3084@end smallexample
3085
3086This option does not warn about designated initializers, so the following
3087modification would not trigger a warning:
3088
3089@smallexample
3090struct s @{ int f, g, h; @};
3091struct s x = @{ .f = 3, .g = 4 @};
3092@end smallexample
3093
3094This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
3095warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}.
3096
3097@item -Wmissing-noreturn
3098@opindex Wmissing-noreturn
3099Warn about functions which might be candidates for attribute @code{noreturn}.
3100Note these are only possible candidates, not absolute ones.  Care should
3101be taken to manually verify functions actually do not ever return before
3102adding the @code{noreturn} attribute, otherwise subtle code generation
3103bugs could be introduced.  You will not get a warning for @code{main} in
3104hosted C environments.
3105
3106@item -Wmissing-format-attribute
3107@opindex Wmissing-format-attribute
3108@opindex Wformat
3109Warn about function pointers which might be candidates for @code{format}
3110attributes.  Note these are only possible candidates, not absolute ones.
3111GCC will guess that function pointers with @code{format} attributes that
3112are used in assignment, initialization, parameter passing or return
3113statements should have a corresponding @code{format} attribute in the
3114resulting type.  I.e.@: the left-hand side of the assignment or
3115initialization, the type of the parameter variable, or the return type
3116of the containing function respectively should also have a @code{format}
3117attribute to avoid the warning.
3118
3119GCC will also warn about function definitions which might be
3120candidates for @code{format} attributes.  Again, these are only
3121possible candidates.  GCC will guess that @code{format} attributes
3122might be appropriate for any function that calls a function like
3123@code{vprintf} or @code{vscanf}, but this might not always be the
3124case, and some functions for which @code{format} attributes are
3125appropriate may not be detected.
3126
3127@item -Wno-multichar
3128@opindex Wno-multichar
3129@opindex Wmultichar
3130Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
3131Usually they indicate a typo in the user's code, as they have
3132implementation-defined values, and should not be used in portable code.
3133
3134@item -Wnormalized=<none|id|nfc|nfkc>
3135@opindex Wnormalized
3136@cindex NFC
3137@cindex NFKC
3138@cindex character set, input normalization
3139In ISO C and ISO C++, two identifiers are different if they are
3140different sequences of characters.  However, sometimes when characters
3141outside the basic ASCII character set are used, you can have two
3142different character sequences that look the same.  To avoid confusion,
3143the ISO 10646 standard sets out some @dfn{normalization rules} which
3144when applied ensure that two sequences that look the same are turned into
3145the same sequence.  GCC can warn you if you are using identifiers which
3146have not been normalized; this option controls that warning.
3147
3148There are four levels of warning that GCC supports.  The default is
3149@option{-Wnormalized=nfc}, which warns about any identifier which is
3150not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
3151recommended form for most uses.
3152
3153Unfortunately, there are some characters which ISO C and ISO C++ allow
3154in identifiers that when turned into NFC aren't allowable as
3155identifiers.  That is, there's no way to use these symbols in portable
3156ISO C or C++ and have all your identifiers in NFC.
3157@option{-Wnormalized=id} suppresses the warning for these characters.
3158It is hoped that future versions of the standards involved will correct
3159this, which is why this option is not the default.
3160
3161You can switch the warning off for all characters by writing
3162@option{-Wnormalized=none}.  You would only want to do this if you
3163were using some other normalization scheme (like ``D''), because
3164otherwise you can easily create bugs that are literally impossible to see.
3165
3166Some characters in ISO 10646 have distinct meanings but look identical
3167in some fonts or display methodologies, especially once formatting has
3168been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
3169LETTER N'', will display just like a regular @code{n} which has been
3170placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
3171normalization scheme to convert all these into a standard form as
3172well, and GCC will warn if your code is not in NFKC if you use
3173@option{-Wnormalized=nfkc}.  This warning is comparable to warning
3174about every identifier that contains the letter O because it might be
3175confused with the digit 0, and so is not the default, but may be
3176useful as a local coding convention if the programming environment is
3177unable to be fixed to display these characters distinctly.
3178
3179@item -Wno-deprecated-declarations
3180@opindex Wno-deprecated-declarations
3181Do not warn about uses of functions (@pxref{Function Attributes}),
3182variables (@pxref{Variable Attributes}), and types (@pxref{Type
3183Attributes}) marked as deprecated by using the @code{deprecated}
3184attribute.
3185
3186@item -Wno-overflow
3187@opindex Wno-overflow
3188Do not warn about compile-time overflow in constant expressions.
3189
3190@item -Woverride-init
3191@opindex Woverride-init
3192@opindex W
3193@opindex Wextra
3194Warn if an initialized field without side effects is overridden when
3195using designated initializers (@pxref{Designated Inits, , Designated
3196Initializers}).
3197
3198This warning is included in @option{-Wextra}.  To get other
3199@option{-Wextra} warnings without this one, use @samp{-Wextra
3200-Wno-override-init}.
3201
3202@item -Wpacked
3203@opindex Wpacked
3204Warn if a structure is given the packed attribute, but the packed
3205attribute has no effect on the layout or size of the structure.
3206Such structures may be mis-aligned for little benefit.  For
3207instance, in this code, the variable @code{f.x} in @code{struct bar}
3208will be misaligned even though @code{struct bar} does not itself
3209have the packed attribute:
3210
3211@smallexample
3212@group
3213struct foo @{
3214  int x;
3215  char a, b, c, d;
3216@} __attribute__((packed));
3217struct bar @{
3218  char z;
3219  struct foo f;
3220@};
3221@end group
3222@end smallexample
3223
3224@item -Wpadded
3225@opindex Wpadded
3226Warn if padding is included in a structure, either to align an element
3227of the structure or to align the whole structure.  Sometimes when this
3228happens it is possible to rearrange the fields of the structure to
3229reduce the padding and so make the structure smaller.
3230
3231@item -Wredundant-decls
3232@opindex Wredundant-decls
3233Warn if anything is declared more than once in the same scope, even in
3234cases where multiple declaration is valid and changes nothing.
3235
3236@item -Wnested-externs @r{(C only)}
3237@opindex Wnested-externs
3238Warn if an @code{extern} declaration is encountered within a function.
3239
3240@item -Wunreachable-code
3241@opindex Wunreachable-code
3242Warn if the compiler detects that code will never be executed.
3243
3244This option is intended to warn when the compiler detects that at
3245least a whole line of source code will never be executed, because
3246some condition is never satisfied or because it is after a
3247procedure that never returns.
3248
3249It is possible for this option to produce a warning even though there
3250are circumstances under which part of the affected line can be executed,
3251so care should be taken when removing apparently-unreachable code.
3252
3253For instance, when a function is inlined, a warning may mean that the
3254line is unreachable in only one inlined copy of the function.
3255
3256This option is not made part of @option{-Wall} because in a debugging
3257version of a program there is often substantial code which checks
3258correct functioning of the program and is, hopefully, unreachable
3259because the program does work.  Another common use of unreachable
3260code is to provide behavior which is selectable at compile-time.
3261
3262@item -Winline
3263@opindex Winline
3264Warn if a function can not be inlined and it was declared as inline.
3265Even with this option, the compiler will not warn about failures to
3266inline functions declared in system headers.
3267
3268The compiler uses a variety of heuristics to determine whether or not
3269to inline a function.  For example, the compiler takes into account
3270the size of the function being inlined and the amount of inlining
3271that has already been done in the current function.  Therefore,
3272seemingly insignificant changes in the source program can cause the
3273warnings produced by @option{-Winline} to appear or disappear.
3274
3275@item -Wno-invalid-offsetof @r{(C++ only)}
3276@opindex Wno-invalid-offsetof
3277Suppress warnings from applying the @samp{offsetof} macro to a non-POD
3278type.  According to the 1998 ISO C++ standard, applying @samp{offsetof}
3279to a non-POD type is undefined.  In existing C++ implementations,
3280however, @samp{offsetof} typically gives meaningful results even when
3281applied to certain kinds of non-POD types. (Such as a simple
3282@samp{struct} that fails to be a POD type only by virtue of having a
3283constructor.)  This flag is for users who are aware that they are
3284writing nonportable code and who have deliberately chosen to ignore the
3285warning about it.
3286
3287The restrictions on @samp{offsetof} may be relaxed in a future version
3288of the C++ standard.
3289
3290@item -Wno-int-to-pointer-cast @r{(C only)}
3291@opindex Wno-int-to-pointer-cast
3292Suppress warnings from casts to pointer type of an integer of a
3293different size.
3294
3295@item -Wno-pointer-to-int-cast @r{(C only)}
3296@opindex Wno-pointer-to-int-cast
3297Suppress warnings from casts from a pointer to an integer type of a
3298different size.
3299
3300@item -Winvalid-pch
3301@opindex Winvalid-pch
3302Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
3303the search path but can't be used.
3304
3305@item -Wlong-long
3306@opindex Wlong-long
3307@opindex Wno-long-long
3308Warn if @samp{long long} type is used.  This is default.  To inhibit
3309the warning messages, use @option{-Wno-long-long}.  Flags
3310@option{-Wlong-long} and @option{-Wno-long-long} are taken into account
3311only when @option{-pedantic} flag is used.
3312
3313@item -Wvariadic-macros
3314@opindex Wvariadic-macros
3315@opindex Wno-variadic-macros
3316Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
3317alternate syntax when in pedantic ISO C99 mode.  This is default.
3318To inhibit the warning messages, use @option{-Wno-variadic-macros}.
3319
3320@item -Wvla
3321@opindex Wvla
3322@opindex Wno-vla
3323Warn if variable length array is used in the code.
3324@option{-Wno-vla} will prevent the @option{-pedantic} warning of
3325the variable length array.
3326
3327@item -Wvolatile-register-var
3328@opindex Wvolatile-register-var
3329@opindex Wno-volatile-register-var
3330Warn if a register variable is declared volatile.  The volatile
3331modifier does not inhibit all optimizations that may eliminate reads
3332and/or writes to register variables.
3333
3334@item -Wdisabled-optimization
3335@opindex Wdisabled-optimization
3336Warn if a requested optimization pass is disabled.  This warning does
3337not generally indicate that there is anything wrong with your code; it
3338merely indicates that GCC's optimizers were unable to handle the code
3339effectively.  Often, the problem is that your code is too big or too
3340complex; GCC will refuse to optimize programs when the optimization
3341itself is likely to take inordinate amounts of time.
3342
3343@item -Wpointer-sign
3344@opindex Wpointer-sign
3345@opindex Wno-pointer-sign
3346Warn for pointer argument passing or assignment with different signedness.
3347This option is only supported for C.  It is implied by @option{-Wall}
3348and by @option{-pedantic}, which can be disabled with
3349@option{-Wno-pointer-sign}.
3350
3351@item -Werror
3352@opindex Werror
3353Make all warnings into errors.
3354
3355@item -Werror=
3356@opindex Werror=
3357Make the specified warning into an errors.  The specifier for a
3358warning is appended, for example @option{-Werror=switch} turns the
3359warnings controlled by @option{-Wswitch} into errors.  This switch
3360takes a negative form, to be used to negate @option{-Werror} for
3361specific warnings, for example @option{-Wno-error=switch} makes
3362@option{-Wswitch} warnings not be errors, even when @option{-Werror}
3363is in effect.  You can use the @option{-fdiagnostics-show-option}
3364option to have each controllable warning amended with the option which
3365controls it, to determine what to use with this option.
3366
3367Note that specifying @option{-Werror=}@var{foo} automatically implies
3368@option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
3369imply anything.
3370
3371@item -Wstack-protector
3372@opindex Wstack-protector
3373This option is only active when @option{-fstack-protector} is active.  It
3374warns about functions that will not be protected against stack smashing.
3375
3376@item -Woverlength-strings
3377@opindex Woverlength-strings
3378Warn about string constants which are longer than the ``minimum
3379maximum'' length specified in the C standard.  Modern compilers
3380generally allow string constants which are much longer than the
3381standard's minimum limit, but very portable programs should avoid
3382using longer strings.
3383
3384The limit applies @emph{after} string constant concatenation, and does
3385not count the trailing NUL@.  In C89, the limit was 509 characters; in
3386C99, it was raised to 4095.  C++98 does not specify a normative
3387minimum maximum, so we do not diagnose overlength strings in C++@.
3388
3389This option is implied by @option{-pedantic}, and can be disabled with
3390@option{-Wno-overlength-strings}.
3391@end table
3392
3393@node Debugging Options
3394@section Options for Debugging Your Program or GCC
3395@cindex options, debugging
3396@cindex debugging information options
3397
3398GCC has various special options that are used for debugging
3399either your program or GCC:
3400
3401@table @gcctabopt
3402@item -g
3403@opindex g
3404Produce debugging information in the operating system's native format
3405(stabs, COFF, XCOFF, or DWARF 2)@.  GDB can work with this debugging
3406information.
3407
3408On most systems that use stabs format, @option{-g} enables use of extra
3409debugging information that only GDB can use; this extra information
3410makes debugging work better in GDB but will probably make other debuggers
3411crash or
3412refuse to read the program.  If you want to control for certain whether
3413to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
3414@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
3415
3416GCC allows you to use @option{-g} with
3417@option{-O}.  The shortcuts taken by optimized code may occasionally
3418produce surprising results: some variables you declared may not exist
3419at all; flow of control may briefly move where you did not expect it;
3420some statements may not be executed because they compute constant
3421results or their values were already at hand; some statements may
3422execute in different places because they were moved out of loops.
3423
3424Nevertheless it proves possible to debug optimized output.  This makes
3425it reasonable to use the optimizer for programs that might have bugs.
3426
3427The following options are useful when GCC is generated with the
3428capability for more than one debugging format.
3429
3430@item -ggdb
3431@opindex ggdb
3432Produce debugging information for use by GDB@.  This means to use the
3433most expressive format available (DWARF 2, stabs, or the native format
3434if neither of those are supported), including GDB extensions if at all
3435possible.
3436
3437@item -gstabs
3438@opindex gstabs
3439Produce debugging information in stabs format (if that is supported),
3440without GDB extensions.  This is the format used by DBX on most BSD
3441systems.  On MIPS, Alpha and System V Release 4 systems this option
3442produces stabs debugging output which is not understood by DBX or SDB@.
3443On System V Release 4 systems this option requires the GNU assembler.
3444
3445@item -feliminate-unused-debug-symbols
3446@opindex feliminate-unused-debug-symbols
3447Produce debugging information in stabs format (if that is supported),
3448for only symbols that are actually used.
3449
3450@item -femit-class-debug-always
3451Instead of emitting debugging information for a C++ class in only one
3452object file, emit it in all object files using the class.  This option
3453should be used only with debuggers that are unable to handle the way GCC
3454normally emits debugging information for classes because using this
3455option will increase the size of debugging information by as much as a
3456factor of two.
3457
3458@item -gstabs+
3459@opindex gstabs+
3460Produce debugging information in stabs format (if that is supported),
3461using GNU extensions understood only by the GNU debugger (GDB)@.  The
3462use of these extensions is likely to make other debuggers crash or
3463refuse to read the program.
3464
3465@item -gcoff
3466@opindex gcoff
3467Produce debugging information in COFF format (if that is supported).
3468This is the format used by SDB on most System V systems prior to
3469System V Release 4.
3470
3471@item -gxcoff
3472@opindex gxcoff
3473Produce debugging information in XCOFF format (if that is supported).
3474This is the format used by the DBX debugger on IBM RS/6000 systems.
3475
3476@item -gxcoff+
3477@opindex gxcoff+
3478Produce debugging information in XCOFF format (if that is supported),
3479using GNU extensions understood only by the GNU debugger (GDB)@.  The
3480use of these extensions is likely to make other debuggers crash or
3481refuse to read the program, and may cause assemblers other than the GNU
3482assembler (GAS) to fail with an error.
3483
3484@item -gdwarf-2
3485@opindex gdwarf-2
3486Produce debugging information in DWARF version 2 format (if that is
3487supported).  This is the format used by DBX on IRIX 6.  With this
3488option, GCC uses features of DWARF version 3 when they are useful;
3489version 3 is upward compatible with version 2, but may still cause
3490problems for older debuggers.
3491
3492@item -gvms
3493@opindex gvms
3494Produce debugging information in VMS debug format (if that is
3495supported).  This is the format used by DEBUG on VMS systems.
3496
3497@item -g@var{level}
3498@itemx -ggdb@var{level}
3499@itemx -gstabs@var{level}
3500@itemx -gcoff@var{level}
3501@itemx -gxcoff@var{level}
3502@itemx -gvms@var{level}
3503Request debugging information and also use @var{level} to specify how
3504much information.  The default level is 2.
3505
3506Level 1 produces minimal information, enough for making backtraces in
3507parts of the program that you don't plan to debug.  This includes
3508descriptions of functions and external variables, but no information
3509about local variables and no line numbers.
3510
3511Level 3 includes extra information, such as all the macro definitions
3512present in the program.  Some debuggers support macro expansion when
3513you use @option{-g3}.
3514
3515@option{-gdwarf-2} does not accept a concatenated debug level, because
3516GCC used to support an option @option{-gdwarf} that meant to generate
3517debug information in version 1 of the DWARF format (which is very
3518different from version 2), and it would have been too confusing.  That
3519debug format is long obsolete, but the option cannot be changed now.
3520Instead use an additional @option{-g@var{level}} option to change the
3521debug level for DWARF2.
3522
3523@item -feliminate-dwarf2-dups
3524@opindex feliminate-dwarf2-dups
3525Compress DWARF2 debugging information by eliminating duplicated
3526information about each symbol.  This option only makes sense when
3527generating DWARF2 debugging information with @option{-gdwarf-2}.
3528
3529@item -femit-struct-debug-baseonly
3530Emit debug information for struct-like types
3531only when the base name of the compilation source file
3532matches the base name of file in which the struct was defined.
3533
3534This option substantially reduces the size of debugging information,
3535but at significant potential loss in type information to the debugger.
3536See @option{-femit-struct-debug-reduced} for a less aggressive option.
3537See @option{-femit-struct-debug-detailed} for more detailed control.
3538
3539This option works only with DWARF 2.
3540
3541@item -femit-struct-debug-reduced
3542Emit debug information for struct-like types
3543only when the base name of the compilation source file
3544matches the base name of file in which the type was defined,
3545unless the struct is a template or defined in a system header.
3546
3547This option significantly reduces the size of debugging information,
3548with some potential loss in type information to the debugger.
3549See @option{-femit-struct-debug-baseonly} for a more aggressive option.
3550See @option{-femit-struct-debug-detailed} for more detailed control.
3551
3552This option works only with DWARF 2.
3553
3554@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
3555Specify the struct-like types
3556for which the compiler will generate debug information.
3557The intent is to reduce duplicate struct debug information
3558between different object files within the same program.
3559
3560This option is a detailed version of
3561@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
3562which will serve for most needs.
3563
3564A specification has the syntax
3565[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
3566
3567The optional first word limits the specification to
3568structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
3569A struct type is used directly when it is the type of a variable, member.
3570Indirect uses arise through pointers to structs.
3571That is, when use of an incomplete struct would be legal, the use is indirect.
3572An example is
3573@samp{struct one direct; struct two * indirect;}.
3574
3575The optional second word limits the specification to
3576ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
3577Generic structs are a bit complicated to explain.
3578For C++, these are non-explicit specializations of template classes,
3579or non-template classes within the above.
3580Other programming languages have generics,
3581but @samp{-femit-struct-debug-detailed} does not yet implement them.
3582
3583The third word specifies the source files for those
3584structs for which the compiler will emit debug information.
3585The values @samp{none} and @samp{any} have the normal meaning.
3586The value @samp{base} means that
3587the base of name of the file in which the type declaration appears
3588must match the base of the name of the main compilation file.
3589In practice, this means that
3590types declared in @file{foo.c} and @file{foo.h} will have debug information,
3591but types declared in other header will not.
3592The value @samp{sys} means those types satisfying @samp{base}
3593or declared in system or compiler headers.
3594
3595You may need to experiment to determine the best settings for your application.
3596
3597The default is @samp{-femit-struct-debug-detailed=all}.
3598
3599This option works only with DWARF 2.
3600
3601@cindex @command{prof}
3602@item -p
3603@opindex p
3604Generate extra code to write profile information suitable for the
3605analysis program @command{prof}.  You must use this option when compiling
3606the source files you want data about, and you must also use it when
3607linking.
3608
3609@cindex @command{gprof}
3610@item -pg
3611@opindex pg
3612Generate extra code to write profile information suitable for the
3613analysis program @command{gprof}.  You must use this option when compiling
3614the source files you want data about, and you must also use it when
3615linking.
3616
3617@item -Q
3618@opindex Q
3619Makes the compiler print out each function name as it is compiled, and
3620print some statistics about each pass when it finishes.
3621
3622@item -ftime-report
3623@opindex ftime-report
3624Makes the compiler print some statistics about the time consumed by each
3625pass when it finishes.
3626
3627@item -fmem-report
3628@opindex fmem-report
3629Makes the compiler print some statistics about permanent memory
3630allocation when it finishes.
3631
3632@item -fprofile-arcs
3633@opindex fprofile-arcs
3634Add code so that program flow @dfn{arcs} are instrumented.  During
3635execution the program records how many times each branch and call is
3636executed and how many times it is taken or returns.  When the compiled
3637program exits it saves this data to a file called
3638@file{@var{auxname}.gcda} for each source file.  The data may be used for
3639profile-directed optimizations (@option{-fbranch-probabilities}), or for
3640test coverage analysis (@option{-ftest-coverage}).  Each object file's
3641@var{auxname} is generated from the name of the output file, if
3642explicitly specified and it is not the final executable, otherwise it is
3643the basename of the source file.  In both cases any suffix is removed
3644(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
3645@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
3646@xref{Cross-profiling}.
3647
3648@cindex @command{gcov}
3649@item --coverage
3650@opindex coverage
3651
3652This option is used to compile and link code instrumented for coverage
3653analysis.  The option is a synonym for @option{-fprofile-arcs}
3654@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
3655linking).  See the documentation for those options for more details.
3656
3657@itemize
3658
3659@item
3660Compile the source files with @option{-fprofile-arcs} plus optimization
3661and code generation options.  For test coverage analysis, use the
3662additional @option{-ftest-coverage} option.  You do not need to profile
3663every source file in a program.
3664
3665@item
3666Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
3667(the latter implies the former).
3668
3669@item
3670Run the program on a representative workload to generate the arc profile
3671information.  This may be repeated any number of times.  You can run
3672concurrent instances of your program, and provided that the file system
3673supports locking, the data files will be correctly updated.  Also
3674@code{fork} calls are detected and correctly handled (double counting
3675will not happen).
3676
3677@item
3678For profile-directed optimizations, compile the source files again with
3679the same optimization and code generation options plus
3680@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
3681Control Optimization}).
3682
3683@item
3684For test coverage analysis, use @command{gcov} to produce human readable
3685information from the @file{.gcno} and @file{.gcda} files.  Refer to the
3686@command{gcov} documentation for further information.
3687
3688@end itemize
3689
3690With @option{-fprofile-arcs}, for each function of your program GCC
3691creates a program flow graph, then finds a spanning tree for the graph.
3692Only arcs that are not on the spanning tree have to be instrumented: the
3693compiler adds code to count the number of times that these arcs are
3694executed.  When an arc is the only exit or only entrance to a block, the
3695instrumentation code can be added to the block; otherwise, a new basic
3696block must be created to hold the instrumentation code.
3697
3698@need 2000
3699@item -ftest-coverage
3700@opindex ftest-coverage
3701Produce a notes file that the @command{gcov} code-coverage utility
3702(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
3703show program coverage.  Each source file's note file is called
3704@file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
3705above for a description of @var{auxname} and instructions on how to
3706generate test coverage data.  Coverage data will match the source files
3707more closely, if you do not optimize.
3708
3709@item -d@var{letters}
3710@item -fdump-rtl-@var{pass}
3711@opindex d
3712Says to make debugging dumps during compilation at times specified by
3713@var{letters}.    This is used for debugging the RTL-based passes of the
3714compiler.  The file names for most of the dumps are made by appending a
3715pass number and a word to the @var{dumpname}.  @var{dumpname} is generated
3716from the name of the output file, if explicitly specified and it is not
3717an executable, otherwise it is the basename of the source file. These
3718switches may have different effects when @option{-E} is used for
3719preprocessing.
3720
3721Most debug dumps can be enabled either passing a letter to the @option{-d}
3722option, or with a long @option{-fdump-rtl} switch; here are the possible
3723letters for use in @var{letters} and @var{pass}, and their meanings:
3724
3725@table @gcctabopt
3726@item -dA
3727@opindex dA
3728Annotate the assembler output with miscellaneous debugging information.
3729
3730@item -dB
3731@itemx -fdump-rtl-bbro
3732@opindex dB
3733@opindex fdump-rtl-bbro
3734Dump after block reordering, to @file{@var{file}.148r.bbro}.
3735
3736@item -dc
3737@itemx -fdump-rtl-combine
3738@opindex dc
3739@opindex fdump-rtl-combine
3740Dump after instruction combination, to the file @file{@var{file}.129r.combine}.
3741
3742@item -dC
3743@itemx -fdump-rtl-ce1
3744@itemx -fdump-rtl-ce2
3745@opindex dC
3746@opindex fdump-rtl-ce1
3747@opindex fdump-rtl-ce2
3748@option{-dC} and @option{-fdump-rtl-ce1} enable dumping after the
3749first if conversion, to the file @file{@var{file}.117r.ce1}.  @option{-dC}
3750and @option{-fdump-rtl-ce2} enable dumping after the second if
3751conversion, to the file @file{@var{file}.130r.ce2}.
3752
3753@item -dd
3754@itemx -fdump-rtl-btl
3755@itemx -fdump-rtl-dbr
3756@opindex dd
3757@opindex fdump-rtl-btl
3758@opindex fdump-rtl-dbr
3759@option{-dd} and @option{-fdump-rtl-btl} enable dumping after branch
3760target load optimization, to @file{@var{file}.31.btl}.  @option{-dd}
3761and @option{-fdump-rtl-dbr} enable dumping after delayed branch
3762scheduling, to @file{@var{file}.36.dbr}.
3763
3764@item -dD
3765@opindex dD
3766Dump all macro definitions, at the end of preprocessing, in addition to
3767normal output.
3768
3769@item -dE
3770@itemx -fdump-rtl-ce3
3771@opindex dE
3772@opindex fdump-rtl-ce3
3773Dump after the third if conversion, to @file{@var{file}.146r.ce3}.
3774
3775@item -df
3776@itemx -fdump-rtl-cfg
3777@itemx -fdump-rtl-life
3778@opindex df
3779@opindex fdump-rtl-cfg
3780@opindex fdump-rtl-life
3781@option{-df} and @option{-fdump-rtl-cfg} enable dumping after control
3782and data flow analysis, to @file{@var{file}.116r.cfg}.  @option{-df}
3783and @option{-fdump-rtl-cfg} enable dumping dump after life analysis,
3784to @file{@var{file}.128r.life1} and @file{@var{file}.135r.life2}.
3785
3786@item -dg
3787@itemx -fdump-rtl-greg
3788@opindex dg
3789@opindex fdump-rtl-greg
3790Dump after global register allocation, to @file{@var{file}.139r.greg}.
3791
3792@item -dG
3793@itemx -fdump-rtl-gcse
3794@itemx -fdump-rtl-bypass
3795@opindex dG
3796@opindex fdump-rtl-gcse
3797@opindex fdump-rtl-bypass
3798@option{-dG} and @option{-fdump-rtl-gcse} enable dumping after GCSE, to
3799@file{@var{file}.114r.gcse}.  @option{-dG} and @option{-fdump-rtl-bypass}
3800enable dumping after jump bypassing and control flow optimizations, to
3801@file{@var{file}.115r.bypass}.
3802
3803@item -dh
3804@itemx -fdump-rtl-eh
3805@opindex dh
3806@opindex fdump-rtl-eh
3807Dump after finalization of EH handling code, to @file{@var{file}.02.eh}.
3808
3809@item -di
3810@itemx -fdump-rtl-sibling
3811@opindex di
3812@opindex fdump-rtl-sibling
3813Dump after sibling call optimizations, to @file{@var{file}.106r.sibling}.
3814
3815@item -dj
3816@itemx -fdump-rtl-jump
3817@opindex dj
3818@opindex fdump-rtl-jump
3819Dump after the first jump optimization, to @file{@var{file}.112r.jump}.
3820
3821@item -dk
3822@itemx -fdump-rtl-stack
3823@opindex dk
3824@opindex fdump-rtl-stack
3825Dump after conversion from registers to stack, to @file{@var{file}.152r.stack}.
3826
3827@item -dl
3828@itemx -fdump-rtl-lreg
3829@opindex dl
3830@opindex fdump-rtl-lreg
3831Dump after local register allocation, to @file{@var{file}.138r.lreg}.
3832
3833@item -dL
3834@itemx -fdump-rtl-loop2
3835@opindex dL
3836@opindex fdump-rtl-loop2
3837@option{-dL} and @option{-fdump-rtl-loop2} enable dumping after the
3838loop optimization pass, to @file{@var{file}.119r.loop2},
3839@file{@var{file}.120r.loop2_init},
3840@file{@var{file}.121r.loop2_invariant}, and
3841@file{@var{file}.125r.loop2_done}.
3842
3843@item -dm
3844@itemx -fdump-rtl-sms
3845@opindex dm
3846@opindex fdump-rtl-sms
3847Dump after modulo scheduling, to @file{@var{file}.136r.sms}.
3848
3849@item -dM
3850@itemx -fdump-rtl-mach
3851@opindex dM
3852@opindex fdump-rtl-mach
3853Dump after performing the machine dependent reorganization pass, to
3854@file{@var{file}.155r.mach} if that pass exists.
3855
3856@item -dn
3857@itemx -fdump-rtl-rnreg
3858@opindex dn
3859@opindex fdump-rtl-rnreg
3860Dump after register renumbering, to @file{@var{file}.147r.rnreg}.
3861
3862@item -dN
3863@itemx -fdump-rtl-regmove
3864@opindex dN
3865@opindex fdump-rtl-regmove
3866Dump after the register move pass, to @file{@var{file}.132r.regmove}.
3867
3868@item -do
3869@itemx -fdump-rtl-postreload
3870@opindex do
3871@opindex fdump-rtl-postreload
3872Dump after post-reload optimizations, to @file{@var{file}.24.postreload}.
3873
3874@item -dr
3875@itemx -fdump-rtl-expand
3876@opindex dr
3877@opindex fdump-rtl-expand
3878Dump after RTL generation, to @file{@var{file}.104r.expand}.
3879
3880@item -dR
3881@itemx -fdump-rtl-sched2
3882@opindex dR
3883@opindex fdump-rtl-sched2
3884Dump after the second scheduling pass, to @file{@var{file}.150r.sched2}.
3885
3886@item -ds
3887@itemx -fdump-rtl-cse
3888@opindex ds
3889@opindex fdump-rtl-cse
3890Dump after CSE (including the jump optimization that sometimes follows
3891CSE), to @file{@var{file}.113r.cse}.
3892
3893@item -dS
3894@itemx -fdump-rtl-sched
3895@opindex dS
3896@opindex fdump-rtl-sched
3897Dump after the first scheduling pass, to @file{@var{file}.21.sched}.
3898
3899@item -dt
3900@itemx -fdump-rtl-cse2
3901@opindex dt
3902@opindex fdump-rtl-cse2
3903Dump after the second CSE pass (including the jump optimization that
3904sometimes follows CSE), to @file{@var{file}.127r.cse2}.
3905
3906@item -dT
3907@itemx -fdump-rtl-tracer
3908@opindex dT
3909@opindex fdump-rtl-tracer
3910Dump after running tracer, to @file{@var{file}.118r.tracer}.
3911
3912@item -dV
3913@itemx -fdump-rtl-vpt
3914@itemx -fdump-rtl-vartrack
3915@opindex dV
3916@opindex fdump-rtl-vpt
3917@opindex fdump-rtl-vartrack
3918@option{-dV} and @option{-fdump-rtl-vpt} enable dumping after the value
3919profile transformations, to @file{@var{file}.10.vpt}.  @option{-dV}
3920and @option{-fdump-rtl-vartrack} enable dumping after variable tracking,
3921to @file{@var{file}.154r.vartrack}.
3922
3923@item -dw
3924@itemx -fdump-rtl-flow2
3925@opindex dw
3926@opindex fdump-rtl-flow2
3927Dump after the second flow pass, to @file{@var{file}.142r.flow2}.
3928
3929@item -dz
3930@itemx -fdump-rtl-peephole2
3931@opindex dz
3932@opindex fdump-rtl-peephole2
3933Dump after the peephole pass, to @file{@var{file}.145r.peephole2}.
3934
3935@item -dZ
3936@itemx -fdump-rtl-web
3937@opindex dZ
3938@opindex fdump-rtl-web
3939Dump after live range splitting, to @file{@var{file}.126r.web}.
3940
3941@item -da
3942@itemx -fdump-rtl-all
3943@opindex da
3944@opindex fdump-rtl-all
3945Produce all the dumps listed above.
3946
3947@item -dH
3948@opindex dH
3949Produce a core dump whenever an error occurs.
3950
3951@item -dm
3952@opindex dm
3953Print statistics on memory usage, at the end of the run, to
3954standard error.
3955
3956@item -dp
3957@opindex dp
3958Annotate the assembler output with a comment indicating which
3959pattern and alternative was used.  The length of each instruction is
3960also printed.
3961
3962@item -dP
3963@opindex dP
3964Dump the RTL in the assembler output as a comment before each instruction.
3965Also turns on @option{-dp} annotation.
3966
3967@item -dv
3968@opindex dv
3969For each of the other indicated dump files (either with @option{-d} or
3970@option{-fdump-rtl-@var{pass}}), dump a representation of the control flow
3971graph suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
3972
3973@item -dx
3974@opindex dx
3975Just generate RTL for a function instead of compiling it.  Usually used
3976with @samp{r} (@option{-fdump-rtl-expand}).
3977
3978@item -dy
3979@opindex dy
3980Dump debugging information during parsing, to standard error.
3981@end table
3982
3983@item -fdump-noaddr
3984@opindex fdump-noaddr
3985When doing debugging dumps (see @option{-d} option above), suppress
3986address output.  This makes it more feasible to use diff on debugging
3987dumps for compiler invocations with different compiler binaries and/or
3988different text / bss / data / heap / stack / dso start locations.
3989
3990@item -fdump-unnumbered
3991@opindex fdump-unnumbered
3992When doing debugging dumps (see @option{-d} option above), suppress instruction
3993numbers, line number note and address output.  This makes it more feasible to
3994use diff on debugging dumps for compiler invocations with different
3995options, in particular with and without @option{-g}.
3996
3997@item -fdump-translation-unit @r{(C++ only)}
3998@itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
3999@opindex fdump-translation-unit
4000Dump a representation of the tree structure for the entire translation
4001unit to a file.  The file name is made by appending @file{.tu} to the
4002source file name.  If the @samp{-@var{options}} form is used, @var{options}
4003controls the details of the dump as described for the
4004@option{-fdump-tree} options.
4005
4006@item -fdump-class-hierarchy @r{(C++ only)}
4007@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
4008@opindex fdump-class-hierarchy
4009Dump a representation of each class's hierarchy and virtual function
4010table layout to a file.  The file name is made by appending @file{.class}
4011to the source file name.  If the @samp{-@var{options}} form is used,
4012@var{options} controls the details of the dump as described for the
4013@option{-fdump-tree} options.
4014
4015@item -fdump-ipa-@var{switch}
4016@opindex fdump-ipa
4017Control the dumping at various stages of inter-procedural analysis
4018language tree to a file.  The file name is generated by appending a switch
4019specific suffix to the source file name.  The following dumps are possible:
4020
4021@table @samp
4022@item all
4023Enables all inter-procedural analysis dumps; currently the only produced
4024dump is the @samp{cgraph} dump.
4025
4026@item cgraph
4027Dumps information about call-graph optimization, unused function removal,
4028and inlining decisions.
4029@end table
4030
4031@item -fdump-tree-@var{switch}
4032@itemx -fdump-tree-@var{switch}-@var{options}
4033@opindex fdump-tree
4034Control the dumping at various stages of processing the intermediate
4035language tree to a file.  The file name is generated by appending a switch
4036specific suffix to the source file name.  If the @samp{-@var{options}}
4037form is used, @var{options} is a list of @samp{-} separated options that
4038control the details of the dump.  Not all options are applicable to all
4039dumps, those which are not meaningful will be ignored.  The following
4040options are available
4041
4042@table @samp
4043@item address
4044Print the address of each node.  Usually this is not meaningful as it
4045changes according to the environment and source file.  Its primary use
4046is for tying up a dump file with a debug environment.
4047@item slim
4048Inhibit dumping of members of a scope or body of a function merely
4049because that scope has been reached.  Only dump such items when they
4050are directly reachable by some other path.  When dumping pretty-printed
4051trees, this option inhibits dumping the bodies of control structures.
4052@item raw
4053Print a raw representation of the tree.  By default, trees are
4054pretty-printed into a C-like representation.
4055@item details
4056Enable more detailed dumps (not honored by every dump option).
4057@item stats
4058Enable dumping various statistics about the pass (not honored by every dump
4059option).
4060@item blocks
4061Enable showing basic block boundaries (disabled in raw dumps).
4062@item vops
4063Enable showing virtual operands for every statement.
4064@item lineno
4065Enable showing line numbers for statements.
4066@item uid
4067Enable showing the unique ID (@code{DECL_UID}) for each variable.
4068@item all
4069Turn on all options, except @option{raw}, @option{slim} and @option{lineno}.
4070@end table
4071
4072The following tree dumps are possible:
4073@table @samp
4074
4075@item original
4076Dump before any tree based optimization, to @file{@var{file}.original}.
4077
4078@item optimized
4079Dump after all tree based optimization, to @file{@var{file}.optimized}.
4080
4081@item inlined
4082Dump after function inlining, to @file{@var{file}.inlined}.
4083
4084@item gimple
4085@opindex fdump-tree-gimple
4086Dump each function before and after the gimplification pass to a file.  The
4087file name is made by appending @file{.gimple} to the source file name.
4088
4089@item cfg
4090@opindex fdump-tree-cfg
4091Dump the control flow graph of each function to a file.  The file name is
4092made by appending @file{.cfg} to the source file name.
4093
4094@item vcg
4095@opindex fdump-tree-vcg
4096Dump the control flow graph of each function to a file in VCG format.  The
4097file name is made by appending @file{.vcg} to the source file name.  Note
4098that if the file contains more than one function, the generated file cannot
4099be used directly by VCG@.  You will need to cut and paste each function's
4100graph into its own separate file first.
4101
4102@item ch
4103@opindex fdump-tree-ch
4104Dump each function after copying loop headers.  The file name is made by
4105appending @file{.ch} to the source file name.
4106
4107@item ssa
4108@opindex fdump-tree-ssa
4109Dump SSA related information to a file.  The file name is made by appending
4110@file{.ssa} to the source file name.
4111
4112@item salias
4113@opindex fdump-tree-salias
4114Dump structure aliasing variable information to a file.  This file name
4115is made by appending @file{.salias} to the source file name.
4116
4117@item alias
4118@opindex fdump-tree-alias
4119Dump aliasing information for each function.  The file name is made by
4120appending @file{.alias} to the source file name.
4121
4122@item ccp
4123@opindex fdump-tree-ccp
4124Dump each function after CCP@.  The file name is made by appending
4125@file{.ccp} to the source file name.
4126
4127@item storeccp
4128@opindex fdump-tree-storeccp
4129Dump each function after STORE-CCP.  The file name is made by appending
4130@file{.storeccp} to the source file name.
4131
4132@item pre
4133@opindex fdump-tree-pre
4134Dump trees after partial redundancy elimination.  The file name is made
4135by appending @file{.pre} to the source file name.
4136
4137@item fre
4138@opindex fdump-tree-fre
4139Dump trees after full redundancy elimination.  The file name is made
4140by appending @file{.fre} to the source file name.
4141
4142@item copyprop
4143@opindex fdump-tree-copyprop
4144Dump trees after copy propagation.  The file name is made
4145by appending @file{.copyprop} to the source file name.
4146
4147@item store_copyprop
4148@opindex fdump-tree-store_copyprop
4149Dump trees after store copy-propagation.  The file name is made
4150by appending @file{.store_copyprop} to the source file name.
4151
4152@item dce
4153@opindex fdump-tree-dce
4154Dump each function after dead code elimination.  The file name is made by
4155appending @file{.dce} to the source file name.
4156
4157@item mudflap
4158@opindex fdump-tree-mudflap
4159Dump each function after adding mudflap instrumentation.  The file name is
4160made by appending @file{.mudflap} to the source file name.
4161
4162@item sra
4163@opindex fdump-tree-sra
4164Dump each function after performing scalar replacement of aggregates.  The
4165file name is made by appending @file{.sra} to the source file name.
4166
4167@item sink
4168@opindex fdump-tree-sink
4169Dump each function after performing code sinking.  The file name is made
4170by appending @file{.sink} to the source file name. 
4171
4172@item dom
4173@opindex fdump-tree-dom
4174Dump each function after applying dominator tree optimizations.  The file
4175name is made by appending @file{.dom} to the source file name.
4176
4177@item dse
4178@opindex fdump-tree-dse
4179Dump each function after applying dead store elimination.  The file
4180name is made by appending @file{.dse} to the source file name.
4181
4182@item phiopt
4183@opindex fdump-tree-phiopt
4184Dump each function after optimizing PHI nodes into straightline code.  The file
4185name is made by appending @file{.phiopt} to the source file name.
4186
4187@item forwprop
4188@opindex fdump-tree-forwprop
4189Dump each function after forward propagating single use variables.  The file
4190name is made by appending @file{.forwprop} to the source file name.
4191
4192@item copyrename
4193@opindex fdump-tree-copyrename
4194Dump each function after applying the copy rename optimization.  The file
4195name is made by appending @file{.copyrename} to the source file name.
4196
4197@item nrv
4198@opindex fdump-tree-nrv
4199Dump each function after applying the named return value optimization on
4200generic trees.  The file name is made by appending @file{.nrv} to the source
4201file name.
4202
4203@item vect
4204@opindex fdump-tree-vect
4205Dump each function after applying vectorization of loops.  The file name is
4206made by appending @file{.vect} to the source file name.
4207
4208@item vrp
4209@opindex fdump-tree-vrp
4210Dump each function after Value Range Propagation (VRP).  The file name
4211is made by appending @file{.vrp} to the source file name.
4212
4213@item all
4214@opindex fdump-tree-all
4215Enable all the available tree dumps with the flags provided in this option.
4216@end table
4217
4218@item -ftree-vectorizer-verbose=@var{n}
4219@opindex ftree-vectorizer-verbose
4220This option controls the amount of debugging output the vectorizer prints.
4221This information is written to standard error, unless 
4222@option{-fdump-tree-all} or @option{-fdump-tree-vect} is specified, 
4223in which case it is output to the usual dump listing file, @file{.vect}.
4224For @var{n}=0 no diagnostic information is reported.
4225If @var{n}=1 the vectorizer reports each loop that got vectorized, 
4226and the total number of loops that got vectorized.
4227If @var{n}=2 the vectorizer also reports non-vectorized loops that passed 
4228the first analysis phase (vect_analyze_loop_form) - i.e. countable, 
4229inner-most, single-bb, single-entry/exit loops.  This is the same verbosity 
4230level that @option{-fdump-tree-vect-stats} uses.
4231Higher verbosity levels mean either more information dumped for each 
4232reported loop, or same amount of information reported for more loops:
4233If @var{n}=3, alignment related information is added to the reports.
4234If @var{n}=4, data-references related information (e.g. memory dependences, 
4235memory access-patterns) is added to the reports.
4236If @var{n}=5, the vectorizer reports also non-vectorized inner-most loops 
4237that did not pass the first analysis phase (i.e. may not be countable, or 
4238may have complicated control-flow).
4239If @var{n}=6, the vectorizer reports also non-vectorized nested loops.
4240For @var{n}=7, all the information the vectorizer generates during its 
4241analysis and transformation is reported.  This is the same verbosity level
4242that @option{-fdump-tree-vect-details} uses.
4243
4244@item -frandom-seed=@var{string}
4245@opindex frandom-string
4246This option provides a seed that GCC uses when it would otherwise use
4247random numbers.  It is used to generate certain symbol names
4248that have to be different in every compiled file.  It is also used to
4249place unique stamps in coverage data files and the object files that
4250produce them.  You can use the @option{-frandom-seed} option to produce
4251reproducibly identical object files.
4252
4253The @var{string} should be different for every file you compile.
4254
4255@item -fsched-verbose=@var{n}
4256@opindex fsched-verbose
4257On targets that use instruction scheduling, this option controls the
4258amount of debugging output the scheduler prints.  This information is
4259written to standard error, unless @option{-dS} or @option{-dR} is
4260specified, in which case it is output to the usual dump
4261listing file, @file{.sched} or @file{.sched2} respectively.  However
4262for @var{n} greater than nine, the output is always printed to standard
4263error.
4264
4265For @var{n} greater than zero, @option{-fsched-verbose} outputs the
4266same information as @option{-dRS}.  For @var{n} greater than one, it
4267also output basic block probabilities, detailed ready list information
4268and unit/insn info.  For @var{n} greater than two, it includes RTL
4269at abort point, control-flow and regions info.  And for @var{n} over
4270four, @option{-fsched-verbose} also includes dependence info.
4271
4272@item -save-temps
4273@opindex save-temps
4274Store the usual ``temporary'' intermediate files permanently; place them
4275in the current directory and name them based on the source file.  Thus,
4276compiling @file{foo.c} with @samp{-c -save-temps} would produce files
4277@file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
4278preprocessed @file{foo.i} output file even though the compiler now
4279normally uses an integrated preprocessor.
4280
4281When used in combination with the @option{-x} command line option,
4282@option{-save-temps} is sensible enough to avoid over writing an
4283input source file with the same extension as an intermediate file.
4284The corresponding intermediate file may be obtained by renaming the
4285source file before using @option{-save-temps}.
4286
4287@item -time
4288@opindex time
4289Report the CPU time taken by each subprocess in the compilation
4290sequence.  For C source files, this is the compiler proper and assembler
4291(plus the linker if linking is done).  The output looks like this:
4292
4293@smallexample
4294# cc1 0.12 0.01
4295# as 0.00 0.01
4296@end smallexample
4297
4298The first number on each line is the ``user time'', that is time spent
4299executing the program itself.  The second number is ``system time'',
4300time spent executing operating system routines on behalf of the program.
4301Both numbers are in seconds.
4302
4303@item -fvar-tracking
4304@opindex fvar-tracking
4305Run variable tracking pass.  It computes where variables are stored at each
4306position in code.  Better debugging information is then generated
4307(if the debugging information format supports this information).
4308
4309It is enabled by default when compiling with optimization (@option{-Os},
4310@option{-O}, @option{-O2}, ...), debugging information (@option{-g}) and
4311the debug info format supports it.
4312
4313@item -print-file-name=@var{library}
4314@opindex print-file-name
4315Print the full absolute name of the library file @var{library} that
4316would be used when linking---and don't do anything else.  With this
4317option, GCC does not compile or link anything; it just prints the
4318file name.
4319
4320@item -print-multi-directory
4321@opindex print-multi-directory
4322Print the directory name corresponding to the multilib selected by any
4323other switches present in the command line.  This directory is supposed
4324to exist in @env{GCC_EXEC_PREFIX}.
4325
4326@item -print-multi-lib
4327@opindex print-multi-lib
4328Print the mapping from multilib directory names to compiler switches
4329that enable them.  The directory name is separated from the switches by
4330@samp{;}, and each switch starts with an @samp{@@} instead of the
4331@samp{-}, without spaces between multiple switches.  This is supposed to
4332ease shell-processing.
4333
4334@item -print-prog-name=@var{program}
4335@opindex print-prog-name
4336Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
4337
4338@item -print-libgcc-file-name
4339@opindex print-libgcc-file-name
4340Same as @option{-print-file-name=libgcc.a}.
4341
4342This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
4343but you do want to link with @file{libgcc.a}.  You can do
4344
4345@smallexample
4346gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
4347@end smallexample
4348
4349@item -print-search-dirs
4350@opindex print-search-dirs
4351Print the name of the configured installation directory and a list of
4352program and library directories @command{gcc} will search---and don't do anything else.
4353
4354This is useful when @command{gcc} prints the error message
4355@samp{installation problem, cannot exec cpp0: No such file or directory}.
4356To resolve this you either need to put @file{cpp0} and the other compiler
4357components where @command{gcc} expects to find them, or you can set the environment
4358variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
4359Don't forget the trailing @samp{/}.
4360@xref{Environment Variables}.
4361
4362@item -dumpmachine
4363@opindex dumpmachine
4364Print the compiler's target machine (for example,
4365@samp{i686-pc-linux-gnu})---and don't do anything else.
4366
4367@item -dumpversion
4368@opindex dumpversion
4369Print the compiler version (for example, @samp{3.0})---and don't do
4370anything else.
4371
4372@item -dumpspecs
4373@opindex dumpspecs
4374Print the compiler's built-in specs---and don't do anything else.  (This
4375is used when GCC itself is being built.)  @xref{Spec Files}.
4376
4377@item -feliminate-unused-debug-types
4378@opindex feliminate-unused-debug-types
4379Normally, when producing DWARF2 output, GCC will emit debugging
4380information for all types declared in a compilation
4381unit, regardless of whether or not they are actually used
4382in that compilation unit.  Sometimes this is useful, such as
4383if, in the debugger, you want to cast a value to a type that is
4384not actually used in your program (but is declared).  More often,
4385however, this results in a significant amount of wasted space.
4386With this option, GCC will avoid producing debug symbol output
4387for types that are nowhere used in the source file being compiled.
4388@end table
4389
4390@node Optimize Options
4391@section Options That Control Optimization
4392@cindex optimize options
4393@cindex options, optimization
4394
4395These options control various sorts of optimizations.
4396
4397Without any optimization option, the compiler's goal is to reduce the
4398cost of compilation and to make debugging produce the expected
4399results.  Statements are independent: if you stop the program with a
4400breakpoint between statements, you can then assign a new value to any
4401variable or change the program counter to any other statement in the
4402function and get exactly the results you would expect from the source
4403code.
4404
4405Turning on optimization flags makes the compiler attempt to improve
4406the performance and/or code size at the expense of compilation time
4407and possibly the ability to debug the program.
4408
4409The compiler performs optimization based on the knowledge it has of
4410the program.  Optimization levels @option{-O} and above, in
4411particular, enable @emph{unit-at-a-time} mode, which allows the
4412compiler to consider information gained from later functions in
4413the file when compiling a function.  Compiling multiple files at
4414once to a single output file in @emph{unit-at-a-time} mode allows
4415the compiler to use information gained from all of the files when
4416compiling each of them.
4417
4418Not all optimizations are controlled directly by a flag.  Only
4419optimizations that have a flag are listed.
4420
4421@table @gcctabopt
4422@item -O
4423@itemx -O1
4424@opindex O
4425@opindex O1
4426Optimize.  Optimizing compilation takes somewhat more time, and a lot
4427more memory for a large function.
4428
4429With @option{-O}, the compiler tries to reduce code size and execution
4430time, without performing any optimizations that take a great deal of
4431compilation time.
4432
4433@option{-O} turns on the following optimization flags:
4434@gccoptlist{-fdefer-pop @gol
4435-fdelayed-branch @gol
4436-fguess-branch-probability @gol
4437-fcprop-registers @gol
4438-fif-conversion @gol
4439-fif-conversion2 @gol
4440-ftree-ccp @gol
4441-ftree-dce @gol
4442-ftree-dominator-opts @gol
4443-ftree-dse @gol
4444-ftree-ter @gol
4445-ftree-lrs @gol
4446-ftree-sra @gol
4447-ftree-copyrename @gol
4448-ftree-fre @gol
4449-ftree-ch @gol
4450-funit-at-a-time @gol
4451-fmerge-constants}
4452
4453@option{-O} also turns on @option{-fomit-frame-pointer} on machines
4454where doing so does not interfere with debugging.
4455
4456@item -O2
4457@opindex O2
4458Optimize even more.  GCC performs nearly all supported optimizations
4459that do not involve a space-speed tradeoff.  The compiler does not
4460perform loop unrolling or function inlining when you specify @option{-O2}.
4461As compared to @option{-O}, this option increases both compilation time
4462and the performance of the generated code.
4463
4464@option{-O2} turns on all optimization flags specified by @option{-O}.  It
4465also turns on the following optimization flags:
4466@gccoptlist{-fthread-jumps @gol
4467-fcrossjumping @gol
4468-foptimize-sibling-calls @gol
4469-fcse-follow-jumps  -fcse-skip-blocks @gol
4470-fgcse  -fgcse-lm  @gol
4471-fexpensive-optimizations @gol
4472-frerun-cse-after-loop  @gol
4473-fcaller-saves @gol
4474-fpeephole2 @gol
4475-fschedule-insns  -fschedule-insns2 @gol
4476-fsched-interblock  -fsched-spec @gol
4477-fregmove @gol
4478-fstrict-aliasing -fstrict-overflow @gol
4479-fdelete-null-pointer-checks @gol
4480-freorder-blocks  -freorder-functions @gol
4481-falign-functions  -falign-jumps @gol
4482-falign-loops  -falign-labels @gol
4483-ftree-vrp @gol
4484-ftree-pre}
4485
4486Please note the warning under @option{-fgcse} about
4487invoking @option{-O2} on programs that use computed gotos.
4488
4489@option{-O2} doesn't turn on @option{-ftree-vrp} for the Ada compiler.
4490This option must be explicitly specified on the command line to be
4491enabled for the Ada compiler.
4492
4493@item -O3
4494@opindex O3
4495Optimize yet more.  @option{-O3} turns on all optimizations specified by
4496@option{-O2} and also turns on the @option{-finline-functions},
4497@option{-funswitch-loops} and @option{-fgcse-after-reload} options.
4498
4499@item -O0
4500@opindex O0
4501Do not optimize.  This is the default.
4502
4503@item -Os
4504@opindex Os
4505Optimize for size.  @option{-Os} enables all @option{-O2} optimizations that
4506do not typically increase code size.  It also performs further
4507optimizations designed to reduce code size.
4508
4509@option{-Os} disables the following optimization flags:
4510@gccoptlist{-falign-functions  -falign-jumps  -falign-loops @gol
4511-falign-labels  -freorder-blocks  -freorder-blocks-and-partition @gol
4512-fprefetch-loop-arrays  -ftree-vect-loop-version}
4513
4514If you use multiple @option{-O} options, with or without level numbers,
4515the last such option is the one that is effective.
4516@end table
4517
4518Options of the form @option{-f@var{flag}} specify machine-independent
4519flags.  Most flags have both positive and negative forms; the negative
4520form of @option{-ffoo} would be @option{-fno-foo}.  In the table
4521below, only one of the forms is listed---the one you typically will
4522use.  You can figure out the other form by either removing @samp{no-}
4523or adding it.
4524
4525The following options control specific optimizations.  They are either
4526activated by @option{-O} options or are related to ones that are.  You
4527can use the following flags in the rare cases when ``fine-tuning'' of
4528optimizations to be performed is desired.
4529
4530@table @gcctabopt
4531@item -fno-default-inline
4532@opindex fno-default-inline
4533Do not make member functions inline by default merely because they are
4534defined inside the class scope (C++ only).  Otherwise, when you specify
4535@w{@option{-O}}, member functions defined inside class scope are compiled
4536inline by default; i.e., you don't need to add @samp{inline} in front of
4537the member function name.
4538
4539@item -fno-defer-pop
4540@opindex fno-defer-pop
4541Always pop the arguments to each function call as soon as that function
4542returns.  For machines which must pop arguments after a function call,
4543the compiler normally lets arguments accumulate on the stack for several
4544function calls and pops them all at once.
4545
4546Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4547
4548@item -fforce-mem
4549@opindex fforce-mem
4550Force memory operands to be copied into registers before doing
4551arithmetic on them.  This produces better code by making all memory
4552references potential common subexpressions.  When they are not common
4553subexpressions, instruction combination should eliminate the separate
4554register-load. This option is now a nop and will be removed in 4.3.
4555
4556@item -fforce-addr
4557@opindex fforce-addr
4558Force memory address constants to be copied into registers before
4559doing arithmetic on them.
4560
4561@item -fomit-frame-pointer
4562@opindex fomit-frame-pointer
4563Don't keep the frame pointer in a register for functions that
4564don't need one.  This avoids the instructions to save, set up and
4565restore frame pointers; it also makes an extra register available
4566in many functions.  @strong{It also makes debugging impossible on
4567some machines.}
4568
4569On some machines, such as the VAX, this flag has no effect, because
4570the standard calling sequence automatically handles the frame pointer
4571and nothing is saved by pretending it doesn't exist.  The
4572machine-description macro @code{FRAME_POINTER_REQUIRED} controls
4573whether a target machine supports this flag.  @xref{Registers,,Register
4574Usage, gccint, GNU Compiler Collection (GCC) Internals}.
4575
4576Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4577
4578@item -foptimize-sibling-calls
4579@opindex foptimize-sibling-calls
4580Optimize sibling and tail recursive calls.
4581
4582Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4583
4584@item -fno-inline
4585@opindex fno-inline
4586Don't pay attention to the @code{inline} keyword.  Normally this option
4587is used to keep the compiler from expanding any functions inline.
4588Note that if you are not optimizing, no functions can be expanded inline.
4589
4590@item -finline-functions
4591@opindex finline-functions
4592Integrate all simple functions into their callers.  The compiler
4593heuristically decides which functions are simple enough to be worth
4594integrating in this way.
4595
4596If all calls to a given function are integrated, and the function is
4597declared @code{static}, then the function is normally not output as
4598assembler code in its own right.
4599
4600Enabled at level @option{-O3}.
4601
4602@item -finline-functions-called-once
4603@opindex finline-functions-called-once
4604Consider all @code{static} functions called once for inlining into their
4605caller even if they are not marked @code{inline}.  If a call to a given
4606function is integrated, then the function is not output as assembler code
4607in its own right.
4608
4609Enabled if @option{-funit-at-a-time} is enabled.
4610
4611@item -fearly-inlining
4612@opindex fearly-inlining
4613Inline functions marked by @code{always_inline} and functions whose body seems
4614smaller than the function call overhead early before doing
4615@option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
4616makes profiling significantly cheaper and usually inlining faster on programs
4617having large chains of nested wrapper functions.
4618
4619Enabled by default.
4620
4621@item -finline-limit=@var{n}
4622@opindex finline-limit
4623By default, GCC limits the size of functions that can be inlined.  This flag
4624allows the control of this limit for functions that are explicitly marked as
4625inline (i.e., marked with the inline keyword or defined within the class
4626definition in c++).  @var{n} is the size of functions that can be inlined in
4627number of pseudo instructions (not counting parameter handling).  The default
4628value of @var{n} is 600.
4629Increasing this value can result in more inlined code at
4630the cost of compilation time and memory consumption.  Decreasing usually makes
4631the compilation faster and less code will be inlined (which presumably
4632means slower programs).  This option is particularly useful for programs that
4633use inlining heavily such as those based on recursive templates with C++.
4634
4635Inlining is actually controlled by a number of parameters, which may be
4636specified individually by using @option{--param @var{name}=@var{value}}.
4637The @option{-finline-limit=@var{n}} option sets some of these parameters
4638as follows:
4639
4640@table @gcctabopt
4641@item max-inline-insns-single
4642 is set to @var{n}/2.
4643@item max-inline-insns-auto
4644 is set to @var{n}/2.
4645@item min-inline-insns
4646 is set to 130 or @var{n}/4, whichever is smaller.
4647@item max-inline-insns-rtl
4648 is set to @var{n}.
4649@end table
4650
4651See below for a documentation of the individual
4652parameters controlling inlining.
4653
4654@emph{Note:} pseudo instruction represents, in this particular context, an
4655abstract measurement of function's size.  In no way does it represent a count
4656of assembly instructions and as such its exact meaning might change from one
4657release to an another.
4658
4659@item -fkeep-inline-functions
4660@opindex fkeep-inline-functions
4661In C, emit @code{static} functions that are declared @code{inline}
4662into the object file, even if the function has been inlined into all
4663of its callers.  This switch does not affect functions using the
4664@code{extern inline} extension in GNU C@.  In C++, emit any and all
4665inline functions into the object file.
4666
4667@item -fkeep-static-consts
4668@opindex fkeep-static-consts
4669Emit variables declared @code{static const} when optimization isn't turned
4670on, even if the variables aren't referenced.
4671
4672GCC enables this option by default.  If you want to force the compiler to
4673check if the variable was referenced, regardless of whether or not
4674optimization is turned on, use the @option{-fno-keep-static-consts} option.
4675
4676@item -fmerge-constants
4677Attempt to merge identical constants (string constants and floating point
4678constants) across compilation units.
4679
4680This option is the default for optimized compilation if the assembler and
4681linker support it.  Use @option{-fno-merge-constants} to inhibit this
4682behavior.
4683
4684Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4685
4686@item -fmerge-all-constants
4687Attempt to merge identical constants and identical variables.
4688
4689This option implies @option{-fmerge-constants}.  In addition to
4690@option{-fmerge-constants} this considers e.g.@: even constant initialized
4691arrays or initialized constant variables with integral or floating point
4692types.  Languages like C or C++ require each non-automatic variable to
4693have distinct location, so using this option will result in non-conforming
4694behavior.
4695
4696@item -fmodulo-sched
4697@opindex fmodulo-sched
4698Perform swing modulo scheduling immediately before the first scheduling
4699pass.  This pass looks at innermost loops and reorders their
4700instructions by overlapping different iterations.
4701
4702@item -fno-branch-count-reg
4703@opindex fno-branch-count-reg
4704Do not use ``decrement and branch'' instructions on a count register,
4705but instead generate a sequence of instructions that decrement a
4706register, compare it against zero, then branch based upon the result.
4707This option is only meaningful on architectures that support such
4708instructions, which include x86, PowerPC, IA-64 and S/390.
4709
4710The default is @option{-fbranch-count-reg}.
4711
4712@item -fno-function-cse
4713@opindex fno-function-cse
4714Do not put function addresses in registers; make each instruction that
4715calls a constant function contain the function's address explicitly.
4716
4717This option results in less efficient code, but some strange hacks
4718that alter the assembler output may be confused by the optimizations
4719performed when this option is not used.
4720
4721The default is @option{-ffunction-cse}
4722
4723@item -fno-zero-initialized-in-bss
4724@opindex fno-zero-initialized-in-bss
4725If the target supports a BSS section, GCC by default puts variables that
4726are initialized to zero into BSS@.  This can save space in the resulting
4727code.
4728
4729This option turns off this behavior because some programs explicitly
4730rely on variables going to the data section.  E.g., so that the
4731resulting executable can find the beginning of that section and/or make
4732assumptions based on that.
4733
4734The default is @option{-fzero-initialized-in-bss}.
4735
4736@item -fbounds-check
4737@opindex fbounds-check
4738For front-ends that support it, generate additional code to check that
4739indices used to access arrays are within the declared range.  This is
4740currently only supported by the Java and Fortran front-ends, where
4741this option defaults to true and false respectively.
4742
4743@item -fmudflap -fmudflapth -fmudflapir
4744@opindex fmudflap
4745@opindex fmudflapth
4746@opindex fmudflapir
4747@cindex bounds checking
4748@cindex mudflap
4749For front-ends that support it (C and C++), instrument all risky
4750pointer/array dereferencing operations, some standard library
4751string/heap functions, and some other associated constructs with
4752range/validity tests.  Modules so instrumented should be immune to
4753buffer overflows, invalid heap use, and some other classes of C/C++
4754programming errors.  The instrumentation relies on a separate runtime
4755library (@file{libmudflap}), which will be linked into a program if
4756@option{-fmudflap} is given at link time.  Run-time behavior of the
4757instrumented program is controlled by the @env{MUDFLAP_OPTIONS}
4758environment variable.  See @code{env MUDFLAP_OPTIONS=-help a.out}
4759for its options.
4760
4761Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to
4762link if your program is multi-threaded.  Use @option{-fmudflapir}, in
4763addition to @option{-fmudflap} or @option{-fmudflapth}, if
4764instrumentation should ignore pointer reads.  This produces less
4765instrumentation (and therefore faster execution) and still provides
4766some protection against outright memory corrupting writes, but allows
4767erroneously read data to propagate within a program.
4768
4769@item -fthread-jumps
4770@opindex fthread-jumps
4771Perform optimizations where we check to see if a jump branches to a
4772location where another comparison subsumed by the first is found.  If
4773so, the first branch is redirected to either the destination of the
4774second branch or a point immediately following it, depending on whether
4775the condition is known to be true or false.
4776
4777Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4778
4779@item -fcse-follow-jumps
4780@opindex fcse-follow-jumps
4781In common subexpression elimination, scan through jump instructions
4782when the target of the jump is not reached by any other path.  For
4783example, when CSE encounters an @code{if} statement with an
4784@code{else} clause, CSE will follow the jump when the condition
4785tested is false.
4786
4787Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4788
4789@item -fcse-skip-blocks
4790@opindex fcse-skip-blocks
4791This is similar to @option{-fcse-follow-jumps}, but causes CSE to
4792follow jumps which conditionally skip over blocks.  When CSE
4793encounters a simple @code{if} statement with no else clause,
4794@option{-fcse-skip-blocks} causes CSE to follow the jump around the
4795body of the @code{if}.
4796
4797Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4798
4799@item -frerun-cse-after-loop
4800@opindex frerun-cse-after-loop
4801Re-run common subexpression elimination after loop optimizations has been
4802performed.
4803
4804Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4805
4806@item -fgcse
4807@opindex fgcse
4808Perform a global common subexpression elimination pass.
4809This pass also performs global constant and copy propagation.
4810
4811@emph{Note:} When compiling a program using computed gotos, a GCC
4812extension, you may get better runtime performance if you disable
4813the global common subexpression elimination pass by adding
4814@option{-fno-gcse} to the command line.
4815
4816Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4817
4818@item -fgcse-lm
4819@opindex fgcse-lm
4820When @option{-fgcse-lm} is enabled, global common subexpression elimination will
4821attempt to move loads which are only killed by stores into themselves.  This
4822allows a loop containing a load/store sequence to be changed to a load outside
4823the loop, and a copy/store within the loop.
4824
4825Enabled by default when gcse is enabled.
4826
4827@item -fgcse-sm
4828@opindex fgcse-sm
4829When @option{-fgcse-sm} is enabled, a store motion pass is run after
4830global common subexpression elimination.  This pass will attempt to move
4831stores out of loops.  When used in conjunction with @option{-fgcse-lm},
4832loops containing a load/store sequence can be changed to a load before
4833the loop and a store after the loop.
4834
4835Not enabled at any optimization level.
4836
4837@item -fgcse-las
4838@opindex fgcse-las
4839When @option{-fgcse-las} is enabled, the global common subexpression
4840elimination pass eliminates redundant loads that come after stores to the
4841same memory location (both partial and full redundancies).
4842
4843Not enabled at any optimization level.
4844
4845@item -fgcse-after-reload
4846@opindex fgcse-after-reload
4847When @option{-fgcse-after-reload} is enabled, a redundant load elimination
4848pass is performed after reload.  The purpose of this pass is to cleanup
4849redundant spilling.
4850
4851@item -funsafe-loop-optimizations
4852@opindex funsafe-loop-optimizations
4853If given, the loop optimizer will assume that loop indices do not
4854overflow, and that the loops with nontrivial exit condition are not
4855infinite.  This enables a wider range of loop optimizations even if
4856the loop optimizer itself cannot prove that these assumptions are valid.
4857Using @option{-Wunsafe-loop-optimizations}, the compiler will warn you
4858if it finds this kind of loop.
4859
4860@item -fcrossjumping
4861@opindex crossjumping
4862Perform cross-jumping transformation.  This transformation unifies equivalent code and save code size.  The
4863resulting code may or may not perform better than without cross-jumping.
4864
4865Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4866
4867@item -fif-conversion
4868@opindex if-conversion
4869Attempt to transform conditional jumps into branch-less equivalents.  This
4870include use of conditional moves, min, max, set flags and abs instructions, and
4871some tricks doable by standard arithmetics.  The use of conditional execution
4872on chips where it is available is controlled by @code{if-conversion2}.
4873
4874Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4875
4876@item -fif-conversion2
4877@opindex if-conversion2
4878Use conditional execution (where available) to transform conditional jumps into
4879branch-less equivalents.
4880
4881Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4882
4883@item -fdelete-null-pointer-checks
4884@opindex fdelete-null-pointer-checks
4885Use global dataflow analysis to identify and eliminate useless checks
4886for null pointers.  The compiler assumes that dereferencing a null
4887pointer would have halted the program.  If a pointer is checked after
4888it has already been dereferenced, it cannot be null.
4889
4890In some environments, this assumption is not true, and programs can
4891safely dereference null pointers.  Use
4892@option{-fno-delete-null-pointer-checks} to disable this optimization
4893for programs which depend on that behavior.
4894
4895Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4896
4897@item -fexpensive-optimizations
4898@opindex fexpensive-optimizations
4899Perform a number of minor optimizations that are relatively expensive.
4900
4901Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4902
4903@item -foptimize-register-move
4904@itemx -fregmove
4905@opindex foptimize-register-move
4906@opindex fregmove
4907Attempt to reassign register numbers in move instructions and as
4908operands of other simple instructions in order to maximize the amount of
4909register tying.  This is especially helpful on machines with two-operand
4910instructions.
4911
4912Note @option{-fregmove} and @option{-foptimize-register-move} are the same
4913optimization.
4914
4915Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4916
4917@item -fdelayed-branch
4918@opindex fdelayed-branch
4919If supported for the target machine, attempt to reorder instructions
4920to exploit instruction slots available after delayed branch
4921instructions.
4922
4923Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4924
4925@item -fschedule-insns
4926@opindex fschedule-insns
4927If supported for the target machine, attempt to reorder instructions to
4928eliminate execution stalls due to required data being unavailable.  This
4929helps machines that have slow floating point or memory load instructions
4930by allowing other instructions to be issued until the result of the load
4931or floating point instruction is required.
4932
4933Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4934
4935@item -fschedule-insns2
4936@opindex fschedule-insns2
4937Similar to @option{-fschedule-insns}, but requests an additional pass of
4938instruction scheduling after register allocation has been done.  This is
4939especially useful on machines with a relatively small number of
4940registers and where memory load instructions take more than one cycle.
4941
4942Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4943
4944@item -fno-sched-interblock
4945@opindex fno-sched-interblock
4946Don't schedule instructions across basic blocks.  This is normally
4947enabled by default when scheduling before register allocation, i.e.@:
4948with @option{-fschedule-insns} or at @option{-O2} or higher.
4949
4950@item -fno-sched-spec
4951@opindex fno-sched-spec
4952Don't allow speculative motion of non-load instructions.  This is normally
4953enabled by default when scheduling before register allocation, i.e.@:
4954with @option{-fschedule-insns} or at @option{-O2} or higher.
4955
4956@item -fsched-spec-load
4957@opindex fsched-spec-load
4958Allow speculative motion of some load instructions.  This only makes
4959sense when scheduling before register allocation, i.e.@: with
4960@option{-fschedule-insns} or at @option{-O2} or higher.
4961
4962@item -fsched-spec-load-dangerous
4963@opindex fsched-spec-load-dangerous
4964Allow speculative motion of more load instructions.  This only makes
4965sense when scheduling before register allocation, i.e.@: with
4966@option{-fschedule-insns} or at @option{-O2} or higher.
4967
4968@item -fsched-stalled-insns=@var{n}
4969@opindex fsched-stalled-insns
4970Define how many insns (if any) can be moved prematurely from the queue
4971of stalled insns into the ready list, during the second scheduling pass.
4972
4973@item -fsched-stalled-insns-dep=@var{n}
4974@opindex fsched-stalled-insns-dep
4975Define how many insn groups (cycles) will be examined for a dependency
4976on a stalled insn that is candidate for premature removal from the queue
4977of stalled insns.  Has an effect only during the second scheduling pass,
4978and only if @option{-fsched-stalled-insns} is used and its value is not zero.
4979
4980@item -fsched2-use-superblocks
4981@opindex fsched2-use-superblocks
4982When scheduling after register allocation, do use superblock scheduling
4983algorithm.  Superblock scheduling allows motion across basic block boundaries
4984resulting on faster schedules.  This option is experimental, as not all machine
4985descriptions used by GCC model the CPU closely enough to avoid unreliable
4986results from the algorithm.
4987
4988This only makes sense when scheduling after register allocation, i.e.@: with
4989@option{-fschedule-insns2} or at @option{-O2} or higher.
4990
4991@item -fsched2-use-traces
4992@opindex fsched2-use-traces
4993Use @option{-fsched2-use-superblocks} algorithm when scheduling after register
4994allocation and additionally perform code duplication in order to increase the
4995size of superblocks using tracer pass.  See @option{-ftracer} for details on
4996trace formation.
4997
4998This mode should produce faster but significantly longer programs.  Also
4999without @option{-fbranch-probabilities} the traces constructed may not
5000match the reality and hurt the performance.  This only makes
5001sense when scheduling after register allocation, i.e.@: with
5002@option{-fschedule-insns2} or at @option{-O2} or higher.
5003
5004@item -fsee
5005@opindex fsee
5006Eliminates redundant extension instructions and move the non redundant
5007ones to optimal placement using LCM.
5008
5009@item -freschedule-modulo-scheduled-loops
5010@opindex fscheduling-in-modulo-scheduled-loops
5011The modulo scheduling comes before the traditional scheduling, if a loop was modulo scheduled
5012we may want to prevent the later scheduling passes from changing its schedule, we use this
5013option to control that.
5014
5015@item -fcaller-saves
5016@opindex fcaller-saves
5017Enable values to be allocated in registers that will be clobbered by
5018function calls, by emitting extra instructions to save and restore the
5019registers around such calls.  Such allocation is done only when it
5020seems to result in better code than would otherwise be produced.
5021
5022This option is always enabled by default on certain machines, usually
5023those which have no call-preserved registers to use instead.
5024
5025Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5026
5027@item -ftree-pre
5028Perform Partial Redundancy Elimination (PRE) on trees.  This flag is
5029enabled by default at @option{-O2} and @option{-O3}.
5030
5031@item -ftree-fre
5032Perform Full Redundancy Elimination (FRE) on trees.  The difference
5033between FRE and PRE is that FRE only considers expressions
5034that are computed on all paths leading to the redundant computation.
5035This analysis faster than PRE, though it exposes fewer redundancies.
5036This flag is enabled by default at @option{-O} and higher.
5037
5038@item -ftree-copy-prop
5039Perform copy propagation on trees.  This pass eliminates unnecessary
5040copy operations.  This flag is enabled by default at @option{-O} and
5041higher.
5042
5043@item -ftree-store-copy-prop
5044Perform copy propagation of memory loads and stores.  This pass
5045eliminates unnecessary copy operations in memory references
5046(structures, global variables, arrays, etc).  This flag is enabled by
5047default at @option{-O2} and higher.
5048
5049@item -ftree-salias
5050Perform structural alias analysis on trees.  This flag
5051is enabled by default at @option{-O} and higher.
5052
5053@item -fipa-pta
5054Perform interprocedural pointer analysis.
5055
5056@item -ftree-sink
5057Perform forward store motion  on trees.  This flag is
5058enabled by default at @option{-O} and higher.
5059
5060@item -ftree-ccp
5061Perform sparse conditional constant propagation (CCP) on trees.  This
5062pass only operates on local scalar variables and is enabled by default
5063at @option{-O} and higher.
5064
5065@item -ftree-store-ccp
5066Perform sparse conditional constant propagation (CCP) on trees.  This
5067pass operates on both local scalar variables and memory stores and
5068loads (global variables, structures, arrays, etc).  This flag is
5069enabled by default at @option{-O2} and higher.
5070
5071@item -ftree-dce
5072Perform dead code elimination (DCE) on trees.  This flag is enabled by
5073default at @option{-O} and higher.
5074
5075@item -ftree-dominator-opts
5076Perform a variety of simple scalar cleanups (constant/copy
5077propagation, redundancy elimination, range propagation and expression
5078simplification) based on a dominator tree traversal.  This also
5079performs jump threading (to reduce jumps to jumps). This flag is
5080enabled by default at @option{-O} and higher.
5081
5082@item -ftree-ch
5083Perform loop header copying on trees.  This is beneficial since it increases
5084effectiveness of code motion optimizations.  It also saves one jump.  This flag
5085is enabled by default at @option{-O} and higher.  It is not enabled
5086for @option{-Os}, since it usually increases code size.
5087
5088@item -ftree-loop-optimize
5089Perform loop optimizations on trees.  This flag is enabled by default
5090at @option{-O} and higher.
5091
5092@item -ftree-loop-linear
5093Perform linear loop transformations on tree.  This flag can improve cache
5094performance and allow further loop optimizations to take place.
5095
5096@item -ftree-loop-im
5097Perform loop invariant motion on trees.  This pass moves only invariants that
5098would be hard to handle at RTL level (function calls, operations that expand to
5099nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
5100operands of conditions that are invariant out of the loop, so that we can use
5101just trivial invariantness analysis in loop unswitching.  The pass also includes
5102store motion.
5103
5104@item -ftree-loop-ivcanon
5105Create a canonical counter for number of iterations in the loop for that
5106determining number of iterations requires complicated analysis.  Later
5107optimizations then may determine the number easily.  Useful especially
5108in connection with unrolling.
5109
5110@item -fivopts
5111Perform induction variable optimizations (strength reduction, induction
5112variable merging and induction variable elimination) on trees.
5113
5114@item -ftree-sra
5115Perform scalar replacement of aggregates.  This pass replaces structure
5116references with scalars to prevent committing structures to memory too
5117early.  This flag is enabled by default at @option{-O} and higher.
5118
5119@item -ftree-copyrename
5120Perform copy renaming on trees.  This pass attempts to rename compiler
5121temporaries to other variables at copy locations, usually resulting in
5122variable names which more closely resemble the original variables.  This flag
5123is enabled by default at @option{-O} and higher.
5124
5125@item -ftree-ter
5126Perform temporary expression replacement during the SSA->normal phase.  Single
5127use/single def temporaries are replaced at their use location with their
5128defining expression.  This results in non-GIMPLE code, but gives the expanders
5129much more complex trees to work on resulting in better RTL generation.  This is
5130enabled by default at @option{-O} and higher.
5131
5132@item -ftree-lrs
5133Perform live range splitting during the SSA->normal phase.  Distinct live
5134ranges of a variable are split into unique variables, allowing for better
5135optimization later.  This is enabled by default at @option{-O} and higher.
5136
5137@item -ftree-vectorize
5138Perform loop vectorization on trees.
5139
5140@item -ftree-vect-loop-version
5141@opindex ftree-vect-loop-version
5142Perform loop versioning when doing loop vectorization on trees.  When a loop
5143appears to be vectorizable except that data alignment or data dependence cannot
5144be determined at compile time then vectorized and non-vectorized versions of
5145the loop are generated along with runtime checks for alignment or dependence
5146to control which version is executed.  This option is enabled by default
5147except at level @option{-Os} where it is disabled.
5148
5149@item -ftree-vrp
5150Perform Value Range Propagation on trees.  This is similar to the
5151constant propagation pass, but instead of values, ranges of values are
5152propagated.  This allows the optimizers to remove unnecessary range
5153checks like array bound checks and null pointer checks.  This is
5154enabled by default at @option{-O2} and higher.  Null pointer check
5155elimination is only done if @option{-fdelete-null-pointer-checks} is
5156enabled.
5157
5158@item -ftracer
5159@opindex ftracer
5160Perform tail duplication to enlarge superblock size.  This transformation
5161simplifies the control flow of the function allowing other optimizations to do
5162better job.
5163
5164@item -funroll-loops
5165@opindex funroll-loops
5166Unroll loops whose number of iterations can be determined at compile
5167time or upon entry to the loop.  @option{-funroll-loops} implies
5168@option{-frerun-cse-after-loop}.  This option makes code larger,
5169and may or may not make it run faster.
5170
5171@item -funroll-all-loops
5172@opindex funroll-all-loops
5173Unroll all loops, even if their number of iterations is uncertain when
5174the loop is entered.  This usually makes programs run more slowly.
5175@option{-funroll-all-loops} implies the same options as
5176@option{-funroll-loops},
5177
5178@item -fsplit-ivs-in-unroller
5179@opindex fsplit-ivs-in-unroller
5180Enables expressing of values of induction variables in later iterations
5181of the unrolled loop using the value in the first iteration.  This breaks
5182long dependency chains, thus improving efficiency of the scheduling passes.
5183
5184Combination of @option{-fweb} and CSE is often sufficient to obtain the
5185same effect.  However in cases the loop body is more complicated than
5186a single basic block, this is not reliable.  It also does not work at all
5187on some of the architectures due to restrictions in the CSE pass.
5188
5189This optimization is enabled by default.
5190
5191@item -fvariable-expansion-in-unroller
5192@opindex fvariable-expansion-in-unroller
5193With this option, the compiler will create multiple copies of some
5194local variables when unrolling a loop which can result in superior code.
5195
5196@item -fprefetch-loop-arrays
5197@opindex fprefetch-loop-arrays
5198If supported by the target machine, generate instructions to prefetch
5199memory to improve the performance of loops that access large arrays.
5200
5201This option may generate better or worse code; results are highly
5202dependent on the structure of loops within the source code.
5203
5204Disabled at level @option{-Os}.
5205
5206@item -fno-peephole
5207@itemx -fno-peephole2
5208@opindex fno-peephole
5209@opindex fno-peephole2
5210Disable any machine-specific peephole optimizations.  The difference
5211between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
5212are implemented in the compiler; some targets use one, some use the
5213other, a few use both.
5214
5215@option{-fpeephole} is enabled by default.
5216@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5217
5218@item -fno-guess-branch-probability
5219@opindex fno-guess-branch-probability
5220Do not guess branch probabilities using heuristics.
5221
5222GCC will use heuristics to guess branch probabilities if they are
5223not provided by profiling feedback (@option{-fprofile-arcs}).  These
5224heuristics are based on the control flow graph.  If some branch probabilities
5225are specified by @samp{__builtin_expect}, then the heuristics will be
5226used to guess branch probabilities for the rest of the control flow graph,
5227taking the @samp{__builtin_expect} info into account.  The interactions
5228between the heuristics and @samp{__builtin_expect} can be complex, and in
5229some cases, it may be useful to disable the heuristics so that the effects
5230of @samp{__builtin_expect} are easier to understand.
5231
5232The default is @option{-fguess-branch-probability} at levels
5233@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5234
5235@item -freorder-blocks
5236@opindex freorder-blocks
5237Reorder basic blocks in the compiled function in order to reduce number of
5238taken branches and improve code locality.
5239
5240Enabled at levels @option{-O2}, @option{-O3}.
5241
5242@item -freorder-blocks-and-partition
5243@opindex freorder-blocks-and-partition
5244In addition to reordering basic blocks in the compiled function, in order
5245to reduce number of taken branches, partitions hot and cold basic blocks
5246into separate sections of the assembly and .o files, to improve
5247paging and cache locality performance.
5248
5249This optimization is automatically turned off in the presence of
5250exception handling, for linkonce sections, for functions with a user-defined
5251section attribute and on any architecture that does not support named
5252sections.
5253
5254@item -freorder-functions
5255@opindex freorder-functions
5256Reorder functions in the object file in order to
5257improve code locality.  This is implemented by using special
5258subsections @code{.text.hot} for most frequently executed functions and
5259@code{.text.unlikely} for unlikely executed functions.  Reordering is done by
5260the linker so object file format must support named sections and linker must
5261place them in a reasonable way.
5262
5263Also profile feedback must be available in to make this option effective.  See
5264@option{-fprofile-arcs} for details.
5265
5266Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5267
5268@item -fstrict-aliasing
5269@opindex fstrict-aliasing
5270Allows the compiler to assume the strictest aliasing rules applicable to
5271the language being compiled.  For C (and C++), this activates
5272optimizations based on the type of expressions.  In particular, an
5273object of one type is assumed never to reside at the same address as an
5274object of a different type, unless the types are almost the same.  For
5275example, an @code{unsigned int} can alias an @code{int}, but not a
5276@code{void*} or a @code{double}.  A character type may alias any other
5277type.
5278
5279Pay special attention to code like this:
5280@smallexample
5281union a_union @{
5282  int i;
5283  double d;
5284@};
5285
5286int f() @{
5287  a_union t;
5288  t.d = 3.0;
5289  return t.i;
5290@}
5291@end smallexample
5292The practice of reading from a different union member than the one most
5293recently written to (called ``type-punning'') is common.  Even with
5294@option{-fstrict-aliasing}, type-punning is allowed, provided the memory
5295is accessed through the union type.  So, the code above will work as
5296expected.  However, this code might not:
5297@smallexample
5298int f() @{
5299  a_union t;
5300  int* ip;
5301  t.d = 3.0;
5302  ip = &t.i;
5303  return *ip;
5304@}
5305@end smallexample
5306
5307Every language that wishes to perform language-specific alias analysis
5308should define a function that computes, given an @code{tree}
5309node, an alias set for the node.  Nodes in different alias sets are not
5310allowed to alias.  For an example, see the C front-end function
5311@code{c_get_alias_set}.
5312
5313Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5314
5315@item -fstrict-overflow
5316@opindex fstrict-overflow
5317Allow the compiler to assume strict signed overflow rules, depending
5318on the language being compiled.  For C (and C++) this means that
5319overflow when doing arithmetic with signed numbers is undefined, which
5320means that the compiler may assume that it will not happen.  This
5321permits various optimizations.  For example, the compiler will assume
5322that an expression like @code{i + 10 > i} will always be true for
5323signed @code{i}.  This assumption is only valid if signed overflow is
5324undefined, as the expression is false if @code{i + 10} overflows when
5325using twos complement arithmetic.  When this option is in effect any
5326attempt to determine whether an operation on signed numbers will
5327overflow must be written carefully to not actually involve overflow.
5328
5329See also the @option{-fwrapv} option.  Using @option{-fwrapv} means
5330that signed overflow is fully defined: it wraps.  When
5331@option{-fwrapv} is used, there is no difference between
5332@option{-fstrict-overflow} and @option{-fno-strict-overflow}.  With
5333@option{-fwrapv} certain types of overflow are permitted.  For
5334example, if the compiler gets an overflow when doing arithmetic on
5335constants, the overflowed value can still be used with
5336@option{-fwrapv}, but not otherwise.
5337
5338The @option{-fstrict-overflow} option is enabled at levels
5339@option{-O2}, @option{-O3}, @option{-Os}.
5340
5341@item -falign-functions
5342@itemx -falign-functions=@var{n}
5343@opindex falign-functions
5344Align the start of functions to the next power-of-two greater than
5345@var{n}, skipping up to @var{n} bytes.  For instance,
5346@option{-falign-functions=32} aligns functions to the next 32-byte
5347boundary, but @option{-falign-functions=24} would align to the next
534832-byte boundary only if this can be done by skipping 23 bytes or less.
5349
5350@option{-fno-align-functions} and @option{-falign-functions=1} are
5351equivalent and mean that functions will not be aligned.
5352
5353Some assemblers only support this flag when @var{n} is a power of two;
5354in that case, it is rounded up.
5355
5356If @var{n} is not specified or is zero, use a machine-dependent default.
5357
5358Enabled at levels @option{-O2}, @option{-O3}.
5359
5360@item -falign-labels
5361@itemx -falign-labels=@var{n}
5362@opindex falign-labels
5363Align all branch targets to a power-of-two boundary, skipping up to
5364@var{n} bytes like @option{-falign-functions}.  This option can easily
5365make code slower, because it must insert dummy operations for when the
5366branch target is reached in the usual flow of the code.
5367
5368@option{-fno-align-labels} and @option{-falign-labels=1} are
5369equivalent and mean that labels will not be aligned.
5370
5371If @option{-falign-loops} or @option{-falign-jumps} are applicable and
5372are greater than this value, then their values are used instead.
5373
5374If @var{n} is not specified or is zero, use a machine-dependent default
5375which is very likely to be @samp{1}, meaning no alignment.
5376
5377Enabled at levels @option{-O2}, @option{-O3}.
5378
5379@item -falign-loops
5380@itemx -falign-loops=@var{n}
5381@opindex falign-loops
5382Align loops to a power-of-two boundary, skipping up to @var{n} bytes
5383like @option{-falign-functions}.  The hope is that the loop will be
5384executed many times, which will make up for any execution of the dummy
5385operations.
5386
5387@option{-fno-align-loops} and @option{-falign-loops=1} are
5388equivalent and mean that loops will not be aligned.
5389
5390If @var{n} is not specified or is zero, use a machine-dependent default.
5391
5392Enabled at levels @option{-O2}, @option{-O3}.
5393
5394@item -falign-jumps
5395@itemx -falign-jumps=@var{n}
5396@opindex falign-jumps
5397Align branch targets to a power-of-two boundary, for branch targets
5398where the targets can only be reached by jumping, skipping up to @var{n}
5399bytes like @option{-falign-functions}.  In this case, no dummy operations
5400need be executed.
5401
5402@option{-fno-align-jumps} and @option{-falign-jumps=1} are
5403equivalent and mean that loops will not be aligned.
5404
5405If @var{n} is not specified or is zero, use a machine-dependent default.
5406
5407Enabled at levels @option{-O2}, @option{-O3}.
5408
5409@item -funit-at-a-time
5410@opindex funit-at-a-time
5411Parse the whole compilation unit before starting to produce code.
5412This allows some extra optimizations to take place but consumes
5413more memory (in general).  There are some compatibility issues
5414with @emph{unit-at-a-time} mode:
5415@itemize @bullet
5416@item
5417enabling @emph{unit-at-a-time} mode may change the order
5418in which functions, variables, and top-level @code{asm} statements
5419are emitted, and will likely break code relying on some particular
5420ordering.  The majority of such top-level @code{asm} statements,
5421though, can be replaced by @code{section} attributes.  The
5422@option{fno-toplevel-reorder} option may be used to keep the ordering
5423used in the input file, at the cost of some optimizations.
5424
5425@item
5426@emph{unit-at-a-time} mode removes unreferenced static variables
5427and functions.  This may result in undefined references
5428when an @code{asm} statement refers directly to variables or functions
5429that are otherwise unused.  In that case either the variable/function
5430shall be listed as an operand of the @code{asm} statement operand or,
5431in the case of top-level @code{asm} statements the attribute @code{used}
5432shall be used on the declaration.
5433
5434@item
5435Static functions now can use non-standard passing conventions that
5436may break @code{asm} statements calling functions directly.  Again,
5437attribute @code{used} will prevent this behavior.
5438@end itemize
5439
5440As a temporary workaround, @option{-fno-unit-at-a-time} can be used,
5441but this scheme may not be supported by future releases of GCC@.
5442
5443Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5444
5445@item -fno-toplevel-reorder
5446Do not reorder top-level functions, variables, and @code{asm}
5447statements.  Output them in the same order that they appear in the
5448input file.  When this option is used, unreferenced static variables
5449will not be removed.  This option is intended to support existing code
5450which relies on a particular ordering.  For new code, it is better to
5451use attributes.
5452
5453@item -fweb
5454@opindex fweb
5455Constructs webs as commonly used for register allocation purposes and assign
5456each web individual pseudo register.  This allows the register allocation pass
5457to operate on pseudos directly, but also strengthens several other optimization
5458passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
5459however, make debugging impossible, since variables will no longer stay in a
5460``home register''.
5461
5462Enabled by default with @option{-funroll-loops}.
5463
5464@item -fwhole-program
5465@opindex fwhole-program
5466Assume that the current compilation unit represents whole program being
5467compiled.  All public functions and variables with the exception of @code{main}
5468and those merged by attribute @code{externally_visible} become static functions
5469and in a affect gets more aggressively optimized by interprocedural optimizers.
5470While this option is equivalent to proper use of @code{static} keyword for
5471programs consisting of single file, in combination with option
5472@option{--combine} this flag can be used to compile most of smaller scale C
5473programs since the functions and variables become local for the whole combined
5474compilation unit, not for the single source file itself.
5475
5476
5477@item -fno-cprop-registers
5478@opindex fno-cprop-registers
5479After register allocation and post-register allocation instruction splitting,
5480we perform a copy-propagation pass to try to reduce scheduling dependencies
5481and occasionally eliminate the copy.
5482
5483Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5484
5485@item -fprofile-generate
5486@opindex fprofile-generate
5487
5488Enable options usually used for instrumenting application to produce
5489profile useful for later recompilation with profile feedback based
5490optimization.  You must use @option{-fprofile-generate} both when
5491compiling and when linking your program.
5492
5493The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
5494
5495@item -fprofile-use
5496@opindex fprofile-use
5497Enable profile feedback directed optimizations, and optimizations
5498generally profitable only with profile feedback available.
5499
5500The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
5501@code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}
5502
5503@end table
5504
5505The following options control compiler behavior regarding floating
5506point arithmetic.  These options trade off between speed and
5507correctness.  All must be specifically enabled.
5508
5509@table @gcctabopt
5510@item -ffloat-store
5511@opindex ffloat-store
5512Do not store floating point variables in registers, and inhibit other
5513options that might change whether a floating point value is taken from a
5514register or memory.
5515
5516@cindex floating point precision
5517This option prevents undesirable excess precision on machines such as
5518the 68000 where the floating registers (of the 68881) keep more
5519precision than a @code{double} is supposed to have.  Similarly for the
5520x86 architecture.  For most programs, the excess precision does only
5521good, but a few programs rely on the precise definition of IEEE floating
5522point.  Use @option{-ffloat-store} for such programs, after modifying
5523them to store all pertinent intermediate computations into variables.
5524
5525@item -ffast-math
5526@opindex ffast-math
5527Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @*
5528@option{-fno-trapping-math}, @option{-ffinite-math-only},
5529@option{-fno-rounding-math}, @option{-fno-signaling-nans}
5530and @option{fcx-limited-range}.
5531
5532This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
5533
5534This option should never be turned on by any @option{-O} option since
5535it can result in incorrect output for programs which depend on
5536an exact implementation of IEEE or ISO rules/specifications for
5537math functions.
5538
5539@item -fno-math-errno
5540@opindex fno-math-errno
5541Do not set ERRNO after calling math functions that are executed
5542with a single instruction, e.g., sqrt.  A program that relies on
5543IEEE exceptions for math error handling may want to use this flag
5544for speed while maintaining IEEE arithmetic compatibility.
5545
5546This option should never be turned on by any @option{-O} option since
5547it can result in incorrect output for programs which depend on
5548an exact implementation of IEEE or ISO rules/specifications for
5549math functions.
5550
5551The default is @option{-fmath-errno}.
5552
5553On Darwin and FreeBSD systems, the math library never sets @code{errno}.
5554There is therefore
5555no reason for the compiler to consider the possibility that it might,
5556and @option{-fno-math-errno} is the default.
5557
5558@item -funsafe-math-optimizations
5559@opindex funsafe-math-optimizations
5560Allow optimizations for floating-point arithmetic that (a) assume
5561that arguments and results are valid and (b) may violate IEEE or
5562ANSI standards.  When used at link-time, it may include libraries
5563or startup files that change the default FPU control word or other
5564similar optimizations.
5565
5566This option should never be turned on by any @option{-O} option since
5567it can result in incorrect output for programs which depend on
5568an exact implementation of IEEE or ISO rules/specifications for
5569math functions.
5570
5571The default is @option{-fno-unsafe-math-optimizations}.
5572
5573@item -ffinite-math-only
5574@opindex ffinite-math-only
5575Allow optimizations for floating-point arithmetic that assume
5576that arguments and results are not NaNs or +-Infs.
5577
5578This option should never be turned on by any @option{-O} option since
5579it can result in incorrect output for programs which depend on
5580an exact implementation of IEEE or ISO rules/specifications.
5581
5582The default is @option{-fno-finite-math-only}.
5583
5584@item -fno-trapping-math
5585@opindex fno-trapping-math
5586Compile code assuming that floating-point operations cannot generate
5587user-visible traps.  These traps include division by zero, overflow,
5588underflow, inexact result and invalid operation.  This option implies
5589@option{-fno-signaling-nans}.  Setting this option may allow faster
5590code if one relies on ``non-stop'' IEEE arithmetic, for example.
5591
5592This option should never be turned on by any @option{-O} option since
5593it can result in incorrect output for programs which depend on
5594an exact implementation of IEEE or ISO rules/specifications for
5595math functions.
5596
5597The default is @option{-ftrapping-math}.
5598
5599@item -frounding-math
5600@opindex frounding-math
5601Disable transformations and optimizations that assume default floating
5602point rounding behavior.  This is round-to-zero for all floating point
5603to integer conversions, and round-to-nearest for all other arithmetic
5604truncations.  This option should be specified for programs that change
5605the FP rounding mode dynamically, or that may be executed with a
5606non-default rounding mode.  This option disables constant folding of
5607floating point expressions at compile-time (which may be affected by
5608rounding mode) and arithmetic transformations that are unsafe in the
5609presence of sign-dependent rounding modes.
5610
5611The default is @option{-fno-rounding-math}.
5612
5613This option is experimental and does not currently guarantee to
5614disable all GCC optimizations that are affected by rounding mode.
5615Future versions of GCC may provide finer control of this setting
5616using C99's @code{FENV_ACCESS} pragma.  This command line option
5617will be used to specify the default state for @code{FENV_ACCESS}.
5618
5619@item -frtl-abstract-sequences
5620@opindex frtl-abstract-sequences
5621It is a size optimization method. This option is to find identical
5622sequences of code, which can be turned into pseudo-procedures  and
5623then  replace  all  occurrences with  calls to  the  newly created
5624subroutine. It is kind of an opposite of @option{-finline-functions}.
5625This optimization runs at RTL level.
5626
5627@item -fsignaling-nans
5628@opindex fsignaling-nans
5629Compile code assuming that IEEE signaling NaNs may generate user-visible
5630traps during floating-point operations.  Setting this option disables
5631optimizations that may change the number of exceptions visible with
5632signaling NaNs.  This option implies @option{-ftrapping-math}.
5633
5634This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
5635be defined.
5636
5637The default is @option{-fno-signaling-nans}.
5638
5639This option is experimental and does not currently guarantee to
5640disable all GCC optimizations that affect signaling NaN behavior.
5641
5642@item -fsingle-precision-constant
5643@opindex fsingle-precision-constant
5644Treat floating point constant as single precision constant instead of
5645implicitly converting it to double precision constant.
5646
5647@item -fcx-limited-range
5648@itemx -fno-cx-limited-range
5649@opindex fcx-limited-range
5650@opindex fno-cx-limited-range
5651When enabled, this option states that a range reduction step is not
5652needed when performing complex division.  The default is
5653@option{-fno-cx-limited-range}, but is enabled by @option{-ffast-math}.
5654
5655This option controls the default setting of the ISO C99 
5656@code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
5657all languages.
5658
5659@end table
5660
5661The following options control optimizations that may improve
5662performance, but are not enabled by any @option{-O} options.  This
5663section includes experimental options that may produce broken code.
5664
5665@table @gcctabopt
5666@item -fbranch-probabilities
5667@opindex fbranch-probabilities
5668After running a program compiled with @option{-fprofile-arcs}
5669(@pxref{Debugging Options,, Options for Debugging Your Program or
5670@command{gcc}}), you can compile it a second time using
5671@option{-fbranch-probabilities}, to improve optimizations based on
5672the number of times each branch was taken.  When the program
5673compiled with @option{-fprofile-arcs} exits it saves arc execution
5674counts to a file called @file{@var{sourcename}.gcda} for each source
5675file  The information in this data file is very dependent on the
5676structure of the generated code, so you must use the same source code
5677and the same optimization options for both compilations.
5678
5679With @option{-fbranch-probabilities}, GCC puts a
5680@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
5681These can be used to improve optimization.  Currently, they are only
5682used in one place: in @file{reorg.c}, instead of guessing which path a
5683branch is mostly to take, the @samp{REG_BR_PROB} values are used to
5684exactly determine which path is taken more often.
5685
5686@item -fprofile-values
5687@opindex fprofile-values
5688If combined with @option{-fprofile-arcs}, it adds code so that some
5689data about values of expressions in the program is gathered.
5690
5691With @option{-fbranch-probabilities}, it reads back the data gathered
5692from profiling values of expressions and adds @samp{REG_VALUE_PROFILE}
5693notes to instructions for their later usage in optimizations.
5694
5695Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
5696
5697@item -fvpt
5698@opindex fvpt
5699If combined with @option{-fprofile-arcs}, it instructs the compiler to add
5700a code to gather information about values of expressions.
5701
5702With @option{-fbranch-probabilities}, it reads back the data gathered
5703and actually performs the optimizations based on them.
5704Currently the optimizations include specialization of division operation
5705using the knowledge about the value of the denominator.
5706
5707@item -frename-registers
5708@opindex frename-registers
5709Attempt to avoid false dependencies in scheduled code by making use
5710of registers left over after register allocation.  This optimization
5711will most benefit processors with lots of registers.  Depending on the
5712debug information format adopted by the target, however, it can
5713make debugging impossible, since variables will no longer stay in
5714a ``home register''.
5715
5716Enabled by default with @option{-funroll-loops}.
5717
5718@item -ftracer
5719@opindex ftracer
5720Perform tail duplication to enlarge superblock size.  This transformation
5721simplifies the control flow of the function allowing other optimizations to do
5722better job.
5723
5724Enabled with @option{-fprofile-use}.
5725
5726@item -funroll-loops
5727@opindex funroll-loops
5728Unroll loops whose number of iterations can be determined at compile time or
5729upon entry to the loop.  @option{-funroll-loops} implies
5730@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}. 
5731It also turns on complete loop peeling (i.e.@: complete removal of loops with
5732small constant number of iterations).  This option makes code larger, and may
5733or may not make it run faster.
5734
5735Enabled with @option{-fprofile-use}.
5736
5737@item -funroll-all-loops
5738@opindex funroll-all-loops
5739Unroll all loops, even if their number of iterations is uncertain when
5740the loop is entered.  This usually makes programs run more slowly.
5741@option{-funroll-all-loops} implies the same options as
5742@option{-funroll-loops}.
5743
5744@item -fpeel-loops
5745@opindex fpeel-loops
5746Peels the loops for that there is enough information that they do not
5747roll much (from profile feedback).  It also turns on complete loop peeling
5748(i.e.@: complete removal of loops with small constant number of iterations).
5749
5750Enabled with @option{-fprofile-use}.
5751
5752@item -fmove-loop-invariants
5753@opindex fmove-loop-invariants
5754Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
5755at level @option{-O1}
5756
5757@item -funswitch-loops
5758@opindex funswitch-loops
5759Move branches with loop invariant conditions out of the loop, with duplicates
5760of the loop on both branches (modified according to result of the condition).
5761
5762@item -ffunction-sections
5763@itemx -fdata-sections
5764@opindex ffunction-sections
5765@opindex fdata-sections
5766Place each function or data item into its own section in the output
5767file if the target supports arbitrary sections.  The name of the
5768function or the name of the data item determines the section's name
5769in the output file.
5770
5771Use these options on systems where the linker can perform optimizations
5772to improve locality of reference in the instruction space.  Most systems
5773using the ELF object format and SPARC processors running Solaris 2 have
5774linkers with such optimizations.  AIX may have these optimizations in
5775the future.
5776
5777Only use these options when there are significant benefits from doing
5778so.  When you specify these options, the assembler and linker will
5779create larger object and executable files and will also be slower.
5780You will not be able to use @code{gprof} on all systems if you
5781specify this option and you may have problems with debugging if
5782you specify both this option and @option{-g}.
5783
5784@item -fbranch-target-load-optimize
5785@opindex fbranch-target-load-optimize
5786Perform branch target register load optimization before prologue / epilogue
5787threading.
5788The use of target registers can typically be exposed only during reload,
5789thus hoisting loads out of loops and doing inter-block scheduling needs
5790a separate optimization pass.
5791
5792@item -fbranch-target-load-optimize2
5793@opindex fbranch-target-load-optimize2
5794Perform branch target register load optimization after prologue / epilogue
5795threading.
5796
5797@item -fbtr-bb-exclusive
5798@opindex fbtr-bb-exclusive
5799When performing branch target register load optimization, don't reuse
5800branch target registers in within any basic block.
5801
5802@item -fstack-protector
5803Emit extra code to check for buffer overflows, such as stack smashing
5804attacks.  This is done by adding a guard variable to functions with
5805vulnerable objects.  This includes functions that call alloca, and
5806functions with buffers larger than 8 bytes.  The guards are initialized
5807when a function is entered and then checked when the function exits.
5808If a guard check fails, an error message is printed and the program exits.
5809
5810@item -fstack-protector-all
5811Like @option{-fstack-protector} except that all functions are protected.
5812
5813@item -fsection-anchors
5814@opindex fsection-anchors
5815Try to reduce the number of symbolic address calculations by using
5816shared ``anchor'' symbols to address nearby objects.  This transformation
5817can help to reduce the number of GOT entries and GOT accesses on some
5818targets.
5819
5820For example, the implementation of the following function @code{foo}:
5821
5822@smallexample
5823static int a, b, c;
5824int foo (void) @{ return a + b + c; @}
5825@end smallexample
5826
5827would usually calculate the addresses of all three variables, but if you
5828compile it with @option{-fsection-anchors}, it will access the variables
5829from a common anchor point instead.  The effect is similar to the
5830following pseudocode (which isn't valid C):
5831
5832@smallexample
5833int foo (void)
5834@{
5835  register int *xr = &x;
5836  return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
5837@}
5838@end smallexample
5839
5840Not all targets support this option.
5841
5842@item --param @var{name}=@var{value}
5843@opindex param
5844In some places, GCC uses various constants to control the amount of
5845optimization that is done.  For example, GCC will not inline functions
5846that contain more that a certain number of instructions.  You can
5847control some of these constants on the command-line using the
5848@option{--param} option.
5849
5850The names of specific parameters, and the meaning of the values, are
5851tied to the internals of the compiler, and are subject to change
5852without notice in future releases.
5853
5854In each case, the @var{value} is an integer.  The allowable choices for
5855@var{name} are given in the following table:
5856
5857@table @gcctabopt
5858@item salias-max-implicit-fields
5859The maximum number of fields in a variable without direct
5860structure accesses for which structure aliasing will consider trying 
5861to track each field.  The default is 5
5862
5863@item salias-max-array-elements
5864The maximum number of elements an array can have and its elements
5865still be tracked individually by structure aliasing. The default is 4
5866
5867@item sra-max-structure-size
5868The maximum structure size, in bytes, at which the scalar replacement
5869of aggregates (SRA) optimization will perform block copies.  The
5870default value, 0, implies that GCC will select the most appropriate
5871size itself.
5872
5873@item sra-field-structure-ratio
5874The threshold ratio (as a percentage) between instantiated fields and
5875the complete structure size.  We say that if the ratio of the number
5876of bytes in instantiated fields to the number of bytes in the complete
5877structure exceeds this parameter, then block copies are not used.  The
5878default is 75.
5879
5880@item max-crossjump-edges
5881The maximum number of incoming edges to consider for crossjumping.
5882The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
5883the number of edges incoming to each block.  Increasing values mean
5884more aggressive optimization, making the compile time increase with
5885probably small improvement in executable size.
5886
5887@item min-crossjump-insns
5888The minimum number of instructions which must be matched at the end
5889of two blocks before crossjumping will be performed on them.  This
5890value is ignored in the case where all instructions in the block being
5891crossjumped from are matched.  The default value is 5.
5892
5893@item max-grow-copy-bb-insns
5894The maximum code size expansion factor when copying basic blocks
5895instead of jumping.  The expansion is relative to a jump instruction.
5896The default value is 8.
5897
5898@item max-goto-duplication-insns
5899The maximum number of instructions to duplicate to a block that jumps
5900to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
5901passes, GCC factors computed gotos early in the compilation process,
5902and unfactors them as late as possible.  Only computed jumps at the
5903end of a basic blocks with no more than max-goto-duplication-insns are
5904unfactored.  The default value is 8.
5905
5906@item max-delay-slot-insn-search
5907The maximum number of instructions to consider when looking for an
5908instruction to fill a delay slot.  If more than this arbitrary number of
5909instructions is searched, the time savings from filling the delay slot
5910will be minimal so stop searching.  Increasing values mean more
5911aggressive optimization, making the compile time increase with probably
5912small improvement in executable run time.
5913
5914@item max-delay-slot-live-search
5915When trying to fill delay slots, the maximum number of instructions to
5916consider when searching for a block with valid live register
5917information.  Increasing this arbitrarily chosen value means more
5918aggressive optimization, increasing the compile time.  This parameter
5919should be removed when the delay slot code is rewritten to maintain the
5920control-flow graph.
5921
5922@item max-gcse-memory
5923The approximate maximum amount of memory that will be allocated in
5924order to perform the global common subexpression elimination
5925optimization.  If more memory than specified is required, the
5926optimization will not be done.
5927
5928@item max-gcse-passes
5929The maximum number of passes of GCSE to run.  The default is 1.
5930
5931@item max-pending-list-length
5932The maximum number of pending dependencies scheduling will allow
5933before flushing the current state and starting over.  Large functions
5934with few branches or calls can create excessively large lists which
5935needlessly consume memory and resources.
5936
5937@item max-inline-insns-single
5938Several parameters control the tree inliner used in gcc.
5939This number sets the maximum number of instructions (counted in GCC's
5940internal representation) in a single function that the tree inliner
5941will consider for inlining.  This only affects functions declared
5942inline and methods implemented in a class declaration (C++).
5943The default value is 450.
5944
5945@item max-inline-insns-auto
5946When you use @option{-finline-functions} (included in @option{-O3}),
5947a lot of functions that would otherwise not be considered for inlining
5948by the compiler will be investigated.  To those functions, a different
5949(more restrictive) limit compared to functions declared inline can
5950be applied.
5951The default value is 90.
5952
5953@item large-function-insns
5954The limit specifying really large functions.  For functions larger than this
5955limit after inlining inlining is constrained by
5956@option{--param large-function-growth}.  This parameter is useful primarily
5957to avoid extreme compilation time caused by non-linear algorithms used by the
5958backend.
5959This parameter is ignored when @option{-funit-at-a-time} is not used.
5960The default value is 2700.
5961
5962@item large-function-growth
5963Specifies maximal growth of large function caused by inlining in percents.
5964This parameter is ignored when @option{-funit-at-a-time} is not used.
5965The default value is 100 which limits large function growth to 2.0 times
5966the original size.
5967
5968@item large-unit-insns
5969The limit specifying large translation unit.  Growth caused by inlining of
5970units larger than this limit is limited by @option{--param inline-unit-growth}.
5971For small units this might be too tight (consider unit consisting of function A
5972that is inline and B that just calls A three time.  If B is small relative to
5973A, the growth of unit is 300\% and yet such inlining is very sane.  For very
5974large units consisting of small inlininable functions however the overall unit
5975growth limit is needed to avoid exponential explosion of code size.  Thus for
5976smaller units, the size is increased to @option{--param large-unit-insns}
5977before applying @option{--param inline-unit-growth}.  The default is 10000
5978
5979@item inline-unit-growth
5980Specifies maximal overall growth of the compilation unit caused by inlining.
5981This parameter is ignored when @option{-funit-at-a-time} is not used.
5982The default value is 50 which limits unit growth to 1.5 times the original
5983size.
5984
5985@item max-inline-insns-recursive
5986@itemx max-inline-insns-recursive-auto
5987Specifies maximum number of instructions out-of-line copy of self recursive inline
5988function can grow into by performing recursive inlining.
5989
5990For functions declared inline @option{--param max-inline-insns-recursive} is
5991taken into account.  For function not declared inline, recursive inlining
5992happens only when @option{-finline-functions} (included in @option{-O3}) is
5993enabled and @option{--param max-inline-insns-recursive-auto} is used.  The
5994default value is 450.
5995
5996@item max-inline-recursive-depth
5997@itemx max-inline-recursive-depth-auto
5998Specifies maximum recursion depth used by the recursive inlining.
5999
6000For functions declared inline @option{--param max-inline-recursive-depth} is
6001taken into account.  For function not declared inline, recursive inlining
6002happens only when @option{-finline-functions} (included in @option{-O3}) is
6003enabled and @option{--param max-inline-recursive-depth-auto} is used.  The
6004default value is 450.
6005
6006@item min-inline-recursive-probability
6007Recursive inlining is profitable only for function having deep recursion
6008in average and can hurt for function having little recursion depth by
6009increasing the prologue size or complexity of function body to other
6010optimizers.
6011
6012When profile feedback is available (see @option{-fprofile-generate}) the actual
6013recursion depth can be guessed from probability that function will recurse via
6014given call expression.  This parameter limits inlining only to call expression
6015whose probability exceeds given threshold (in percents).  The default value is
601610.
6017
6018@item inline-call-cost
6019Specify cost of call instruction relative to simple arithmetics operations
6020(having cost of 1).  Increasing this cost disqualifies inlining of non-leaf
6021functions and at the same time increases size of leaf function that is believed to
6022reduce function size by being inlined.  In effect it increases amount of
6023inlining for code having large abstraction penalty (many functions that just
6024pass the arguments to other functions) and decrease inlining for code with low
6025abstraction penalty.  The default value is 16.
6026
6027@item max-unrolled-insns
6028The maximum number of instructions that a loop should have if that loop
6029is unrolled, and if the loop is unrolled, it determines how many times
6030the loop code is unrolled.
6031
6032@item max-average-unrolled-insns
6033The maximum number of instructions biased by probabilities of their execution
6034that a loop should have if that loop is unrolled, and if the loop is unrolled,
6035it determines how many times the loop code is unrolled.
6036
6037@item max-unroll-times
6038The maximum number of unrollings of a single loop.
6039
6040@item max-peeled-insns
6041The maximum number of instructions that a loop should have if that loop
6042is peeled, and if the loop is peeled, it determines how many times
6043the loop code is peeled.
6044
6045@item max-peel-times
6046The maximum number of peelings of a single loop.
6047
6048@item max-completely-peeled-insns
6049The maximum number of insns of a completely peeled loop.
6050
6051@item max-completely-peel-times
6052The maximum number of iterations of a loop to be suitable for complete peeling.
6053
6054@item max-unswitch-insns
6055The maximum number of insns of an unswitched loop.
6056
6057@item max-unswitch-level
6058The maximum number of branches unswitched in a single loop.
6059
6060@item lim-expensive
6061The minimum cost of an expensive expression in the loop invariant motion.
6062
6063@item iv-consider-all-candidates-bound
6064Bound on number of candidates for induction variables below that
6065all candidates are considered for each use in induction variable
6066optimizations.  Only the most relevant candidates are considered
6067if there are more candidates, to avoid quadratic time complexity.
6068
6069@item iv-max-considered-uses
6070The induction variable optimizations give up on loops that contain more
6071induction variable uses.
6072
6073@item iv-always-prune-cand-set-bound
6074If number of candidates in the set is smaller than this value,
6075we always try to remove unnecessary ivs from the set during its
6076optimization when a new iv is added to the set.
6077
6078@item scev-max-expr-size
6079Bound on size of expressions used in the scalar evolutions analyzer.
6080Large expressions slow the analyzer.
6081
6082@item vect-max-version-checks
6083The maximum number of runtime checks that can be performed when doing
6084loop versioning in the vectorizer.  See option ftree-vect-loop-version
6085for more information.
6086
6087@item max-iterations-to-track
6088
6089The maximum number of iterations of a loop the brute force algorithm
6090for analysis of # of iterations of the loop tries to evaluate.
6091
6092@item hot-bb-count-fraction
6093Select fraction of the maximal count of repetitions of basic block in program
6094given basic block needs to have to be considered hot.
6095
6096@item hot-bb-frequency-fraction
6097Select fraction of the maximal frequency of executions of basic block in
6098function given basic block needs to have to be considered hot
6099
6100@item max-predicted-iterations
6101The maximum number of loop iterations we predict statically.  This is useful
6102in cases where function contain single loop with known bound and other loop
6103with unknown.  We predict the known number of iterations correctly, while
6104the unknown number of iterations average to roughly 10.  This means that the
6105loop without bounds would appear artificially cold relative to the other one.
6106
6107@item tracer-dynamic-coverage
6108@itemx tracer-dynamic-coverage-feedback
6109
6110This value is used to limit superblock formation once the given percentage of
6111executed instructions is covered.  This limits unnecessary code size
6112expansion.
6113
6114The @option{tracer-dynamic-coverage-feedback} is used only when profile
6115feedback is available.  The real profiles (as opposed to statically estimated
6116ones) are much less balanced allowing the threshold to be larger value.
6117
6118@item tracer-max-code-growth
6119Stop tail duplication once code growth has reached given percentage.  This is
6120rather hokey argument, as most of the duplicates will be eliminated later in
6121cross jumping, so it may be set to much higher values than is the desired code
6122growth.
6123
6124@item tracer-min-branch-ratio
6125
6126Stop reverse growth when the reverse probability of best edge is less than this
6127threshold (in percent).
6128
6129@item tracer-min-branch-ratio
6130@itemx tracer-min-branch-ratio-feedback
6131
6132Stop forward growth if the best edge do have probability lower than this
6133threshold.
6134
6135Similarly to @option{tracer-dynamic-coverage} two values are present, one for
6136compilation for profile feedback and one for compilation without.  The value
6137for compilation with profile feedback needs to be more conservative (higher) in
6138order to make tracer effective.
6139
6140@item max-cse-path-length
6141
6142Maximum number of basic blocks on path that cse considers.  The default is 10.
6143
6144@item max-cse-insns
6145The maximum instructions CSE process before flushing. The default is 1000.
6146
6147@item global-var-threshold
6148
6149Counts the number of function calls (@var{n}) and the number of
6150call-clobbered variables (@var{v}).  If @var{n}x@var{v} is larger than this limit, a
6151single artificial variable will be created to represent all the
6152call-clobbered variables at function call sites.  This artificial
6153variable will then be made to alias every call-clobbered variable.
6154(done as @code{int * size_t} on the host machine; beware overflow).
6155
6156@item max-aliased-vops
6157
6158Maximum number of virtual operands allowed to represent aliases
6159before triggering the alias grouping heuristic.  Alias grouping
6160reduces compile times and memory consumption needed for aliasing at
6161the expense of precision loss in alias information.
6162
6163@item ggc-min-expand
6164
6165GCC uses a garbage collector to manage its own memory allocation.  This
6166parameter specifies the minimum percentage by which the garbage
6167collector's heap should be allowed to expand between collections.
6168Tuning this may improve compilation speed; it has no effect on code
6169generation.
6170
6171The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
6172RAM >= 1GB@.  If @code{getrlimit} is available, the notion of "RAM" is
6173the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
6174GCC is not able to calculate RAM on a particular platform, the lower
6175bound of 30% is used.  Setting this parameter and
6176@option{ggc-min-heapsize} to zero causes a full collection to occur at
6177every opportunity.  This is extremely slow, but can be useful for
6178debugging.
6179
6180@item ggc-min-heapsize
6181
6182Minimum size of the garbage collector's heap before it begins bothering
6183to collect garbage.  The first collection occurs after the heap expands
6184by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
6185tuning this may improve compilation speed, and has no effect on code
6186generation.
6187
6188The default is the smaller of RAM/8, RLIMIT_RSS, or a limit which
6189tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
6190with a lower bound of 4096 (four megabytes) and an upper bound of
6191131072 (128 megabytes).  If GCC is not able to calculate RAM on a
6192particular platform, the lower bound is used.  Setting this parameter
6193very large effectively disables garbage collection.  Setting this
6194parameter and @option{ggc-min-expand} to zero causes a full collection
6195to occur at every opportunity.
6196
6197@item max-reload-search-insns
6198The maximum number of instruction reload should look backward for equivalent
6199register.  Increasing values mean more aggressive optimization, making the
6200compile time increase with probably slightly better performance.  The default
6201value is 100.
6202
6203@item max-cselib-memory-locations
6204The maximum number of memory locations cselib should take into account.
6205Increasing values mean more aggressive optimization, making the compile time
6206increase with probably slightly better performance.  The default value is 500.
6207
6208@item max-flow-memory-locations
6209Similar as @option{max-cselib-memory-locations} but for dataflow liveness.
6210The default value is 100.
6211
6212@item reorder-blocks-duplicate
6213@itemx reorder-blocks-duplicate-feedback
6214
6215Used by basic block reordering pass to decide whether to use unconditional
6216branch or duplicate the code on its destination.  Code is duplicated when its
6217estimated size is smaller than this value multiplied by the estimated size of
6218unconditional jump in the hot spots of the program.
6219
6220The @option{reorder-block-duplicate-feedback} is used only when profile
6221feedback is available and may be set to higher values than
6222@option{reorder-block-duplicate} since information about the hot spots is more
6223accurate.
6224
6225@item max-sched-ready-insns
6226The maximum number of instructions ready to be issued the scheduler should
6227consider at any given time during the first scheduling pass.  Increasing
6228values mean more thorough searches, making the compilation time increase
6229with probably little benefit.  The default value is 100.
6230
6231@item max-sched-region-blocks
6232The maximum number of blocks in a region to be considered for
6233interblock scheduling.  The default value is 10.
6234
6235@item max-sched-region-insns
6236The maximum number of insns in a region to be considered for
6237interblock scheduling.  The default value is 100.
6238
6239@item min-spec-prob
6240The minimum probability (in percents) of reaching a source block
6241for interblock speculative scheduling.  The default value is 40.
6242
6243@item max-sched-extend-regions-iters
6244The maximum number of iterations through CFG to extend regions.
62450 - disable region extension,
6246N - do at most N iterations.
6247The default value is 0.
6248
6249@item max-sched-insn-conflict-delay
6250The maximum conflict delay for an insn to be considered for speculative motion.
6251The default value is 3.
6252
6253@item sched-spec-prob-cutoff
6254The minimal probability of speculation success (in percents), so that
6255speculative insn will be scheduled.
6256The default value is 40.
6257
6258@item max-last-value-rtl
6259
6260The maximum size measured as number of RTLs that can be recorded in an expression
6261in combiner for a pseudo register as last known value of that register.  The default
6262is 10000.
6263
6264@item integer-share-limit
6265Small integer constants can use a shared data structure, reducing the
6266compiler's memory usage and increasing its speed.  This sets the maximum
6267value of a shared integer constant's.  The default value is 256.
6268
6269@item min-virtual-mappings
6270Specifies the minimum number of virtual mappings in the incremental
6271SSA updater that should be registered to trigger the virtual mappings
6272heuristic defined by virtual-mappings-ratio.  The default value is
6273100.
6274
6275@item virtual-mappings-ratio
6276If the number of virtual mappings is virtual-mappings-ratio bigger
6277than the number of virtual symbols to be updated, then the incremental
6278SSA updater switches to a full update for those symbols.  The default
6279ratio is 3.
6280
6281@item ssp-buffer-size
6282The minimum size of buffers (i.e. arrays) that will receive stack smashing
6283protection when @option{-fstack-protection} is used.
6284
6285@item max-jump-thread-duplication-stmts
6286Maximum number of statements allowed in a block that needs to be
6287duplicated when threading jumps.
6288
6289@item max-fields-for-field-sensitive
6290Maximum number of fields in a structure we will treat in
6291a field sensitive manner during pointer analysis.
6292
6293@end table
6294@end table
6295
6296@node Preprocessor Options
6297@section Options Controlling the Preprocessor
6298@cindex preprocessor options
6299@cindex options, preprocessor
6300
6301These options control the C preprocessor, which is run on each C source
6302file before actual compilation.
6303
6304If you use the @option{-E} option, nothing is done except preprocessing.
6305Some of these options make sense only together with @option{-E} because
6306they cause the preprocessor output to be unsuitable for actual
6307compilation.
6308
6309@table @gcctabopt
6310@opindex Wp
6311You can use @option{-Wp,@var{option}} to bypass the compiler driver
6312and pass @var{option} directly through to the preprocessor.  If
6313@var{option} contains commas, it is split into multiple options at the
6314commas.  However, many options are modified, translated or interpreted
6315by the compiler driver before being passed to the preprocessor, and
6316@option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
6317interface is undocumented and subject to change, so whenever possible
6318you should avoid using @option{-Wp} and let the driver handle the
6319options instead.
6320
6321@item -Xpreprocessor @var{option}
6322@opindex preprocessor
6323Pass @var{option} as an option to the preprocessor.  You can use this to
6324supply system-specific preprocessor options which GCC does not know how to
6325recognize.
6326
6327If you want to pass an option that takes an argument, you must use
6328@option{-Xpreprocessor} twice, once for the option and once for the argument.
6329@end table
6330
6331@include cppopts.texi
6332
6333@node Assembler Options
6334@section Passing Options to the Assembler
6335
6336@c prevent bad page break with this line
6337You can pass options to the assembler.
6338
6339@table @gcctabopt
6340@item -Wa,@var{option}
6341@opindex Wa
6342Pass @var{option} as an option to the assembler.  If @var{option}
6343contains commas, it is split into multiple options at the commas.
6344
6345@item -Xassembler @var{option}
6346@opindex Xassembler
6347Pass @var{option} as an option to the assembler.  You can use this to
6348supply system-specific assembler options which GCC does not know how to
6349recognize.
6350
6351If you want to pass an option that takes an argument, you must use
6352@option{-Xassembler} twice, once for the option and once for the argument.
6353
6354@end table
6355
6356@node Link Options
6357@section Options for Linking
6358@cindex link options
6359@cindex options, linking
6360
6361These options come into play when the compiler links object files into
6362an executable output file.  They are meaningless if the compiler is
6363not doing a link step.
6364
6365@table @gcctabopt
6366@cindex file names
6367@item @var{object-file-name}
6368A file name that does not end in a special recognized suffix is
6369considered to name an object file or library.  (Object files are
6370distinguished from libraries by the linker according to the file
6371contents.)  If linking is done, these object files are used as input
6372to the linker.
6373
6374@item -c
6375@itemx -S
6376@itemx -E
6377@opindex c
6378@opindex S
6379@opindex E
6380If any of these options is used, then the linker is not run, and
6381object file names should not be used as arguments.  @xref{Overall
6382Options}.
6383
6384@cindex Libraries
6385@item -l@var{library}
6386@itemx -l @var{library}
6387@opindex l
6388Search the library named @var{library} when linking.  (The second
6389alternative with the library as a separate argument is only for
6390POSIX compliance and is not recommended.)
6391
6392It makes a difference where in the command you write this option; the
6393linker searches and processes libraries and object files in the order they
6394are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
6395after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
6396to functions in @samp{z}, those functions may not be loaded.
6397
6398The linker searches a standard list of directories for the library,
6399which is actually a file named @file{lib@var{library}.a}.  The linker
6400then uses this file as if it had been specified precisely by name.
6401
6402The directories searched include several standard system directories
6403plus any that you specify with @option{-L}.
6404
6405Normally the files found this way are library files---archive files
6406whose members are object files.  The linker handles an archive file by
6407scanning through it for members which define symbols that have so far
6408been referenced but not defined.  But if the file that is found is an
6409ordinary object file, it is linked in the usual fashion.  The only
6410difference between using an @option{-l} option and specifying a file name
6411is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
6412and searches several directories.
6413
6414@item -nostartfiles
6415@opindex nostartfiles
6416Do not use the standard system startup files when linking.
6417The standard system libraries are used normally, unless @option{-nostdlib}
6418or @option{-nodefaultlibs} is used.
6419
6420@item -nodefaultlibs
6421@opindex nodefaultlibs
6422Do not use the standard system libraries when linking.
6423Only the libraries you specify will be passed to the linker.
6424The standard startup files are used normally, unless @option{-nostartfiles}
6425is used.  The compiler may generate calls to @code{memcmp},
6426@code{memset}, @code{memcpy} and @code{memmove}.
6427These entries are usually resolved by entries in
6428libc.  These entry points should be supplied through some other
6429mechanism when this option is specified.
6430
6431@item -nostdlib
6432@opindex nostdlib
6433Do not use the standard system startup files or libraries when linking.
6434No startup files and only the libraries you specify will be passed to
6435the linker.  The compiler may generate calls to @code{memcmp}, @code{memset},
6436@code{memcpy} and @code{memmove}.
6437These entries are usually resolved by entries in
6438libc.  These entry points should be supplied through some other
6439mechanism when this option is specified.
6440
6441@cindex @option{-lgcc}, use with @option{-nostdlib}
6442@cindex @option{-nostdlib} and unresolved references
6443@cindex unresolved references and @option{-nostdlib}
6444@cindex @option{-lgcc}, use with @option{-nodefaultlibs}
6445@cindex @option{-nodefaultlibs} and unresolved references
6446@cindex unresolved references and @option{-nodefaultlibs}
6447One of the standard libraries bypassed by @option{-nostdlib} and
6448@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
6449that GCC uses to overcome shortcomings of particular machines, or special
6450needs for some languages.
6451(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
6452Collection (GCC) Internals},
6453for more discussion of @file{libgcc.a}.)
6454In most cases, you need @file{libgcc.a} even when you want to avoid
6455other standard libraries.  In other words, when you specify @option{-nostdlib}
6456or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
6457This ensures that you have no unresolved references to internal GCC
6458library subroutines.  (For example, @samp{__main}, used to ensure C++
6459constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
6460GNU Compiler Collection (GCC) Internals}.)
6461
6462@item -pie
6463@opindex pie
6464Produce a position independent executable on targets which support it.
6465For predictable results, you must also specify the same set of options
6466that were used to generate code (@option{-fpie}, @option{-fPIE},
6467or model suboptions) when you specify this option.
6468
6469@item -rdynamic
6470@opindex rdynamic
6471Pass the flag @option{-export-dynamic} to the ELF linker, on targets
6472that support it. This instructs the linker to add all symbols, not
6473only used ones, to the dynamic symbol table. This option is needed
6474for some uses of @code{dlopen} or to allow obtaining backtraces
6475from within a program.
6476
6477@item -s
6478@opindex s
6479Remove all symbol table and relocation information from the executable.
6480
6481@item -static
6482@opindex static
6483On systems that support dynamic linking, this prevents linking with the shared
6484libraries.  On other systems, this option has no effect.
6485
6486@item -shared
6487@opindex shared
6488Produce a shared object which can then be linked with other objects to
6489form an executable.  Not all systems support this option.  For predictable
6490results, you must also specify the same set of options that were used to
6491generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
6492when you specify this option.@footnote{On some systems, @samp{gcc -shared}
6493needs to build supplementary stub code for constructors to work.  On
6494multi-libbed systems, @samp{gcc -shared} must select the correct support
6495libraries to link against.  Failing to supply the correct flags may lead
6496to subtle defects.  Supplying them in cases where they are not necessary
6497is innocuous.}
6498
6499@item -shared-libgcc
6500@itemx -static-libgcc
6501@opindex shared-libgcc
6502@opindex static-libgcc
6503On systems that provide @file{libgcc} as a shared library, these options
6504force the use of either the shared or static version respectively.
6505If no shared version of @file{libgcc} was built when the compiler was
6506configured, these options have no effect.
6507
6508There are several situations in which an application should use the
6509shared @file{libgcc} instead of the static version.  The most common
6510of these is when the application wishes to throw and catch exceptions
6511across different shared libraries.  In that case, each of the libraries
6512as well as the application itself should use the shared @file{libgcc}.
6513
6514Therefore, the G++ and GCJ drivers automatically add
6515@option{-shared-libgcc} whenever you build a shared library or a main
6516executable, because C++ and Java programs typically use exceptions, so
6517this is the right thing to do.
6518
6519If, instead, you use the GCC driver to create shared libraries, you may
6520find that they will not always be linked with the shared @file{libgcc}.
6521If GCC finds, at its configuration time, that you have a non-GNU linker
6522or a GNU linker that does not support option @option{--eh-frame-hdr},
6523it will link the shared version of @file{libgcc} into shared libraries
6524by default.  Otherwise, it will take advantage of the linker and optimize
6525away the linking with the shared version of @file{libgcc}, linking with
6526the static version of libgcc by default.  This allows exceptions to
6527propagate through such shared libraries, without incurring relocation
6528costs at library load time.
6529
6530However, if a library or main executable is supposed to throw or catch
6531exceptions, you must link it using the G++ or GCJ driver, as appropriate
6532for the languages used in the program, or using the option
6533@option{-shared-libgcc}, such that it is linked with the shared
6534@file{libgcc}.
6535
6536@item -symbolic
6537@opindex symbolic
6538Bind references to global symbols when building a shared object.  Warn
6539about any unresolved references (unless overridden by the link editor
6540option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
6541this option.
6542
6543@item -Xlinker @var{option}
6544@opindex Xlinker
6545Pass @var{option} as an option to the linker.  You can use this to
6546supply system-specific linker options which GCC does not know how to
6547recognize.
6548
6549If you want to pass an option that takes an argument, you must use
6550@option{-Xlinker} twice, once for the option and once for the argument.
6551For example, to pass @option{-assert definitions}, you must write
6552@samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
6553@option{-Xlinker "-assert definitions"}, because this passes the entire
6554string as a single argument, which is not what the linker expects.
6555
6556@item -Wl,@var{option}
6557@opindex Wl
6558Pass @var{option} as an option to the linker.  If @var{option} contains
6559commas, it is split into multiple options at the commas.
6560
6561@item -u @var{symbol}
6562@opindex u
6563Pretend the symbol @var{symbol} is undefined, to force linking of
6564library modules to define it.  You can use @option{-u} multiple times with
6565different symbols to force loading of additional library modules.
6566@end table
6567
6568@node Directory Options
6569@section Options for Directory Search
6570@cindex directory options
6571@cindex options, directory search
6572@cindex search path
6573
6574These options specify directories to search for header files, for
6575libraries and for parts of the compiler:
6576
6577@table @gcctabopt
6578@item -I@var{dir}
6579@opindex I
6580Add the directory @var{dir} to the head of the list of directories to be
6581searched for header files.  This can be used to override a system header
6582file, substituting your own version, since these directories are
6583searched before the system header file directories.  However, you should
6584not use this option to add directories that contain vendor-supplied
6585system header files (use @option{-isystem} for that).  If you use more than
6586one @option{-I} option, the directories are scanned in left-to-right
6587order; the standard system directories come after.
6588
6589If a standard system include directory, or a directory specified with
6590@option{-isystem}, is also specified with @option{-I}, the @option{-I}
6591option will be ignored.  The directory will still be searched but as a
6592system directory at its normal position in the system include chain.
6593This is to ensure that GCC's procedure to fix buggy system headers and
6594the ordering for the include_next directive are not inadvertently changed.
6595If you really need to change the search order for system directories,
6596use the @option{-nostdinc} and/or @option{-isystem} options.
6597
6598@item -iquote@var{dir}
6599@opindex iquote
6600Add the directory @var{dir} to the head of the list of directories to
6601be searched for header files only for the case of @samp{#include
6602"@var{file}"}; they are not searched for @samp{#include <@var{file}>},
6603otherwise just like @option{-I}.
6604
6605@item -L@var{dir}
6606@opindex L
6607Add directory @var{dir} to the list of directories to be searched
6608for @option{-l}.
6609
6610@item -B@var{prefix}
6611@opindex B
6612This option specifies where to find the executables, libraries,
6613include files, and data files of the compiler itself.
6614
6615The compiler driver program runs one or more of the subprograms
6616@file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
6617@var{prefix} as a prefix for each program it tries to run, both with and
6618without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
6619
6620For each subprogram to be run, the compiler driver first tries the
6621@option{-B} prefix, if any.  If that name is not found, or if @option{-B}
6622was not specified, the driver tries two standard prefixes, which are
6623@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
6624those results in a file name that is found, the unmodified program
6625name is searched for using the directories specified in your
6626@env{PATH} environment variable.
6627
6628The compiler will check to see if the path provided by the @option{-B}
6629refers to a directory, and if necessary it will add a directory
6630separator character at the end of the path.
6631
6632@option{-B} prefixes that effectively specify directory names also apply
6633to libraries in the linker, because the compiler translates these
6634options into @option{-L} options for the linker.  They also apply to
6635includes files in the preprocessor, because the compiler translates these
6636options into @option{-isystem} options for the preprocessor.  In this case,
6637the compiler appends @samp{include} to the prefix.
6638
6639The run-time support file @file{libgcc.a} can also be searched for using
6640the @option{-B} prefix, if needed.  If it is not found there, the two
6641standard prefixes above are tried, and that is all.  The file is left
6642out of the link if it is not found by those means.
6643
6644Another way to specify a prefix much like the @option{-B} prefix is to use
6645the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
6646Variables}.
6647
6648As a special kludge, if the path provided by @option{-B} is
6649@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
66509, then it will be replaced by @file{[dir/]include}.  This is to help
6651with boot-strapping the compiler.
6652
6653@item -specs=@var{file}
6654@opindex specs
6655Process @var{file} after the compiler reads in the standard @file{specs}
6656file, in order to override the defaults that the @file{gcc} driver
6657program uses when determining what switches to pass to @file{cc1},
6658@file{cc1plus}, @file{as}, @file{ld}, etc.  More than one
6659@option{-specs=@var{file}} can be specified on the command line, and they
6660are processed in order, from left to right.
6661
6662@item --sysroot=@var{dir}
6663@opindex sysroot
6664Use @var{dir} as the logical root directory for headers and libraries.
6665For example, if the compiler would normally search for headers in
6666@file{/usr/include} and libraries in @file{/usr/lib}, it will instead
6667search @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.  
6668
6669If you use both this option and the @option{-isysroot} option, then
6670the @option{--sysroot} option will apply to libraries, but the
6671@option{-isysroot} option will apply to header files.
6672
6673The GNU linker (beginning with version 2.16) has the necessary support
6674for this option.  If your linker does not support this option, the
6675header file aspect of @option{--sysroot} will still work, but the
6676library aspect will not.
6677
6678@item -I-
6679@opindex I-
6680This option has been deprecated.  Please use @option{-iquote} instead for
6681@option{-I} directories before the @option{-I-} and remove the @option{-I-}.
6682Any directories you specify with @option{-I} options before the @option{-I-}
6683option are searched only for the case of @samp{#include "@var{file}"};
6684they are not searched for @samp{#include <@var{file}>}.
6685
6686If additional directories are specified with @option{-I} options after
6687the @option{-I-}, these directories are searched for all @samp{#include}
6688directives.  (Ordinarily @emph{all} @option{-I} directories are used
6689this way.)
6690
6691In addition, the @option{-I-} option inhibits the use of the current
6692directory (where the current input file came from) as the first search
6693directory for @samp{#include "@var{file}"}.  There is no way to
6694override this effect of @option{-I-}.  With @option{-I.} you can specify
6695searching the directory which was current when the compiler was
6696invoked.  That is not exactly the same as what the preprocessor does
6697by default, but it is often satisfactory.
6698
6699@option{-I-} does not inhibit the use of the standard system directories
6700for header files.  Thus, @option{-I-} and @option{-nostdinc} are
6701independent.
6702@end table
6703
6704@c man end
6705
6706@node Spec Files
6707@section Specifying subprocesses and the switches to pass to them
6708@cindex Spec Files
6709
6710@command{gcc} is a driver program.  It performs its job by invoking a
6711sequence of other programs to do the work of compiling, assembling and
6712linking.  GCC interprets its command-line parameters and uses these to
6713deduce which programs it should invoke, and which command-line options
6714it ought to place on their command lines.  This behavior is controlled
6715by @dfn{spec strings}.  In most cases there is one spec string for each
6716program that GCC can invoke, but a few programs have multiple spec
6717strings to control their behavior.  The spec strings built into GCC can
6718be overridden by using the @option{-specs=} command-line switch to specify
6719a spec file.
6720
6721@dfn{Spec files} are plaintext files that are used to construct spec
6722strings.  They consist of a sequence of directives separated by blank
6723lines.  The type of directive is determined by the first non-whitespace
6724character on the line and it can be one of the following:
6725
6726@table @code
6727@item %@var{command}
6728Issues a @var{command} to the spec file processor.  The commands that can
6729appear here are:
6730
6731@table @code
6732@item %include <@var{file}>
6733@cindex %include
6734Search for @var{file} and insert its text at the current point in the
6735specs file.
6736
6737@item %include_noerr <@var{file}>
6738@cindex %include_noerr
6739Just like @samp{%include}, but do not generate an error message if the include
6740file cannot be found.
6741
6742@item %rename @var{old_name} @var{new_name}
6743@cindex %rename
6744Rename the spec string @var{old_name} to @var{new_name}.
6745
6746@end table
6747
6748@item *[@var{spec_name}]:
6749This tells the compiler to create, override or delete the named spec
6750string.  All lines after this directive up to the next directive or
6751blank line are considered to be the text for the spec string.  If this
6752results in an empty string then the spec will be deleted.  (Or, if the
6753spec did not exist, then nothing will happened.)  Otherwise, if the spec
6754does not currently exist a new spec will be created.  If the spec does
6755exist then its contents will be overridden by the text of this
6756directive, unless the first character of that text is the @samp{+}
6757character, in which case the text will be appended to the spec.
6758
6759@item [@var{suffix}]:
6760Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
6761and up to the next directive or blank line are considered to make up the
6762spec string for the indicated suffix.  When the compiler encounters an
6763input file with the named suffix, it will processes the spec string in
6764order to work out how to compile that file.  For example:
6765
6766@smallexample
6767.ZZ:
6768z-compile -input %i
6769@end smallexample
6770
6771This says that any input file whose name ends in @samp{.ZZ} should be
6772passed to the program @samp{z-compile}, which should be invoked with the
6773command-line switch @option{-input} and with the result of performing the
6774@samp{%i} substitution.  (See below.)
6775
6776As an alternative to providing a spec string, the text that follows a
6777suffix directive can be one of the following:
6778
6779@table @code
6780@item @@@var{language}
6781This says that the suffix is an alias for a known @var{language}.  This is
6782similar to using the @option{-x} command-line switch to GCC to specify a
6783language explicitly.  For example:
6784
6785@smallexample
6786.ZZ:
6787@@c++
6788@end smallexample
6789
6790Says that .ZZ files are, in fact, C++ source files.
6791
6792@item #@var{name}
6793This causes an error messages saying:
6794
6795@smallexample
6796@var{name} compiler not installed on this system.
6797@end smallexample
6798@end table
6799
6800GCC already has an extensive list of suffixes built into it.
6801This directive will add an entry to the end of the list of suffixes, but
6802since the list is searched from the end backwards, it is effectively
6803possible to override earlier entries using this technique.
6804
6805@end table
6806
6807GCC has the following spec strings built into it.  Spec files can
6808override these strings or create their own.  Note that individual
6809targets can also add their own spec strings to this list.
6810
6811@smallexample
6812asm          Options to pass to the assembler
6813asm_final    Options to pass to the assembler post-processor
6814cpp          Options to pass to the C preprocessor
6815cc1          Options to pass to the C compiler
6816cc1plus      Options to pass to the C++ compiler
6817endfile      Object files to include at the end of the link
6818link         Options to pass to the linker
6819lib          Libraries to include on the command line to the linker
6820libgcc       Decides which GCC support library to pass to the linker
6821linker       Sets the name of the linker
6822predefines   Defines to be passed to the C preprocessor
6823signed_char  Defines to pass to CPP to say whether @code{char} is signed
6824             by default
6825startfile    Object files to include at the start of the link
6826@end smallexample
6827
6828Here is a small example of a spec file:
6829
6830@smallexample
6831%rename lib                 old_lib
6832
6833*lib:
6834--start-group -lgcc -lc -leval1 --end-group %(old_lib)
6835@end smallexample
6836
6837This example renames the spec called @samp{lib} to @samp{old_lib} and
6838then overrides the previous definition of @samp{lib} with a new one.
6839The new definition adds in some extra command-line options before
6840including the text of the old definition.
6841
6842@dfn{Spec strings} are a list of command-line options to be passed to their
6843corresponding program.  In addition, the spec strings can contain
6844@samp{%}-prefixed sequences to substitute variable text or to
6845conditionally insert text into the command line.  Using these constructs
6846it is possible to generate quite complex command lines.
6847
6848Here is a table of all defined @samp{%}-sequences for spec
6849strings.  Note that spaces are not generated automatically around the
6850results of expanding these sequences.  Therefore you can concatenate them
6851together or combine them with constant text in a single argument.
6852
6853@table @code
6854@item %%
6855Substitute one @samp{%} into the program name or argument.
6856
6857@item %i
6858Substitute the name of the input file being processed.
6859
6860@item %b
6861Substitute the basename of the input file being processed.
6862This is the substring up to (and not including) the last period
6863and not including the directory.
6864
6865@item %B
6866This is the same as @samp{%b}, but include the file suffix (text after
6867the last period).
6868
6869@item %d
6870Marks the argument containing or following the @samp{%d} as a
6871temporary file name, so that that file will be deleted if GCC exits
6872successfully.  Unlike @samp{%g}, this contributes no text to the
6873argument.
6874
6875@item %g@var{suffix}
6876Substitute a file name that has suffix @var{suffix} and is chosen
6877once per compilation, and mark the argument in the same way as
6878@samp{%d}.  To reduce exposure to denial-of-service attacks, the file
6879name is now chosen in a way that is hard to predict even when previously
6880chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
6881might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
6882the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
6883treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
6884was simply substituted with a file name chosen once per compilation,
6885without regard to any appended suffix (which was therefore treated
6886just like ordinary text), making such attacks more likely to succeed.
6887
6888@item %u@var{suffix}
6889Like @samp{%g}, but generates a new temporary file name even if
6890@samp{%u@var{suffix}} was already seen.
6891
6892@item %U@var{suffix}
6893Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
6894new one if there is no such last file name.  In the absence of any
6895@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
6896the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
6897would involve the generation of two distinct file names, one
6898for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
6899simply substituted with a file name chosen for the previous @samp{%u},
6900without regard to any appended suffix.
6901
6902@item %j@var{suffix}
6903Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
6904writable, and if save-temps is off; otherwise, substitute the name
6905of a temporary file, just like @samp{%u}.  This temporary file is not
6906meant for communication between processes, but rather as a junk
6907disposal mechanism.
6908
6909@item %|@var{suffix}
6910@itemx %m@var{suffix}
6911Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
6912@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
6913all.  These are the two most common ways to instruct a program that it
6914should read from standard input or write to standard output.  If you
6915need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
6916construct: see for example @file{f/lang-specs.h}.
6917
6918@item %.@var{SUFFIX}
6919Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
6920when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
6921terminated by the next space or %.
6922
6923@item %w
6924Marks the argument containing or following the @samp{%w} as the
6925designated output file of this compilation.  This puts the argument
6926into the sequence of arguments that @samp{%o} will substitute later.
6927
6928@item %o
6929Substitutes the names of all the output files, with spaces
6930automatically placed around them.  You should write spaces
6931around the @samp{%o} as well or the results are undefined.
6932@samp{%o} is for use in the specs for running the linker.
6933Input files whose names have no recognized suffix are not compiled
6934at all, but they are included among the output files, so they will
6935be linked.
6936
6937@item %O
6938Substitutes the suffix for object files.  Note that this is
6939handled specially when it immediately follows @samp{%g, %u, or %U},
6940because of the need for those to form complete file names.  The
6941handling is such that @samp{%O} is treated exactly as if it had already
6942been substituted, except that @samp{%g, %u, and %U} do not currently
6943support additional @var{suffix} characters following @samp{%O} as they would
6944following, for example, @samp{.o}.
6945
6946@item %p
6947Substitutes the standard macro predefinitions for the
6948current target machine.  Use this when running @code{cpp}.
6949
6950@item %P
6951Like @samp{%p}, but puts @samp{__} before and after the name of each
6952predefined macro, except for macros that start with @samp{__} or with
6953@samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
6954C@.
6955
6956@item %I
6957Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
6958@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
6959@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
6960and @option{-imultilib} as necessary.
6961
6962@item %s
6963Current argument is the name of a library or startup file of some sort.
6964Search for that file in a standard list of directories and substitute
6965the full name found.
6966
6967@item %e@var{str}
6968Print @var{str} as an error message.  @var{str} is terminated by a newline.
6969Use this when inconsistent options are detected.
6970
6971@item %(@var{name})
6972Substitute the contents of spec string @var{name} at this point.
6973
6974@item %[@var{name}]
6975Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
6976
6977@item %x@{@var{option}@}
6978Accumulate an option for @samp{%X}.
6979
6980@item %X
6981Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
6982spec string.
6983
6984@item %Y
6985Output the accumulated assembler options specified by @option{-Wa}.
6986
6987@item %Z
6988Output the accumulated preprocessor options specified by @option{-Wp}.
6989
6990@item %a
6991Process the @code{asm} spec.  This is used to compute the
6992switches to be passed to the assembler.
6993
6994@item %A
6995Process the @code{asm_final} spec.  This is a spec string for
6996passing switches to an assembler post-processor, if such a program is
6997needed.
6998
6999@item %l
7000Process the @code{link} spec.  This is the spec for computing the
7001command line passed to the linker.  Typically it will make use of the
7002@samp{%L %G %S %D and %E} sequences.
7003
7004@item %D
7005Dump out a @option{-L} option for each directory that GCC believes might
7006contain startup files.  If the target supports multilibs then the
7007current multilib directory will be prepended to each of these paths.
7008
7009@item %L
7010Process the @code{lib} spec.  This is a spec string for deciding which
7011libraries should be included on the command line to the linker.
7012
7013@item %G
7014Process the @code{libgcc} spec.  This is a spec string for deciding
7015which GCC support library should be included on the command line to the linker.
7016
7017@item %S
7018Process the @code{startfile} spec.  This is a spec for deciding which
7019object files should be the first ones passed to the linker.  Typically
7020this might be a file named @file{crt0.o}.
7021
7022@item %E
7023Process the @code{endfile} spec.  This is a spec string that specifies
7024the last object files that will be passed to the linker.
7025
7026@item %C
7027Process the @code{cpp} spec.  This is used to construct the arguments
7028to be passed to the C preprocessor.
7029
7030@item %1
7031Process the @code{cc1} spec.  This is used to construct the options to be
7032passed to the actual C compiler (@samp{cc1}).
7033
7034@item %2
7035Process the @code{cc1plus} spec.  This is used to construct the options to be
7036passed to the actual C++ compiler (@samp{cc1plus}).
7037
7038@item %*
7039Substitute the variable part of a matched option.  See below.
7040Note that each comma in the substituted string is replaced by
7041a single space.
7042
7043@item %<@code{S}
7044Remove all occurrences of @code{-S} from the command line.  Note---this
7045command is position dependent.  @samp{%} commands in the spec string
7046before this one will see @code{-S}, @samp{%} commands in the spec string
7047after this one will not.
7048
7049@item %:@var{function}(@var{args})
7050Call the named function @var{function}, passing it @var{args}.
7051@var{args} is first processed as a nested spec string, then split
7052into an argument vector in the usual fashion.  The function returns
7053a string which is processed as if it had appeared literally as part
7054of the current spec.
7055
7056The following built-in spec functions are provided:
7057
7058@table @code
7059@item @code{if-exists}
7060The @code{if-exists} spec function takes one argument, an absolute
7061pathname to a file.  If the file exists, @code{if-exists} returns the
7062pathname.  Here is a small example of its usage:
7063
7064@smallexample
7065*startfile:
7066crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
7067@end smallexample
7068
7069@item @code{if-exists-else}
7070The @code{if-exists-else} spec function is similar to the @code{if-exists}
7071spec function, except that it takes two arguments.  The first argument is
7072an absolute pathname to a file.  If the file exists, @code{if-exists-else}
7073returns the pathname.  If it does not exist, it returns the second argument.
7074This way, @code{if-exists-else} can be used to select one file or another,
7075based on the existence of the first.  Here is a small example of its usage:
7076
7077@smallexample
7078*startfile:
7079crt0%O%s %:if-exists(crti%O%s) \
7080%:if-exists-else(crtbeginT%O%s crtbegin%O%s)
7081@end smallexample
7082
7083@item @code{replace-outfile}
7084The @code{replace-outfile} spec function takes two arguments.  It looks for the
7085first argument in the outfiles array and replaces it with the second argument.  Here
7086is a small example of its usage:
7087
7088@smallexample
7089%@{static|static-libgcc|static-libstdc++:%:replace-outfile(-lstdc++ \
7090libstdc++.a%s)@}
7091
7092@end smallexample
7093
7094@end table
7095
7096@item %@{@code{S}@}
7097Substitutes the @code{-S} switch, if that switch was given to GCC@.
7098If that switch was not specified, this substitutes nothing.  Note that
7099the leading dash is omitted when specifying this option, and it is
7100automatically inserted if the substitution is performed.  Thus the spec
7101string @samp{%@{foo@}} would match the command-line option @option{-foo}
7102and would output the command line option @option{-foo}.
7103
7104@item %W@{@code{S}@}
7105Like %@{@code{S}@} but mark last argument supplied within as a file to be
7106deleted on failure.
7107
7108@item %@{@code{S}*@}
7109Substitutes all the switches specified to GCC whose names start
7110with @code{-S}, but which also take an argument.  This is used for
7111switches like @option{-o}, @option{-D}, @option{-I}, etc.
7112GCC considers @option{-o foo} as being
7113one switch whose names starts with @samp{o}.  %@{o*@} would substitute this
7114text, including the space.  Thus two arguments would be generated.
7115
7116@item %@{@code{S}*&@code{T}*@}
7117Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
7118(the order of @code{S} and @code{T} in the spec is not significant).
7119There can be any number of ampersand-separated variables; for each the
7120wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
7121
7122@item %@{@code{S}:@code{X}@}
7123Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
7124
7125@item %@{!@code{S}:@code{X}@}
7126Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
7127
7128@item %@{@code{S}*:@code{X}@}
7129Substitutes @code{X} if one or more switches whose names start with
7130@code{-S} are specified to GCC@.  Normally @code{X} is substituted only
7131once, no matter how many such switches appeared.  However, if @code{%*}
7132appears somewhere in @code{X}, then @code{X} will be substituted once
7133for each matching switch, with the @code{%*} replaced by the part of
7134that switch that matched the @code{*}.
7135
7136@item %@{.@code{S}:@code{X}@}
7137Substitutes @code{X}, if processing a file with suffix @code{S}.
7138
7139@item %@{!.@code{S}:@code{X}@}
7140Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
7141
7142@item %@{@code{S}|@code{P}:@code{X}@}
7143Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@.
7144This may be combined with @samp{!}, @samp{.}, and @code{*} sequences as well,
7145although they have a stronger binding than the @samp{|}.  If @code{%*}
7146appears in @code{X}, all of the alternatives must be starred, and only
7147the first matching alternative is substituted.
7148
7149For example, a spec string like this:
7150
7151@smallexample
7152%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
7153@end smallexample
7154
7155will output the following command-line options from the following input
7156command-line options:
7157
7158@smallexample
7159fred.c        -foo -baz
7160jim.d         -bar -boggle
7161-d fred.c     -foo -baz -boggle
7162-d jim.d      -bar -baz -boggle
7163@end smallexample
7164
7165@item %@{S:X; T:Y; :D@}
7166
7167If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
7168given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
7169be as many clauses as you need.  This may be combined with @code{.},
7170@code{!}, @code{|}, and @code{*} as needed.
7171
7172
7173@end table
7174
7175The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
7176construct may contain other nested @samp{%} constructs or spaces, or
7177even newlines.  They are processed as usual, as described above.
7178Trailing white space in @code{X} is ignored.  White space may also
7179appear anywhere on the left side of the colon in these constructs,
7180except between @code{.} or @code{*} and the corresponding word.
7181
7182The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
7183handled specifically in these constructs.  If another value of
7184@option{-O} or the negated form of a @option{-f}, @option{-m}, or
7185@option{-W} switch is found later in the command line, the earlier
7186switch value is ignored, except with @{@code{S}*@} where @code{S} is
7187just one letter, which passes all matching options.
7188
7189The character @samp{|} at the beginning of the predicate text is used to
7190indicate that a command should be piped to the following command, but
7191only if @option{-pipe} is specified.
7192
7193It is built into GCC which switches take arguments and which do not.
7194(You might think it would be useful to generalize this to allow each
7195compiler's spec to say which switches take arguments.  But this cannot
7196be done in a consistent fashion.  GCC cannot even decide which input
7197files have been specified without knowing which switches take arguments,
7198and it must know which input files to compile in order to tell which
7199compilers to run).
7200
7201GCC also knows implicitly that arguments starting in @option{-l} are to be
7202treated as compiler output files, and passed to the linker in their
7203proper position among the other output files.
7204
7205@c man begin OPTIONS
7206
7207@node Target Options
7208@section Specifying Target Machine and Compiler Version
7209@cindex target options
7210@cindex cross compiling
7211@cindex specifying machine version
7212@cindex specifying compiler version and target machine
7213@cindex compiler version, specifying
7214@cindex target machine, specifying
7215
7216The usual way to run GCC is to run the executable called @file{gcc}, or
7217@file{<machine>-gcc} when cross-compiling, or
7218@file{<machine>-gcc-<version>} to run a version other than the one that
7219was installed last.  Sometimes this is inconvenient, so GCC provides
7220options that will switch to another cross-compiler or version.
7221
7222@table @gcctabopt
7223@item -b @var{machine}
7224@opindex b
7225The argument @var{machine} specifies the target machine for compilation.
7226
7227The value to use for @var{machine} is the same as was specified as the
7228machine type when configuring GCC as a cross-compiler.  For
7229example, if a cross-compiler was configured with @samp{configure
7230arm-elf}, meaning to compile for an arm processor with elf binaries,
7231then you would specify @option{-b arm-elf} to run that cross compiler.
7232Because there are other options beginning with @option{-b}, the
7233configuration must contain a hyphen. 
7234
7235@item -V @var{version}
7236@opindex V
7237The argument @var{version} specifies which version of GCC to run.
7238This is useful when multiple versions are installed.  For example,
7239@var{version} might be @samp{4.0}, meaning to run GCC version 4.0.
7240@end table
7241
7242The @option{-V} and @option{-b} options work by running the
7243@file{<machine>-gcc-<version>} executable, so there's no real reason to
7244use them if you can just run that directly.
7245
7246@node Submodel Options
7247@section Hardware Models and Configurations
7248@cindex submodel options
7249@cindex specifying hardware config
7250@cindex hardware models and configurations, specifying
7251@cindex machine dependent options
7252
7253Earlier we discussed the standard option @option{-b} which chooses among
7254different installed compilers for completely different target
7255machines, such as VAX vs.@: 68000 vs.@: 80386.
7256
7257In addition, each of these target machine types can have its own
7258special options, starting with @samp{-m}, to choose among various
7259hardware models or configurations---for example, 68010 vs 68020,
7260floating coprocessor or none.  A single installed version of the
7261compiler can compile for any model or configuration, according to the
7262options specified.
7263
7264Some configurations of the compiler also support additional special
7265options, usually for compatibility with other compilers on the same
7266platform.
7267
7268@c This list is ordered alphanumerically by subsection name.
7269@c It should be the same order and spelling as these options are listed
7270@c in Machine Dependent Options
7271
7272@menu
7273* ARC Options::
7274* ARM Options::
7275* AVR Options::
7276* Blackfin Options::
7277* CRIS Options::
7278* CRX Options::
7279* Darwin Options::
7280* DEC Alpha Options::
7281* DEC Alpha/VMS Options::
7282* FRV Options::
7283* GNU/Linux Options::
7284* H8/300 Options::
7285* HPPA Options::
7286* i386 and x86-64 Options::
7287* IA-64 Options::
7288* M32C Options::
7289* M32R/D Options::
7290* M680x0 Options::
7291* M68hc1x Options::
7292* MCore Options::
7293* MIPS Options::
7294* MMIX Options::
7295* MN10300 Options::
7296* MT Options::
7297* PDP-11 Options::
7298* PowerPC Options::
7299* RS/6000 and PowerPC Options::
7300* S/390 and zSeries Options::
7301* Score Options::
7302* SH Options::
7303* SPARC Options::
7304* System V Options::
7305* TMS320C3x/C4x Options::
7306* V850 Options::
7307* VAX Options::
7308* x86-64 Options::
7309* Xstormy16 Options::
7310* Xtensa Options::
7311* zSeries Options::
7312@end menu
7313
7314@node ARC Options
7315@subsection ARC Options
7316@cindex ARC Options
7317
7318These options are defined for ARC implementations:
7319
7320@table @gcctabopt
7321@item -EL
7322@opindex EL
7323Compile code for little endian mode.  This is the default.
7324
7325@item -EB
7326@opindex EB
7327Compile code for big endian mode.
7328
7329@item -mmangle-cpu
7330@opindex mmangle-cpu
7331Prepend the name of the cpu to all public symbol names.
7332In multiple-processor systems, there are many ARC variants with different
7333instruction and register set characteristics.  This flag prevents code
7334compiled for one cpu to be linked with code compiled for another.
7335No facility exists for handling variants that are ``almost identical''.
7336This is an all or nothing option.
7337
7338@item -mcpu=@var{cpu}
7339@opindex mcpu
7340Compile code for ARC variant @var{cpu}.
7341Which variants are supported depend on the configuration.
7342All variants support @option{-mcpu=base}, this is the default.
7343
7344@item -mtext=@var{text-section}
7345@itemx -mdata=@var{data-section}
7346@itemx -mrodata=@var{readonly-data-section}
7347@opindex mtext
7348@opindex mdata
7349@opindex mrodata
7350Put functions, data, and readonly data in @var{text-section},
7351@var{data-section}, and @var{readonly-data-section} respectively
7352by default.  This can be overridden with the @code{section} attribute.
7353@xref{Variable Attributes}.
7354
7355@end table
7356
7357@node ARM Options
7358@subsection ARM Options
7359@cindex ARM options
7360
7361These @samp{-m} options are defined for Advanced RISC Machines (ARM)
7362architectures:
7363
7364@table @gcctabopt
7365@item -mabi=@var{name}
7366@opindex mabi
7367Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
7368@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
7369
7370@item -mapcs-frame
7371@opindex mapcs-frame
7372Generate a stack frame that is compliant with the ARM Procedure Call
7373Standard for all functions, even if this is not strictly necessary for
7374correct execution of the code.  Specifying @option{-fomit-frame-pointer}
7375with this option will cause the stack frames not to be generated for
7376leaf functions.  The default is @option{-mno-apcs-frame}.
7377
7378@item -mapcs
7379@opindex mapcs
7380This is a synonym for @option{-mapcs-frame}.
7381
7382@ignore
7383@c not currently implemented
7384@item -mapcs-stack-check
7385@opindex mapcs-stack-check
7386Generate code to check the amount of stack space available upon entry to
7387every function (that actually uses some stack space).  If there is
7388insufficient space available then either the function
7389@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
7390called, depending upon the amount of stack space required.  The run time
7391system is required to provide these functions.  The default is
7392@option{-mno-apcs-stack-check}, since this produces smaller code.
7393
7394@c not currently implemented
7395@item -mapcs-float
7396@opindex mapcs-float
7397Pass floating point arguments using the float point registers.  This is
7398one of the variants of the APCS@.  This option is recommended if the
7399target hardware has a floating point unit or if a lot of floating point
7400arithmetic is going to be performed by the code.  The default is
7401@option{-mno-apcs-float}, since integer only code is slightly increased in
7402size if @option{-mapcs-float} is used.
7403
7404@c not currently implemented
7405@item -mapcs-reentrant
7406@opindex mapcs-reentrant
7407Generate reentrant, position independent code.  The default is
7408@option{-mno-apcs-reentrant}.
7409@end ignore
7410
7411@item -mthumb-interwork
7412@opindex mthumb-interwork
7413Generate code which supports calling between the ARM and Thumb
7414instruction sets.  Without this option the two instruction sets cannot
7415be reliably used inside one program.  The default is
7416@option{-mno-thumb-interwork}, since slightly larger code is generated
7417when @option{-mthumb-interwork} is specified.
7418
7419@item -mno-sched-prolog
7420@opindex mno-sched-prolog
7421Prevent the reordering of instructions in the function prolog, or the
7422merging of those instruction with the instructions in the function's
7423body.  This means that all functions will start with a recognizable set
7424of instructions (or in fact one of a choice from a small set of
7425different function prologues), and this information can be used to
7426locate the start if functions inside an executable piece of code.  The
7427default is @option{-msched-prolog}.
7428
7429@item -mhard-float
7430@opindex mhard-float
7431Generate output containing floating point instructions.  This is the
7432default.
7433
7434@item -msoft-float
7435@opindex msoft-float
7436Generate output containing library calls for floating point.
7437@strong{Warning:} the requisite libraries are not available for all ARM
7438targets.  Normally the facilities of the machine's usual C compiler are
7439used, but this cannot be done directly in cross-compilation.  You must make
7440your own arrangements to provide suitable library functions for
7441cross-compilation.
7442
7443@option{-msoft-float} changes the calling convention in the output file;
7444therefore, it is only useful if you compile @emph{all} of a program with
7445this option.  In particular, you need to compile @file{libgcc.a}, the
7446library that comes with GCC, with @option{-msoft-float} in order for
7447this to work.
7448
7449@item -mfloat-abi=@var{name}
7450@opindex mfloat-abi
7451Specifies which ABI to use for floating point values.  Permissible values
7452are: @samp{soft}, @samp{softfp} and @samp{hard}.
7453
7454@samp{soft} and @samp{hard} are equivalent to @option{-msoft-float}
7455and @option{-mhard-float} respectively.  @samp{softfp} allows the generation
7456of floating point instructions, but still uses the soft-float calling
7457conventions.
7458
7459@item -mlittle-endian
7460@opindex mlittle-endian
7461Generate code for a processor running in little-endian mode.  This is
7462the default for all standard configurations.
7463
7464@item -mbig-endian
7465@opindex mbig-endian
7466Generate code for a processor running in big-endian mode; the default is
7467to compile code for a little-endian processor.
7468
7469@item -mwords-little-endian
7470@opindex mwords-little-endian
7471This option only applies when generating code for big-endian processors.
7472Generate code for a little-endian word order but a big-endian byte
7473order.  That is, a byte order of the form @samp{32107654}.  Note: this
7474option should only be used if you require compatibility with code for
7475big-endian ARM processors generated by versions of the compiler prior to
74762.8.
7477
7478@item -mcpu=@var{name}
7479@opindex mcpu
7480This specifies the name of the target ARM processor.  GCC uses this name
7481to determine what kind of instructions it can emit when generating
7482assembly code.  Permissible names are: @samp{arm2}, @samp{arm250},
7483@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
7484@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
7485@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
7486@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
7487@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
7488@samp{arm8}, @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
7489@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
7490@samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
7491@samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
7492@samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
7493@samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
7494@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
7495@samp{arm1176jz-s}, @samp{arm1176jzf-s}, @samp{xscale}, @samp{iwmmxt},
7496@samp{ep9312}.
7497
7498@itemx -mtune=@var{name}
7499@opindex mtune
7500This option is very similar to the @option{-mcpu=} option, except that
7501instead of specifying the actual target processor type, and hence
7502restricting which instructions can be used, it specifies that GCC should
7503tune the performance of the code as if the target were of the type
7504specified in this option, but still choosing the instructions that it
7505will generate based on the cpu specified by a @option{-mcpu=} option.
7506For some ARM implementations better performance can be obtained by using
7507this option.
7508
7509@item -march=@var{name}
7510@opindex march
7511This specifies the name of the target ARM architecture.  GCC uses this
7512name to determine what kind of instructions it can emit when generating
7513assembly code.  This option can be used in conjunction with or instead
7514of the @option{-mcpu=} option.  Permissible names are: @samp{armv2},
7515@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
7516@samp{armv5}, @samp{armv5t}, @samp{armv5te}, @samp{armv6}, @samp{armv6j},
7517@samp{iwmmxt}, @samp{ep9312}.
7518
7519@item -mfpu=@var{name}
7520@itemx -mfpe=@var{number}
7521@itemx -mfp=@var{number}
7522@opindex mfpu
7523@opindex mfpe
7524@opindex mfp
7525This specifies what floating point hardware (or hardware emulation) is
7526available on the target.  Permissible names are: @samp{fpa}, @samp{fpe2},
7527@samp{fpe3}, @samp{maverick}, @samp{vfp}.  @option{-mfp} and @option{-mfpe}
7528are synonyms for @option{-mfpu}=@samp{fpe}@var{number}, for compatibility
7529with older versions of GCC@.
7530
7531If @option{-msoft-float} is specified this specifies the format of
7532floating point values.
7533
7534@item -mstructure-size-boundary=@var{n}
7535@opindex mstructure-size-boundary
7536The size of all structures and unions will be rounded up to a multiple
7537of the number of bits set by this option.  Permissible values are 8, 32
7538and 64.  The default value varies for different toolchains.  For the COFF
7539targeted toolchain the default value is 8.  A value of 64 is only allowed
7540if the underlying ABI supports it.
7541
7542Specifying the larger number can produce faster, more efficient code, but
7543can also increase the size of the program.  Different values are potentially
7544incompatible.  Code compiled with one value cannot necessarily expect to
7545work with code or libraries compiled with another value, if they exchange
7546information using structures or unions.
7547
7548@item -mabort-on-noreturn
7549@opindex mabort-on-noreturn
7550Generate a call to the function @code{abort} at the end of a
7551@code{noreturn} function.  It will be executed if the function tries to
7552return.
7553
7554@item -mlong-calls
7555@itemx -mno-long-calls
7556@opindex mlong-calls
7557@opindex mno-long-calls
7558Tells the compiler to perform function calls by first loading the
7559address of the function into a register and then performing a subroutine
7560call on this register.  This switch is needed if the target function
7561will lie outside of the 64 megabyte addressing range of the offset based
7562version of subroutine call instruction.
7563
7564Even if this switch is enabled, not all function calls will be turned
7565into long calls.  The heuristic is that static functions, functions
7566which have the @samp{short-call} attribute, functions that are inside
7567the scope of a @samp{#pragma no_long_calls} directive and functions whose
7568definitions have already been compiled within the current compilation
7569unit, will not be turned into long calls.  The exception to this rule is
7570that weak function definitions, functions with the @samp{long-call}
7571attribute or the @samp{section} attribute, and functions that are within
7572the scope of a @samp{#pragma long_calls} directive, will always be
7573turned into long calls.
7574
7575This feature is not enabled by default.  Specifying
7576@option{-mno-long-calls} will restore the default behavior, as will
7577placing the function calls within the scope of a @samp{#pragma
7578long_calls_off} directive.  Note these switches have no effect on how
7579the compiler generates code to handle function calls via function
7580pointers.
7581
7582@item -mnop-fun-dllimport
7583@opindex mnop-fun-dllimport
7584Disable support for the @code{dllimport} attribute.
7585
7586@item -msingle-pic-base
7587@opindex msingle-pic-base
7588Treat the register used for PIC addressing as read-only, rather than
7589loading it in the prologue for each function.  The run-time system is
7590responsible for initializing this register with an appropriate value
7591before execution begins.
7592
7593@item -mpic-register=@var{reg}
7594@opindex mpic-register
7595Specify the register to be used for PIC addressing.  The default is R10
7596unless stack-checking is enabled, when R9 is used.
7597
7598@item -mcirrus-fix-invalid-insns
7599@opindex mcirrus-fix-invalid-insns
7600@opindex mno-cirrus-fix-invalid-insns
7601Insert NOPs into the instruction stream to in order to work around
7602problems with invalid Maverick instruction combinations.  This option
7603is only valid if the @option{-mcpu=ep9312} option has been used to
7604enable generation of instructions for the Cirrus Maverick floating
7605point co-processor.  This option is not enabled by default, since the
7606problem is only present in older Maverick implementations.  The default
7607can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
7608switch.
7609
7610@item -mpoke-function-name
7611@opindex mpoke-function-name
7612Write the name of each function into the text section, directly
7613preceding the function prologue.  The generated code is similar to this:
7614
7615@smallexample
7616     t0
7617         .ascii "arm_poke_function_name", 0
7618         .align
7619     t1
7620         .word 0xff000000 + (t1 - t0)
7621     arm_poke_function_name
7622         mov     ip, sp
7623         stmfd   sp!, @{fp, ip, lr, pc@}
7624         sub     fp, ip, #4
7625@end smallexample
7626
7627When performing a stack backtrace, code can inspect the value of
7628@code{pc} stored at @code{fp + 0}.  If the trace function then looks at
7629location @code{pc - 12} and the top 8 bits are set, then we know that
7630there is a function name embedded immediately preceding this location
7631and has length @code{((pc[-3]) & 0xff000000)}.
7632
7633@item -mthumb
7634@opindex mthumb
7635Generate code for the 16-bit Thumb instruction set.  The default is to
7636use the 32-bit ARM instruction set.
7637
7638@item -mtpcs-frame
7639@opindex mtpcs-frame
7640Generate a stack frame that is compliant with the Thumb Procedure Call
7641Standard for all non-leaf functions.  (A leaf function is one that does
7642not call any other functions.)  The default is @option{-mno-tpcs-frame}.
7643
7644@item -mtpcs-leaf-frame
7645@opindex mtpcs-leaf-frame
7646Generate a stack frame that is compliant with the Thumb Procedure Call
7647Standard for all leaf functions.  (A leaf function is one that does
7648not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
7649
7650@item -mcallee-super-interworking
7651@opindex mcallee-super-interworking
7652Gives all externally visible functions in the file being compiled an ARM
7653instruction set header which switches to Thumb mode before executing the
7654rest of the function.  This allows these functions to be called from
7655non-interworking code.
7656
7657@item -mcaller-super-interworking
7658@opindex mcaller-super-interworking
7659Allows calls via function pointers (including virtual functions) to
7660execute correctly regardless of whether the target code has been
7661compiled for interworking or not.  There is a small overhead in the cost
7662of executing a function pointer if this option is enabled.
7663
7664@item -mtp=@var{name}
7665@opindex mtp
7666Specify the access model for the thread local storage pointer.  The valid
7667models are @option{soft}, which generates calls to @code{__aeabi_read_tp},
7668@option{cp15}, which fetches the thread pointer from @code{cp15} directly
7669(supported in the arm6k architecture), and @option{auto}, which uses the
7670best available method for the selected processor.  The default setting is
7671@option{auto}.
7672
7673@end table
7674
7675@node AVR Options
7676@subsection AVR Options
7677@cindex AVR Options
7678
7679These options are defined for AVR implementations:
7680
7681@table @gcctabopt
7682@item -mmcu=@var{mcu}
7683@opindex mmcu
7684Specify ATMEL AVR instruction set or MCU type.
7685
7686Instruction set avr1 is for the minimal AVR core, not supported by the C
7687compiler, only for assembler programs (MCU types: at90s1200, attiny10,
7688attiny11, attiny12, attiny15, attiny28).
7689
7690Instruction set avr2 (default) is for the classic AVR core with up to
76918K program memory space (MCU types: at90s2313, at90s2323, attiny22,
7692at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
7693at90c8534, at90s8535).
7694
7695Instruction set avr3 is for the classic AVR core with up to 128K program
7696memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
7697
7698Instruction set avr4 is for the enhanced AVR core with up to 8K program
7699memory space (MCU types: atmega8, atmega83, atmega85).
7700
7701Instruction set avr5 is for the enhanced AVR core with up to 128K program
7702memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
7703atmega64, atmega128, at43usb355, at94k).
7704
7705@item -msize
7706@opindex msize
7707Output instruction sizes to the asm file.
7708
7709@item -minit-stack=@var{N}
7710@opindex minit-stack
7711Specify the initial stack address, which may be a symbol or numeric value,
7712@samp{__stack} is the default.
7713
7714@item -mno-interrupts
7715@opindex mno-interrupts
7716Generated code is not compatible with hardware interrupts.
7717Code size will be smaller.
7718
7719@item -mcall-prologues
7720@opindex mcall-prologues
7721Functions prologues/epilogues expanded as call to appropriate
7722subroutines.  Code size will be smaller.
7723
7724@item -mno-tablejump
7725@opindex mno-tablejump
7726Do not generate tablejump insns which sometimes increase code size.
7727
7728@item -mtiny-stack
7729@opindex mtiny-stack
7730Change only the low 8 bits of the stack pointer.
7731
7732@item -mint8
7733@opindex mint8
7734Assume int to be 8 bit integer.  This affects the sizes of all types: A
7735char will be 1 byte, an int will be 1 byte, an long will be 2 bytes
7736and long long will be 4 bytes.  Please note that this option does not
7737comply to the C standards, but it will provide you with smaller code
7738size.
7739@end table
7740
7741@node Blackfin Options
7742@subsection Blackfin Options
7743@cindex Blackfin Options
7744
7745@table @gcctabopt
7746@item -momit-leaf-frame-pointer
7747@opindex momit-leaf-frame-pointer
7748Don't keep the frame pointer in a register for leaf functions.  This
7749avoids the instructions to save, set up and restore frame pointers and
7750makes an extra register available in leaf functions.  The option
7751@option{-fomit-frame-pointer} removes the frame pointer for all functions
7752which might make debugging harder.
7753
7754@item -mspecld-anomaly
7755@opindex mspecld-anomaly
7756When enabled, the compiler will ensure that the generated code does not
7757contain speculative loads after jump instructions.  This option is enabled
7758by default.
7759
7760@item -mno-specld-anomaly
7761@opindex mno-specld-anomaly
7762Don't generate extra code to prevent speculative loads from occurring.
7763
7764@item -mcsync-anomaly
7765@opindex mcsync-anomaly
7766When enabled, the compiler will ensure that the generated code does not
7767contain CSYNC or SSYNC instructions too soon after conditional branches.
7768This option is enabled by default.
7769
7770@item -mno-csync-anomaly
7771@opindex mno-csync-anomaly
7772Don't generate extra code to prevent CSYNC or SSYNC instructions from
7773occurring too soon after a conditional branch.
7774
7775@item -mlow-64k
7776@opindex mlow-64k
7777When enabled, the compiler is free to take advantage of the knowledge that
7778the entire program fits into the low 64k of memory.
7779
7780@item -mno-low-64k
7781@opindex mno-low-64k
7782Assume that the program is arbitrarily large.  This is the default.
7783
7784@item -mid-shared-library
7785@opindex mid-shared-library
7786Generate code that supports shared libraries via the library ID method.
7787This allows for execute in place and shared libraries in an environment
7788without virtual memory management.  This option implies @option{-fPIC}.
7789
7790@item -mno-id-shared-library
7791@opindex mno-id-shared-library
7792Generate code that doesn't assume ID based shared libraries are being used.
7793This is the default.
7794
7795@item -mshared-library-id=n
7796@opindex mshared-library-id
7797Specified the identification number of the ID based shared library being
7798compiled.  Specifying a value of 0 will generate more compact code, specifying
7799other values will force the allocation of that number to the current
7800library but is no more space or time efficient than omitting this option.
7801
7802@item -mlong-calls
7803@itemx -mno-long-calls
7804@opindex mlong-calls
7805@opindex mno-long-calls
7806Tells the compiler to perform function calls by first loading the
7807address of the function into a register and then performing a subroutine
7808call on this register.  This switch is needed if the target function
7809will lie outside of the 24 bit addressing range of the offset based
7810version of subroutine call instruction.
7811
7812This feature is not enabled by default.  Specifying
7813@option{-mno-long-calls} will restore the default behavior.  Note these
7814switches have no effect on how the compiler generates code to handle
7815function calls via function pointers.
7816@end table
7817
7818@node CRIS Options
7819@subsection CRIS Options
7820@cindex CRIS Options
7821
7822These options are defined specifically for the CRIS ports.
7823
7824@table @gcctabopt
7825@item -march=@var{architecture-type}
7826@itemx -mcpu=@var{architecture-type}
7827@opindex march
7828@opindex mcpu
7829Generate code for the specified architecture.  The choices for
7830@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
7831respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
7832Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
7833@samp{v10}.
7834
7835@item -mtune=@var{architecture-type}
7836@opindex mtune
7837Tune to @var{architecture-type} everything applicable about the generated
7838code, except for the ABI and the set of available instructions.  The
7839choices for @var{architecture-type} are the same as for
7840@option{-march=@var{architecture-type}}.
7841
7842@item -mmax-stack-frame=@var{n}
7843@opindex mmax-stack-frame
7844Warn when the stack frame of a function exceeds @var{n} bytes.
7845
7846@item -melinux-stacksize=@var{n}
7847@opindex melinux-stacksize
7848Only available with the @samp{cris-axis-aout} target.  Arranges for
7849indications in the program to the kernel loader that the stack of the
7850program should be set to @var{n} bytes.
7851
7852@item -metrax4
7853@itemx -metrax100
7854@opindex metrax4
7855@opindex metrax100
7856The options @option{-metrax4} and @option{-metrax100} are synonyms for
7857@option{-march=v3} and @option{-march=v8} respectively.
7858
7859@item -mmul-bug-workaround
7860@itemx -mno-mul-bug-workaround
7861@opindex mmul-bug-workaround
7862@opindex mno-mul-bug-workaround
7863Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
7864models where it applies.  This option is active by default.
7865
7866@item -mpdebug
7867@opindex mpdebug
7868Enable CRIS-specific verbose debug-related information in the assembly
7869code.  This option also has the effect to turn off the @samp{#NO_APP}
7870formatted-code indicator to the assembler at the beginning of the
7871assembly file.
7872
7873@item -mcc-init
7874@opindex mcc-init
7875Do not use condition-code results from previous instruction; always emit
7876compare and test instructions before use of condition codes.
7877
7878@item -mno-side-effects
7879@opindex mno-side-effects
7880Do not emit instructions with side-effects in addressing modes other than
7881post-increment.
7882
7883@item -mstack-align
7884@itemx -mno-stack-align
7885@itemx -mdata-align
7886@itemx -mno-data-align
7887@itemx -mconst-align
7888@itemx -mno-const-align
7889@opindex mstack-align
7890@opindex mno-stack-align
7891@opindex mdata-align
7892@opindex mno-data-align
7893@opindex mconst-align
7894@opindex mno-const-align
7895These options (no-options) arranges (eliminate arrangements) for the
7896stack-frame, individual data and constants to be aligned for the maximum
7897single data access size for the chosen CPU model.  The default is to
7898arrange for 32-bit alignment.  ABI details such as structure layout are
7899not affected by these options.
7900
7901@item -m32-bit
7902@itemx -m16-bit
7903@itemx -m8-bit
7904@opindex m32-bit
7905@opindex m16-bit
7906@opindex m8-bit
7907Similar to the stack- data- and const-align options above, these options
7908arrange for stack-frame, writable data and constants to all be 32-bit,
790916-bit or 8-bit aligned.  The default is 32-bit alignment.
7910
7911@item -mno-prologue-epilogue
7912@itemx -mprologue-epilogue
7913@opindex mno-prologue-epilogue
7914@opindex mprologue-epilogue
7915With @option{-mno-prologue-epilogue}, the normal function prologue and
7916epilogue that sets up the stack-frame are omitted and no return
7917instructions or return sequences are generated in the code.  Use this
7918option only together with visual inspection of the compiled code: no
7919warnings or errors are generated when call-saved registers must be saved,
7920or storage for local variable needs to be allocated.
7921
7922@item -mno-gotplt
7923@itemx -mgotplt
7924@opindex mno-gotplt
7925@opindex mgotplt
7926With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
7927instruction sequences that load addresses for functions from the PLT part
7928of the GOT rather than (traditional on other architectures) calls to the
7929PLT@.  The default is @option{-mgotplt}.
7930
7931@item -maout
7932@opindex maout
7933Legacy no-op option only recognized with the cris-axis-aout target.
7934
7935@item -melf
7936@opindex melf
7937Legacy no-op option only recognized with the cris-axis-elf and
7938cris-axis-linux-gnu targets.
7939
7940@item -melinux
7941@opindex melinux
7942Only recognized with the cris-axis-aout target, where it selects a
7943GNU/linux-like multilib, include files and instruction set for
7944@option{-march=v8}.
7945
7946@item -mlinux
7947@opindex mlinux
7948Legacy no-op option only recognized with the cris-axis-linux-gnu target.
7949
7950@item -sim
7951@opindex sim
7952This option, recognized for the cris-axis-aout and cris-axis-elf arranges
7953to link with input-output functions from a simulator library.  Code,
7954initialized data and zero-initialized data are allocated consecutively.
7955
7956@item -sim2
7957@opindex sim2
7958Like @option{-sim}, but pass linker options to locate initialized data at
79590x40000000 and zero-initialized data at 0x80000000.
7960@end table
7961
7962@node CRX Options
7963@subsection CRX Options
7964@cindex CRX Options
7965
7966These options are defined specifically for the CRX ports.
7967
7968@table @gcctabopt
7969
7970@item -mmac
7971@opindex mmac
7972Enable the use of multiply-accumulate instructions. Disabled by default.
7973
7974@item -mpush-args
7975@opindex mpush-args
7976Push instructions will be used to pass outgoing arguments when functions
7977are called. Enabled by default.
7978@end table
7979
7980@node Darwin Options
7981@subsection Darwin Options
7982@cindex Darwin options
7983
7984These options are defined for all architectures running the Darwin operating
7985system.
7986
7987FSF GCC on Darwin does not create ``fat'' object files; it will create
7988an object file for the single architecture that it was built to
7989target.  Apple's GCC on Darwin does create ``fat'' files if multiple
7990@option{-arch} options are used; it does so by running the compiler or
7991linker multiple times and joining the results together with
7992@file{lipo}.
7993
7994The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
7995@samp{i686}) is determined by the flags that specify the ISA
7996that GCC is targetting, like @option{-mcpu} or @option{-march}.  The
7997@option{-force_cpusubtype_ALL} option can be used to override this.
7998
7999The Darwin tools vary in their behavior when presented with an ISA
8000mismatch.  The assembler, @file{as}, will only permit instructions to
8001be used that are valid for the subtype of the file it is generating,
8002so you cannot put 64-bit instructions in an @samp{ppc750} object file.
8003The linker for shared libraries, @file{/usr/bin/libtool}, will fail
8004and print an error if asked to create a shared library with a less
8005restrictive subtype than its input files (for instance, trying to put
8006a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
8007for executables, @file{ld}, will quietly give the executable the most
8008restrictive subtype of any of its input files.
8009
8010@table @gcctabopt
8011@item -F@var{dir}
8012@opindex F
8013Add the framework directory @var{dir} to the head of the list of
8014directories to be searched for header files.  These directories are
8015interleaved with those specified by @option{-I} options and are
8016scanned in a left-to-right order.
8017
8018A framework directory is a directory with frameworks in it.  A
8019framework is a directory with a @samp{"Headers"} and/or
8020@samp{"PrivateHeaders"} directory contained directly in it that ends
8021in @samp{".framework"}.  The name of a framework is the name of this
8022directory excluding the @samp{".framework"}.  Headers associated with
8023the framework are found in one of those two directories, with
8024@samp{"Headers"} being searched first.  A subframework is a framework
8025directory that is in a framework's @samp{"Frameworks"} directory.
8026Includes of subframework headers can only appear in a header of a
8027framework that contains the subframework, or in a sibling subframework
8028header.  Two subframeworks are siblings if they occur in the same
8029framework.  A subframework should not have the same name as a
8030framework, a warning will be issued if this is violated.  Currently a
8031subframework cannot have subframeworks, in the future, the mechanism
8032may be extended to support this.  The standard frameworks can be found
8033in @samp{"/System/Library/Frameworks"} and
8034@samp{"/Library/Frameworks"}.  An example include looks like
8035@code{#include <Framework/header.h>}, where @samp{Framework} denotes
8036the name of the framework and header.h is found in the
8037@samp{"PrivateHeaders"} or @samp{"Headers"} directory.
8038
8039@item -gused
8040@opindex gused
8041Emit debugging information for symbols that are used.  For STABS
8042debugging format, this enables @option{-feliminate-unused-debug-symbols}.
8043This is by default ON@.
8044
8045@item -gfull
8046@opindex gfull
8047Emit debugging information for all symbols and types.
8048
8049@item -mmacosx-version-min=@var{version}
8050The earliest version of MacOS X that this executable will run on
8051is @var{version}.  Typical values of @var{version} include @code{10.1},
8052@code{10.2}, and @code{10.3.9}.
8053
8054The default for this option is to make choices that seem to be most
8055useful.  
8056
8057@item -mkernel
8058@opindex mkernel
8059Enable kernel development mode.  The @option{-mkernel} option sets
8060@option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit},
8061@option{-fno-exceptions}, @option{-fno-non-call-exceptions},
8062@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
8063applicable.  This mode also sets @option{-mno-altivec},
8064@option{-msoft-float}, @option{-fno-builtin} and
8065@option{-mlong-branch} for PowerPC targets.
8066
8067@item -mone-byte-bool
8068@opindex mone-byte-bool
8069Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}.
8070By default @samp{sizeof(bool)} is @samp{4} when compiling for
8071Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this
8072option has no effect on x86.
8073
8074@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
8075to generate code that is not binary compatible with code generated
8076without that switch.  Using this switch may require recompiling all
8077other modules in a program, including system libraries.  Use this
8078switch to conform to a non-default data model.
8079
8080@item -mfix-and-continue
8081@itemx -ffix-and-continue
8082@itemx -findirect-data
8083@opindex mfix-and-continue
8084@opindex ffix-and-continue
8085@opindex findirect-data
8086Generate code suitable for fast turn around development.  Needed to
8087enable gdb to dynamically load @code{.o} files into already running
8088programs.  @option{-findirect-data} and @option{-ffix-and-continue}
8089are provided for backwards compatibility.
8090
8091@item -all_load
8092@opindex all_load
8093Loads all members of static archive libraries.
8094See man ld(1) for more information.
8095
8096@item -arch_errors_fatal
8097@opindex arch_errors_fatal
8098Cause the errors having to do with files that have the wrong architecture
8099to be fatal.
8100
8101@item -bind_at_load
8102@opindex bind_at_load
8103Causes the output file to be marked such that the dynamic linker will
8104bind all undefined references when the file is loaded or launched.
8105
8106@item -bundle
8107@opindex bundle
8108Produce a Mach-o bundle format file.
8109See man ld(1) for more information.
8110
8111@item -bundle_loader @var{executable}
8112@opindex bundle_loader
8113This option specifies the @var{executable} that will be loading the build
8114output file being linked.  See man ld(1) for more information.
8115
8116@item -dynamiclib
8117@opindex dynamiclib
8118When passed this option, GCC will produce a dynamic library instead of
8119an executable when linking, using the Darwin @file{libtool} command.
8120
8121@item -force_cpusubtype_ALL
8122@opindex force_cpusubtype_ALL
8123This causes GCC's output file to have the @var{ALL} subtype, instead of
8124one controlled by the @option{-mcpu} or @option{-march} option.
8125
8126@item -allowable_client  @var{client_name}
8127@itemx -client_name
8128@itemx -compatibility_version
8129@itemx -current_version
8130@itemx -dead_strip
8131@itemx -dependency-file
8132@itemx -dylib_file
8133@itemx -dylinker_install_name
8134@itemx -dynamic
8135@itemx -exported_symbols_list
8136@itemx -filelist
8137@itemx -flat_namespace
8138@itemx -force_flat_namespace
8139@itemx -headerpad_max_install_names
8140@itemx -image_base
8141@itemx -init
8142@itemx -install_name
8143@itemx -keep_private_externs
8144@itemx -multi_module
8145@itemx -multiply_defined
8146@itemx -multiply_defined_unused
8147@itemx -noall_load
8148@itemx -no_dead_strip_inits_and_terms
8149@itemx -nofixprebinding
8150@itemx -nomultidefs
8151@itemx -noprebind
8152@itemx -noseglinkedit
8153@itemx -pagezero_size
8154@itemx -prebind
8155@itemx -prebind_all_twolevel_modules
8156@itemx -private_bundle
8157@itemx -read_only_relocs
8158@itemx -sectalign
8159@itemx -sectobjectsymbols
8160@itemx -whyload
8161@itemx -seg1addr
8162@itemx -sectcreate
8163@itemx -sectobjectsymbols
8164@itemx -sectorder
8165@itemx -segaddr
8166@itemx -segs_read_only_addr
8167@itemx -segs_read_write_addr
8168@itemx -seg_addr_table
8169@itemx -seg_addr_table_filename
8170@itemx -seglinkedit
8171@itemx -segprot
8172@itemx -segs_read_only_addr
8173@itemx -segs_read_write_addr
8174@itemx -single_module
8175@itemx -static
8176@itemx -sub_library
8177@itemx -sub_umbrella
8178@itemx -twolevel_namespace
8179@itemx -umbrella
8180@itemx -undefined
8181@itemx -unexported_symbols_list
8182@itemx -weak_reference_mismatches
8183@itemx -whatsloaded
8184
8185@opindex allowable_client
8186@opindex client_name
8187@opindex compatibility_version
8188@opindex current_version
8189@opindex dead_strip
8190@opindex dependency-file
8191@opindex dylib_file
8192@opindex dylinker_install_name
8193@opindex dynamic
8194@opindex exported_symbols_list
8195@opindex filelist
8196@opindex flat_namespace
8197@opindex force_flat_namespace
8198@opindex headerpad_max_install_names
8199@opindex image_base
8200@opindex init
8201@opindex install_name
8202@opindex keep_private_externs
8203@opindex multi_module
8204@opindex multiply_defined
8205@opindex multiply_defined_unused
8206@opindex noall_load
8207@opindex no_dead_strip_inits_and_terms
8208@opindex nofixprebinding
8209@opindex nomultidefs
8210@opindex noprebind
8211@opindex noseglinkedit
8212@opindex pagezero_size
8213@opindex prebind
8214@opindex prebind_all_twolevel_modules
8215@opindex private_bundle
8216@opindex read_only_relocs
8217@opindex sectalign
8218@opindex sectobjectsymbols
8219@opindex whyload
8220@opindex seg1addr
8221@opindex sectcreate
8222@opindex sectobjectsymbols
8223@opindex sectorder
8224@opindex segaddr
8225@opindex segs_read_only_addr
8226@opindex segs_read_write_addr
8227@opindex seg_addr_table
8228@opindex seg_addr_table_filename
8229@opindex seglinkedit
8230@opindex segprot
8231@opindex segs_read_only_addr
8232@opindex segs_read_write_addr
8233@opindex single_module
8234@opindex static
8235@opindex sub_library
8236@opindex sub_umbrella
8237@opindex twolevel_namespace
8238@opindex umbrella
8239@opindex undefined
8240@opindex unexported_symbols_list
8241@opindex weak_reference_mismatches
8242@opindex whatsloaded
8243
8244These options are passed to the Darwin linker.  The Darwin linker man page
8245describes them in detail.
8246@end table
8247
8248@node DEC Alpha Options
8249@subsection DEC Alpha Options
8250
8251These @samp{-m} options are defined for the DEC Alpha implementations:
8252
8253@table @gcctabopt
8254@item -mno-soft-float
8255@itemx -msoft-float
8256@opindex mno-soft-float
8257@opindex msoft-float
8258Use (do not use) the hardware floating-point instructions for
8259floating-point operations.  When @option{-msoft-float} is specified,
8260functions in @file{libgcc.a} will be used to perform floating-point
8261operations.  Unless they are replaced by routines that emulate the
8262floating-point operations, or compiled in such a way as to call such
8263emulations routines, these routines will issue floating-point
8264operations.   If you are compiling for an Alpha without floating-point
8265operations, you must ensure that the library is built so as not to call
8266them.
8267
8268Note that Alpha implementations without floating-point operations are
8269required to have floating-point registers.
8270
8271@item -mfp-reg
8272@itemx -mno-fp-regs
8273@opindex mfp-reg
8274@opindex mno-fp-regs
8275Generate code that uses (does not use) the floating-point register set.
8276@option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
8277register set is not used, floating point operands are passed in integer
8278registers as if they were integers and floating-point results are passed
8279in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
8280so any function with a floating-point argument or return value called by code
8281compiled with @option{-mno-fp-regs} must also be compiled with that
8282option.
8283
8284A typical use of this option is building a kernel that does not use,
8285and hence need not save and restore, any floating-point registers.
8286
8287@item -mieee
8288@opindex mieee
8289The Alpha architecture implements floating-point hardware optimized for
8290maximum performance.  It is mostly compliant with the IEEE floating
8291point standard.  However, for full compliance, software assistance is
8292required.  This option generates code fully IEEE compliant code
8293@emph{except} that the @var{inexact-flag} is not maintained (see below).
8294If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
8295defined during compilation.  The resulting code is less efficient but is
8296able to correctly support denormalized numbers and exceptional IEEE
8297values such as not-a-number and plus/minus infinity.  Other Alpha
8298compilers call this option @option{-ieee_with_no_inexact}.
8299
8300@item -mieee-with-inexact
8301@opindex mieee-with-inexact
8302This is like @option{-mieee} except the generated code also maintains
8303the IEEE @var{inexact-flag}.  Turning on this option causes the
8304generated code to implement fully-compliant IEEE math.  In addition to
8305@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
8306macro.  On some Alpha implementations the resulting code may execute
8307significantly slower than the code generated by default.  Since there is
8308very little code that depends on the @var{inexact-flag}, you should
8309normally not specify this option.  Other Alpha compilers call this
8310option @option{-ieee_with_inexact}.
8311
8312@item -mfp-trap-mode=@var{trap-mode}
8313@opindex mfp-trap-mode
8314This option controls what floating-point related traps are enabled.
8315Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
8316The trap mode can be set to one of four values:
8317
8318@table @samp
8319@item n
8320This is the default (normal) setting.  The only traps that are enabled
8321are the ones that cannot be disabled in software (e.g., division by zero
8322trap).
8323
8324@item u
8325In addition to the traps enabled by @samp{n}, underflow traps are enabled
8326as well.
8327
8328@item su
8329Like @samp{u}, but the instructions are marked to be safe for software
8330completion (see Alpha architecture manual for details).
8331
8332@item sui
8333Like @samp{su}, but inexact traps are enabled as well.
8334@end table
8335
8336@item -mfp-rounding-mode=@var{rounding-mode}
8337@opindex mfp-rounding-mode
8338Selects the IEEE rounding mode.  Other Alpha compilers call this option
8339@option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
8340of:
8341
8342@table @samp
8343@item n
8344Normal IEEE rounding mode.  Floating point numbers are rounded towards
8345the nearest machine number or towards the even machine number in case
8346of a tie.
8347
8348@item m
8349Round towards minus infinity.
8350
8351@item c
8352Chopped rounding mode.  Floating point numbers are rounded towards zero.
8353
8354@item d
8355Dynamic rounding mode.  A field in the floating point control register
8356(@var{fpcr}, see Alpha architecture reference manual) controls the
8357rounding mode in effect.  The C library initializes this register for
8358rounding towards plus infinity.  Thus, unless your program modifies the
8359@var{fpcr}, @samp{d} corresponds to round towards plus infinity.
8360@end table
8361
8362@item -mtrap-precision=@var{trap-precision}
8363@opindex mtrap-precision
8364In the Alpha architecture, floating point traps are imprecise.  This
8365means without software assistance it is impossible to recover from a
8366floating trap and program execution normally needs to be terminated.
8367GCC can generate code that can assist operating system trap handlers
8368in determining the exact location that caused a floating point trap.
8369Depending on the requirements of an application, different levels of
8370precisions can be selected:
8371
8372@table @samp
8373@item p
8374Program precision.  This option is the default and means a trap handler
8375can only identify which program caused a floating point exception.
8376
8377@item f
8378Function precision.  The trap handler can determine the function that
8379caused a floating point exception.
8380
8381@item i
8382Instruction precision.  The trap handler can determine the exact
8383instruction that caused a floating point exception.
8384@end table
8385
8386Other Alpha compilers provide the equivalent options called
8387@option{-scope_safe} and @option{-resumption_safe}.
8388
8389@item -mieee-conformant
8390@opindex mieee-conformant
8391This option marks the generated code as IEEE conformant.  You must not
8392use this option unless you also specify @option{-mtrap-precision=i} and either
8393@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
8394is to emit the line @samp{.eflag 48} in the function prologue of the
8395generated assembly file.  Under DEC Unix, this has the effect that
8396IEEE-conformant math library routines will be linked in.
8397
8398@item -mbuild-constants
8399@opindex mbuild-constants
8400Normally GCC examines a 32- or 64-bit integer constant to
8401see if it can construct it from smaller constants in two or three
8402instructions.  If it cannot, it will output the constant as a literal and
8403generate code to load it from the data segment at runtime.
8404
8405Use this option to require GCC to construct @emph{all} integer constants
8406using code, even if it takes more instructions (the maximum is six).
8407
8408You would typically use this option to build a shared library dynamic
8409loader.  Itself a shared library, it must relocate itself in memory
8410before it can find the variables and constants in its own data segment.
8411
8412@item -malpha-as
8413@itemx -mgas
8414@opindex malpha-as
8415@opindex mgas
8416Select whether to generate code to be assembled by the vendor-supplied
8417assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
8418
8419@item -mbwx
8420@itemx -mno-bwx
8421@itemx -mcix
8422@itemx -mno-cix
8423@itemx -mfix
8424@itemx -mno-fix
8425@itemx -mmax
8426@itemx -mno-max
8427@opindex mbwx
8428@opindex mno-bwx
8429@opindex mcix
8430@opindex mno-cix
8431@opindex mfix
8432@opindex mno-fix
8433@opindex mmax
8434@opindex mno-max
8435Indicate whether GCC should generate code to use the optional BWX,
8436CIX, FIX and MAX instruction sets.  The default is to use the instruction
8437sets supported by the CPU type specified via @option{-mcpu=} option or that
8438of the CPU on which GCC was built if none was specified.
8439
8440@item -mfloat-vax
8441@itemx -mfloat-ieee
8442@opindex mfloat-vax
8443@opindex mfloat-ieee
8444Generate code that uses (does not use) VAX F and G floating point
8445arithmetic instead of IEEE single and double precision.
8446
8447@item -mexplicit-relocs
8448@itemx -mno-explicit-relocs
8449@opindex mexplicit-relocs
8450@opindex mno-explicit-relocs
8451Older Alpha assemblers provided no way to generate symbol relocations
8452except via assembler macros.  Use of these macros does not allow
8453optimal instruction scheduling.  GNU binutils as of version 2.12
8454supports a new syntax that allows the compiler to explicitly mark
8455which relocations should apply to which instructions.  This option
8456is mostly useful for debugging, as GCC detects the capabilities of
8457the assembler when it is built and sets the default accordingly.
8458
8459@item -msmall-data
8460@itemx -mlarge-data
8461@opindex msmall-data
8462@opindex mlarge-data
8463When @option{-mexplicit-relocs} is in effect, static data is
8464accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
8465is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
8466(the @code{.sdata} and @code{.sbss} sections) and are accessed via
846716-bit relocations off of the @code{$gp} register.  This limits the
8468size of the small data area to 64KB, but allows the variables to be
8469directly accessed via a single instruction.
8470
8471The default is @option{-mlarge-data}.  With this option the data area
8472is limited to just below 2GB@.  Programs that require more than 2GB of
8473data must use @code{malloc} or @code{mmap} to allocate the data in the
8474heap instead of in the program's data segment.
8475
8476When generating code for shared libraries, @option{-fpic} implies
8477@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
8478
8479@item -msmall-text
8480@itemx -mlarge-text
8481@opindex msmall-text
8482@opindex mlarge-text
8483When @option{-msmall-text} is used, the compiler assumes that the
8484code of the entire program (or shared library) fits in 4MB, and is
8485thus reachable with a branch instruction.  When @option{-msmall-data}
8486is used, the compiler can assume that all local symbols share the
8487same @code{$gp} value, and thus reduce the number of instructions
8488required for a function call from 4 to 1.
8489
8490The default is @option{-mlarge-text}.
8491
8492@item -mcpu=@var{cpu_type}
8493@opindex mcpu
8494Set the instruction set and instruction scheduling parameters for
8495machine type @var{cpu_type}.  You can specify either the @samp{EV}
8496style name or the corresponding chip number.  GCC supports scheduling
8497parameters for the EV4, EV5 and EV6 family of processors and will
8498choose the default values for the instruction set from the processor
8499you specify.  If you do not specify a processor type, GCC will default
8500to the processor on which the compiler was built.
8501
8502Supported values for @var{cpu_type} are
8503
8504@table @samp
8505@item ev4
8506@itemx ev45
8507@itemx 21064
8508Schedules as an EV4 and has no instruction set extensions.
8509
8510@item ev5
8511@itemx 21164
8512Schedules as an EV5 and has no instruction set extensions.
8513
8514@item ev56
8515@itemx 21164a
8516Schedules as an EV5 and supports the BWX extension.
8517
8518@item pca56
8519@itemx 21164pc
8520@itemx 21164PC
8521Schedules as an EV5 and supports the BWX and MAX extensions.
8522
8523@item ev6
8524@itemx 21264
8525Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
8526
8527@item ev67
8528@itemx 21264a
8529Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
8530@end table
8531
8532@item -mtune=@var{cpu_type}
8533@opindex mtune
8534Set only the instruction scheduling parameters for machine type
8535@var{cpu_type}.  The instruction set is not changed.
8536
8537@item -mmemory-latency=@var{time}
8538@opindex mmemory-latency
8539Sets the latency the scheduler should assume for typical memory
8540references as seen by the application.  This number is highly
8541dependent on the memory access patterns used by the application
8542and the size of the external cache on the machine.
8543
8544Valid options for @var{time} are
8545
8546@table @samp
8547@item @var{number}
8548A decimal number representing clock cycles.
8549
8550@item L1
8551@itemx L2
8552@itemx L3
8553@itemx main
8554The compiler contains estimates of the number of clock cycles for
8555``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
8556(also called Dcache, Scache, and Bcache), as well as to main memory.
8557Note that L3 is only valid for EV5.
8558
8559@end table
8560@end table
8561
8562@node DEC Alpha/VMS Options
8563@subsection DEC Alpha/VMS Options
8564
8565These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
8566
8567@table @gcctabopt
8568@item -mvms-return-codes
8569@opindex mvms-return-codes
8570Return VMS condition codes from main.  The default is to return POSIX
8571style condition (e.g.@ error) codes.
8572@end table
8573
8574@node FRV Options
8575@subsection FRV Options
8576@cindex FRV Options
8577
8578@table @gcctabopt
8579@item -mgpr-32
8580@opindex mgpr-32
8581
8582Only use the first 32 general purpose registers.
8583
8584@item -mgpr-64
8585@opindex mgpr-64
8586
8587Use all 64 general purpose registers.
8588
8589@item -mfpr-32
8590@opindex mfpr-32
8591
8592Use only the first 32 floating point registers.
8593
8594@item -mfpr-64
8595@opindex mfpr-64
8596
8597Use all 64 floating point registers
8598
8599@item -mhard-float
8600@opindex mhard-float
8601
8602Use hardware instructions for floating point operations.
8603
8604@item -msoft-float
8605@opindex msoft-float
8606
8607Use library routines for floating point operations.
8608
8609@item -malloc-cc
8610@opindex malloc-cc
8611
8612Dynamically allocate condition code registers.
8613
8614@item -mfixed-cc
8615@opindex mfixed-cc
8616
8617Do not try to dynamically allocate condition code registers, only
8618use @code{icc0} and @code{fcc0}.
8619
8620@item -mdword
8621@opindex mdword
8622
8623Change ABI to use double word insns.
8624
8625@item -mno-dword
8626@opindex mno-dword
8627
8628Do not use double word instructions.
8629
8630@item -mdouble
8631@opindex mdouble
8632
8633Use floating point double instructions.
8634
8635@item -mno-double
8636@opindex mno-double
8637
8638Do not use floating point double instructions.
8639
8640@item -mmedia
8641@opindex mmedia
8642
8643Use media instructions.
8644
8645@item -mno-media
8646@opindex mno-media
8647
8648Do not use media instructions.
8649
8650@item -mmuladd
8651@opindex mmuladd
8652
8653Use multiply and add/subtract instructions.
8654
8655@item -mno-muladd
8656@opindex mno-muladd
8657
8658Do not use multiply and add/subtract instructions.
8659
8660@item -mfdpic
8661@opindex mfdpic
8662
8663Select the FDPIC ABI, that uses function descriptors to represent
8664pointers to functions.  Without any PIC/PIE-related options, it
8665implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
8666assumes GOT entries and small data are within a 12-bit range from the
8667GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
8668are computed with 32 bits.
8669
8670@item -minline-plt
8671@opindex minline-plt
8672
8673Enable inlining of PLT entries in function calls to functions that are
8674not known to bind locally.  It has no effect without @option{-mfdpic}.
8675It's enabled by default if optimizing for speed and compiling for
8676shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
8677optimization option such as @option{-O3} or above is present in the
8678command line.
8679
8680@item -mTLS
8681@opindex TLS
8682
8683Assume a large TLS segment when generating thread-local code.
8684
8685@item -mtls
8686@opindex tls
8687
8688Do not assume a large TLS segment when generating thread-local code.
8689
8690@item -mgprel-ro
8691@opindex mgprel-ro
8692
8693Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
8694that is known to be in read-only sections.  It's enabled by default,
8695except for @option{-fpic} or @option{-fpie}: even though it may help
8696make the global offset table smaller, it trades 1 instruction for 4.
8697With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
8698one of which may be shared by multiple symbols, and it avoids the need
8699for a GOT entry for the referenced symbol, so it's more likely to be a
8700win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
8701
8702@item -multilib-library-pic
8703@opindex multilib-library-pic
8704
8705Link with the (library, not FD) pic libraries.  It's implied by
8706@option{-mlibrary-pic}, as well as by @option{-fPIC} and
8707@option{-fpic} without @option{-mfdpic}.  You should never have to use
8708it explicitly.
8709
8710@item -mlinked-fp
8711@opindex mlinked-fp
8712
8713Follow the EABI requirement of always creating a frame pointer whenever
8714a stack frame is allocated.  This option is enabled by default and can
8715be disabled with @option{-mno-linked-fp}.
8716
8717@item -mlong-calls
8718@opindex mlong-calls
8719
8720Use indirect addressing to call functions outside the current
8721compilation unit.  This allows the functions to be placed anywhere
8722within the 32-bit address space.
8723
8724@item -malign-labels
8725@opindex malign-labels
8726
8727Try to align labels to an 8-byte boundary by inserting nops into the
8728previous packet.  This option only has an effect when VLIW packing
8729is enabled.  It doesn't create new packets; it merely adds nops to
8730existing ones.
8731
8732@item -mlibrary-pic
8733@opindex mlibrary-pic
8734
8735Generate position-independent EABI code.
8736
8737@item -macc-4
8738@opindex macc-4
8739
8740Use only the first four media accumulator registers.
8741
8742@item -macc-8
8743@opindex macc-8
8744
8745Use all eight media accumulator registers.
8746
8747@item -mpack
8748@opindex mpack
8749
8750Pack VLIW instructions.
8751
8752@item -mno-pack
8753@opindex mno-pack
8754
8755Do not pack VLIW instructions.
8756
8757@item -mno-eflags
8758@opindex mno-eflags
8759
8760Do not mark ABI switches in e_flags.
8761
8762@item -mcond-move
8763@opindex mcond-move
8764
8765Enable the use of conditional-move instructions (default).
8766
8767This switch is mainly for debugging the compiler and will likely be removed
8768in a future version.
8769
8770@item -mno-cond-move
8771@opindex mno-cond-move
8772
8773Disable the use of conditional-move instructions.
8774
8775This switch is mainly for debugging the compiler and will likely be removed
8776in a future version.
8777
8778@item -mscc
8779@opindex mscc
8780
8781Enable the use of conditional set instructions (default).
8782
8783This switch is mainly for debugging the compiler and will likely be removed
8784in a future version.
8785
8786@item -mno-scc
8787@opindex mno-scc
8788
8789Disable the use of conditional set instructions.
8790
8791This switch is mainly for debugging the compiler and will likely be removed
8792in a future version.
8793
8794@item -mcond-exec
8795@opindex mcond-exec
8796
8797Enable the use of conditional execution (default).
8798
8799This switch is mainly for debugging the compiler and will likely be removed
8800in a future version.
8801
8802@item -mno-cond-exec
8803@opindex mno-cond-exec
8804
8805Disable the use of conditional execution.
8806
8807This switch is mainly for debugging the compiler and will likely be removed
8808in a future version.
8809
8810@item -mvliw-branch
8811@opindex mvliw-branch
8812
8813Run a pass to pack branches into VLIW instructions (default).
8814
8815This switch is mainly for debugging the compiler and will likely be removed
8816in a future version.
8817
8818@item -mno-vliw-branch
8819@opindex mno-vliw-branch
8820
8821Do not run a pass to pack branches into VLIW instructions.
8822
8823This switch is mainly for debugging the compiler and will likely be removed
8824in a future version.
8825
8826@item -mmulti-cond-exec
8827@opindex mmulti-cond-exec
8828
8829Enable optimization of @code{&&} and @code{||} in conditional execution
8830(default).
8831
8832This switch is mainly for debugging the compiler and will likely be removed
8833in a future version.
8834
8835@item -mno-multi-cond-exec
8836@opindex mno-multi-cond-exec
8837
8838Disable optimization of @code{&&} and @code{||} in conditional execution.
8839
8840This switch is mainly for debugging the compiler and will likely be removed
8841in a future version.
8842
8843@item -mnested-cond-exec
8844@opindex mnested-cond-exec
8845
8846Enable nested conditional execution optimizations (default).
8847
8848This switch is mainly for debugging the compiler and will likely be removed
8849in a future version.
8850
8851@item -mno-nested-cond-exec
8852@opindex mno-nested-cond-exec
8853
8854Disable nested conditional execution optimizations.
8855
8856This switch is mainly for debugging the compiler and will likely be removed
8857in a future version.
8858
8859@item -moptimize-membar
8860@opindex moptimize-membar
8861
8862This switch removes redundant @code{membar} instructions from the
8863compiler generated code.  It is enabled by default.
8864
8865@item -mno-optimize-membar
8866@opindex mno-optimize-membar
8867
8868This switch disables the automatic removal of redundant @code{membar}
8869instructions from the generated code.
8870
8871@item -mtomcat-stats
8872@opindex mtomcat-stats
8873
8874Cause gas to print out tomcat statistics.
8875
8876@item -mcpu=@var{cpu}
8877@opindex mcpu
8878
8879Select the processor type for which to generate code.  Possible values are
8880@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
8881@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
8882
8883@end table
8884
8885@node GNU/Linux Options
8886@subsection GNU/Linux Options
8887
8888These @samp{-m} options are defined for GNU/Linux targets:
8889
8890@table @gcctabopt
8891@item -mglibc
8892@opindex mglibc
8893Use the GNU C library instead of uClibc.  This is the default except
8894on @samp{*-*-linux-*uclibc*} targets.
8895
8896@item -muclibc
8897@opindex muclibc
8898Use uClibc instead of the GNU C library.  This is the default on
8899@samp{*-*-linux-*uclibc*} targets.
8900@end table
8901
8902@node H8/300 Options
8903@subsection H8/300 Options
8904
8905These @samp{-m} options are defined for the H8/300 implementations:
8906
8907@table @gcctabopt
8908@item -mrelax
8909@opindex mrelax
8910Shorten some address references at link time, when possible; uses the
8911linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
8912ld, Using ld}, for a fuller description.
8913
8914@item -mh
8915@opindex mh
8916Generate code for the H8/300H@.
8917
8918@item -ms
8919@opindex ms
8920Generate code for the H8S@.
8921
8922@item -mn
8923@opindex mn
8924Generate code for the H8S and H8/300H in the normal mode.  This switch
8925must be used either with @option{-mh} or @option{-ms}.
8926
8927@item -ms2600
8928@opindex ms2600
8929Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
8930
8931@item -mint32
8932@opindex mint32
8933Make @code{int} data 32 bits by default.
8934
8935@item -malign-300
8936@opindex malign-300
8937On the H8/300H and H8S, use the same alignment rules as for the H8/300.
8938The default for the H8/300H and H8S is to align longs and floats on 4
8939byte boundaries.
8940@option{-malign-300} causes them to be aligned on 2 byte boundaries.
8941This option has no effect on the H8/300.
8942@end table
8943
8944@node HPPA Options
8945@subsection HPPA Options
8946@cindex HPPA Options
8947
8948These @samp{-m} options are defined for the HPPA family of computers:
8949
8950@table @gcctabopt
8951@item -march=@var{architecture-type}
8952@opindex march
8953Generate code for the specified architecture.  The choices for
8954@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
89551.1, and @samp{2.0} for PA 2.0 processors.  Refer to
8956@file{/usr/lib/sched.models} on an HP-UX system to determine the proper
8957architecture option for your machine.  Code compiled for lower numbered
8958architectures will run on higher numbered architectures, but not the
8959other way around.
8960
8961@item -mpa-risc-1-0
8962@itemx -mpa-risc-1-1
8963@itemx -mpa-risc-2-0
8964@opindex mpa-risc-1-0
8965@opindex mpa-risc-1-1
8966@opindex mpa-risc-2-0
8967Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
8968
8969@item -mbig-switch
8970@opindex mbig-switch
8971Generate code suitable for big switch tables.  Use this option only if
8972the assembler/linker complain about out of range branches within a switch
8973table.
8974
8975@item -mjump-in-delay
8976@opindex mjump-in-delay
8977Fill delay slots of function calls with unconditional jump instructions
8978by modifying the return pointer for the function call to be the target
8979of the conditional jump.
8980
8981@item -mdisable-fpregs
8982@opindex mdisable-fpregs
8983Prevent floating point registers from being used in any manner.  This is
8984necessary for compiling kernels which perform lazy context switching of
8985floating point registers.  If you use this option and attempt to perform
8986floating point operations, the compiler will abort.
8987
8988@item -mdisable-indexing
8989@opindex mdisable-indexing
8990Prevent the compiler from using indexing address modes.  This avoids some
8991rather obscure problems when compiling MIG generated code under MACH@.
8992
8993@item -mno-space-regs
8994@opindex mno-space-regs
8995Generate code that assumes the target has no space registers.  This allows
8996GCC to generate faster indirect calls and use unscaled index address modes.
8997
8998Such code is suitable for level 0 PA systems and kernels.
8999
9000@item -mfast-indirect-calls
9001@opindex mfast-indirect-calls
9002Generate code that assumes calls never cross space boundaries.  This
9003allows GCC to emit code which performs faster indirect calls.
9004
9005This option will not work in the presence of shared libraries or nested
9006functions.
9007
9008@item -mfixed-range=@var{register-range}
9009@opindex mfixed-range
9010Generate code treating the given register range as fixed registers.
9011A fixed register is one that the register allocator can not use.  This is
9012useful when compiling kernel code.  A register range is specified as
9013two registers separated by a dash.  Multiple register ranges can be
9014specified separated by a comma.
9015
9016@item -mlong-load-store
9017@opindex mlong-load-store
9018Generate 3-instruction load and store sequences as sometimes required by
9019the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
9020the HP compilers.
9021
9022@item -mportable-runtime
9023@opindex mportable-runtime
9024Use the portable calling conventions proposed by HP for ELF systems.
9025
9026@item -mgas
9027@opindex mgas
9028Enable the use of assembler directives only GAS understands.
9029
9030@item -mschedule=@var{cpu-type}
9031@opindex mschedule
9032Schedule code according to the constraints for the machine type
9033@var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
9034@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
9035to @file{/usr/lib/sched.models} on an HP-UX system to determine the
9036proper scheduling option for your machine.  The default scheduling is
9037@samp{8000}.
9038
9039@item -mlinker-opt
9040@opindex mlinker-opt
9041Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
9042debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
9043linkers in which they give bogus error messages when linking some programs.
9044
9045@item -msoft-float
9046@opindex msoft-float
9047Generate output containing library calls for floating point.
9048@strong{Warning:} the requisite libraries are not available for all HPPA
9049targets.  Normally the facilities of the machine's usual C compiler are
9050used, but this cannot be done directly in cross-compilation.  You must make
9051your own arrangements to provide suitable library functions for
9052cross-compilation.  The embedded target @samp{hppa1.1-*-pro}
9053does provide software floating point support.
9054
9055@option{-msoft-float} changes the calling convention in the output file;
9056therefore, it is only useful if you compile @emph{all} of a program with
9057this option.  In particular, you need to compile @file{libgcc.a}, the
9058library that comes with GCC, with @option{-msoft-float} in order for
9059this to work.
9060
9061@item -msio
9062@opindex msio
9063Generate the predefine, @code{_SIO}, for server IO@.  The default is
9064@option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
9065@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
9066options are available under HP-UX and HI-UX@.
9067
9068@item -mgnu-ld
9069@opindex gnu-ld
9070Use GNU ld specific options.  This passes @option{-shared} to ld when
9071building a shared library.  It is the default when GCC is configured,
9072explicitly or implicitly, with the GNU linker.  This option does not
9073have any affect on which ld is called, it only changes what parameters
9074are passed to that ld.  The ld that is called is determined by the
9075@option{--with-ld} configure option, GCC's program search path, and
9076finally by the user's @env{PATH}.  The linker used by GCC can be printed
9077using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
9078on the 64 bit HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}.
9079
9080@item -mhp-ld
9081@opindex hp-ld
9082Use HP ld specific options.  This passes @option{-b} to ld when building
9083a shared library and passes @option{+Accept TypeMismatch} to ld on all
9084links.  It is the default when GCC is configured, explicitly or
9085implicitly, with the HP linker.  This option does not have any affect on
9086which ld is called, it only changes what parameters are passed to that
9087ld.  The ld that is called is determined by the @option{--with-ld}
9088configure option, GCC's program search path, and finally by the user's
9089@env{PATH}.  The linker used by GCC can be printed using @samp{which
9090`gcc -print-prog-name=ld`}.  This option is only available on the 64 bit
9091HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}.
9092
9093@item -mlong-calls
9094@opindex mno-long-calls
9095Generate code that uses long call sequences.  This ensures that a call
9096is always able to reach linker generated stubs.  The default is to generate
9097long calls only when the distance from the call site to the beginning
9098of the function or translation unit, as the case may be, exceeds a
9099predefined limit set by the branch type being used.  The limits for
9100normal calls are 7,600,000 and 240,000 bytes, respectively for the
9101PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
9102240,000 bytes.
9103
9104Distances are measured from the beginning of functions when using the
9105@option{-ffunction-sections} option, or when using the @option{-mgas}
9106and @option{-mno-portable-runtime} options together under HP-UX with
9107the SOM linker.
9108
9109It is normally not desirable to use this option as it will degrade
9110performance.  However, it may be useful in large applications,
9111particularly when partial linking is used to build the application.
9112
9113The types of long calls used depends on the capabilities of the
9114assembler and linker, and the type of code being generated.  The
9115impact on systems that support long absolute calls, and long pic
9116symbol-difference or pc-relative calls should be relatively small.
9117However, an indirect call is used on 32-bit ELF systems in pic code
9118and it is quite long.
9119
9120@item -munix=@var{unix-std}
9121@opindex march
9122Generate compiler predefines and select a startfile for the specified
9123UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
9124and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
9125is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
912611.11 and later.  The default values are @samp{93} for HP-UX 10.00,
9127@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
9128and later.
9129
9130@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
9131@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
9132and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
9133@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
9134@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
9135@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
9136
9137It is @emph{important} to note that this option changes the interfaces
9138for various library routines.  It also affects the operational behavior
9139of the C library.  Thus, @emph{extreme} care is needed in using this
9140option.
9141
9142Library code that is intended to operate with more than one UNIX
9143standard must test, set and restore the variable @var{__xpg4_extended_mask}
9144as appropriate.  Most GNU software doesn't provide this capability.
9145
9146@item -nolibdld
9147@opindex nolibdld
9148Suppress the generation of link options to search libdld.sl when the
9149@option{-static} option is specified on HP-UX 10 and later.
9150
9151@item -static
9152@opindex static
9153The HP-UX implementation of setlocale in libc has a dependency on
9154libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
9155when the @option{-static} option is specified, special link options
9156are needed to resolve this dependency.
9157
9158On HP-UX 10 and later, the GCC driver adds the necessary options to
9159link with libdld.sl when the @option{-static} option is specified.
9160This causes the resulting binary to be dynamic.  On the 64-bit port,
9161the linkers generate dynamic binaries by default in any case.  The
9162@option{-nolibdld} option can be used to prevent the GCC driver from
9163adding these link options.
9164
9165@item -threads
9166@opindex threads
9167Add support for multithreading with the @dfn{dce thread} library
9168under HP-UX@.  This option sets flags for both the preprocessor and
9169linker.
9170@end table
9171
9172@node i386 and x86-64 Options
9173@subsection Intel 386 and AMD x86-64 Options
9174@cindex i386 Options
9175@cindex x86-64 Options
9176@cindex Intel 386 Options
9177@cindex AMD x86-64 Options
9178
9179These @samp{-m} options are defined for the i386 and x86-64 family of
9180computers:
9181
9182@table @gcctabopt
9183@item -mtune=@var{cpu-type}
9184@opindex mtune
9185Tune to @var{cpu-type} everything applicable about the generated code, except
9186for the ABI and the set of available instructions.  The choices for
9187@var{cpu-type} are:
9188@table @emph
9189@item generic
9190Produce code optimized for the most common IA32/AMD64/EM64T processors.
9191If you know the CPU on which your code will run, then you should use
9192the corresponding @option{-mtune} option instead of
9193@option{-mtune=generic}.  But, if you do not know exactly what CPU users
9194of your application will have, then you should use this option.
9195
9196As new processors are deployed in the marketplace, the behavior of this
9197option will change.  Therefore, if you upgrade to a newer version of
9198GCC, the code generated option will change to reflect the processors
9199that were most common when that version of GCC was released.
9200
9201There is no @option{-march=generic} option because @option{-march}
9202indicates the instruction set the compiler can use, and there is no
9203generic instruction set applicable to all processors.  In contrast,
9204@option{-mtune} indicates the processor (or, in this case, collection of
9205processors) for which the code is optimized.
9206@item native
9207This selects the CPU to tune for at compilation time by determining
9208the processor type of the compiling machine.  Using @option{-mtune=native}
9209will produce code optimized for the local machine under the constraints
9210of the selected instruction set.  Using @option{-march=native} will
9211enable all instruction subsets supported by the local machine (hence
9212the result might not run on different machines).
9213@item i386
9214Original Intel's i386 CPU@.
9215@item i486
9216Intel's i486 CPU@.  (No scheduling is implemented for this chip.)
9217@item i586, pentium
9218Intel Pentium CPU with no MMX support.
9219@item pentium-mmx
9220Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
9221@item pentiumpro
9222Intel PentiumPro CPU@.
9223@item i686
9224Same as @code{generic}, but when used as @code{march} option, PentiumPro
9225instruction set will be used, so the code will run on all i686 family chips.
9226@item pentium2
9227Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
9228@item pentium3, pentium3m
9229Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
9230support.
9231@item pentium-m
9232Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set
9233support.  Used by Centrino notebooks.
9234@item pentium4, pentium4m
9235Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
9236@item prescott
9237Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction
9238set support.
9239@item nocona
9240Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE,
9241SSE2 and SSE3 instruction set support.
9242@item core2
9243Intel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
9244instruction set support.
9245@item k6
9246AMD K6 CPU with MMX instruction set support.
9247@item k6-2, k6-3
9248Improved versions of AMD K6 CPU with MMX and 3dNOW! instruction set support.
9249@item athlon, athlon-tbird
9250AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE prefetch instructions
9251support.
9252@item athlon-4, athlon-xp, athlon-mp
9253Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and full SSE
9254instruction set support.
9255@item k8, opteron, athlon64, athlon-fx
9256AMD K8 core based CPUs with x86-64 instruction set support.  (This supersets
9257MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.)
9258@item k8-sse3, opteron-sse3, athlon64-sse3
9259Improved versions of k8, opteron and athlon64 with SSE3 instruction set support.
9260@item amdfam10, barcelona
9261AMD Family 10h core based CPUs with x86-64 instruction set support.  (This
9262supersets MMX, SSE, SSE2, SSE3, SSE4A, 3dNOW!, enhanced 3dNOW!, ABM and 64-bit
9263instruction set extensions.)
9264@item winchip-c6
9265IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
9266set support.
9267@item winchip2
9268IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW!
9269instruction set support.
9270@item c3
9271Via C3 CPU with MMX and 3dNOW! instruction set support.  (No scheduling is
9272implemented for this chip.)
9273@item c3-2
9274Via C3-2 CPU with MMX and SSE instruction set support.  (No scheduling is
9275implemented for this chip.)
9276@item geode
9277Embedded AMD CPU with MMX and 3dNOW! instruction set support.
9278@end table
9279
9280While picking a specific @var{cpu-type} will schedule things appropriately
9281for that particular chip, the compiler will not generate any code that
9282does not run on the i386 without the @option{-march=@var{cpu-type}} option
9283being used.
9284
9285@item -march=@var{cpu-type}
9286@opindex march
9287Generate instructions for the machine type @var{cpu-type}.  The choices
9288for @var{cpu-type} are the same as for @option{-mtune}.  Moreover,
9289specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
9290
9291@item -mcpu=@var{cpu-type}
9292@opindex mcpu
9293A deprecated synonym for @option{-mtune}.
9294
9295@item -m386
9296@itemx -m486
9297@itemx -mpentium
9298@itemx -mpentiumpro
9299@opindex m386
9300@opindex m486
9301@opindex mpentium
9302@opindex mpentiumpro
9303These options are synonyms for @option{-mtune=i386}, @option{-mtune=i486},
9304@option{-mtune=pentium}, and @option{-mtune=pentiumpro} respectively.
9305These synonyms are deprecated.
9306
9307@item -mfpmath=@var{unit}
9308@opindex march
9309Generate floating point arithmetics for selected unit @var{unit}.  The choices
9310for @var{unit} are:
9311
9312@table @samp
9313@item 387
9314Use the standard 387 floating point coprocessor present majority of chips and
9315emulated otherwise.  Code compiled with this option will run almost everywhere.
9316The temporary results are computed in 80bit precision instead of precision
9317specified by the type resulting in slightly different results compared to most
9318of other chips.  See @option{-ffloat-store} for more detailed description.
9319
9320This is the default choice for i386 compiler.
9321
9322@item sse
9323Use scalar floating point instructions present in the SSE instruction set.
9324This instruction set is supported by Pentium3 and newer chips, in the AMD line
9325by Athlon-4, Athlon-xp and Athlon-mp chips.  The earlier version of SSE
9326instruction set supports only single precision arithmetics, thus the double and
9327extended precision arithmetics is still done using 387.  Later version, present
9328only in Pentium4 and the future AMD x86-64 chips supports double precision
9329arithmetics too.
9330
9331For the i386 compiler, you need to use @option{-march=@var{cpu-type}}, @option{-msse}
9332or @option{-msse2} switches to enable SSE extensions and make this option
9333effective.  For the x86-64 compiler, these extensions are enabled by default.
9334
9335The resulting code should be considerably faster in the majority of cases and avoid
9336the numerical instability problems of 387 code, but may break some existing
9337code that expects temporaries to be 80bit.
9338
9339This is the default choice for the x86-64 compiler.
9340
9341@item sse,387
9342Attempt to utilize both instruction sets at once.  This effectively double the
9343amount of available registers and on chips with separate execution units for
9344387 and SSE the execution resources too.  Use this option with care, as it is
9345still experimental, because the GCC register allocator does not model separate
9346functional units well resulting in instable performance.
9347@end table
9348
9349@item -masm=@var{dialect}
9350@opindex masm=@var{dialect}
9351Output asm instructions using selected @var{dialect}.  Supported
9352choices are @samp{intel} or @samp{att} (the default one).  Darwin does
9353not support @samp{intel}.
9354
9355@item -mieee-fp
9356@itemx -mno-ieee-fp
9357@opindex mieee-fp
9358@opindex mno-ieee-fp
9359Control whether or not the compiler uses IEEE floating point
9360comparisons.  These handle correctly the case where the result of a
9361comparison is unordered.
9362
9363@item -msoft-float
9364@opindex msoft-float
9365Generate output containing library calls for floating point.
9366@strong{Warning:} the requisite libraries are not part of GCC@.
9367Normally the facilities of the machine's usual C compiler are used, but
9368this can't be done directly in cross-compilation.  You must make your
9369own arrangements to provide suitable library functions for
9370cross-compilation.
9371
9372On machines where a function returns floating point results in the 80387
9373register stack, some floating point opcodes may be emitted even if
9374@option{-msoft-float} is used.
9375
9376@item -mno-fp-ret-in-387
9377@opindex mno-fp-ret-in-387
9378Do not use the FPU registers for return values of functions.
9379
9380The usual calling convention has functions return values of types
9381@code{float} and @code{double} in an FPU register, even if there
9382is no FPU@.  The idea is that the operating system should emulate
9383an FPU@.
9384
9385The option @option{-mno-fp-ret-in-387} causes such values to be returned
9386in ordinary CPU registers instead.
9387
9388@item -mno-fancy-math-387
9389@opindex mno-fancy-math-387
9390Some 387 emulators do not support the @code{sin}, @code{cos} and
9391@code{sqrt} instructions for the 387.  Specify this option to avoid
9392generating those instructions.  This option is the default on
9393OpenBSD and NetBSD@.  This option is overridden when @option{-march}
9394indicates that the target cpu will always have an FPU and so the
9395instruction will not need emulation.  As of revision 2.6.1, these
9396instructions are not generated unless you also use the
9397@option{-funsafe-math-optimizations} switch.
9398
9399@item -malign-double
9400@itemx -mno-align-double
9401@opindex malign-double
9402@opindex mno-align-double
9403Control whether GCC aligns @code{double}, @code{long double}, and
9404@code{long long} variables on a two word boundary or a one word
9405boundary.  Aligning @code{double} variables on a two word boundary will
9406produce code that runs somewhat faster on a @samp{Pentium} at the
9407expense of more memory.
9408
9409On x86-64, @option{-malign-double} is enabled by default.
9410
9411@strong{Warning:} if you use the @option{-malign-double} switch,
9412structures containing the above types will be aligned differently than
9413the published application binary interface specifications for the 386
9414and will not be binary compatible with structures in code compiled
9415without that switch.
9416
9417@item -m96bit-long-double
9418@itemx -m128bit-long-double
9419@opindex m96bit-long-double
9420@opindex m128bit-long-double
9421These switches control the size of @code{long double} type.  The i386
9422application binary interface specifies the size to be 96 bits,
9423so @option{-m96bit-long-double} is the default in 32 bit mode.
9424
9425Modern architectures (Pentium and newer) would prefer @code{long double}
9426to be aligned to an 8 or 16 byte boundary.  In arrays or structures
9427conforming to the ABI, this would not be possible.  So specifying a
9428@option{-m128bit-long-double} will align @code{long double}
9429to a 16 byte boundary by padding the @code{long double} with an additional
943032 bit zero.
9431
9432In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
9433its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
9434
9435Notice that neither of these options enable any extra precision over the x87
9436standard of 80 bits for a @code{long double}.
9437
9438@strong{Warning:} if you override the default value for your target ABI, the
9439structures and arrays containing @code{long double} variables will change
9440their size as well as function calling convention for function taking
9441@code{long double} will be modified.  Hence they will not be binary
9442compatible with arrays or structures in code compiled without that switch.
9443
9444@item -mmlarge-data-threshold=@var{number}
9445@opindex mlarge-data-threshold=@var{number}
9446When @option{-mcmodel=medium} is specified, the data greater than
9447@var{threshold} are placed in large data section.  This value must be the
9448same across all object linked into the binary and defaults to 65535.
9449
9450@item -msvr3-shlib
9451@itemx -mno-svr3-shlib
9452@opindex msvr3-shlib
9453@opindex mno-svr3-shlib
9454Control whether GCC places uninitialized local variables into the
9455@code{bss} or @code{data} segments.  @option{-msvr3-shlib} places them
9456into @code{bss}.  These options are meaningful only on System V Release 3.
9457
9458@item -mrtd
9459@opindex mrtd
9460Use a different function-calling convention, in which functions that
9461take a fixed number of arguments return with the @code{ret} @var{num}
9462instruction, which pops their arguments while returning.  This saves one
9463instruction in the caller since there is no need to pop the arguments
9464there.
9465
9466You can specify that an individual function is called with this calling
9467sequence with the function attribute @samp{stdcall}.  You can also
9468override the @option{-mrtd} option by using the function attribute
9469@samp{cdecl}.  @xref{Function Attributes}.
9470
9471@strong{Warning:} this calling convention is incompatible with the one
9472normally used on Unix, so you cannot use it if you need to call
9473libraries compiled with the Unix compiler.
9474
9475Also, you must provide function prototypes for all functions that
9476take variable numbers of arguments (including @code{printf});
9477otherwise incorrect code will be generated for calls to those
9478functions.
9479
9480In addition, seriously incorrect code will result if you call a
9481function with too many arguments.  (Normally, extra arguments are
9482harmlessly ignored.)
9483
9484@item -mregparm=@var{num}
9485@opindex mregparm
9486Control how many registers are used to pass integer arguments.  By
9487default, no registers are used to pass arguments, and at most 3
9488registers can be used.  You can control this behavior for a specific
9489function by using the function attribute @samp{regparm}.
9490@xref{Function Attributes}.
9491
9492@strong{Warning:} if you use this switch, and
9493@var{num} is nonzero, then you must build all modules with the same
9494value, including any libraries.  This includes the system libraries and
9495startup modules.
9496
9497@item -msseregparm
9498@opindex msseregparm
9499Use SSE register passing conventions for float and double arguments
9500and return values.  You can control this behavior for a specific
9501function by using the function attribute @samp{sseregparm}.
9502@xref{Function Attributes}.
9503
9504@strong{Warning:} if you use this switch then you must build all
9505modules with the same value, including any libraries.  This includes
9506the system libraries and startup modules.
9507
9508@item -mstackrealign
9509@opindex mstackrealign
9510Realign the stack at entry.  On the Intel x86, the
9511@option{-mstackrealign} option will generate an alternate prologue and
9512epilogue that realigns the runtime stack.  This supports mixing legacy
9513codes that keep a 4-byte aligned stack with modern codes that keep a
951416-byte stack for SSE compatibility.  The alternate prologue and
9515epilogue are slower and bigger than the regular ones, and the
9516alternate prologue requires an extra scratch register; this lowers the
9517number of registers available if used in conjunction with the
9518@code{regparm} attribute.  The @option{-mstackrealign} option is
9519incompatible with the nested function prologue; this is considered a
9520hard error.  See also the attribute @code{force_align_arg_pointer},
9521applicable to individual functions.
9522
9523@item -mpreferred-stack-boundary=@var{num}
9524@opindex mpreferred-stack-boundary
9525Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
9526byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
9527the default is 4 (16 bytes or 128 bits).
9528
9529On Pentium and PentiumPro, @code{double} and @code{long double} values
9530should be aligned to an 8 byte boundary (see @option{-malign-double}) or
9531suffer significant run time performance penalties.  On Pentium III, the
9532Streaming SIMD Extension (SSE) data type @code{__m128} may not work
9533properly if it is not 16 byte aligned.
9534
9535To ensure proper alignment of this values on the stack, the stack boundary
9536must be as aligned as that required by any value stored on the stack.
9537Further, every function must be generated such that it keeps the stack
9538aligned.  Thus calling a function compiled with a higher preferred
9539stack boundary from a function compiled with a lower preferred stack
9540boundary will most likely misalign the stack.  It is recommended that
9541libraries that use callbacks always use the default setting.
9542
9543This extra alignment does consume extra stack space, and generally
9544increases code size.  Code that is sensitive to stack space usage, such
9545as embedded systems and operating system kernels, may want to reduce the
9546preferred alignment to @option{-mpreferred-stack-boundary=2}.
9547
9548@item -mmmx
9549@itemx -mno-mmx
9550@item -msse
9551@itemx -mno-sse
9552@item -msse2
9553@itemx -mno-sse2
9554@item -msse3
9555@itemx -mno-sse3
9556@item -mssse3
9557@itemx -mno-ssse3
9558@item -msse4a
9559@item -mno-sse4a
9560@item -m3dnow
9561@itemx -mno-3dnow
9562@item -mpopcnt
9563@itemx -mno-popcnt
9564@item -mabm
9565@itemx -mno-abm
9566@item -maes
9567@itemx -mno-aes
9568@opindex mmmx
9569@opindex mno-mmx
9570@opindex msse
9571@opindex mno-sse
9572@opindex m3dnow
9573@opindex mno-3dnow
9574These switches enable or disable the use of instructions in the MMX,
9575SSE, SSE2, SSE3, SSSE3, SSE4A, ABM, AES or 3DNow! extended
9576instruction sets.  These extensions are also available as built-in
9577functions: see @ref{X86 Built-in Functions}, for details of the functions
9578enabled and disabled by these switches.
9579
9580To have SSE/SSE2 instructions generated automatically from floating-point
9581code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
9582
9583These options will enable GCC to use these extended instructions in
9584generated code, even without @option{-mfpmath=sse}.  Applications which
9585perform runtime CPU detection must compile separate files for each
9586supported architecture, using the appropriate flags.  In particular,
9587the file containing the CPU detection code should be compiled without
9588these options.
9589
9590@item -mpush-args
9591@itemx -mno-push-args
9592@opindex mpush-args
9593@opindex mno-push-args
9594Use PUSH operations to store outgoing parameters.  This method is shorter
9595and usually equally fast as method using SUB/MOV operations and is enabled
9596by default.  In some cases disabling it may improve performance because of
9597improved scheduling and reduced dependencies.
9598
9599@item -maccumulate-outgoing-args
9600@opindex maccumulate-outgoing-args
9601If enabled, the maximum amount of space required for outgoing arguments will be
9602computed in the function prologue.  This is faster on most modern CPUs
9603because of reduced dependencies, improved scheduling and reduced stack usage
9604when preferred stack boundary is not equal to 2.  The drawback is a notable
9605increase in code size.  This switch implies @option{-mno-push-args}.
9606
9607@item -mthreads
9608@opindex mthreads
9609Support thread-safe exception handling on @samp{Mingw32}.  Code that relies
9610on thread-safe exception handling must compile and link all code with the
9611@option{-mthreads} option.  When compiling, @option{-mthreads} defines
9612@option{-D_MT}; when linking, it links in a special thread helper library
9613@option{-lmingwthrd} which cleans up per thread exception handling data.
9614
9615@item -mno-align-stringops
9616@opindex mno-align-stringops
9617Do not align destination of inlined string operations.  This switch reduces
9618code size and improves performance in case the destination is already aligned,
9619but GCC doesn't know about it.
9620
9621@item -minline-all-stringops
9622@opindex minline-all-stringops
9623By default GCC inlines string operations only when destination is known to be
9624aligned at least to 4 byte boundary.  This enables more inlining, increase code
9625size, but may improve performance of code that depends on fast memcpy, strlen
9626and memset for short lengths.
9627
9628@item -momit-leaf-frame-pointer
9629@opindex momit-leaf-frame-pointer
9630Don't keep the frame pointer in a register for leaf functions.  This
9631avoids the instructions to save, set up and restore frame pointers and
9632makes an extra register available in leaf functions.  The option
9633@option{-fomit-frame-pointer} removes the frame pointer for all functions
9634which might make debugging harder.
9635
9636@item -mtls-direct-seg-refs
9637@itemx -mno-tls-direct-seg-refs
9638@opindex mtls-direct-seg-refs
9639Controls whether TLS variables may be accessed with offsets from the
9640TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
9641or whether the thread base pointer must be added.  Whether or not this
9642is legal depends on the operating system, and whether it maps the
9643segment to cover the entire TLS area.
9644
9645For systems that use GNU libc, the default is on.
9646@end table
9647
9648These @samp{-m} switches are supported in addition to the above
9649on AMD x86-64 processors in 64-bit environments.
9650
9651@table @gcctabopt
9652@item -m32
9653@itemx -m64
9654@opindex m32
9655@opindex m64
9656Generate code for a 32-bit or 64-bit environment.
9657The 32-bit environment sets int, long and pointer to 32 bits and
9658generates code that runs on any i386 system.
9659The 64-bit environment sets int to 32 bits and long and pointer
9660to 64 bits and generates code for AMD's x86-64 architecture. For
9661darwin only the -m64 option turns off the @option{-fno-pic} and
9662@option{-mdynamic-no-pic} options.
9663
9664@item -mno-red-zone
9665@opindex no-red-zone
9666Do not use a so called red zone for x86-64 code.  The red zone is mandated
9667by the x86-64 ABI, it is a 128-byte area beyond the location of the
9668stack pointer that will not be modified by signal or interrupt handlers
9669and therefore can be used for temporary data without adjusting the stack
9670pointer.  The flag @option{-mno-red-zone} disables this red zone.
9671
9672@item -mcmodel=small
9673@opindex mcmodel=small
9674Generate code for the small code model: the program and its symbols must
9675be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
9676Programs can be statically or dynamically linked.  This is the default
9677code model.
9678
9679@item -mcmodel=kernel
9680@opindex mcmodel=kernel
9681Generate code for the kernel code model.  The kernel runs in the
9682negative 2 GB of the address space.
9683This model has to be used for Linux kernel code.
9684
9685@item -mcmodel=medium
9686@opindex mcmodel=medium
9687Generate code for the medium model: The program is linked in the lower 2
9688GB of the address space but symbols can be located anywhere in the
9689address space.  Programs can be statically or dynamically linked, but
9690building of shared libraries are not supported with the medium model.
9691
9692@item -mcmodel=large
9693@opindex mcmodel=large
9694Generate code for the large model: This model makes no assumptions
9695about addresses and sizes of sections.  Currently GCC does not implement
9696this model.
9697@end table
9698
9699@node IA-64 Options
9700@subsection IA-64 Options
9701@cindex IA-64 Options
9702
9703These are the @samp{-m} options defined for the Intel IA-64 architecture.
9704
9705@table @gcctabopt
9706@item -mbig-endian
9707@opindex mbig-endian
9708Generate code for a big endian target.  This is the default for HP-UX@.
9709
9710@item -mlittle-endian
9711@opindex mlittle-endian
9712Generate code for a little endian target.  This is the default for AIX5
9713and GNU/Linux.
9714
9715@item -mgnu-as
9716@itemx -mno-gnu-as
9717@opindex mgnu-as
9718@opindex mno-gnu-as
9719Generate (or don't) code for the GNU assembler.  This is the default.
9720@c Also, this is the default if the configure option @option{--with-gnu-as}
9721@c is used.
9722
9723@item -mgnu-ld
9724@itemx -mno-gnu-ld
9725@opindex mgnu-ld
9726@opindex mno-gnu-ld
9727Generate (or don't) code for the GNU linker.  This is the default.
9728@c Also, this is the default if the configure option @option{--with-gnu-ld}
9729@c is used.
9730
9731@item -mno-pic
9732@opindex mno-pic
9733Generate code that does not use a global pointer register.  The result
9734is not position independent code, and violates the IA-64 ABI@.
9735
9736@item -mvolatile-asm-stop
9737@itemx -mno-volatile-asm-stop
9738@opindex mvolatile-asm-stop
9739@opindex mno-volatile-asm-stop
9740Generate (or don't) a stop bit immediately before and after volatile asm
9741statements.
9742
9743@item -mregister-names
9744@itemx -mno-register-names
9745@opindex mregister-names
9746@opindex mno-register-names
9747Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
9748the stacked registers.  This may make assembler output more readable.
9749
9750@item -mno-sdata
9751@itemx -msdata
9752@opindex mno-sdata
9753@opindex msdata
9754Disable (or enable) optimizations that use the small data section.  This may
9755be useful for working around optimizer bugs.
9756
9757@item -mconstant-gp
9758@opindex mconstant-gp
9759Generate code that uses a single constant global pointer value.  This is
9760useful when compiling kernel code.
9761
9762@item -mauto-pic
9763@opindex mauto-pic
9764Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
9765This is useful when compiling firmware code.
9766
9767@item -minline-float-divide-min-latency
9768@opindex minline-float-divide-min-latency
9769Generate code for inline divides of floating point values
9770using the minimum latency algorithm.
9771
9772@item -minline-float-divide-max-throughput
9773@opindex minline-float-divide-max-throughput
9774Generate code for inline divides of floating point values
9775using the maximum throughput algorithm.
9776
9777@item -minline-int-divide-min-latency
9778@opindex minline-int-divide-min-latency
9779Generate code for inline divides of integer values
9780using the minimum latency algorithm.
9781
9782@item -minline-int-divide-max-throughput
9783@opindex minline-int-divide-max-throughput
9784Generate code for inline divides of integer values
9785using the maximum throughput algorithm.
9786
9787@item -minline-sqrt-min-latency
9788@opindex minline-sqrt-min-latency
9789Generate code for inline square roots
9790using the minimum latency algorithm.
9791
9792@item -minline-sqrt-max-throughput
9793@opindex minline-sqrt-max-throughput
9794Generate code for inline square roots
9795using the maximum throughput algorithm.
9796
9797@item -mno-dwarf2-asm
9798@itemx -mdwarf2-asm
9799@opindex mno-dwarf2-asm
9800@opindex mdwarf2-asm
9801Don't (or do) generate assembler code for the DWARF2 line number debugging
9802info.  This may be useful when not using the GNU assembler.
9803
9804@item -mearly-stop-bits
9805@itemx -mno-early-stop-bits
9806@opindex mearly-stop-bits
9807@opindex mno-early-stop-bits
9808Allow stop bits to be placed earlier than immediately preceding the
9809instruction that triggered the stop bit.  This can improve instruction
9810scheduling, but does not always do so.
9811
9812@item -mfixed-range=@var{register-range}
9813@opindex mfixed-range
9814Generate code treating the given register range as fixed registers.
9815A fixed register is one that the register allocator can not use.  This is
9816useful when compiling kernel code.  A register range is specified as
9817two registers separated by a dash.  Multiple register ranges can be
9818specified separated by a comma.
9819
9820@item -mtls-size=@var{tls-size}
9821@opindex mtls-size
9822Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
982364.
9824
9825@item -mtune=@var{cpu-type}
9826@opindex mtune
9827Tune the instruction scheduling for a particular CPU, Valid values are
9828itanium, itanium1, merced, itanium2, and mckinley.
9829
9830@item -mt
9831@itemx -pthread
9832@opindex mt
9833@opindex pthread
9834Add support for multithreading using the POSIX threads library.  This
9835option sets flags for both the preprocessor and linker.  It does
9836not affect the thread safety of object code produced by the compiler or
9837that of libraries supplied with it.  These are HP-UX specific flags.
9838
9839@item -milp32
9840@itemx -mlp64
9841@opindex milp32
9842@opindex mlp64
9843Generate code for a 32-bit or 64-bit environment.
9844The 32-bit environment sets int, long and pointer to 32 bits.
9845The 64-bit environment sets int to 32 bits and long and pointer
9846to 64 bits.  These are HP-UX specific flags.
9847
9848@item -mno-sched-br-data-spec
9849@itemx -msched-br-data-spec
9850@opindex mno-sched-br-data-spec
9851@opindex msched-br-data-spec
9852(Dis/En)able data speculative scheduling before reload.
9853This will result in generation of the ld.a instructions and
9854the corresponding check instructions (ld.c / chk.a).
9855The default is 'disable'.
9856
9857@item -msched-ar-data-spec
9858@itemx -mno-sched-ar-data-spec
9859@opindex msched-ar-data-spec
9860@opindex mno-sched-ar-data-spec
9861(En/Dis)able data speculative scheduling after reload.
9862This will result in generation of the ld.a instructions and
9863the corresponding check instructions (ld.c / chk.a).
9864The default is 'enable'.
9865
9866@item -mno-sched-control-spec
9867@itemx -msched-control-spec
9868@opindex mno-sched-control-spec
9869@opindex msched-control-spec
9870(Dis/En)able control speculative scheduling.  This feature is
9871available only during region scheduling (i.e. before reload).
9872This will result in generation of the ld.s instructions and
9873the corresponding check instructions chk.s .
9874The default is 'disable'.
9875
9876@item -msched-br-in-data-spec
9877@itemx -mno-sched-br-in-data-spec
9878@opindex msched-br-in-data-spec
9879@opindex mno-sched-br-in-data-spec
9880(En/Dis)able speculative scheduling of the instructions that
9881are dependent on the data speculative loads before reload.
9882This is effective only with @option{-msched-br-data-spec} enabled.
9883The default is 'enable'.
9884
9885@item -msched-ar-in-data-spec
9886@itemx -mno-sched-ar-in-data-spec
9887@opindex msched-ar-in-data-spec
9888@opindex mno-sched-ar-in-data-spec
9889(En/Dis)able speculative scheduling of the instructions that
9890are dependent on the data speculative loads after reload.
9891This is effective only with @option{-msched-ar-data-spec} enabled.
9892The default is 'enable'.
9893
9894@item -msched-in-control-spec
9895@itemx -mno-sched-in-control-spec
9896@opindex msched-in-control-spec
9897@opindex mno-sched-in-control-spec
9898(En/Dis)able speculative scheduling of the instructions that
9899are dependent on the control speculative loads.
9900This is effective only with @option{-msched-control-spec} enabled.
9901The default is 'enable'.
9902
9903@item -msched-ldc
9904@itemx -mno-sched-ldc
9905@opindex msched-ldc
9906@opindex mno-sched-ldc
9907(En/Dis)able use of simple data speculation checks ld.c .
9908If disabled, only chk.a instructions will be emitted to check
9909data speculative loads.
9910The default is 'enable'.
9911
9912@item -mno-sched-control-ldc
9913@itemx -msched-control-ldc
9914@opindex mno-sched-control-ldc
9915@opindex msched-control-ldc 
9916(Dis/En)able use of ld.c instructions to check control speculative loads.
9917If enabled, in case of control speculative load with no speculatively
9918scheduled dependent instructions this load will be emitted as ld.sa and
9919ld.c will be used to check it.
9920The default is 'disable'.
9921
9922@item -mno-sched-spec-verbose
9923@itemx -msched-spec-verbose
9924@opindex mno-sched-spec-verbose
9925@opindex msched-spec-verbose
9926(Dis/En)able printing of the information about speculative motions.
9927
9928@item -mno-sched-prefer-non-data-spec-insns
9929@itemx -msched-prefer-non-data-spec-insns
9930@opindex mno-sched-prefer-non-data-spec-insns
9931@opindex msched-prefer-non-data-spec-insns
9932If enabled, data speculative instructions will be chosen for schedule
9933only if there are no other choices at the moment.  This will make
9934the use of the data speculation much more conservative.
9935The default is 'disable'.
9936
9937@item -mno-sched-prefer-non-control-spec-insns
9938@itemx -msched-prefer-non-control-spec-insns
9939@opindex mno-sched-prefer-non-control-spec-insns
9940@opindex msched-prefer-non-control-spec-insns
9941If enabled, control speculative instructions will be chosen for schedule
9942only if there are no other choices at the moment.  This will make
9943the use of the control speculation much more conservative.
9944The default is 'disable'.
9945
9946@item -mno-sched-count-spec-in-critical-path
9947@itemx -msched-count-spec-in-critical-path
9948@opindex mno-sched-count-spec-in-critical-path
9949@opindex msched-count-spec-in-critical-path
9950If enabled, speculative dependencies will be considered during
9951computation of the instructions priorities.  This will make the use of the
9952speculation a bit more conservative.
9953The default is 'disable'.
9954
9955@end table
9956
9957@node M32C Options
9958@subsection M32C Options
9959@cindex M32C options
9960
9961@table @gcctabopt
9962@item -mcpu=@var{name}
9963@opindex mcpu=
9964Select the CPU for which code is generated.  @var{name} may be one of
9965@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
9966/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
9967the M32C/80 series.
9968
9969@item -msim
9970@opindex msim
9971Specifies that the program will be run on the simulator.  This causes
9972an alternate runtime library to be linked in which supports, for
9973example, file I/O.  You must not use this option when generating
9974programs that will run on real hardware; you must provide your own
9975runtime library for whatever I/O functions are needed.
9976
9977@item -memregs=@var{number}
9978@opindex memregs=
9979Specifies the number of memory-based pseudo-registers GCC will use
9980during code generation.  These pseudo-registers will be used like real
9981registers, so there is a tradeoff between GCC's ability to fit the
9982code into available registers, and the performance penalty of using
9983memory instead of registers.  Note that all modules in a program must
9984be compiled with the same value for this option.  Because of that, you
9985must not use this option with the default runtime libraries gcc
9986builds.
9987
9988@end table
9989
9990@node M32R/D Options
9991@subsection M32R/D Options
9992@cindex M32R/D options
9993
9994These @option{-m} options are defined for Renesas M32R/D architectures:
9995
9996@table @gcctabopt
9997@item -m32r2
9998@opindex m32r2
9999Generate code for the M32R/2@.
10000
10001@item -m32rx
10002@opindex m32rx
10003Generate code for the M32R/X@.
10004
10005@item -m32r
10006@opindex m32r
10007Generate code for the M32R@.  This is the default.
10008
10009@item -mmodel=small
10010@opindex mmodel=small
10011Assume all objects live in the lower 16MB of memory (so that their addresses
10012can be loaded with the @code{ld24} instruction), and assume all subroutines
10013are reachable with the @code{bl} instruction.
10014This is the default.
10015
10016The addressability of a particular object can be set with the
10017@code{model} attribute.
10018
10019@item -mmodel=medium
10020@opindex mmodel=medium
10021Assume objects may be anywhere in the 32-bit address space (the compiler
10022will generate @code{seth/add3} instructions to load their addresses), and
10023assume all subroutines are reachable with the @code{bl} instruction.
10024
10025@item -mmodel=large
10026@opindex mmodel=large
10027Assume objects may be anywhere in the 32-bit address space (the compiler
10028will generate @code{seth/add3} instructions to load their addresses), and
10029assume subroutines may not be reachable with the @code{bl} instruction
10030(the compiler will generate the much slower @code{seth/add3/jl}
10031instruction sequence).
10032
10033@item -msdata=none
10034@opindex msdata=none
10035Disable use of the small data area.  Variables will be put into
10036one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
10037@code{section} attribute has been specified).
10038This is the default.
10039
10040The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
10041Objects may be explicitly put in the small data area with the
10042@code{section} attribute using one of these sections.
10043
10044@item -msdata=sdata
10045@opindex msdata=sdata
10046Put small global and static data in the small data area, but do not
10047generate special code to reference them.
10048
10049@item -msdata=use
10050@opindex msdata=use
10051Put small global and static data in the small data area, and generate
10052special instructions to reference them.
10053
10054@item -G @var{num}
10055@opindex G
10056@cindex smaller data references
10057Put global and static objects less than or equal to @var{num} bytes
10058into the small data or bss sections instead of the normal data or bss
10059sections.  The default value of @var{num} is 8.
10060The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
10061for this option to have any effect.
10062
10063All modules should be compiled with the same @option{-G @var{num}} value.
10064Compiling with different values of @var{num} may or may not work; if it
10065doesn't the linker will give an error message---incorrect code will not be
10066generated.
10067
10068@item -mdebug
10069@opindex mdebug
10070Makes the M32R specific code in the compiler display some statistics
10071that might help in debugging programs.
10072
10073@item -malign-loops
10074@opindex malign-loops
10075Align all loops to a 32-byte boundary.
10076
10077@item -mno-align-loops
10078@opindex mno-align-loops
10079Do not enforce a 32-byte alignment for loops.  This is the default.
10080
10081@item -missue-rate=@var{number}
10082@opindex missue-rate=@var{number}
10083Issue @var{number} instructions per cycle.  @var{number} can only be 1
10084or 2.
10085
10086@item -mbranch-cost=@var{number}
10087@opindex mbranch-cost=@var{number}
10088@var{number} can only be 1 or 2.  If it is 1 then branches will be
10089preferred over conditional code, if it is 2, then the opposite will
10090apply.
10091
10092@item -mflush-trap=@var{number}
10093@opindex mflush-trap=@var{number}
10094Specifies the trap number to use to flush the cache.  The default is
1009512.  Valid numbers are between 0 and 15 inclusive.
10096
10097@item -mno-flush-trap
10098@opindex mno-flush-trap
10099Specifies that the cache cannot be flushed by using a trap.
10100
10101@item -mflush-func=@var{name}
10102@opindex mflush-func=@var{name}
10103Specifies the name of the operating system function to call to flush
10104the cache.  The default is @emph{_flush_cache}, but a function call
10105will only be used if a trap is not available.
10106
10107@item -mno-flush-func
10108@opindex mno-flush-func
10109Indicates that there is no OS function for flushing the cache.
10110
10111@end table
10112
10113@node M680x0 Options
10114@subsection M680x0 Options
10115@cindex M680x0 options
10116
10117These are the @samp{-m} options defined for the 68000 series.  The default
10118values for these options depends on which style of 68000 was selected when
10119the compiler was configured; the defaults for the most common choices are
10120given below.
10121
10122@table @gcctabopt
10123@item -m68000
10124@itemx -mc68000
10125@opindex m68000
10126@opindex mc68000
10127Generate output for a 68000.  This is the default
10128when the compiler is configured for 68000-based systems.
10129
10130Use this option for microcontrollers with a 68000 or EC000 core,
10131including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
10132
10133@item -m68020
10134@itemx -mc68020
10135@opindex m68020
10136@opindex mc68020
10137Generate output for a 68020.  This is the default
10138when the compiler is configured for 68020-based systems.
10139
10140@item -m68881
10141@opindex m68881
10142Generate output containing 68881 instructions for floating point.
10143This is the default for most 68020 systems unless @option{--nfp} was
10144specified when the compiler was configured.
10145
10146@item -m68030
10147@opindex m68030
10148Generate output for a 68030.  This is the default when the compiler is
10149configured for 68030-based systems.
10150
10151@item -m68040
10152@opindex m68040
10153Generate output for a 68040.  This is the default when the compiler is
10154configured for 68040-based systems.
10155
10156This option inhibits the use of 68881/68882 instructions that have to be
10157emulated by software on the 68040.  Use this option if your 68040 does not
10158have code to emulate those instructions.
10159
10160@item -m68060
10161@opindex m68060
10162Generate output for a 68060.  This is the default when the compiler is
10163configured for 68060-based systems.
10164
10165This option inhibits the use of 68020 and 68881/68882 instructions that
10166have to be emulated by software on the 68060.  Use this option if your 68060
10167does not have code to emulate those instructions.
10168
10169@item -mcpu32
10170@opindex mcpu32
10171Generate output for a CPU32.  This is the default
10172when the compiler is configured for CPU32-based systems.
10173
10174Use this option for microcontrollers with a
10175CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
1017668336, 68340, 68341, 68349 and 68360.
10177
10178@item -m5200
10179@opindex m5200
10180Generate output for a 520X ``coldfire'' family cpu.  This is the default
10181when the compiler is configured for 520X-based systems.
10182
10183Use this option for microcontroller with a 5200 core, including
10184the MCF5202, MCF5203, MCF5204 and MCF5202.
10185
10186@item -mcfv4e
10187@opindex mcfv4e
10188Generate output for a ColdFire V4e family cpu (e.g.@: 547x/548x).
10189This includes use of hardware floating point instructions.
10190
10191@item -m68020-40
10192@opindex m68020-40
10193Generate output for a 68040, without using any of the new instructions.
10194This results in code which can run relatively efficiently on either a
1019568020/68881 or a 68030 or a 68040.  The generated code does use the
1019668881 instructions that are emulated on the 68040.
10197
10198@item -m68020-60
10199@opindex m68020-60
10200Generate output for a 68060, without using any of the new instructions.
10201This results in code which can run relatively efficiently on either a
1020268020/68881 or a 68030 or a 68040.  The generated code does use the
1020368881 instructions that are emulated on the 68060.
10204
10205@item -msoft-float
10206@opindex msoft-float
10207Generate output containing library calls for floating point.
10208@strong{Warning:} the requisite libraries are not available for all m68k
10209targets.  Normally the facilities of the machine's usual C compiler are
10210used, but this can't be done directly in cross-compilation.  You must
10211make your own arrangements to provide suitable library functions for
10212cross-compilation.  The embedded targets @samp{m68k-*-aout} and
10213@samp{m68k-*-coff} do provide software floating point support.
10214
10215@item -mshort
10216@opindex mshort
10217Consider type @code{int} to be 16 bits wide, like @code{short int}.
10218Additionally, parameters passed on the stack are also aligned to a
1021916-bit boundary even on targets whose API mandates promotion to 32-bit.
10220
10221@item -mnobitfield
10222@opindex mnobitfield
10223Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
10224and @option{-m5200} options imply @w{@option{-mnobitfield}}.
10225
10226@item -mbitfield
10227@opindex mbitfield
10228Do use the bit-field instructions.  The @option{-m68020} option implies
10229@option{-mbitfield}.  This is the default if you use a configuration
10230designed for a 68020.
10231
10232@item -mrtd
10233@opindex mrtd
10234Use a different function-calling convention, in which functions
10235that take a fixed number of arguments return with the @code{rtd}
10236instruction, which pops their arguments while returning.  This
10237saves one instruction in the caller since there is no need to pop
10238the arguments there.
10239
10240This calling convention is incompatible with the one normally
10241used on Unix, so you cannot use it if you need to call libraries
10242compiled with the Unix compiler.
10243
10244Also, you must provide function prototypes for all functions that
10245take variable numbers of arguments (including @code{printf});
10246otherwise incorrect code will be generated for calls to those
10247functions.
10248
10249In addition, seriously incorrect code will result if you call a
10250function with too many arguments.  (Normally, extra arguments are
10251harmlessly ignored.)
10252
10253The @code{rtd} instruction is supported by the 68010, 68020, 68030,
1025468040, 68060 and CPU32 processors, but not by the 68000 or 5200.
10255
10256@item -malign-int
10257@itemx -mno-align-int
10258@opindex malign-int
10259@opindex mno-align-int
10260Control whether GCC aligns @code{int}, @code{long}, @code{long long},
10261@code{float}, @code{double}, and @code{long double} variables on a 32-bit
10262boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
10263Aligning variables on 32-bit boundaries produces code that runs somewhat
10264faster on processors with 32-bit busses at the expense of more memory.
10265
10266@strong{Warning:} if you use the @option{-malign-int} switch, GCC will
10267align structures containing the above types  differently than
10268most published application binary interface specifications for the m68k.
10269
10270@item -mpcrel
10271@opindex mpcrel
10272Use the pc-relative addressing mode of the 68000 directly, instead of
10273using a global offset table.  At present, this option implies @option{-fpic},
10274allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
10275not presently supported with @option{-mpcrel}, though this could be supported for
1027668020 and higher processors.
10277
10278@item -mno-strict-align
10279@itemx -mstrict-align
10280@opindex mno-strict-align
10281@opindex mstrict-align
10282Do not (do) assume that unaligned memory references will be handled by
10283the system.
10284
10285@item -msep-data
10286Generate code that allows the data segment to be located in a different
10287area of memory from the text segment.  This allows for execute in place in
10288an environment without virtual memory management.  This option implies
10289@option{-fPIC}.
10290
10291@item -mno-sep-data
10292Generate code that assumes that the data segment follows the text segment.
10293This is the default.
10294
10295@item -mid-shared-library
10296Generate code that supports shared libraries via the library ID method.
10297This allows for execute in place and shared libraries in an environment
10298without virtual memory management.  This option implies @option{-fPIC}.
10299
10300@item -mno-id-shared-library
10301Generate code that doesn't assume ID based shared libraries are being used.
10302This is the default.
10303
10304@item -mshared-library-id=n
10305Specified the identification number of the ID based shared library being
10306compiled.  Specifying a value of 0 will generate more compact code, specifying
10307other values will force the allocation of that number to the current
10308library but is no more space or time efficient than omitting this option.
10309
10310@end table
10311
10312@node M68hc1x Options
10313@subsection M68hc1x Options
10314@cindex M68hc1x options
10315
10316These are the @samp{-m} options defined for the 68hc11 and 68hc12
10317microcontrollers.  The default values for these options depends on
10318which style of microcontroller was selected when the compiler was configured;
10319the defaults for the most common choices are given below.
10320
10321@table @gcctabopt
10322@item -m6811
10323@itemx -m68hc11
10324@opindex m6811
10325@opindex m68hc11
10326Generate output for a 68HC11.  This is the default
10327when the compiler is configured for 68HC11-based systems.
10328
10329@item -m6812
10330@itemx -m68hc12
10331@opindex m6812
10332@opindex m68hc12
10333Generate output for a 68HC12.  This is the default
10334when the compiler is configured for 68HC12-based systems.
10335
10336@item -m68S12
10337@itemx -m68hcs12
10338@opindex m68S12
10339@opindex m68hcs12
10340Generate output for a 68HCS12.
10341
10342@item -mauto-incdec
10343@opindex mauto-incdec
10344Enable the use of 68HC12 pre and post auto-increment and auto-decrement
10345addressing modes.
10346
10347@item -minmax
10348@itemx -nominmax
10349@opindex minmax
10350@opindex mnominmax
10351Enable the use of 68HC12 min and max instructions.
10352
10353@item -mlong-calls
10354@itemx -mno-long-calls
10355@opindex mlong-calls
10356@opindex mno-long-calls
10357Treat all calls as being far away (near).  If calls are assumed to be
10358far away, the compiler will use the @code{call} instruction to
10359call a function and the @code{rtc} instruction for returning.
10360
10361@item -mshort
10362@opindex mshort
10363Consider type @code{int} to be 16 bits wide, like @code{short int}.
10364
10365@item -msoft-reg-count=@var{count}
10366@opindex msoft-reg-count
10367Specify the number of pseudo-soft registers which are used for the
10368code generation.  The maximum number is 32.  Using more pseudo-soft
10369register may or may not result in better code depending on the program.
10370The default is 4 for 68HC11 and 2 for 68HC12.
10371
10372@end table
10373
10374@node MCore Options
10375@subsection MCore Options
10376@cindex MCore options
10377
10378These are the @samp{-m} options defined for the Motorola M*Core
10379processors.
10380
10381@table @gcctabopt
10382
10383@item -mhardlit
10384@itemx -mno-hardlit
10385@opindex mhardlit
10386@opindex mno-hardlit
10387Inline constants into the code stream if it can be done in two
10388instructions or less.
10389
10390@item -mdiv
10391@itemx -mno-div
10392@opindex mdiv
10393@opindex mno-div
10394Use the divide instruction.  (Enabled by default).
10395
10396@item -mrelax-immediate
10397@itemx -mno-relax-immediate
10398@opindex mrelax-immediate
10399@opindex mno-relax-immediate
10400Allow arbitrary sized immediates in bit operations.
10401
10402@item -mwide-bitfields
10403@itemx -mno-wide-bitfields
10404@opindex mwide-bitfields
10405@opindex mno-wide-bitfields
10406Always treat bit-fields as int-sized.
10407
10408@item -m4byte-functions
10409@itemx -mno-4byte-functions
10410@opindex m4byte-functions
10411@opindex mno-4byte-functions
10412Force all functions to be aligned to a four byte boundary.
10413
10414@item -mcallgraph-data
10415@itemx -mno-callgraph-data
10416@opindex mcallgraph-data
10417@opindex mno-callgraph-data
10418Emit callgraph information.
10419
10420@item -mslow-bytes
10421@itemx -mno-slow-bytes
10422@opindex mslow-bytes
10423@opindex mno-slow-bytes
10424Prefer word access when reading byte quantities.
10425
10426@item -mlittle-endian
10427@itemx -mbig-endian
10428@opindex mlittle-endian
10429@opindex mbig-endian
10430Generate code for a little endian target.
10431
10432@item -m210
10433@itemx -m340
10434@opindex m210
10435@opindex m340
10436Generate code for the 210 processor.
10437@end table
10438
10439@node MIPS Options
10440@subsection MIPS Options
10441@cindex MIPS options
10442
10443@table @gcctabopt
10444
10445@item -EB
10446@opindex EB
10447Generate big-endian code.
10448
10449@item -EL
10450@opindex EL
10451Generate little-endian code.  This is the default for @samp{mips*el-*-*}
10452configurations.
10453
10454@item -march=@var{arch}
10455@opindex march
10456Generate code that will run on @var{arch}, which can be the name of a
10457generic MIPS ISA, or the name of a particular processor.
10458The ISA names are:
10459@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
10460@samp{mips32}, @samp{mips32r2}, and @samp{mips64}.
10461The processor names are:
10462@samp{4kc}, @samp{4km}, @samp{4kp},
10463@samp{5kc}, @samp{5kf},
10464@samp{20kc},
10465@samp{24k}, @samp{24kc}, @samp{24kf}, @samp{24kx},
10466@samp{m4k},
10467@samp{orion},
10468@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
10469@samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000},
10470@samp{rm7000}, @samp{rm9000},
10471@samp{sb1},
10472@samp{sr71000},
10473@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
10474@samp{vr5000}, @samp{vr5400} and @samp{vr5500}.
10475The special value @samp{from-abi} selects the
10476most compatible architecture for the selected ABI (that is,
10477@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
10478
10479In processor names, a final @samp{000} can be abbreviated as @samp{k}
10480(for example, @samp{-march=r2k}).  Prefixes are optional, and
10481@samp{vr} may be written @samp{r}.
10482
10483GCC defines two macros based on the value of this option.  The first
10484is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
10485a string.  The second has the form @samp{_MIPS_ARCH_@var{foo}},
10486where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
10487For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
10488to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
10489
10490Note that the @samp{_MIPS_ARCH} macro uses the processor names given
10491above.  In other words, it will have the full prefix and will not
10492abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
10493the macro names the resolved architecture (either @samp{"mips1"} or
10494@samp{"mips3"}).  It names the default architecture when no
10495@option{-march} option is given.
10496
10497@item -mtune=@var{arch}
10498@opindex mtune
10499Optimize for @var{arch}.  Among other things, this option controls
10500the way instructions are scheduled, and the perceived cost of arithmetic
10501operations.  The list of @var{arch} values is the same as for
10502@option{-march}.
10503
10504When this option is not used, GCC will optimize for the processor
10505specified by @option{-march}.  By using @option{-march} and
10506@option{-mtune} together, it is possible to generate code that will
10507run on a family of processors, but optimize the code for one
10508particular member of that family.
10509
10510@samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
10511@samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
10512@samp{-march} ones described above.
10513
10514@item -mips1
10515@opindex mips1
10516Equivalent to @samp{-march=mips1}.
10517
10518@item -mips2
10519@opindex mips2
10520Equivalent to @samp{-march=mips2}.
10521
10522@item -mips3
10523@opindex mips3
10524Equivalent to @samp{-march=mips3}.
10525
10526@item -mips4
10527@opindex mips4
10528Equivalent to @samp{-march=mips4}.
10529
10530@item -mips32
10531@opindex mips32
10532Equivalent to @samp{-march=mips32}.
10533
10534@item -mips32r2
10535@opindex mips32r2
10536Equivalent to @samp{-march=mips32r2}.
10537
10538@item -mips64
10539@opindex mips64
10540Equivalent to @samp{-march=mips64}.
10541
10542@item -mips16
10543@itemx -mno-mips16
10544@opindex mips16
10545@opindex mno-mips16
10546Generate (do not generate) MIPS16 code.  If GCC is targetting a
10547MIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE@.
10548
10549@item -mabi=32
10550@itemx -mabi=o64
10551@itemx -mabi=n32
10552@itemx -mabi=64
10553@itemx -mabi=eabi
10554@opindex mabi=32
10555@opindex mabi=o64
10556@opindex mabi=n32
10557@opindex mabi=64
10558@opindex mabi=eabi
10559Generate code for the given ABI@.
10560
10561Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
10562generates 64-bit code when you select a 64-bit architecture, but you
10563can use @option{-mgp32} to get 32-bit code instead.
10564
10565For information about the O64 ABI, see
10566@w{@uref{http://gcc.gnu.org/projects/mipso64-abi.html}}.
10567
10568@item -mabicalls
10569@itemx -mno-abicalls
10570@opindex mabicalls
10571@opindex mno-abicalls
10572Generate (do not generate) code that is suitable for SVR4-style
10573dynamic objects.  @option{-mabicalls} is the default for SVR4-based
10574systems.
10575
10576@item -mshared
10577@itemx -mno-shared
10578Generate (do not generate) code that is fully position-independent,
10579and that can therefore be linked into shared libraries.  This option
10580only affects @option{-mabicalls}.
10581
10582All @option{-mabicalls} code has traditionally been position-independent,
10583regardless of options like @option{-fPIC} and @option{-fpic}.  However,
10584as an extension, the GNU toolchain allows executables to use absolute
10585accesses for locally-binding symbols.  It can also use shorter GP
10586initialization sequences and generate direct calls to locally-defined
10587functions.  This mode is selected by @option{-mno-shared}.
10588
10589@option{-mno-shared} depends on binutils 2.16 or higher and generates
10590objects that can only be linked by the GNU linker.  However, the option
10591does not affect the ABI of the final executable; it only affects the ABI
10592of relocatable objects.  Using @option{-mno-shared} will generally make
10593executables both smaller and quicker.
10594
10595@option{-mshared} is the default.
10596
10597@item -mxgot
10598@itemx -mno-xgot
10599@opindex mxgot
10600@opindex mno-xgot
10601Lift (do not lift) the usual restrictions on the size of the global
10602offset table.
10603
10604GCC normally uses a single instruction to load values from the GOT@.
10605While this is relatively efficient, it will only work if the GOT
10606is smaller than about 64k.  Anything larger will cause the linker
10607to report an error such as:
10608
10609@cindex relocation truncated to fit (MIPS)
10610@smallexample
10611relocation truncated to fit: R_MIPS_GOT16 foobar
10612@end smallexample
10613
10614If this happens, you should recompile your code with @option{-mxgot}.
10615It should then work with very large GOTs, although it will also be
10616less efficient, since it will take three instructions to fetch the
10617value of a global symbol.
10618
10619Note that some linkers can create multiple GOTs.  If you have such a
10620linker, you should only need to use @option{-mxgot} when a single object
10621file accesses more than 64k's worth of GOT entries.  Very few do.
10622
10623These options have no effect unless GCC is generating position
10624independent code.
10625
10626@item -mgp32
10627@opindex mgp32
10628Assume that general-purpose registers are 32 bits wide.
10629
10630@item -mgp64
10631@opindex mgp64
10632Assume that general-purpose registers are 64 bits wide.
10633
10634@item -mfp32
10635@opindex mfp32
10636Assume that floating-point registers are 32 bits wide.
10637
10638@item -mfp64
10639@opindex mfp64
10640Assume that floating-point registers are 64 bits wide.
10641
10642@item -mhard-float
10643@opindex mhard-float
10644Use floating-point coprocessor instructions.
10645
10646@item -msoft-float
10647@opindex msoft-float
10648Do not use floating-point coprocessor instructions.  Implement
10649floating-point calculations using library calls instead.
10650
10651@item -msingle-float
10652@opindex msingle-float
10653Assume that the floating-point coprocessor only supports single-precision
10654operations.
10655
10656@itemx -mdouble-float
10657@opindex mdouble-float
10658Assume that the floating-point coprocessor supports double-precision
10659operations.  This is the default.
10660
10661@itemx -mdsp
10662@itemx -mno-dsp
10663@opindex mdsp
10664@opindex mno-dsp
10665Use (do not use) the MIPS DSP ASE.  @xref{MIPS DSP Built-in Functions}.
10666
10667@itemx -mpaired-single
10668@itemx -mno-paired-single
10669@opindex mpaired-single
10670@opindex mno-paired-single
10671Use (do not use) paired-single floating-point instructions.
10672@xref{MIPS Paired-Single Support}.  This option can only be used
10673when generating 64-bit code and requires hardware floating-point
10674support to be enabled.
10675
10676@itemx -mips3d
10677@itemx -mno-mips3d
10678@opindex mips3d
10679@opindex mno-mips3d
10680Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
10681The option @option{-mips3d} implies @option{-mpaired-single}.
10682
10683@item -mlong64
10684@opindex mlong64
10685Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
10686an explanation of the default and the way that the pointer size is
10687determined.
10688
10689@item -mlong32
10690@opindex mlong32
10691Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
10692
10693The default size of @code{int}s, @code{long}s and pointers depends on
10694the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
10695uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
1069632-bit @code{long}s.  Pointers are the same size as @code{long}s,
10697or the same size as integer registers, whichever is smaller.
10698
10699@item -msym32
10700@itemx -mno-sym32
10701@opindex msym32
10702@opindex mno-sym32
10703Assume (do not assume) that all symbols have 32-bit values, regardless
10704of the selected ABI@.  This option is useful in combination with
10705@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
10706to generate shorter and faster references to symbolic addresses.
10707
10708@item -G @var{num}
10709@opindex G
10710@cindex smaller data references (MIPS)
10711@cindex gp-relative references (MIPS)
10712Put global and static items less than or equal to @var{num} bytes into
10713the small data or bss section instead of the normal data or bss section.
10714This allows the data to be accessed using a single instruction.
10715
10716All modules should be compiled with the same @option{-G @var{num}}
10717value.
10718
10719@item -membedded-data
10720@itemx -mno-embedded-data
10721@opindex membedded-data
10722@opindex mno-embedded-data
10723Allocate variables to the read-only data section first if possible, then
10724next in the small data section if possible, otherwise in data.  This gives
10725slightly slower code than the default, but reduces the amount of RAM required
10726when executing, and thus may be preferred for some embedded systems.
10727
10728@item -muninit-const-in-rodata
10729@itemx -mno-uninit-const-in-rodata
10730@opindex muninit-const-in-rodata
10731@opindex mno-uninit-const-in-rodata
10732Put uninitialized @code{const} variables in the read-only data section.
10733This option is only meaningful in conjunction with @option{-membedded-data}.
10734
10735@item -msplit-addresses
10736@itemx -mno-split-addresses
10737@opindex msplit-addresses
10738@opindex mno-split-addresses
10739Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
10740relocation operators.  This option has been superseded by
10741@option{-mexplicit-relocs} but is retained for backwards compatibility.
10742
10743@item -mexplicit-relocs
10744@itemx -mno-explicit-relocs
10745@opindex mexplicit-relocs
10746@opindex mno-explicit-relocs
10747Use (do not use) assembler relocation operators when dealing with symbolic
10748addresses.  The alternative, selected by @option{-mno-explicit-relocs},
10749is to use assembler macros instead.
10750
10751@option{-mexplicit-relocs} is the default if GCC was configured
10752to use an assembler that supports relocation operators.
10753
10754@item -mcheck-zero-division
10755@itemx -mno-check-zero-division
10756@opindex mcheck-zero-division
10757@opindex mno-check-zero-division
10758Trap (do not trap) on integer division by zero.  The default is
10759@option{-mcheck-zero-division}.
10760
10761@item -mdivide-traps
10762@itemx -mdivide-breaks
10763@opindex mdivide-traps
10764@opindex mdivide-breaks
10765MIPS systems check for division by zero by generating either a
10766conditional trap or a break instruction.  Using traps results in
10767smaller code, but is only supported on MIPS II and later.  Also, some
10768versions of the Linux kernel have a bug that prevents trap from
10769generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
10770allow conditional traps on architectures that support them and
10771@option{-mdivide-breaks} to force the use of breaks.
10772
10773The default is usually @option{-mdivide-traps}, but this can be
10774overridden at configure time using @option{--with-divide=breaks}.
10775Divide-by-zero checks can be completely disabled using
10776@option{-mno-check-zero-division}.
10777
10778@item -mmemcpy
10779@itemx -mno-memcpy
10780@opindex mmemcpy
10781@opindex mno-memcpy
10782Force (do not force) the use of @code{memcpy()} for non-trivial block
10783moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
10784most constant-sized copies.
10785
10786@item -mlong-calls
10787@itemx -mno-long-calls
10788@opindex mlong-calls
10789@opindex mno-long-calls
10790Disable (do not disable) use of the @code{jal} instruction.  Calling
10791functions using @code{jal} is more efficient but requires the caller
10792and callee to be in the same 256 megabyte segment.
10793
10794This option has no effect on abicalls code.  The default is
10795@option{-mno-long-calls}.
10796
10797@item -mmad
10798@itemx -mno-mad
10799@opindex mmad
10800@opindex mno-mad
10801Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
10802instructions, as provided by the R4650 ISA@.
10803
10804@item -mfused-madd
10805@itemx -mno-fused-madd
10806@opindex mfused-madd
10807@opindex mno-fused-madd
10808Enable (disable) use of the floating point multiply-accumulate
10809instructions, when they are available.  The default is
10810@option{-mfused-madd}.
10811
10812When multiply-accumulate instructions are used, the intermediate
10813product is calculated to infinite precision and is not subject to
10814the FCSR Flush to Zero bit.  This may be undesirable in some
10815circumstances.
10816
10817@item -nocpp
10818@opindex nocpp
10819Tell the MIPS assembler to not run its preprocessor over user
10820assembler files (with a @samp{.s} suffix) when assembling them.
10821
10822@item -mfix-r4000
10823@itemx -mno-fix-r4000
10824@opindex mfix-r4000
10825@opindex mno-fix-r4000
10826Work around certain R4000 CPU errata:
10827@itemize @minus
10828@item
10829A double-word or a variable shift may give an incorrect result if executed
10830immediately after starting an integer division.
10831@item
10832A double-word or a variable shift may give an incorrect result if executed
10833while an integer multiplication is in progress.
10834@item
10835An integer division may give an incorrect result if started in a delay slot
10836of a taken branch or a jump.
10837@end itemize
10838
10839@item -mfix-r4400
10840@itemx -mno-fix-r4400
10841@opindex mfix-r4400
10842@opindex mno-fix-r4400
10843Work around certain R4400 CPU errata:
10844@itemize @minus
10845@item
10846A double-word or a variable shift may give an incorrect result if executed
10847immediately after starting an integer division.
10848@end itemize
10849
10850@item -mfix-vr4120
10851@itemx -mno-fix-vr4120
10852@opindex mfix-vr4120
10853Work around certain VR4120 errata:
10854@itemize @minus
10855@item
10856@code{dmultu} does not always produce the correct result.
10857@item
10858@code{div} and @code{ddiv} do not always produce the correct result if one
10859of the operands is negative.
10860@end itemize
10861The workarounds for the division errata rely on special functions in
10862@file{libgcc.a}.  At present, these functions are only provided by
10863the @code{mips64vr*-elf} configurations.
10864
10865Other VR4120 errata require a nop to be inserted between certain pairs of
10866instructions.  These errata are handled by the assembler, not by GCC itself.
10867
10868@item -mfix-vr4130
10869@opindex mfix-vr4130
10870Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
10871workarounds are implemented by the assembler rather than by GCC,
10872although GCC will avoid using @code{mflo} and @code{mfhi} if the
10873VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
10874instructions are available instead.
10875
10876@item -mfix-sb1
10877@itemx -mno-fix-sb1
10878@opindex mfix-sb1
10879Work around certain SB-1 CPU core errata.
10880(This flag currently works around the SB-1 revision 2
10881``F1'' and ``F2'' floating point errata.)
10882
10883@item -mflush-func=@var{func}
10884@itemx -mno-flush-func
10885@opindex mflush-func
10886Specifies the function to call to flush the I and D caches, or to not
10887call any such function.  If called, the function must take the same
10888arguments as the common @code{_flush_func()}, that is, the address of the
10889memory range for which the cache is being flushed, the size of the
10890memory range, and the number 3 (to flush both caches).  The default
10891depends on the target GCC was configured for, but commonly is either
10892@samp{_flush_func} or @samp{__cpu_flush}.
10893
10894@item -mbranch-likely
10895@itemx -mno-branch-likely
10896@opindex mbranch-likely
10897@opindex mno-branch-likely
10898Enable or disable use of Branch Likely instructions, regardless of the
10899default for the selected architecture.  By default, Branch Likely
10900instructions may be generated if they are supported by the selected
10901architecture.  An exception is for the MIPS32 and MIPS64 architectures
10902and processors which implement those architectures; for those, Branch
10903Likely instructions will not be generated by default because the MIPS32
10904and MIPS64 architectures specifically deprecate their use.
10905
10906@item -mfp-exceptions
10907@itemx -mno-fp-exceptions
10908@opindex mfp-exceptions
10909Specifies whether FP exceptions are enabled.  This affects how we schedule
10910FP instructions for some processors.  The default is that FP exceptions are
10911enabled.
10912
10913For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
1091464-bit code, then we can use both FP pipes.  Otherwise, we can only use one
10915FP pipe.
10916
10917@item -mvr4130-align
10918@itemx -mno-vr4130-align
10919@opindex mvr4130-align
10920The VR4130 pipeline is two-way superscalar, but can only issue two
10921instructions together if the first one is 8-byte aligned.  When this
10922option is enabled, GCC will align pairs of instructions that it
10923thinks should execute in parallel.
10924
10925This option only has an effect when optimizing for the VR4130.
10926It normally makes code faster, but at the expense of making it bigger.
10927It is enabled by default at optimization level @option{-O3}.
10928@end table
10929
10930@node MMIX Options
10931@subsection MMIX Options
10932@cindex MMIX Options
10933
10934These options are defined for the MMIX:
10935
10936@table @gcctabopt
10937@item -mlibfuncs
10938@itemx -mno-libfuncs
10939@opindex mlibfuncs
10940@opindex mno-libfuncs
10941Specify that intrinsic library functions are being compiled, passing all
10942values in registers, no matter the size.
10943
10944@item -mepsilon
10945@itemx -mno-epsilon
10946@opindex mepsilon
10947@opindex mno-epsilon
10948Generate floating-point comparison instructions that compare with respect
10949to the @code{rE} epsilon register.
10950
10951@item -mabi=mmixware
10952@itemx -mabi=gnu
10953@opindex mabi-mmixware
10954@opindex mabi=gnu
10955Generate code that passes function parameters and return values that (in
10956the called function) are seen as registers @code{$0} and up, as opposed to
10957the GNU ABI which uses global registers @code{$231} and up.
10958
10959@item -mzero-extend
10960@itemx -mno-zero-extend
10961@opindex mzero-extend
10962@opindex mno-zero-extend
10963When reading data from memory in sizes shorter than 64 bits, use (do not
10964use) zero-extending load instructions by default, rather than
10965sign-extending ones.
10966
10967@item -mknuthdiv
10968@itemx -mno-knuthdiv
10969@opindex mknuthdiv
10970@opindex mno-knuthdiv
10971Make the result of a division yielding a remainder have the same sign as
10972the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
10973remainder follows the sign of the dividend.  Both methods are
10974arithmetically valid, the latter being almost exclusively used.
10975
10976@item -mtoplevel-symbols
10977@itemx -mno-toplevel-symbols
10978@opindex mtoplevel-symbols
10979@opindex mno-toplevel-symbols
10980Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
10981code can be used with the @code{PREFIX} assembly directive.
10982
10983@item -melf
10984@opindex melf
10985Generate an executable in the ELF format, rather than the default
10986@samp{mmo} format used by the @command{mmix} simulator.
10987
10988@item -mbranch-predict
10989@itemx -mno-branch-predict
10990@opindex mbranch-predict
10991@opindex mno-branch-predict
10992Use (do not use) the probable-branch instructions, when static branch
10993prediction indicates a probable branch.
10994
10995@item -mbase-addresses
10996@itemx -mno-base-addresses
10997@opindex mbase-addresses
10998@opindex mno-base-addresses
10999Generate (do not generate) code that uses @emph{base addresses}.  Using a
11000base address automatically generates a request (handled by the assembler
11001and the linker) for a constant to be set up in a global register.  The
11002register is used for one or more base address requests within the range 0
11003to 255 from the value held in the register.  The generally leads to short
11004and fast code, but the number of different data items that can be
11005addressed is limited.  This means that a program that uses lots of static
11006data may require @option{-mno-base-addresses}.
11007
11008@item -msingle-exit
11009@itemx -mno-single-exit
11010@opindex msingle-exit
11011@opindex mno-single-exit
11012Force (do not force) generated code to have a single exit point in each
11013function.
11014@end table
11015
11016@node MN10300 Options
11017@subsection MN10300 Options
11018@cindex MN10300 options
11019
11020These @option{-m} options are defined for Matsushita MN10300 architectures:
11021
11022@table @gcctabopt
11023@item -mmult-bug
11024@opindex mmult-bug
11025Generate code to avoid bugs in the multiply instructions for the MN10300
11026processors.  This is the default.
11027
11028@item -mno-mult-bug
11029@opindex mno-mult-bug
11030Do not generate code to avoid bugs in the multiply instructions for the
11031MN10300 processors.
11032
11033@item -mam33
11034@opindex mam33
11035Generate code which uses features specific to the AM33 processor.
11036
11037@item -mno-am33
11038@opindex mno-am33
11039Do not generate code which uses features specific to the AM33 processor.  This
11040is the default.
11041
11042@item -mreturn-pointer-on-d0
11043@opindex mreturn-pointer-on-d0
11044When generating a function which returns a pointer, return the pointer
11045in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
11046only in a0, and attempts to call such functions without a prototype
11047would result in errors.  Note that this option is on by default; use
11048@option{-mno-return-pointer-on-d0} to disable it.
11049
11050@item -mno-crt0
11051@opindex mno-crt0
11052Do not link in the C run-time initialization object file.
11053
11054@item -mrelax
11055@opindex mrelax
11056Indicate to the linker that it should perform a relaxation optimization pass
11057to shorten branches, calls and absolute memory addresses.  This option only
11058has an effect when used on the command line for the final link step.
11059
11060This option makes symbolic debugging impossible.
11061@end table
11062
11063@node MT Options
11064@subsection MT Options
11065@cindex MT options
11066
11067These @option{-m} options are defined for Morpho MT architectures:
11068
11069@table @gcctabopt
11070
11071@item -march=@var{cpu-type}
11072@opindex march
11073Generate code that will run on @var{cpu-type}, which is the name of a system
11074representing a certain processor type.  Possible values for
11075@var{cpu-type} are @samp{ms1-64-001}, @samp{ms1-16-002},
11076@samp{ms1-16-003} and @samp{ms2}.
11077
11078When this option is not used, the default is @option{-march=ms1-16-002}.
11079
11080@item -mbacc
11081@opindex mbacc
11082Use byte loads and stores when generating code.
11083
11084@item -mno-bacc
11085@opindex mno-bacc
11086Do not use byte loads and stores when generating code.
11087
11088@item -msim
11089@opindex msim
11090Use simulator runtime
11091
11092@item -mno-crt0
11093@opindex mno-crt0
11094Do not link in the C run-time initialization object file
11095@file{crti.o}.  Other run-time initialization and termination files
11096such as @file{startup.o} and @file{exit.o} are still included on the
11097linker command line.
11098
11099@end table
11100
11101@node PDP-11 Options
11102@subsection PDP-11 Options
11103@cindex PDP-11 Options
11104
11105These options are defined for the PDP-11:
11106
11107@table @gcctabopt
11108@item -mfpu
11109@opindex mfpu
11110Use hardware FPP floating point.  This is the default.  (FIS floating
11111point on the PDP-11/40 is not supported.)
11112
11113@item -msoft-float
11114@opindex msoft-float
11115Do not use hardware floating point.
11116
11117@item -mac0
11118@opindex mac0
11119Return floating-point results in ac0 (fr0 in Unix assembler syntax).
11120
11121@item -mno-ac0
11122@opindex mno-ac0
11123Return floating-point results in memory.  This is the default.
11124
11125@item -m40
11126@opindex m40
11127Generate code for a PDP-11/40.
11128
11129@item -m45
11130@opindex m45
11131Generate code for a PDP-11/45.  This is the default.
11132
11133@item -m10
11134@opindex m10
11135Generate code for a PDP-11/10.
11136
11137@item -mbcopy-builtin
11138@opindex bcopy-builtin
11139Use inline @code{movmemhi} patterns for copying memory.  This is the
11140default.
11141
11142@item -mbcopy
11143@opindex mbcopy
11144Do not use inline @code{movmemhi} patterns for copying memory.
11145
11146@item -mint16
11147@itemx -mno-int32
11148@opindex mint16
11149@opindex mno-int32
11150Use 16-bit @code{int}.  This is the default.
11151
11152@item -mint32
11153@itemx -mno-int16
11154@opindex mint32
11155@opindex mno-int16
11156Use 32-bit @code{int}.
11157
11158@item -mfloat64
11159@itemx -mno-float32
11160@opindex mfloat64
11161@opindex mno-float32
11162Use 64-bit @code{float}.  This is the default.
11163
11164@item -mfloat32
11165@itemx -mno-float64
11166@opindex mfloat32
11167@opindex mno-float64
11168Use 32-bit @code{float}.
11169
11170@item -mabshi
11171@opindex mabshi
11172Use @code{abshi2} pattern.  This is the default.
11173
11174@item -mno-abshi
11175@opindex mno-abshi
11176Do not use @code{abshi2} pattern.
11177
11178@item -mbranch-expensive
11179@opindex mbranch-expensive
11180Pretend that branches are expensive.  This is for experimenting with
11181code generation only.
11182
11183@item -mbranch-cheap
11184@opindex mbranch-cheap
11185Do not pretend that branches are expensive.  This is the default.
11186
11187@item -msplit
11188@opindex msplit
11189Generate code for a system with split I&D@.
11190
11191@item -mno-split
11192@opindex mno-split
11193Generate code for a system without split I&D@.  This is the default.
11194
11195@item -munix-asm
11196@opindex munix-asm
11197Use Unix assembler syntax.  This is the default when configured for
11198@samp{pdp11-*-bsd}.
11199
11200@item -mdec-asm
11201@opindex mdec-asm
11202Use DEC assembler syntax.  This is the default when configured for any
11203PDP-11 target other than @samp{pdp11-*-bsd}.
11204@end table
11205
11206@node PowerPC Options
11207@subsection PowerPC Options
11208@cindex PowerPC options
11209
11210These are listed under @xref{RS/6000 and PowerPC Options}.
11211
11212@node RS/6000 and PowerPC Options
11213@subsection IBM RS/6000 and PowerPC Options
11214@cindex RS/6000 and PowerPC Options
11215@cindex IBM RS/6000 and PowerPC Options
11216
11217These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
11218@table @gcctabopt
11219@item -mpower
11220@itemx -mno-power
11221@itemx -mpower2
11222@itemx -mno-power2
11223@itemx -mpowerpc
11224@itemx -mno-powerpc
11225@itemx -mpowerpc-gpopt
11226@itemx -mno-powerpc-gpopt
11227@itemx -mpowerpc-gfxopt
11228@itemx -mno-powerpc-gfxopt
11229@itemx -mpowerpc64
11230@itemx -mno-powerpc64
11231@itemx -mmfcrf
11232@itemx -mno-mfcrf
11233@itemx -mpopcntb
11234@itemx -mno-popcntb
11235@itemx -mfprnd
11236@itemx -mno-fprnd
11237@opindex mpower
11238@opindex mno-power
11239@opindex mpower2
11240@opindex mno-power2
11241@opindex mpowerpc
11242@opindex mno-powerpc
11243@opindex mpowerpc-gpopt
11244@opindex mno-powerpc-gpopt
11245@opindex mpowerpc-gfxopt
11246@opindex mno-powerpc-gfxopt
11247@opindex mpowerpc64
11248@opindex mno-powerpc64
11249@opindex mmfcrf
11250@opindex mno-mfcrf
11251@opindex mpopcntb
11252@opindex mno-popcntb
11253@opindex mfprnd
11254@opindex mno-fprnd
11255GCC supports two related instruction set architectures for the
11256RS/6000 and PowerPC@.  The @dfn{POWER} instruction set are those
11257instructions supported by the @samp{rios} chip set used in the original
11258RS/6000 systems and the @dfn{PowerPC} instruction set is the
11259architecture of the Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and
11260the IBM 4xx, 6xx, and follow-on microprocessors.
11261
11262Neither architecture is a subset of the other.  However there is a
11263large common subset of instructions supported by both.  An MQ
11264register is included in processors supporting the POWER architecture.
11265
11266You use these options to specify which instructions are available on the
11267processor you are using.  The default value of these options is
11268determined when configuring GCC@.  Specifying the
11269@option{-mcpu=@var{cpu_type}} overrides the specification of these
11270options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
11271rather than the options listed above.
11272
11273The @option{-mpower} option allows GCC to generate instructions that
11274are found only in the POWER architecture and to use the MQ register.
11275Specifying @option{-mpower2} implies @option{-power} and also allows GCC
11276to generate instructions that are present in the POWER2 architecture but
11277not the original POWER architecture.
11278
11279The @option{-mpowerpc} option allows GCC to generate instructions that
11280are found only in the 32-bit subset of the PowerPC architecture.
11281Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
11282GCC to use the optional PowerPC architecture instructions in the
11283General Purpose group, including floating-point square root.  Specifying
11284@option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
11285use the optional PowerPC architecture instructions in the Graphics
11286group, including floating-point select.
11287
11288The @option{-mmfcrf} option allows GCC to generate the move from
11289condition register field instruction implemented on the POWER4
11290processor and other processors that support the PowerPC V2.01
11291architecture.
11292The @option{-mpopcntb} option allows GCC to generate the popcount and
11293double precision FP reciprocal estimate instruction implemented on the
11294POWER5 processor and other processors that support the PowerPC V2.02
11295architecture.
11296The @option{-mfprnd} option allows GCC to generate the FP round to
11297integer instructions implemented on the POWER5+ processor and other
11298processors that support the PowerPC V2.03 architecture.
11299
11300The @option{-mpowerpc64} option allows GCC to generate the additional
1130164-bit instructions that are found in the full PowerPC64 architecture
11302and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
11303@option{-mno-powerpc64}.
11304
11305If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
11306will use only the instructions in the common subset of both
11307architectures plus some special AIX common-mode calls, and will not use
11308the MQ register.  Specifying both @option{-mpower} and @option{-mpowerpc}
11309permits GCC to use any instruction from either architecture and to
11310allow use of the MQ register; specify this for the Motorola MPC601.
11311
11312@item -mnew-mnemonics
11313@itemx -mold-mnemonics
11314@opindex mnew-mnemonics
11315@opindex mold-mnemonics
11316Select which mnemonics to use in the generated assembler code.  With
11317@option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
11318the PowerPC architecture.  With @option{-mold-mnemonics} it uses the
11319assembler mnemonics defined for the POWER architecture.  Instructions
11320defined in only one architecture have only one mnemonic; GCC uses that
11321mnemonic irrespective of which of these options is specified.
11322
11323GCC defaults to the mnemonics appropriate for the architecture in
11324use.  Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
11325value of these option.  Unless you are building a cross-compiler, you
11326should normally not specify either @option{-mnew-mnemonics} or
11327@option{-mold-mnemonics}, but should instead accept the default.
11328
11329@item -mcpu=@var{cpu_type}
11330@opindex mcpu
11331Set architecture type, register usage, choice of mnemonics, and
11332instruction scheduling parameters for machine type @var{cpu_type}.
11333Supported values for @var{cpu_type} are @samp{401}, @samp{403},
11334@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{505},
11335@samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604},
11336@samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400},
11337@samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
11338@samp{860}, @samp{970}, @samp{8540}, @samp{ec603e}, @samp{G3},
11339@samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3},
11340@samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6},
11341@samp{common}, @samp{powerpc}, @samp{powerpc64},
11342@samp{rios}, @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}.
11343
11344@option{-mcpu=common} selects a completely generic processor.  Code
11345generated under this option will run on any POWER or PowerPC processor.
11346GCC will use only the instructions in the common subset of both
11347architectures, and will not use the MQ register.  GCC assumes a generic
11348processor model for scheduling purposes.
11349
11350@option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
11351@option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
11352PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
11353types, with an appropriate, generic processor model assumed for
11354scheduling purposes.
11355
11356The other options specify a specific processor.  Code generated under
11357those options will run best on that processor, and may not run at all on
11358others.
11359
11360The @option{-mcpu} options automatically enable or disable the
11361following options: @option{-maltivec}, @option{-mfprnd},
11362@option{-mhard-float}, @option{-mmfcrf}, @option{-mmultiple},
11363@option{-mnew-mnemonics}, @option{-mpopcntb}, @option{-mpower},
11364@option{-mpower2}, @option{-mpowerpc64}, @option{-mpowerpc-gpopt},
11365@option{-mpowerpc-gfxopt}, @option{-mstring}, @option{-mmulhw}, @option{-mdlmzb}.
11366The particular options
11367set for any particular CPU will vary between compiler versions,
11368depending on what setting seems to produce optimal code for that CPU;
11369it doesn't necessarily reflect the actual hardware's capabilities.  If
11370you wish to set an individual option to a particular value, you may
11371specify it after the @option{-mcpu} option, like @samp{-mcpu=970
11372-mno-altivec}.
11373
11374On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
11375not enabled or disabled by the @option{-mcpu} option at present because
11376AIX does not have full support for these options.  You may still
11377enable or disable them individually if you're sure it'll work in your
11378environment.
11379
11380@item -mtune=@var{cpu_type}
11381@opindex mtune
11382Set the instruction scheduling parameters for machine type
11383@var{cpu_type}, but do not set the architecture type, register usage, or
11384choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would.  The same
11385values for @var{cpu_type} are used for @option{-mtune} as for
11386@option{-mcpu}.  If both are specified, the code generated will use the
11387architecture, registers, and mnemonics set by @option{-mcpu}, but the
11388scheduling parameters set by @option{-mtune}.
11389
11390@item -mswdiv
11391@itemx -mno-swdiv
11392@opindex mswdiv
11393@opindex mno-swdiv
11394Generate code to compute division as reciprocal estimate and iterative
11395refinement, creating opportunities for increased throughput.  This
11396feature requires: optional PowerPC Graphics instruction set for single
11397precision and FRE instruction for double precision, assuming divides
11398cannot generate user-visible traps, and the domain values not include
11399Infinities, denormals or zero denominator.
11400
11401@item -maltivec
11402@itemx -mno-altivec
11403@opindex maltivec
11404@opindex mno-altivec
11405Generate code that uses (does not use) AltiVec instructions, and also
11406enable the use of built-in functions that allow more direct access to
11407the AltiVec instruction set.  You may also need to set
11408@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
11409enhancements.
11410
11411@item -mvrsave
11412@item -mno-vrsave
11413@opindex mvrsave
11414@opindex mno-vrsave
11415Generate VRSAVE instructions when generating AltiVec code.
11416
11417@item -msecure-plt
11418@opindex msecure-plt
11419Generate code that allows ld and ld.so to build executables and shared
11420libraries with non-exec .plt and .got sections.  This is a PowerPC
1142132-bit SYSV ABI option.
11422
11423@item -mbss-plt
11424@opindex mbss-plt
11425Generate code that uses a BSS .plt section that ld.so fills in, and
11426requires .plt and .got sections that are both writable and executable.
11427This is a PowerPC 32-bit SYSV ABI option.
11428
11429@item -misel
11430@itemx -mno-isel
11431@opindex misel
11432@opindex mno-isel
11433This switch enables or disables the generation of ISEL instructions.
11434
11435@item -misel=@var{yes/no}
11436This switch has been deprecated.  Use @option{-misel} and
11437@option{-mno-isel} instead.
11438
11439@item -mspe
11440@itemx -mno-spe
11441@opindex mspe
11442@opindex mno-spe
11443This switch enables or disables the generation of SPE simd
11444instructions.
11445
11446@item -mspe=@var{yes/no}
11447This option has been deprecated.  Use @option{-mspe} and
11448@option{-mno-spe} instead.
11449
11450@item -mfloat-gprs=@var{yes/single/double/no}
11451@itemx -mfloat-gprs
11452@opindex mfloat-gprs
11453This switch enables or disables the generation of floating point
11454operations on the general purpose registers for architectures that
11455support it.
11456
11457The argument @var{yes} or @var{single} enables the use of
11458single-precision floating point operations.
11459
11460The argument @var{double} enables the use of single and
11461double-precision floating point operations.
11462
11463The argument @var{no} disables floating point operations on the
11464general purpose registers.
11465
11466This option is currently only available on the MPC854x.
11467
11468@item -m32
11469@itemx -m64
11470@opindex m32
11471@opindex m64
11472Generate code for 32-bit or 64-bit environments of Darwin and SVR4
11473targets (including GNU/Linux).  The 32-bit environment sets int, long
11474and pointer to 32 bits and generates code that runs on any PowerPC
11475variant.  The 64-bit environment sets int to 32 bits and long and
11476pointer to 64 bits, and generates code for PowerPC64, as for
11477@option{-mpowerpc64}.
11478
11479@item -mfull-toc
11480@itemx -mno-fp-in-toc
11481@itemx -mno-sum-in-toc
11482@itemx -mminimal-toc
11483@opindex mfull-toc
11484@opindex mno-fp-in-toc
11485@opindex mno-sum-in-toc
11486@opindex mminimal-toc
11487Modify generation of the TOC (Table Of Contents), which is created for
11488every executable file.  The @option{-mfull-toc} option is selected by
11489default.  In that case, GCC will allocate at least one TOC entry for
11490each unique non-automatic variable reference in your program.  GCC
11491will also place floating-point constants in the TOC@.  However, only
1149216,384 entries are available in the TOC@.
11493
11494If you receive a linker error message that saying you have overflowed
11495the available TOC space, you can reduce the amount of TOC space used
11496with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
11497@option{-mno-fp-in-toc} prevents GCC from putting floating-point
11498constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
11499generate code to calculate the sum of an address and a constant at
11500run-time instead of putting that sum into the TOC@.  You may specify one
11501or both of these options.  Each causes GCC to produce very slightly
11502slower and larger code at the expense of conserving TOC space.
11503
11504If you still run out of space in the TOC even when you specify both of
11505these options, specify @option{-mminimal-toc} instead.  This option causes
11506GCC to make only one TOC entry for every file.  When you specify this
11507option, GCC will produce code that is slower and larger but which
11508uses extremely little TOC space.  You may wish to use this option
11509only on files that contain less frequently executed code.
11510
11511@item -maix64
11512@itemx -maix32
11513@opindex maix64
11514@opindex maix32
11515Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
11516@code{long} type, and the infrastructure needed to support them.
11517Specifying @option{-maix64} implies @option{-mpowerpc64} and
11518@option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
11519implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
11520
11521@item -mxl-compat
11522@itemx -mno-xl-compat
11523@opindex mxl-compat
11524@opindex mno-xl-compat
11525Produce code that conforms more closely to IBM XL compiler semantics
11526when using AIX-compatible ABI.  Pass floating-point arguments to
11527prototyped functions beyond the register save area (RSA) on the stack
11528in addition to argument FPRs.  Do not assume that most significant
11529double in 128-bit long double value is properly rounded when comparing
11530values and converting to double.  Use XL symbol names for long double
11531support routines.
11532
11533The AIX calling convention was extended but not initially documented to
11534handle an obscure K&R C case of calling a function that takes the
11535address of its arguments with fewer arguments than declared.  IBM XL
11536compilers access floating point arguments which do not fit in the
11537RSA from the stack when a subroutine is compiled without
11538optimization.  Because always storing floating-point arguments on the
11539stack is inefficient and rarely needed, this option is not enabled by
11540default and only is necessary when calling subroutines compiled by IBM
11541XL compilers without optimization.
11542
11543@item -mpe
11544@opindex mpe
11545Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
11546application written to use message passing with special startup code to
11547enable the application to run.  The system must have PE installed in the
11548standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
11549must be overridden with the @option{-specs=} option to specify the
11550appropriate directory location.  The Parallel Environment does not
11551support threads, so the @option{-mpe} option and the @option{-pthread}
11552option are incompatible.
11553
11554@item -malign-natural
11555@itemx -malign-power
11556@opindex malign-natural
11557@opindex malign-power
11558On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
11559@option{-malign-natural} overrides the ABI-defined alignment of larger
11560types, such as floating-point doubles, on their natural size-based boundary.
11561The option @option{-malign-power} instructs GCC to follow the ABI-specified
11562alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
11563
11564On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
11565is not supported.
11566
11567@item -msoft-float
11568@itemx -mhard-float
11569@opindex msoft-float
11570@opindex mhard-float
11571Generate code that does not use (uses) the floating-point register set.
11572Software floating point emulation is provided if you use the
11573@option{-msoft-float} option, and pass the option to GCC when linking.
11574
11575@item -mmultiple
11576@itemx -mno-multiple
11577@opindex mmultiple
11578@opindex mno-multiple
11579Generate code that uses (does not use) the load multiple word
11580instructions and the store multiple word instructions.  These
11581instructions are generated by default on POWER systems, and not
11582generated on PowerPC systems.  Do not use @option{-mmultiple} on little
11583endian PowerPC systems, since those instructions do not work when the
11584processor is in little endian mode.  The exceptions are PPC740 and
11585PPC750 which permit the instructions usage in little endian mode.
11586
11587@item -mstring
11588@itemx -mno-string
11589@opindex mstring
11590@opindex mno-string
11591Generate code that uses (does not use) the load string instructions
11592and the store string word instructions to save multiple registers and
11593do small block moves.  These instructions are generated by default on
11594POWER systems, and not generated on PowerPC systems.  Do not use
11595@option{-mstring} on little endian PowerPC systems, since those
11596instructions do not work when the processor is in little endian mode.
11597The exceptions are PPC740 and PPC750 which permit the instructions
11598usage in little endian mode.
11599
11600@item -mupdate
11601@itemx -mno-update
11602@opindex mupdate
11603@opindex mno-update
11604Generate code that uses (does not use) the load or store instructions
11605that update the base register to the address of the calculated memory
11606location.  These instructions are generated by default.  If you use
11607@option{-mno-update}, there is a small window between the time that the
11608stack pointer is updated and the address of the previous frame is
11609stored, which means code that walks the stack frame across interrupts or
11610signals may get corrupted data.
11611
11612@item -mfused-madd
11613@itemx -mno-fused-madd
11614@opindex mfused-madd
11615@opindex mno-fused-madd
11616Generate code that uses (does not use) the floating point multiply and
11617accumulate instructions.  These instructions are generated by default if
11618hardware floating is used.
11619
11620@item -mmulhw
11621@itemx -mno-mulhw
11622@opindex mmulhw
11623@opindex mno-mulhw
11624Generate code that uses (does not use) the half-word multiply and
11625multiply-accumulate instructions on the IBM 405 and 440 processors.
11626These instructions are generated by default when targetting those
11627processors.
11628
11629@item -mdlmzb
11630@itemx -mno-dlmzb
11631@opindex mdlmzb
11632@opindex mno-dlmzb
11633Generate code that uses (does not use) the string-search @samp{dlmzb}
11634instruction on the IBM 405 and 440 processors.  This instruction is
11635generated by default when targetting those processors.
11636
11637@item -mno-bit-align
11638@itemx -mbit-align
11639@opindex mno-bit-align
11640@opindex mbit-align
11641On System V.4 and embedded PowerPC systems do not (do) force structures
11642and unions that contain bit-fields to be aligned to the base type of the
11643bit-field.
11644
11645For example, by default a structure containing nothing but 8
11646@code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
11647boundary and have a size of 4 bytes.  By using @option{-mno-bit-align},
11648the structure would be aligned to a 1 byte boundary and be one byte in
11649size.
11650
11651@item -mno-strict-align
11652@itemx -mstrict-align
11653@opindex mno-strict-align
11654@opindex mstrict-align
11655On System V.4 and embedded PowerPC systems do not (do) assume that
11656unaligned memory references will be handled by the system.
11657
11658@item -mrelocatable
11659@itemx -mno-relocatable
11660@opindex mrelocatable
11661@opindex mno-relocatable
11662On embedded PowerPC systems generate code that allows (does not allow)
11663the program to be relocated to a different address at runtime.  If you
11664use @option{-mrelocatable} on any module, all objects linked together must
11665be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
11666
11667@item -mrelocatable-lib
11668@itemx -mno-relocatable-lib
11669@opindex mrelocatable-lib
11670@opindex mno-relocatable-lib
11671On embedded PowerPC systems generate code that allows (does not allow)
11672the program to be relocated to a different address at runtime.  Modules
11673compiled with @option{-mrelocatable-lib} can be linked with either modules
11674compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
11675with modules compiled with the @option{-mrelocatable} options.
11676
11677@item -mno-toc
11678@itemx -mtoc
11679@opindex mno-toc
11680@opindex mtoc
11681On System V.4 and embedded PowerPC systems do not (do) assume that
11682register 2 contains a pointer to a global area pointing to the addresses
11683used in the program.
11684
11685@item -mlittle
11686@itemx -mlittle-endian
11687@opindex mlittle
11688@opindex mlittle-endian
11689On System V.4 and embedded PowerPC systems compile code for the
11690processor in little endian mode.  The @option{-mlittle-endian} option is
11691the same as @option{-mlittle}.
11692
11693@item -mbig
11694@itemx -mbig-endian
11695@opindex mbig
11696@opindex mbig-endian
11697On System V.4 and embedded PowerPC systems compile code for the
11698processor in big endian mode.  The @option{-mbig-endian} option is
11699the same as @option{-mbig}.
11700
11701@item -mdynamic-no-pic
11702@opindex mdynamic-no-pic
11703On Darwin and Mac OS X systems, compile code so that it is not
11704relocatable, but that its external references are relocatable.  The
11705resulting code is suitable for applications, but not shared
11706libraries.
11707
11708@item -mprioritize-restricted-insns=@var{priority}
11709@opindex mprioritize-restricted-insns
11710This option controls the priority that is assigned to
11711dispatch-slot restricted instructions during the second scheduling
11712pass.  The argument @var{priority} takes the value @var{0/1/2} to assign
11713@var{no/highest/second-highest} priority to dispatch slot restricted
11714instructions.
11715
11716@item -msched-costly-dep=@var{dependence_type}
11717@opindex msched-costly-dep
11718This option controls which dependences are considered costly
11719by the target during instruction scheduling.  The argument
11720@var{dependence_type} takes one of the following values:
11721@var{no}: no dependence is costly,
11722@var{all}: all dependences are costly,
11723@var{true_store_to_load}: a true dependence from store to load is costly,
11724@var{store_to_load}: any dependence from store to load is costly,
11725@var{number}: any dependence which latency >= @var{number} is costly.
11726
11727@item -minsert-sched-nops=@var{scheme}
11728@opindex minsert-sched-nops
11729This option controls which nop insertion scheme will be used during
11730the second scheduling pass.  The argument @var{scheme} takes one of the
11731following values:
11732@var{no}: Don't insert nops.
11733@var{pad}: Pad with nops any dispatch group which has vacant issue slots,
11734according to the scheduler's grouping.
11735@var{regroup_exact}: Insert nops to force costly dependent insns into
11736separate groups.  Insert exactly as many nops as needed to force an insn
11737to a new group, according to the estimated processor grouping.
11738@var{number}: Insert nops to force costly dependent insns into
11739separate groups.  Insert @var{number} nops to force an insn to a new group.
11740
11741@item -mcall-sysv
11742@opindex mcall-sysv
11743On System V.4 and embedded PowerPC systems compile code using calling
11744conventions that adheres to the March 1995 draft of the System V
11745Application Binary Interface, PowerPC processor supplement.  This is the
11746default unless you configured GCC using @samp{powerpc-*-eabiaix}.
11747
11748@item -mcall-sysv-eabi
11749@opindex mcall-sysv-eabi
11750Specify both @option{-mcall-sysv} and @option{-meabi} options.
11751
11752@item -mcall-sysv-noeabi
11753@opindex mcall-sysv-noeabi
11754Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
11755
11756@item -mcall-solaris
11757@opindex mcall-solaris
11758On System V.4 and embedded PowerPC systems compile code for the Solaris
11759operating system.
11760
11761@item -mcall-linux
11762@opindex mcall-linux
11763On System V.4 and embedded PowerPC systems compile code for the
11764Linux-based GNU system.
11765
11766@item -mcall-gnu
11767@opindex mcall-gnu
11768On System V.4 and embedded PowerPC systems compile code for the
11769Hurd-based GNU system.
11770
11771@item -mcall-netbsd
11772@opindex mcall-netbsd
11773On System V.4 and embedded PowerPC systems compile code for the
11774NetBSD operating system.
11775
11776@item -maix-struct-return
11777@opindex maix-struct-return
11778Return all structures in memory (as specified by the AIX ABI)@.
11779
11780@item -msvr4-struct-return
11781@opindex msvr4-struct-return
11782Return structures smaller than 8 bytes in registers (as specified by the
11783SVR4 ABI)@.
11784
11785@item -mabi=@var{abi-type}
11786@opindex mabi
11787Extend the current ABI with a particular extension, or remove such extension.
11788Valid values are @var{altivec}, @var{no-altivec}, @var{spe},
11789@var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@.
11790
11791@item -mabi=spe
11792@opindex mabi=spe
11793Extend the current ABI with SPE ABI extensions.  This does not change
11794the default ABI, instead it adds the SPE ABI extensions to the current
11795ABI@.
11796
11797@item -mabi=no-spe
11798@opindex mabi=no-spe
11799Disable Booke SPE ABI extensions for the current ABI@.
11800
11801@item -mabi=ibmlongdouble
11802@opindex mabi=ibmlongdouble
11803Change the current ABI to use IBM extended precision long double.
11804This is a PowerPC 32-bit SYSV ABI option.
11805
11806@item -mabi=ieeelongdouble
11807@opindex mabi=ieeelongdouble
11808Change the current ABI to use IEEE extended precision long double.
11809This is a PowerPC 32-bit Linux ABI option.
11810
11811@item -mprototype
11812@itemx -mno-prototype
11813@opindex mprototype
11814@opindex mno-prototype
11815On System V.4 and embedded PowerPC systems assume that all calls to
11816variable argument functions are properly prototyped.  Otherwise, the
11817compiler must insert an instruction before every non prototyped call to
11818set or clear bit 6 of the condition code register (@var{CR}) to
11819indicate whether floating point values were passed in the floating point
11820registers in case the function takes a variable arguments.  With
11821@option{-mprototype}, only calls to prototyped variable argument functions
11822will set or clear the bit.
11823
11824@item -msim
11825@opindex msim
11826On embedded PowerPC systems, assume that the startup module is called
11827@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
11828@file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}.
11829configurations.
11830
11831@item -mmvme
11832@opindex mmvme
11833On embedded PowerPC systems, assume that the startup module is called
11834@file{crt0.o} and the standard C libraries are @file{libmvme.a} and
11835@file{libc.a}.
11836
11837@item -mads
11838@opindex mads
11839On embedded PowerPC systems, assume that the startup module is called
11840@file{crt0.o} and the standard C libraries are @file{libads.a} and
11841@file{libc.a}.
11842
11843@item -myellowknife
11844@opindex myellowknife
11845On embedded PowerPC systems, assume that the startup module is called
11846@file{crt0.o} and the standard C libraries are @file{libyk.a} and
11847@file{libc.a}.
11848
11849@item -mvxworks
11850@opindex mvxworks
11851On System V.4 and embedded PowerPC systems, specify that you are
11852compiling for a VxWorks system.
11853
11854@item -mwindiss
11855@opindex mwindiss
11856Specify that you are compiling for the WindISS simulation environment.
11857
11858@item -memb
11859@opindex memb
11860On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
11861header to indicate that @samp{eabi} extended relocations are used.
11862
11863@item -meabi
11864@itemx -mno-eabi
11865@opindex meabi
11866@opindex mno-eabi
11867On System V.4 and embedded PowerPC systems do (do not) adhere to the
11868Embedded Applications Binary Interface (eabi) which is a set of
11869modifications to the System V.4 specifications.  Selecting @option{-meabi}
11870means that the stack is aligned to an 8 byte boundary, a function
11871@code{__eabi} is called to from @code{main} to set up the eabi
11872environment, and the @option{-msdata} option can use both @code{r2} and
11873@code{r13} to point to two separate small data areas.  Selecting
11874@option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
11875do not call an initialization function from @code{main}, and the
11876@option{-msdata} option will only use @code{r13} to point to a single
11877small data area.  The @option{-meabi} option is on by default if you
11878configured GCC using one of the @samp{powerpc*-*-eabi*} options.
11879
11880@item -msdata=eabi
11881@opindex msdata=eabi
11882On System V.4 and embedded PowerPC systems, put small initialized
11883@code{const} global and static data in the @samp{.sdata2} section, which
11884is pointed to by register @code{r2}.  Put small initialized
11885non-@code{const} global and static data in the @samp{.sdata} section,
11886which is pointed to by register @code{r13}.  Put small uninitialized
11887global and static data in the @samp{.sbss} section, which is adjacent to
11888the @samp{.sdata} section.  The @option{-msdata=eabi} option is
11889incompatible with the @option{-mrelocatable} option.  The
11890@option{-msdata=eabi} option also sets the @option{-memb} option.
11891
11892@item -msdata=sysv
11893@opindex msdata=sysv
11894On System V.4 and embedded PowerPC systems, put small global and static
11895data in the @samp{.sdata} section, which is pointed to by register
11896@code{r13}.  Put small uninitialized global and static data in the
11897@samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
11898The @option{-msdata=sysv} option is incompatible with the
11899@option{-mrelocatable} option.
11900
11901@item -msdata=default
11902@itemx -msdata
11903@opindex msdata=default
11904@opindex msdata
11905On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
11906compile code the same as @option{-msdata=eabi}, otherwise compile code the
11907same as @option{-msdata=sysv}.
11908
11909@item -msdata-data
11910@opindex msdata-data
11911On System V.4 and embedded PowerPC systems, put small global
11912data in the @samp{.sdata} section.  Put small uninitialized global
11913data in the @samp{.sbss} section.  Do not use register @code{r13}
11914to address small data however.  This is the default behavior unless
11915other @option{-msdata} options are used.
11916
11917@item -msdata=none
11918@itemx -mno-sdata
11919@opindex msdata=none
11920@opindex mno-sdata
11921On embedded PowerPC systems, put all initialized global and static data
11922in the @samp{.data} section, and all uninitialized data in the
11923@samp{.bss} section.
11924
11925@item -G @var{num}
11926@opindex G
11927@cindex smaller data references (PowerPC)
11928@cindex .sdata/.sdata2 references (PowerPC)
11929On embedded PowerPC systems, put global and static items less than or
11930equal to @var{num} bytes into the small data or bss sections instead of
11931the normal data or bss section.  By default, @var{num} is 8.  The
11932@option{-G @var{num}} switch is also passed to the linker.
11933All modules should be compiled with the same @option{-G @var{num}} value.
11934
11935@item -mregnames
11936@itemx -mno-regnames
11937@opindex mregnames
11938@opindex mno-regnames
11939On System V.4 and embedded PowerPC systems do (do not) emit register
11940names in the assembly language output using symbolic forms.
11941
11942@item -mlongcall
11943@itemx -mno-longcall
11944@opindex mlongcall
11945@opindex mno-longcall
11946By default assume that all calls are far away so that a longer more
11947expensive calling sequence is required.  This is required for calls
11948further than 32 megabytes (33,554,432 bytes) from the current location.
11949A short call will be generated if the compiler knows
11950the call cannot be that far away.  This setting can be overridden by
11951the @code{shortcall} function attribute, or by @code{#pragma
11952longcall(0)}.
11953
11954Some linkers are capable of detecting out-of-range calls and generating
11955glue code on the fly.  On these systems, long calls are unnecessary and
11956generate slower code.  As of this writing, the AIX linker can do this,
11957as can the GNU linker for PowerPC/64.  It is planned to add this feature
11958to the GNU linker for 32-bit PowerPC systems as well.
11959
11960On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr
11961callee, L42'', plus a ``branch island'' (glue code).  The two target
11962addresses represent the callee and the ``branch island''.  The
11963Darwin/PPC linker will prefer the first address and generate a ``bl
11964callee'' if the PPC ``bl'' instruction will reach the callee directly;
11965otherwise, the linker will generate ``bl L42'' to call the ``branch
11966island''.  The ``branch island'' is appended to the body of the
11967calling function; it computes the full 32-bit address of the callee
11968and jumps to it.
11969
11970On Mach-O (Darwin) systems, this option directs the compiler emit to
11971the glue for every direct call, and the Darwin linker decides whether
11972to use or discard it.
11973
11974In the future, we may cause GCC to ignore all longcall specifications
11975when the linker is known to generate glue.
11976
11977@item -pthread
11978@opindex pthread
11979Adds support for multithreading with the @dfn{pthreads} library.
11980This option sets flags for both the preprocessor and linker.
11981
11982@end table
11983
11984@node S/390 and zSeries Options
11985@subsection S/390 and zSeries Options
11986@cindex S/390 and zSeries Options
11987
11988These are the @samp{-m} options defined for the S/390 and zSeries architecture.
11989
11990@table @gcctabopt
11991@item -mhard-float
11992@itemx -msoft-float
11993@opindex mhard-float
11994@opindex msoft-float
11995Use (do not use) the hardware floating-point instructions and registers
11996for floating-point operations.  When @option{-msoft-float} is specified,
11997functions in @file{libgcc.a} will be used to perform floating-point
11998operations.  When @option{-mhard-float} is specified, the compiler
11999generates IEEE floating-point instructions.  This is the default.
12000
12001@item -mlong-double-64
12002@itemx -mlong-double-128
12003@opindex mlong-double-64
12004@opindex mlong-double-128
12005These switches control the size of @code{long double} type. A size
12006of 64bit makes the @code{long double} type equivalent to the @code{double}
12007type. This is the default.
12008
12009@item -mbackchain
12010@itemx -mno-backchain
12011@opindex mbackchain
12012@opindex mno-backchain
12013Store (do not store) the address of the caller's frame as backchain pointer
12014into the callee's stack frame.
12015A backchain may be needed to allow debugging using tools that do not understand
12016DWARF-2 call frame information.
12017When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
12018at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
12019the backchain is placed into the topmost word of the 96/160 byte register
12020save area.
12021
12022In general, code compiled with @option{-mbackchain} is call-compatible with
12023code compiled with @option{-mmo-backchain}; however, use of the backchain
12024for debugging purposes usually requires that the whole binary is built with
12025@option{-mbackchain}.  Note that the combination of @option{-mbackchain},
12026@option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
12027to build a linux kernel use @option{-msoft-float}.
12028
12029The default is to not maintain the backchain.
12030
12031@item -mpacked-stack
12032@item -mno-packed-stack
12033@opindex mpacked-stack
12034@opindex mno-packed-stack
12035Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
12036specified, the compiler uses the all fields of the 96/160 byte register save
12037area only for their default purpose; unused fields still take up stack space.
12038When @option{-mpacked-stack} is specified, register save slots are densely
12039packed at the top of the register save area; unused space is reused for other
12040purposes, allowing for more efficient use of the available stack space.
12041However, when @option{-mbackchain} is also in effect, the topmost word of
12042the save area is always used to store the backchain, and the return address
12043register is always saved two words below the backchain.
12044
12045As long as the stack frame backchain is not used, code generated with
12046@option{-mpacked-stack} is call-compatible with code generated with
12047@option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
12048S/390 or zSeries generated code that uses the stack frame backchain at run
12049time, not just for debugging purposes.  Such code is not call-compatible
12050with code compiled with @option{-mpacked-stack}.  Also, note that the
12051combination of @option{-mbackchain},
12052@option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
12053to build a linux kernel use @option{-msoft-float}.
12054
12055The default is to not use the packed stack layout.
12056
12057@item -msmall-exec
12058@itemx -mno-small-exec
12059@opindex msmall-exec
12060@opindex mno-small-exec
12061Generate (or do not generate) code using the @code{bras} instruction
12062to do subroutine calls.
12063This only works reliably if the total executable size does not
12064exceed 64k.  The default is to use the @code{basr} instruction instead,
12065which does not have this limitation.
12066
12067@item -m64
12068@itemx -m31
12069@opindex m64
12070@opindex m31
12071When @option{-m31} is specified, generate code compliant to the
12072GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
12073code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
12074particular to generate 64-bit instructions.  For the @samp{s390}
12075targets, the default is @option{-m31}, while the @samp{s390x}
12076targets default to @option{-m64}.
12077
12078@item -mzarch
12079@itemx -mesa
12080@opindex mzarch
12081@opindex mesa
12082When @option{-mzarch} is specified, generate code using the
12083instructions available on z/Architecture.
12084When @option{-mesa} is specified, generate code using the
12085instructions available on ESA/390.  Note that @option{-mesa} is
12086not possible with @option{-m64}.
12087When generating code compliant to the GNU/Linux for S/390 ABI,
12088the default is @option{-mesa}.  When generating code compliant
12089to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
12090
12091@item -mmvcle
12092@itemx -mno-mvcle
12093@opindex mmvcle
12094@opindex mno-mvcle
12095Generate (or do not generate) code using the @code{mvcle} instruction
12096to perform block moves.  When @option{-mno-mvcle} is specified,
12097use a @code{mvc} loop instead.  This is the default unless optimizing for
12098size.
12099
12100@item -mdebug
12101@itemx -mno-debug
12102@opindex mdebug
12103@opindex mno-debug
12104Print (or do not print) additional debug information when compiling.
12105The default is to not print debug information.
12106
12107@item -march=@var{cpu-type}
12108@opindex march
12109Generate code that will run on @var{cpu-type}, which is the name of a system
12110representing a certain processor type.  Possible values for
12111@var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}.
12112When generating code using the instructions available on z/Architecture,
12113the default is @option{-march=z900}.  Otherwise, the default is
12114@option{-march=g5}.
12115
12116@item -mtune=@var{cpu-type}
12117@opindex mtune
12118Tune to @var{cpu-type} everything applicable about the generated code,
12119except for the ABI and the set of available instructions.
12120The list of @var{cpu-type} values is the same as for @option{-march}.
12121The default is the value used for @option{-march}.
12122
12123@item -mtpf-trace
12124@itemx -mno-tpf-trace
12125@opindex mtpf-trace
12126@opindex mno-tpf-trace
12127Generate code that adds (does not add) in TPF OS specific branches to trace
12128routines in the operating system.  This option is off by default, even
12129when compiling for the TPF OS@.
12130
12131@item -mfused-madd
12132@itemx -mno-fused-madd
12133@opindex mfused-madd
12134@opindex mno-fused-madd
12135Generate code that uses (does not use) the floating point multiply and
12136accumulate instructions.  These instructions are generated by default if
12137hardware floating point is used.
12138
12139@item -mwarn-framesize=@var{framesize}
12140@opindex mwarn-framesize
12141Emit a warning if the current function exceeds the given frame size.  Because
12142this is a compile time check it doesn't need to be a real problem when the program
12143runs.  It is intended to identify functions which most probably cause
12144a stack overflow.  It is useful to be used in an environment with limited stack
12145size e.g.@: the linux kernel.
12146
12147@item -mwarn-dynamicstack
12148@opindex mwarn-dynamicstack
12149Emit a warning if the function calls alloca or uses dynamically
12150sized arrays.  This is generally a bad idea with a limited stack size.
12151
12152@item -mstack-guard=@var{stack-guard}
12153@item -mstack-size=@var{stack-size}
12154@opindex mstack-guard
12155@opindex mstack-size
12156These arguments always have to be used in conjunction.  If they are present the s390
12157back end emits additional instructions in the function prologue which trigger a trap
12158if the stack size is @var{stack-guard} bytes above the @var{stack-size}
12159(remember that the stack on s390 grows downward).  These options are intended to
12160be used to help debugging stack overflow problems.  The additionally emitted code
12161causes only little overhead and hence can also be used in production like systems
12162without greater performance degradation.  The given values have to be exact
12163powers of 2 and @var{stack-size} has to be greater than @var{stack-guard} without
12164exceeding 64k.
12165In order to be efficient the extra code makes the assumption that the stack starts
12166at an address aligned to the value given by @var{stack-size}.
12167@end table
12168
12169@node Score Options
12170@subsection Score Options
12171@cindex Score Options
12172
12173These options are defined for Score implementations:
12174
12175@table @gcctabopt
12176@item -meb
12177@opindex meb
12178Compile code for big endian mode.  This is the default.
12179
12180@item -mel
12181@opindex mel
12182Compile code for little endian mode. 
12183
12184@item -mnhwloop
12185@opindex mnhwloop
12186Disable generate bcnz instruction.
12187
12188@item -muls
12189@opindex muls
12190Enable generate unaligned load and store instruction.
12191
12192@item -mmac
12193@opindex mmac
12194Enable the use of multiply-accumulate instructions. Disabled by default. 
12195
12196@item -mscore5
12197@opindex mscore5
12198Specify the SCORE5 as the target architecture.
12199
12200@item -mscore5u
12201@opindex mscore5u
12202Specify the SCORE5U of the target architecture.
12203
12204@item -mscore7
12205@opindex mscore7
12206Specify the SCORE7 as the target architecture. This is the default.
12207
12208@item -mscore7d
12209@opindex mscore7d
12210Specify the SCORE7D as the target architecture.
12211@end table
12212
12213@node SH Options
12214@subsection SH Options
12215
12216These @samp{-m} options are defined for the SH implementations:
12217
12218@table @gcctabopt
12219@item -m1
12220@opindex m1
12221Generate code for the SH1.
12222
12223@item -m2
12224@opindex m2
12225Generate code for the SH2.
12226
12227@item -m2e
12228Generate code for the SH2e.
12229
12230@item -m3
12231@opindex m3
12232Generate code for the SH3.
12233
12234@item -m3e
12235@opindex m3e
12236Generate code for the SH3e.
12237
12238@item -m4-nofpu
12239@opindex m4-nofpu
12240Generate code for the SH4 without a floating-point unit.
12241
12242@item -m4-single-only
12243@opindex m4-single-only
12244Generate code for the SH4 with a floating-point unit that only
12245supports single-precision arithmetic.
12246
12247@item -m4-single
12248@opindex m4-single
12249Generate code for the SH4 assuming the floating-point unit is in
12250single-precision mode by default.
12251
12252@item -m4
12253@opindex m4
12254Generate code for the SH4.
12255
12256@item -m4a-nofpu
12257@opindex m4a-nofpu
12258Generate code for the SH4al-dsp, or for a SH4a in such a way that the
12259floating-point unit is not used.
12260
12261@item -m4a-single-only
12262@opindex m4a-single-only
12263Generate code for the SH4a, in such a way that no double-precision
12264floating point operations are used.
12265
12266@item -m4a-single
12267@opindex m4a-single
12268Generate code for the SH4a assuming the floating-point unit is in
12269single-precision mode by default.
12270
12271@item -m4a
12272@opindex m4a
12273Generate code for the SH4a.
12274
12275@item -m4al
12276@opindex m4al
12277Same as @option{-m4a-nofpu}, except that it implicitly passes
12278@option{-dsp} to the assembler.  GCC doesn't generate any DSP
12279instructions at the moment.
12280
12281@item -mb
12282@opindex mb
12283Compile code for the processor in big endian mode.
12284
12285@item -ml
12286@opindex ml
12287Compile code for the processor in little endian mode.
12288
12289@item -mdalign
12290@opindex mdalign
12291Align doubles at 64-bit boundaries.  Note that this changes the calling
12292conventions, and thus some functions from the standard C library will
12293not work unless you recompile it first with @option{-mdalign}.
12294
12295@item -mrelax
12296@opindex mrelax
12297Shorten some address references at link time, when possible; uses the
12298linker option @option{-relax}.
12299
12300@item -mbigtable
12301@opindex mbigtable
12302Use 32-bit offsets in @code{switch} tables.  The default is to use
1230316-bit offsets.
12304
12305@item -mfmovd
12306@opindex mfmovd
12307Enable the use of the instruction @code{fmovd}.
12308
12309@item -mhitachi
12310@opindex mhitachi
12311Comply with the calling conventions defined by Renesas.
12312
12313@item -mrenesas
12314@opindex mhitachi
12315Comply with the calling conventions defined by Renesas.
12316
12317@item -mno-renesas
12318@opindex mhitachi
12319Comply with the calling conventions defined for GCC before the Renesas
12320conventions were available.  This option is the default for all
12321targets of the SH toolchain except for @samp{sh-symbianelf}.
12322
12323@item -mnomacsave
12324@opindex mnomacsave
12325Mark the @code{MAC} register as call-clobbered, even if
12326@option{-mhitachi} is given.
12327
12328@item -mieee
12329@opindex mieee
12330Increase IEEE-compliance of floating-point code.
12331At the moment, this is equivalent to @option{-fno-finite-math-only}.
12332When generating 16 bit SH opcodes, getting IEEE-conforming results for
12333comparisons of NANs / infinities incurs extra overhead in every
12334floating point comparison, therefore the default is set to
12335@option{-ffinite-math-only}.
12336
12337@item -misize
12338@opindex misize
12339Dump instruction size and location in the assembly code.
12340
12341@item -mpadstruct
12342@opindex mpadstruct
12343This option is deprecated.  It pads structures to multiple of 4 bytes,
12344which is incompatible with the SH ABI@.
12345
12346@item -mspace
12347@opindex mspace
12348Optimize for space instead of speed.  Implied by @option{-Os}.
12349
12350@item -mprefergot
12351@opindex mprefergot
12352When generating position-independent code, emit function calls using
12353the Global Offset Table instead of the Procedure Linkage Table.
12354
12355@item -musermode
12356@opindex musermode
12357Generate a library function call to invalidate instruction cache
12358entries, after fixing up a trampoline.  This library function call
12359doesn't assume it can write to the whole memory address space.  This
12360is the default when the target is @code{sh-*-linux*}.
12361
12362@item -multcost=@var{number}
12363@opindex multcost=@var{number}
12364Set the cost to assume for a multiply insn.
12365
12366@item -mdiv=@var{strategy}
12367@opindex mdiv=@var{strategy}
12368Set the division strategy to use for SHmedia code.  @var{strategy} must be
12369one of: call, call2, fp, inv, inv:minlat, inv20u, inv20l, inv:call,
12370inv:call2, inv:fp .
12371"fp" performs the operation in floating point.  This has a very high latency,
12372but needs only a few instructions, so it might be a good choice if
12373your code has enough easily exploitable ILP to allow the compiler to
12374schedule the floating point instructions together with other instructions.
12375Division by zero causes a floating point exception.
12376"inv" uses integer operations to calculate the inverse of the divisor,
12377and then multiplies the dividend with the inverse.  This strategy allows
12378cse and hoisting of the inverse calculation.  Division by zero calculates
12379an unspecified result, but does not trap.
12380"inv:minlat" is a variant of "inv" where if no cse / hoisting opportunities
12381have been found, or if the entire operation has been hoisted to the same
12382place, the last stages of the inverse calculation are intertwined with the
12383final multiply to reduce the overall latency, at the expense of using a few
12384more instructions, and thus offering fewer scheduling opportunities with
12385other code.
12386"call" calls a library function that usually implements the inv:minlat
12387strategy.
12388This gives high code density for m5-*media-nofpu compilations.
12389"call2" uses a different entry point of the same library function, where it
12390assumes that a pointer to a lookup table has already been set up, which
12391exposes the pointer load to cse / code hoisting optimizations.
12392"inv:call", "inv:call2" and "inv:fp" all use the "inv" algorithm for initial
12393code generation, but if the code stays unoptimized, revert to the "call",
12394"call2", or "fp" strategies, respectively.  Note that the
12395potentially-trapping side effect of division by zero is carried by a
12396separate instruction, so it is possible that all the integer instructions
12397are hoisted out, but the marker for the side effect stays where it is.
12398A recombination to fp operations or a call is not possible in that case.
12399"inv20u" and "inv20l" are variants of the "inv:minlat" strategy.  In the case
12400that the inverse calculation was nor separated from the multiply, they speed
12401up division where the dividend fits into 20 bits (plus sign where applicable),
12402by inserting a test to skip a number of operations in this case; this test
12403slows down the case of larger dividends.  inv20u assumes the case of a such
12404a small dividend to be unlikely, and inv20l assumes it to be likely.
12405
12406@item -mdivsi3_libfunc=@var{name}
12407@opindex mdivsi3_libfunc=@var{name}
12408Set the name of the library function used for 32 bit signed division to
12409@var{name}.  This only affect the name used in the call and inv:call
12410division strategies, and the compiler will still expect the same
12411sets of input/output/clobbered registers as if this option was not present.
12412
12413@item -madjust-unroll
12414@opindex madjust-unroll
12415Throttle unrolling to avoid thrashing target registers.
12416This option only has an effect if the gcc code base supports the
12417TARGET_ADJUST_UNROLL_MAX target hook.
12418
12419@item -mindexed-addressing
12420@opindex mindexed-addressing
12421Enable the use of the indexed addressing mode for SHmedia32/SHcompact.
12422This is only safe if the hardware and/or OS implement 32 bit wrap-around
12423semantics for the indexed addressing mode.  The architecture allows the
12424implementation of processors with 64 bit MMU, which the OS could use to
12425get 32 bit addressing, but since no current hardware implementation supports
12426this or any other way to make the indexed addressing mode safe to use in
12427the 32 bit ABI, the default is -mno-indexed-addressing.
12428
12429@item -mgettrcost=@var{number}
12430@opindex mgettrcost=@var{number}
12431Set the cost assumed for the gettr instruction to @var{number}.
12432The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise.
12433
12434@item -mpt-fixed
12435@opindex mpt-fixed
12436Assume pt* instructions won't trap.  This will generally generate better
12437scheduled code, but is unsafe on current hardware.  The current architecture
12438definition says that ptabs and ptrel trap when the target anded with 3 is 3.
12439This has the unintentional effect of making it unsafe to schedule ptabs /
12440ptrel before a branch, or hoist it out of a loop.  For example,
12441__do_global_ctors, a part of libgcc that runs constructors at program
12442startup, calls functions in a list which is delimited by -1.  With the
12443-mpt-fixed option, the ptabs will be done before testing against -1.
12444That means that all the constructors will be run a bit quicker, but when
12445the loop comes to the end of the list, the program crashes because ptabs
12446loads -1 into a target register.  Since this option is unsafe for any
12447hardware implementing the current architecture specification, the default
12448is -mno-pt-fixed.  Unless the user specifies a specific cost with
12449@option{-mgettrcost}, -mno-pt-fixed also implies @option{-mgettrcost=100};
12450this deters register allocation using target registers for storing
12451ordinary integers.
12452
12453@item -minvalid-symbols
12454@opindex minvalid-symbols
12455Assume symbols might be invalid.  Ordinary function symbols generated by
12456the compiler will always be valid to load with movi/shori/ptabs or
12457movi/shori/ptrel, but with assembler and/or linker tricks it is possible
12458to generate symbols that will cause ptabs / ptrel to trap.
12459This option is only meaningful when @option{-mno-pt-fixed} is in effect.
12460It will then prevent cross-basic-block cse, hoisting and most scheduling
12461of symbol loads.  The default is @option{-mno-invalid-symbols}.
12462@end table
12463
12464@node SPARC Options
12465@subsection SPARC Options
12466@cindex SPARC options
12467
12468These @samp{-m} options are supported on the SPARC:
12469
12470@table @gcctabopt
12471@item -mno-app-regs
12472@itemx -mapp-regs
12473@opindex mno-app-regs
12474@opindex mapp-regs
12475Specify @option{-mapp-regs} to generate output using the global registers
124762 through 4, which the SPARC SVR4 ABI reserves for applications.  This
12477is the default.
12478
12479To be fully SVR4 ABI compliant at the cost of some performance loss,
12480specify @option{-mno-app-regs}.  You should compile libraries and system
12481software with this option.
12482
12483@item -mfpu
12484@itemx -mhard-float
12485@opindex mfpu
12486@opindex mhard-float
12487Generate output containing floating point instructions.  This is the
12488default.
12489
12490@item -mno-fpu
12491@itemx -msoft-float
12492@opindex mno-fpu
12493@opindex msoft-float
12494Generate output containing library calls for floating point.
12495@strong{Warning:} the requisite libraries are not available for all SPARC
12496targets.  Normally the facilities of the machine's usual C compiler are
12497used, but this cannot be done directly in cross-compilation.  You must make
12498your own arrangements to provide suitable library functions for
12499cross-compilation.  The embedded targets @samp{sparc-*-aout} and
12500@samp{sparclite-*-*} do provide software floating point support.
12501
12502@option{-msoft-float} changes the calling convention in the output file;
12503therefore, it is only useful if you compile @emph{all} of a program with
12504this option.  In particular, you need to compile @file{libgcc.a}, the
12505library that comes with GCC, with @option{-msoft-float} in order for
12506this to work.
12507
12508@item -mhard-quad-float
12509@opindex mhard-quad-float
12510Generate output containing quad-word (long double) floating point
12511instructions.
12512
12513@item -msoft-quad-float
12514@opindex msoft-quad-float
12515Generate output containing library calls for quad-word (long double)
12516floating point instructions.  The functions called are those specified
12517in the SPARC ABI@.  This is the default.
12518
12519As of this writing, there are no SPARC implementations that have hardware
12520support for the quad-word floating point instructions.  They all invoke
12521a trap handler for one of these instructions, and then the trap handler
12522emulates the effect of the instruction.  Because of the trap handler overhead,
12523this is much slower than calling the ABI library routines.  Thus the
12524@option{-msoft-quad-float} option is the default.
12525
12526@item -mno-unaligned-doubles
12527@itemx -munaligned-doubles
12528@opindex mno-unaligned-doubles
12529@opindex munaligned-doubles
12530Assume that doubles have 8 byte alignment.  This is the default.
12531
12532With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
12533alignment only if they are contained in another type, or if they have an
12534absolute address.  Otherwise, it assumes they have 4 byte alignment.
12535Specifying this option avoids some rare compatibility problems with code
12536generated by other compilers.  It is not the default because it results
12537in a performance loss, especially for floating point code.
12538
12539@item -mno-faster-structs
12540@itemx -mfaster-structs
12541@opindex mno-faster-structs
12542@opindex mfaster-structs
12543With @option{-mfaster-structs}, the compiler assumes that structures
12544should have 8 byte alignment.  This enables the use of pairs of
12545@code{ldd} and @code{std} instructions for copies in structure
12546assignment, in place of twice as many @code{ld} and @code{st} pairs.
12547However, the use of this changed alignment directly violates the SPARC
12548ABI@.  Thus, it's intended only for use on targets where the developer
12549acknowledges that their resulting code will not be directly in line with
12550the rules of the ABI@.
12551
12552@item -mimpure-text
12553@opindex mimpure-text
12554@option{-mimpure-text}, used in addition to @option{-shared}, tells
12555the compiler to not pass @option{-z text} to the linker when linking a
12556shared object.  Using this option, you can link position-dependent
12557code into a shared object.
12558
12559@option{-mimpure-text} suppresses the ``relocations remain against
12560allocatable but non-writable sections'' linker error message.
12561However, the necessary relocations will trigger copy-on-write, and the
12562shared object is not actually shared across processes.  Instead of
12563using @option{-mimpure-text}, you should compile all source code with
12564@option{-fpic} or @option{-fPIC}.
12565
12566This option is only available on SunOS and Solaris.
12567
12568@item -mcpu=@var{cpu_type}
12569@opindex mcpu
12570Set the instruction set, register set, and instruction scheduling parameters
12571for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
12572@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
12573@samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x},
12574@samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc},
12575@samp{ultrasparc3}, and @samp{niagara}.
12576
12577Default instruction scheduling parameters are used for values that select
12578an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
12579@samp{sparclite}, @samp{sparclet}, @samp{v9}.
12580
12581Here is a list of each supported architecture and their supported
12582implementations.
12583
12584@smallexample
12585    v7:             cypress
12586    v8:             supersparc, hypersparc
12587    sparclite:      f930, f934, sparclite86x
12588    sparclet:       tsc701
12589    v9:             ultrasparc, ultrasparc3, niagara
12590@end smallexample
12591
12592By default (unless configured otherwise), GCC generates code for the V7
12593variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
12594additionally optimizes it for the Cypress CY7C602 chip, as used in the
12595SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
12596SPARCStation 1, 2, IPX etc.
12597
12598With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
12599architecture.  The only difference from V7 code is that the compiler emits
12600the integer multiply and integer divide instructions which exist in SPARC-V8
12601but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
12602optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
126032000 series.
12604
12605With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
12606the SPARC architecture.  This adds the integer multiply, integer divide step
12607and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
12608With @option{-mcpu=f930}, the compiler additionally optimizes it for the
12609Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
12610@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
12611MB86934 chip, which is the more recent SPARClite with FPU@.
12612
12613With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
12614the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
12615integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
12616but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
12617optimizes it for the TEMIC SPARClet chip.
12618
12619With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
12620architecture.  This adds 64-bit integer and floating-point move instructions,
126213 additional floating-point condition code registers and conditional move
12622instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
12623optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
12624@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
12625Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
12626@option{-mcpu=niagara}, the compiler additionally optimizes it for
12627Sun UltraSPARC T1 chips.
12628
12629@item -mtune=@var{cpu_type}
12630@opindex mtune
12631Set the instruction scheduling parameters for machine type
12632@var{cpu_type}, but do not set the instruction set or register set that the
12633option @option{-mcpu=@var{cpu_type}} would.
12634
12635The same values for @option{-mcpu=@var{cpu_type}} can be used for
12636@option{-mtune=@var{cpu_type}}, but the only useful values are those
12637that select a particular cpu implementation.  Those are @samp{cypress},
12638@samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
12639@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
12640@samp{ultrasparc3}, and @samp{niagara}.
12641
12642@item -mv8plus
12643@itemx -mno-v8plus
12644@opindex mv8plus
12645@opindex mno-v8plus
12646With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
12647difference from the V8 ABI is that the global and out registers are
12648considered 64-bit wide.  This is enabled by default on Solaris in 32-bit
12649mode for all SPARC-V9 processors.
12650
12651@item -mvis
12652@itemx -mno-vis
12653@opindex mvis
12654@opindex mno-vis
12655With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
12656Visual Instruction Set extensions.  The default is @option{-mno-vis}.
12657@end table
12658
12659These @samp{-m} options are supported in addition to the above
12660on SPARC-V9 processors in 64-bit environments:
12661
12662@table @gcctabopt
12663@item -mlittle-endian
12664@opindex mlittle-endian
12665Generate code for a processor running in little-endian mode.  It is only
12666available for a few configurations and most notably not on Solaris and Linux.
12667
12668@item -m32
12669@itemx -m64
12670@opindex m32
12671@opindex m64
12672Generate code for a 32-bit or 64-bit environment.
12673The 32-bit environment sets int, long and pointer to 32 bits.
12674The 64-bit environment sets int to 32 bits and long and pointer
12675to 64 bits.
12676
12677@item -mcmodel=medlow
12678@opindex mcmodel=medlow
12679Generate code for the Medium/Low code model: 64-bit addresses, programs
12680must be linked in the low 32 bits of memory.  Programs can be statically
12681or dynamically linked.
12682
12683@item -mcmodel=medmid
12684@opindex mcmodel=medmid
12685Generate code for the Medium/Middle code model: 64-bit addresses, programs
12686must be linked in the low 44 bits of memory, the text and data segments must
12687be less than 2GB in size and the data segment must be located within 2GB of
12688the text segment.
12689
12690@item -mcmodel=medany
12691@opindex mcmodel=medany
12692Generate code for the Medium/Anywhere code model: 64-bit addresses, programs
12693may be linked anywhere in memory, the text and data segments must be less
12694than 2GB in size and the data segment must be located within 2GB of the
12695text segment.
12696
12697@item -mcmodel=embmedany
12698@opindex mcmodel=embmedany
12699Generate code for the Medium/Anywhere code model for embedded systems:
1270064-bit addresses, the text and data segments must be less than 2GB in
12701size, both starting anywhere in memory (determined at link time).  The
12702global register %g4 points to the base of the data segment.  Programs
12703are statically linked and PIC is not supported.
12704
12705@item -mstack-bias
12706@itemx -mno-stack-bias
12707@opindex mstack-bias
12708@opindex mno-stack-bias
12709With @option{-mstack-bias}, GCC assumes that the stack pointer, and
12710frame pointer if present, are offset by @minus{}2047 which must be added back
12711when making stack frame references.  This is the default in 64-bit mode.
12712Otherwise, assume no such offset is present.
12713@end table
12714
12715These switches are supported in addition to the above on Solaris:
12716
12717@table @gcctabopt
12718@item -threads
12719@opindex threads
12720Add support for multithreading using the Solaris threads library.  This
12721option sets flags for both the preprocessor and linker.  This option does
12722not affect the thread safety of object code produced by the compiler or
12723that of libraries supplied with it.
12724
12725@item -pthreads
12726@opindex pthreads
12727Add support for multithreading using the POSIX threads library.  This
12728option sets flags for both the preprocessor and linker.  This option does
12729not affect the thread safety of object code produced  by the compiler or
12730that of libraries supplied with it.
12731
12732@item -pthread
12733@opindex pthread
12734This is a synonym for @option{-pthreads}.
12735@end table
12736
12737@node System V Options
12738@subsection Options for System V
12739
12740These additional options are available on System V Release 4 for
12741compatibility with other compilers on those systems:
12742
12743@table @gcctabopt
12744@item -G
12745@opindex G
12746Create a shared object.
12747It is recommended that @option{-symbolic} or @option{-shared} be used instead.
12748
12749@item -Qy
12750@opindex Qy
12751Identify the versions of each tool used by the compiler, in a
12752@code{.ident} assembler directive in the output.
12753
12754@item -Qn
12755@opindex Qn
12756Refrain from adding @code{.ident} directives to the output file (this is
12757the default).
12758
12759@item -YP,@var{dirs}
12760@opindex YP
12761Search the directories @var{dirs}, and no others, for libraries
12762specified with @option{-l}.
12763
12764@item -Ym,@var{dir}
12765@opindex Ym
12766Look in the directory @var{dir} to find the M4 preprocessor.
12767The assembler uses this option.
12768@c This is supposed to go with a -Yd for predefined M4 macro files, but
12769@c the generic assembler that comes with Solaris takes just -Ym.
12770@end table
12771
12772@node TMS320C3x/C4x Options
12773@subsection TMS320C3x/C4x Options
12774@cindex TMS320C3x/C4x Options
12775
12776These @samp{-m} options are defined for TMS320C3x/C4x implementations:
12777
12778@table @gcctabopt
12779
12780@item -mcpu=@var{cpu_type}
12781@opindex mcpu
12782Set the instruction set, register set, and instruction scheduling
12783parameters for machine type @var{cpu_type}.  Supported values for
12784@var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
12785@samp{c44}.  The default is @samp{c40} to generate code for the
12786TMS320C40.
12787
12788@item -mbig-memory
12789@itemx -mbig
12790@itemx -msmall-memory
12791@itemx -msmall
12792@opindex mbig-memory
12793@opindex mbig
12794@opindex msmall-memory
12795@opindex msmall
12796Generates code for the big or small memory model.  The small memory
12797model assumed that all data fits into one 64K word page.  At run-time
12798the data page (DP) register must be set to point to the 64K page
12799containing the .bss and .data program sections.  The big memory model is
12800the default and requires reloading of the DP register for every direct
12801memory access.
12802
12803@item -mbk
12804@itemx -mno-bk
12805@opindex mbk
12806@opindex mno-bk
12807Allow (disallow) allocation of general integer operands into the block
12808count register BK@.
12809
12810@item -mdb
12811@itemx -mno-db
12812@opindex mdb
12813@opindex mno-db
12814Enable (disable) generation of code using decrement and branch,
12815DBcond(D), instructions.  This is enabled by default for the C4x.  To be
12816on the safe side, this is disabled for the C3x, since the maximum
12817iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than
12818@math{2^{23}} times on the C3x?).  Note that GCC will try to reverse a loop so
12819that it can utilize the decrement and branch instruction, but will give
12820up if there is more than one memory reference in the loop.  Thus a loop
12821where the loop counter is decremented can generate slightly more
12822efficient code, in cases where the RPTB instruction cannot be utilized.
12823
12824@item -mdp-isr-reload
12825@itemx -mparanoid
12826@opindex mdp-isr-reload
12827@opindex mparanoid
12828Force the DP register to be saved on entry to an interrupt service
12829routine (ISR), reloaded to point to the data section, and restored on
12830exit from the ISR@.  This should not be required unless someone has
12831violated the small memory model by modifying the DP register, say within
12832an object library.
12833
12834@item -mmpyi
12835@itemx -mno-mpyi
12836@opindex mmpyi
12837@opindex mno-mpyi
12838For the C3x use the 24-bit MPYI instruction for integer multiplies
12839instead of a library call to guarantee 32-bit results.  Note that if one
12840of the operands is a constant, then the multiplication will be performed
12841using shifts and adds.  If the @option{-mmpyi} option is not specified for the C3x,
12842then squaring operations are performed inline instead of a library call.
12843
12844@item -mfast-fix
12845@itemx -mno-fast-fix
12846@opindex mfast-fix
12847@opindex mno-fast-fix
12848The C3x/C4x FIX instruction to convert a floating point value to an
12849integer value chooses the nearest integer less than or equal to the
12850floating point value rather than to the nearest integer.  Thus if the
12851floating point number is negative, the result will be incorrectly
12852truncated an additional code is necessary to detect and correct this
12853case.  This option can be used to disable generation of the additional
12854code required to correct the result.
12855
12856@item -mrptb
12857@itemx -mno-rptb
12858@opindex mrptb
12859@opindex mno-rptb
12860Enable (disable) generation of repeat block sequences using the RPTB
12861instruction for zero overhead looping.  The RPTB construct is only used
12862for innermost loops that do not call functions or jump across the loop
12863boundaries.  There is no advantage having nested RPTB loops due to the
12864overhead required to save and restore the RC, RS, and RE registers.
12865This is enabled by default with @option{-O2}.
12866
12867@item -mrpts=@var{count}
12868@itemx -mno-rpts
12869@opindex mrpts
12870@opindex mno-rpts
12871Enable (disable) the use of the single instruction repeat instruction
12872RPTS@.  If a repeat block contains a single instruction, and the loop
12873count can be guaranteed to be less than the value @var{count}, GCC will
12874emit a RPTS instruction instead of a RPTB@.  If no value is specified,
12875then a RPTS will be emitted even if the loop count cannot be determined
12876at compile time.  Note that the repeated instruction following RPTS does
12877not have to be reloaded from memory each iteration, thus freeing up the
12878CPU buses for operands.  However, since interrupts are blocked by this
12879instruction, it is disabled by default.
12880
12881@item -mloop-unsigned
12882@itemx -mno-loop-unsigned
12883@opindex mloop-unsigned
12884@opindex mno-loop-unsigned
12885The maximum iteration count when using RPTS and RPTB (and DB on the C40)
12886is @math{2^{31} + 1} since these instructions test if the iteration count is
12887negative to terminate the loop.  If the iteration count is unsigned
12888there is a possibility than the @math{2^{31} + 1} maximum iteration count may be
12889exceeded.  This switch allows an unsigned iteration count.
12890
12891@item -mti
12892@opindex mti
12893Try to emit an assembler syntax that the TI assembler (asm30) is happy
12894with.  This also enforces compatibility with the API employed by the TI
12895C3x C compiler.  For example, long doubles are passed as structures
12896rather than in floating point registers.
12897
12898@item -mregparm
12899@itemx -mmemparm
12900@opindex mregparm
12901@opindex mmemparm
12902Generate code that uses registers (stack) for passing arguments to functions.
12903By default, arguments are passed in registers where possible rather
12904than by pushing arguments on to the stack.
12905
12906@item -mparallel-insns
12907@itemx -mno-parallel-insns
12908@opindex mparallel-insns
12909@opindex mno-parallel-insns
12910Allow the generation of parallel instructions.  This is enabled by
12911default with @option{-O2}.
12912
12913@item -mparallel-mpy
12914@itemx -mno-parallel-mpy
12915@opindex mparallel-mpy
12916@opindex mno-parallel-mpy
12917Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
12918provided @option{-mparallel-insns} is also specified.  These instructions have
12919tight register constraints which can pessimize the code generation
12920of large functions.
12921
12922@end table
12923
12924@node V850 Options
12925@subsection V850 Options
12926@cindex V850 Options
12927
12928These @samp{-m} options are defined for V850 implementations:
12929
12930@table @gcctabopt
12931@item -mlong-calls
12932@itemx -mno-long-calls
12933@opindex mlong-calls
12934@opindex mno-long-calls
12935Treat all calls as being far away (near).  If calls are assumed to be
12936far away, the compiler will always load the functions address up into a
12937register, and call indirect through the pointer.
12938
12939@item -mno-ep
12940@itemx -mep
12941@opindex mno-ep
12942@opindex mep
12943Do not optimize (do optimize) basic blocks that use the same index
12944pointer 4 or more times to copy pointer into the @code{ep} register, and
12945use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
12946option is on by default if you optimize.
12947
12948@item -mno-prolog-function
12949@itemx -mprolog-function
12950@opindex mno-prolog-function
12951@opindex mprolog-function
12952Do not use (do use) external functions to save and restore registers
12953at the prologue and epilogue of a function.  The external functions
12954are slower, but use less code space if more than one function saves
12955the same number of registers.  The @option{-mprolog-function} option
12956is on by default if you optimize.
12957
12958@item -mspace
12959@opindex mspace
12960Try to make the code as small as possible.  At present, this just turns
12961on the @option{-mep} and @option{-mprolog-function} options.
12962
12963@item -mtda=@var{n}
12964@opindex mtda
12965Put static or global variables whose size is @var{n} bytes or less into
12966the tiny data area that register @code{ep} points to.  The tiny data
12967area can hold up to 256 bytes in total (128 bytes for byte references).
12968
12969@item -msda=@var{n}
12970@opindex msda
12971Put static or global variables whose size is @var{n} bytes or less into
12972the small data area that register @code{gp} points to.  The small data
12973area can hold up to 64 kilobytes.
12974
12975@item -mzda=@var{n}
12976@opindex mzda
12977Put static or global variables whose size is @var{n} bytes or less into
12978the first 32 kilobytes of memory.
12979
12980@item -mv850
12981@opindex mv850
12982Specify that the target processor is the V850.
12983
12984@item -mbig-switch
12985@opindex mbig-switch
12986Generate code suitable for big switch tables.  Use this option only if
12987the assembler/linker complain about out of range branches within a switch
12988table.
12989
12990@item -mapp-regs
12991@opindex mapp-regs
12992This option will cause r2 and r5 to be used in the code generated by
12993the compiler.  This setting is the default.
12994
12995@item -mno-app-regs
12996@opindex mno-app-regs
12997This option will cause r2 and r5 to be treated as fixed registers.
12998
12999@item -mv850e1
13000@opindex mv850e1
13001Specify that the target processor is the V850E1.  The preprocessor
13002constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
13003this option is used.
13004
13005@item -mv850e
13006@opindex mv850e
13007Specify that the target processor is the V850E@.  The preprocessor
13008constant @samp{__v850e__} will be defined if this option is used.
13009
13010If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
13011are defined then a default target processor will be chosen and the
13012relevant @samp{__v850*__} preprocessor constant will be defined.
13013
13014The preprocessor constants @samp{__v850} and @samp{__v851__} are always
13015defined, regardless of which processor variant is the target.
13016
13017@item -mdisable-callt
13018@opindex mdisable-callt
13019This option will suppress generation of the CALLT instruction for the
13020v850e and v850e1 flavors of the v850 architecture.  The default is
13021@option{-mno-disable-callt} which allows the CALLT instruction to be used.
13022
13023@end table
13024
13025@node VAX Options
13026@subsection VAX Options
13027@cindex VAX options
13028
13029These @samp{-m} options are defined for the VAX:
13030
13031@table @gcctabopt
13032@item -munix
13033@opindex munix
13034Do not output certain jump instructions (@code{aobleq} and so on)
13035that the Unix assembler for the VAX cannot handle across long
13036ranges.
13037
13038@item -mgnu
13039@opindex mgnu
13040Do output those jump instructions, on the assumption that you
13041will assemble with the GNU assembler.
13042
13043@item -mg
13044@opindex mg
13045Output code for g-format floating point numbers instead of d-format.
13046@end table
13047
13048@node x86-64 Options
13049@subsection x86-64 Options
13050@cindex x86-64 options
13051
13052These are listed under @xref{i386 and x86-64 Options}.
13053
13054@node Xstormy16 Options
13055@subsection Xstormy16 Options
13056@cindex Xstormy16 Options
13057
13058These options are defined for Xstormy16:
13059
13060@table @gcctabopt
13061@item -msim
13062@opindex msim
13063Choose startup files and linker script suitable for the simulator.
13064@end table
13065
13066@node Xtensa Options
13067@subsection Xtensa Options
13068@cindex Xtensa Options
13069
13070These options are supported for Xtensa targets:
13071
13072@table @gcctabopt
13073@item -mconst16
13074@itemx -mno-const16
13075@opindex mconst16
13076@opindex mno-const16
13077Enable or disable use of @code{CONST16} instructions for loading
13078constant values.  The @code{CONST16} instruction is currently not a
13079standard option from Tensilica.  When enabled, @code{CONST16}
13080instructions are always used in place of the standard @code{L32R}
13081instructions.  The use of @code{CONST16} is enabled by default only if
13082the @code{L32R} instruction is not available.
13083
13084@item -mfused-madd
13085@itemx -mno-fused-madd
13086@opindex mfused-madd
13087@opindex mno-fused-madd
13088Enable or disable use of fused multiply/add and multiply/subtract
13089instructions in the floating-point option.  This has no effect if the
13090floating-point option is not also enabled.  Disabling fused multiply/add
13091and multiply/subtract instructions forces the compiler to use separate
13092instructions for the multiply and add/subtract operations.  This may be
13093desirable in some cases where strict IEEE 754-compliant results are
13094required: the fused multiply add/subtract instructions do not round the
13095intermediate result, thereby producing results with @emph{more} bits of
13096precision than specified by the IEEE standard.  Disabling fused multiply
13097add/subtract instructions also ensures that the program output is not
13098sensitive to the compiler's ability to combine multiply and add/subtract
13099operations.
13100
13101@item -mtext-section-literals
13102@itemx -mno-text-section-literals
13103@opindex mtext-section-literals
13104@opindex mno-text-section-literals
13105Control the treatment of literal pools.  The default is
13106@option{-mno-text-section-literals}, which places literals in a separate
13107section in the output file.  This allows the literal pool to be placed
13108in a data RAM/ROM, and it also allows the linker to combine literal
13109pools from separate object files to remove redundant literals and
13110improve code size.  With @option{-mtext-section-literals}, the literals
13111are interspersed in the text section in order to keep them as close as
13112possible to their references.  This may be necessary for large assembly
13113files.
13114
13115@item -mtarget-align
13116@itemx -mno-target-align
13117@opindex mtarget-align
13118@opindex mno-target-align
13119When this option is enabled, GCC instructs the assembler to
13120automatically align instructions to reduce branch penalties at the
13121expense of some code density.  The assembler attempts to widen density
13122instructions to align branch targets and the instructions following call
13123instructions.  If there are not enough preceding safe density
13124instructions to align a target, no widening will be performed.  The
13125default is @option{-mtarget-align}.  These options do not affect the
13126treatment of auto-aligned instructions like @code{LOOP}, which the
13127assembler will always align, either by widening density instructions or
13128by inserting no-op instructions.
13129
13130@item -mlongcalls
13131@itemx -mno-longcalls
13132@opindex mlongcalls
13133@opindex mno-longcalls
13134When this option is enabled, GCC instructs the assembler to translate
13135direct calls to indirect calls unless it can determine that the target
13136of a direct call is in the range allowed by the call instruction.  This
13137translation typically occurs for calls to functions in other source
13138files.  Specifically, the assembler translates a direct @code{CALL}
13139instruction into an @code{L32R} followed by a @code{CALLX} instruction.
13140The default is @option{-mno-longcalls}.  This option should be used in
13141programs where the call target can potentially be out of range.  This
13142option is implemented in the assembler, not the compiler, so the
13143assembly code generated by GCC will still show direct call
13144instructions---look at the disassembled object code to see the actual
13145instructions.  Note that the assembler will use an indirect call for
13146every cross-file call, not just those that really will be out of range.
13147@end table
13148
13149@node zSeries Options
13150@subsection zSeries Options
13151@cindex zSeries options
13152
13153These are listed under @xref{S/390 and zSeries Options}.
13154
13155@node Code Gen Options
13156@section Options for Code Generation Conventions
13157@cindex code generation conventions
13158@cindex options, code generation
13159@cindex run-time options
13160
13161These machine-independent options control the interface conventions
13162used in code generation.
13163
13164Most of them have both positive and negative forms; the negative form
13165of @option{-ffoo} would be @option{-fno-foo}.  In the table below, only
13166one of the forms is listed---the one which is not the default.  You
13167can figure out the other form by either removing @samp{no-} or adding
13168it.
13169
13170@table @gcctabopt
13171@item -fbounds-check
13172@opindex fbounds-check
13173For front-ends that support it, generate additional code to check that
13174indices used to access arrays are within the declared range.  This is
13175currently only supported by the Java and Fortran front-ends, where
13176this option defaults to true and false respectively.
13177
13178@item -ftrapv
13179@opindex ftrapv
13180This option generates traps for signed overflow on addition, subtraction,
13181multiplication operations.
13182
13183@item -fwrapv
13184@opindex fwrapv
13185This option instructs the compiler to assume that signed arithmetic
13186overflow of addition, subtraction and multiplication wraps around
13187using twos-complement representation.  This flag enables some optimizations
13188and disables others.  This option is enabled by default for the Java
13189front-end, as required by the Java language specification.
13190
13191@item -fexceptions
13192@opindex fexceptions
13193Enable exception handling.  Generates extra code needed to propagate
13194exceptions.  For some targets, this implies GCC will generate frame
13195unwind information for all functions, which can produce significant data
13196size overhead, although it does not affect execution.  If you do not
13197specify this option, GCC will enable it by default for languages like
13198C++ which normally require exception handling, and disable it for
13199languages like C that do not normally require it.  However, you may need
13200to enable this option when compiling C code that needs to interoperate
13201properly with exception handlers written in C++.  You may also wish to
13202disable this option if you are compiling older C++ programs that don't
13203use exception handling.
13204
13205@item -fnon-call-exceptions
13206@opindex fnon-call-exceptions
13207Generate code that allows trapping instructions to throw exceptions.
13208Note that this requires platform-specific runtime support that does
13209not exist everywhere.  Moreover, it only allows @emph{trapping}
13210instructions to throw exceptions, i.e.@: memory references or floating
13211point instructions.  It does not allow exceptions to be thrown from
13212arbitrary signal handlers such as @code{SIGALRM}.
13213
13214@item -funwind-tables
13215@opindex funwind-tables
13216Similar to @option{-fexceptions}, except that it will just generate any needed
13217static data, but will not affect the generated code in any other way.
13218You will normally not enable this option; instead, a language processor
13219that needs this handling would enable it on your behalf.
13220
13221@item -fasynchronous-unwind-tables
13222@opindex fasynchronous-unwind-tables
13223Generate unwind table in dwarf2 format, if supported by target machine.  The
13224table is exact at each instruction boundary, so it can be used for stack
13225unwinding from asynchronous events (such as debugger or garbage collector).
13226
13227@item -fpcc-struct-return
13228@opindex fpcc-struct-return
13229Return ``short'' @code{struct} and @code{union} values in memory like
13230longer ones, rather than in registers.  This convention is less
13231efficient, but it has the advantage of allowing intercallability between
13232GCC-compiled files and files compiled with other compilers, particularly
13233the Portable C Compiler (pcc).
13234
13235The precise convention for returning structures in memory depends
13236on the target configuration macros.
13237
13238Short structures and unions are those whose size and alignment match
13239that of some integer type.
13240
13241@strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13242switch is not binary compatible with code compiled with the
13243@option{-freg-struct-return} switch.
13244Use it to conform to a non-default application binary interface.
13245
13246@item -freg-struct-return
13247@opindex freg-struct-return
13248Return @code{struct} and @code{union} values in registers when possible.
13249This is more efficient for small structures than
13250@option{-fpcc-struct-return}.
13251
13252If you specify neither @option{-fpcc-struct-return} nor
13253@option{-freg-struct-return}, GCC defaults to whichever convention is
13254standard for the target.  If there is no standard convention, GCC
13255defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13256the principal compiler.  In those cases, we can choose the standard, and
13257we chose the more efficient register return alternative.
13258
13259@strong{Warning:} code compiled with the @option{-freg-struct-return}
13260switch is not binary compatible with code compiled with the
13261@option{-fpcc-struct-return} switch.
13262Use it to conform to a non-default application binary interface.
13263
13264@item -fshort-enums
13265@opindex fshort-enums
13266Allocate to an @code{enum} type only as many bytes as it needs for the
13267declared range of possible values.  Specifically, the @code{enum} type
13268will be equivalent to the smallest integer type which has enough room.
13269
13270@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13271code that is not binary compatible with code generated without that switch.
13272Use it to conform to a non-default application binary interface.
13273
13274@item -fshort-double
13275@opindex fshort-double
13276Use the same size for @code{double} as for @code{float}.
13277
13278@strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
13279code that is not binary compatible with code generated without that switch.
13280Use it to conform to a non-default application binary interface.
13281
13282@item -fshort-wchar
13283@opindex fshort-wchar
13284Override the underlying type for @samp{wchar_t} to be @samp{short
13285unsigned int} instead of the default for the target.  This option is
13286useful for building programs to run under WINE@.
13287
13288@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13289code that is not binary compatible with code generated without that switch.
13290Use it to conform to a non-default application binary interface.
13291
13292@item -fno-common
13293@opindex fno-common
13294In C, allocate even uninitialized global variables in the data section of the
13295object file, rather than generating them as common blocks.  This has the
13296effect that if the same variable is declared (without @code{extern}) in
13297two different compilations, you will get an error when you link them.
13298The only reason this might be useful is if you wish to verify that the
13299program will work on other systems which always work this way.
13300
13301@item -fno-ident
13302@opindex fno-ident
13303Ignore the @samp{#ident} directive.
13304
13305@item -finhibit-size-directive
13306@opindex finhibit-size-directive
13307Don't output a @code{.size} assembler directive, or anything else that
13308would cause trouble if the function is split in the middle, and the
13309two halves are placed at locations far apart in memory.  This option is
13310used when compiling @file{crtstuff.c}; you should not need to use it
13311for anything else.
13312
13313@item -fverbose-asm
13314@opindex fverbose-asm
13315Put extra commentary information in the generated assembly code to
13316make it more readable.  This option is generally only of use to those
13317who actually need to read the generated assembly code (perhaps while
13318debugging the compiler itself).
13319
13320@option{-fno-verbose-asm}, the default, causes the
13321extra information to be omitted and is useful when comparing two assembler
13322files.
13323
13324@item -fpic
13325@opindex fpic
13326@cindex global offset table
13327@cindex PIC
13328Generate position-independent code (PIC) suitable for use in a shared
13329library, if supported for the target machine.  Such code accesses all
13330constant addresses through a global offset table (GOT)@.  The dynamic
13331loader resolves the GOT entries when the program starts (the dynamic
13332loader is not part of GCC; it is part of the operating system).  If
13333the GOT size for the linked executable exceeds a machine-specific
13334maximum size, you get an error message from the linker indicating that
13335@option{-fpic} does not work; in that case, recompile with @option{-fPIC}
13336instead.  (These maximums are 8k on the SPARC and 32k
13337on the m68k and RS/6000.  The 386 has no such limit.)
13338
13339Position-independent code requires special support, and therefore works
13340only on certain machines.  For the 386, GCC supports PIC for System V
13341but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
13342position-independent.
13343
13344When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13345are defined to 1.
13346
13347@item -fPIC
13348@opindex fPIC
13349If supported for the target machine, emit position-independent code,
13350suitable for dynamic linking and avoiding any limit on the size of the
13351global offset table.  This option makes a difference on the m68k,
13352PowerPC and SPARC@.
13353
13354Position-independent code requires special support, and therefore works
13355only on certain machines.
13356
13357When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13358are defined to 2.
13359
13360@item -fpie
13361@itemx -fPIE
13362@opindex fpie
13363@opindex fPIE
13364These options are similar to @option{-fpic} and @option{-fPIC}, but
13365generated position independent code can be only linked into executables.
13366Usually these options are used when @option{-pie} GCC option will be
13367used during linking.
13368
13369@item -fno-jump-tables
13370@opindex fno-jump-tables
13371Do not use jump tables for switch statements even where it would be
13372more efficient than other code generation strategies.  This option is
13373of use in conjunction with @option{-fpic} or @option{-fPIC} for
13374building code which forms part of a dynamic linker and cannot
13375reference the address of a jump table.  On some targets, jump tables
13376do not require a GOT and this option is not needed.
13377
13378@item -ffixed-@var{reg}
13379@opindex ffixed
13380Treat the register named @var{reg} as a fixed register; generated code
13381should never refer to it (except perhaps as a stack pointer, frame
13382pointer or in some other fixed role).
13383
13384@var{reg} must be the name of a register.  The register names accepted
13385are machine-specific and are defined in the @code{REGISTER_NAMES}
13386macro in the machine description macro file.
13387
13388This flag does not have a negative form, because it specifies a
13389three-way choice.
13390
13391@item -fcall-used-@var{reg}
13392@opindex fcall-used
13393Treat the register named @var{reg} as an allocable register that is
13394clobbered by function calls.  It may be allocated for temporaries or
13395variables that do not live across a call.  Functions compiled this way
13396will not save and restore the register @var{reg}.
13397
13398It is an error to used this flag with the frame pointer or stack pointer.
13399Use of this flag for other registers that have fixed pervasive roles in
13400the machine's execution model will produce disastrous results.
13401
13402This flag does not have a negative form, because it specifies a
13403three-way choice.
13404
13405@item -fcall-saved-@var{reg}
13406@opindex fcall-saved
13407Treat the register named @var{reg} as an allocable register saved by
13408functions.  It may be allocated even for temporaries or variables that
13409live across a call.  Functions compiled this way will save and restore
13410the register @var{reg} if they use it.
13411
13412It is an error to used this flag with the frame pointer or stack pointer.
13413Use of this flag for other registers that have fixed pervasive roles in
13414the machine's execution model will produce disastrous results.
13415
13416A different sort of disaster will result from the use of this flag for
13417a register in which function values may be returned.
13418
13419This flag does not have a negative form, because it specifies a
13420three-way choice.
13421
13422@item -fpack-struct[=@var{n}]
13423@opindex fpack-struct
13424Without a value specified, pack all structure members together without
13425holes.  When a value is specified (which must be a small power of two), pack
13426structure members according to this value, representing the maximum
13427alignment (that is, objects with default alignment requirements larger than
13428this will be output potentially unaligned at the next fitting location.
13429
13430@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
13431code that is not binary compatible with code generated without that switch.
13432Additionally, it makes the code suboptimal.
13433Use it to conform to a non-default application binary interface.
13434
13435@item -finstrument-functions
13436@opindex finstrument-functions
13437Generate instrumentation calls for entry and exit to functions.  Just
13438after function entry and just before function exit, the following
13439profiling functions will be called with the address of the current
13440function and its call site.  (On some platforms,
13441@code{__builtin_return_address} does not work beyond the current
13442function, so the call site information may not be available to the
13443profiling functions otherwise.)
13444
13445@smallexample
13446void __cyg_profile_func_enter (void *this_fn,
13447                               void *call_site);
13448void __cyg_profile_func_exit  (void *this_fn,
13449                               void *call_site);
13450@end smallexample
13451
13452The first argument is the address of the start of the current function,
13453which may be looked up exactly in the symbol table.
13454
13455This instrumentation is also done for functions expanded inline in other
13456functions.  The profiling calls will indicate where, conceptually, the
13457inline function is entered and exited.  This means that addressable
13458versions of such functions must be available.  If all your uses of a
13459function are expanded inline, this may mean an additional expansion of
13460code size.  If you use @samp{extern inline} in your C code, an
13461addressable version of such functions must be provided.  (This is
13462normally the case anyways, but if you get lucky and the optimizer always
13463expands the functions inline, you might have gotten away without
13464providing static copies.)
13465
13466A function may be given the attribute @code{no_instrument_function}, in
13467which case this instrumentation will not be done.  This can be used, for
13468example, for the profiling functions listed above, high-priority
13469interrupt routines, and any functions from which the profiling functions
13470cannot safely be called (perhaps signal handlers, if the profiling
13471routines generate output or allocate memory).
13472
13473@item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
13474@opindex finstrument-functions-exclude-file-list
13475
13476Set the list of functions that are excluded from instrumentation (see
13477the description of @code{-finstrument-functions}).  If the file that
13478contains a function definition matches with one of @var{file}, then
13479that function is not instrumented.  The match is done on substrings:
13480if the @var{file} parameter is a substring of the file name, it is
13481considered to be a match.
13482
13483For example,
13484@code{-finstrument-functions-exclude-file-list=/bits/stl,include/sys}
13485will exclude any inline function defined in files whose pathnames
13486contain @code{/bits/stl} or @code{include/sys}.
13487
13488If, for some reason, you want to include letter @code{','} in one of
13489@var{sym}, write @code{'\,'}. For example,
13490@code{-finstrument-functions-exclude-file-list='\,\,tmp'}
13491(note the single quote surrounding the option).
13492
13493@item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
13494@opindex finstrument-functions-exclude-function-list
13495
13496This is similar to @code{-finstrument-functions-exclude-file-list},
13497but this option sets the list of function names to be excluded from
13498instrumentation.  The function name to be matched is its user-visible
13499name, such as @code{vector<int> blah(const vector<int> &)}, not the
13500internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}).  The
13501match is done on substrings: if the @var{sym} parameter is a substring
13502of the function name, it is considered to be a match.
13503
13504@item -fstack-check
13505@opindex fstack-check
13506Generate code to verify that you do not go beyond the boundary of the
13507stack.  You should specify this flag if you are running in an
13508environment with multiple threads, but only rarely need to specify it in
13509a single-threaded environment since stack overflow is automatically
13510detected on nearly all systems if there is only one stack.
13511
13512Note that this switch does not actually cause checking to be done; the
13513operating system must do that.  The switch causes generation of code
13514to ensure that the operating system sees the stack being extended.
13515
13516@item -fstack-limit-register=@var{reg}
13517@itemx -fstack-limit-symbol=@var{sym}
13518@itemx -fno-stack-limit
13519@opindex fstack-limit-register
13520@opindex fstack-limit-symbol
13521@opindex fno-stack-limit
13522Generate code to ensure that the stack does not grow beyond a certain value,
13523either the value of a register or the address of a symbol.  If the stack
13524would grow beyond the value, a signal is raised.  For most targets,
13525the signal is raised before the stack overruns the boundary, so
13526it is possible to catch the signal without taking special precautions.
13527
13528For instance, if the stack starts at absolute address @samp{0x80000000}
13529and grows downwards, you can use the flags
13530@option{-fstack-limit-symbol=__stack_limit} and
13531@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
13532of 128KB@.  Note that this may only work with the GNU linker.
13533
13534@cindex aliasing of parameters
13535@cindex parameters, aliased
13536@item -fargument-alias
13537@itemx -fargument-noalias
13538@itemx -fargument-noalias-global
13539@itemx -fargument-noalias-anything
13540@opindex fargument-alias
13541@opindex fargument-noalias
13542@opindex fargument-noalias-global
13543@opindex fargument-noalias-anything
13544Specify the possible relationships among parameters and between
13545parameters and global data.
13546
13547@option{-fargument-alias} specifies that arguments (parameters) may
13548alias each other and may alias global storage.@*
13549@option{-fargument-noalias} specifies that arguments do not alias
13550each other, but may alias global storage.@*
13551@option{-fargument-noalias-global} specifies that arguments do not
13552alias each other and do not alias global storage.
13553@option{-fargument-noalias-anything} specifies that arguments do not
13554alias any other storage.
13555
13556Each language will automatically use whatever option is required by
13557the language standard.  You should not need to use these options yourself.
13558
13559@item -fleading-underscore
13560@opindex fleading-underscore
13561This option and its counterpart, @option{-fno-leading-underscore}, forcibly
13562change the way C symbols are represented in the object file.  One use
13563is to help link with legacy assembly code.
13564
13565@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
13566generate code that is not binary compatible with code generated without that
13567switch.  Use it to conform to a non-default application binary interface.
13568Not all targets provide complete support for this switch.
13569
13570@item -ftls-model=@var{model}
13571Alter the thread-local storage model to be used (@pxref{Thread-Local}).
13572The @var{model} argument should be one of @code{global-dynamic},
13573@code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
13574
13575The default without @option{-fpic} is @code{initial-exec}; with
13576@option{-fpic} the default is @code{global-dynamic}.
13577
13578@item -fvisibility=@var{default|internal|hidden|protected}
13579@opindex fvisibility
13580Set the default ELF image symbol visibility to the specified option---all
13581symbols will be marked with this unless overridden within the code.
13582Using this feature can very substantially improve linking and
13583load times of shared object libraries, produce more optimized
13584code, provide near-perfect API export and prevent symbol clashes.
13585It is @strong{strongly} recommended that you use this in any shared objects
13586you distribute.
13587
13588Despite the nomenclature, @code{default} always means public ie;
13589available to be linked against from outside the shared object.
13590@code{protected} and @code{internal} are pretty useless in real-world
13591usage so the only other commonly used option will be @code{hidden}.
13592The default if @option{-fvisibility} isn't specified is
13593@code{default}, i.e., make every
13594symbol public---this causes the same behavior as previous versions of
13595GCC@.
13596
13597A good explanation of the benefits offered by ensuring ELF
13598symbols have the correct visibility is given by ``How To Write
13599Shared Libraries'' by Ulrich Drepper (which can be found at
13600@w{@uref{http://people.redhat.com/~drepper/}})---however a superior
13601solution made possible by this option to marking things hidden when
13602the default is public is to make the default hidden and mark things
13603public.  This is the norm with DLL's on Windows and with @option{-fvisibility=hidden}
13604and @code{__attribute__ ((visibility("default")))} instead of
13605@code{__declspec(dllexport)} you get almost identical semantics with
13606identical syntax.  This is a great boon to those working with
13607cross-platform projects.
13608
13609For those adding visibility support to existing code, you may find
13610@samp{#pragma GCC visibility} of use.  This works by you enclosing
13611the declarations you wish to set visibility for with (for example)
13612@samp{#pragma GCC visibility push(hidden)} and
13613@samp{#pragma GCC visibility pop}.
13614Bear in mind that symbol visibility should be viewed @strong{as
13615part of the API interface contract} and thus all new code should
13616always specify visibility when it is not the default ie; declarations
13617only for use within the local DSO should @strong{always} be marked explicitly
13618as hidden as so to avoid PLT indirection overheads---making this
13619abundantly clear also aids readability and self-documentation of the code.
13620Note that due to ISO C++ specification requirements, operator new and
13621operator delete must always be of default visibility.
13622
13623Be aware that headers from outside your project, in particular system
13624headers and headers from any other library you use, may not be
13625expecting to be compiled with visibility other than the default.  You
13626may need to explicitly say @samp{#pragma GCC visibility push(default)}
13627before including any such headers.
13628
13629@samp{extern} declarations are not affected by @samp{-fvisibility}, so
13630a lot of code can be recompiled with @samp{-fvisibility=hidden} with
13631no modifications.  However, this means that calls to @samp{extern}
13632functions with no explicit visibility will use the PLT, so it is more
13633effective to use @samp{__attribute ((visibility))} and/or
13634@samp{#pragma GCC visibility} to tell the compiler which @samp{extern}
13635declarations should be treated as hidden.
13636
13637Note that @samp{-fvisibility} does affect C++ vague linkage
13638entities. This means that, for instance, an exception class that will
13639be thrown between DSOs must be explicitly marked with default
13640visibility so that the @samp{type_info} nodes will be unified between
13641the DSOs.
13642
13643An overview of these techniques, their benefits and how to use them
13644is at @w{@uref{http://gcc.gnu.org/wiki/Visibility}}.
13645
13646@end table
13647
13648@c man end
13649
13650@node Environment Variables
13651@section Environment Variables Affecting GCC
13652@cindex environment variables
13653
13654@c man begin ENVIRONMENT
13655This section describes several environment variables that affect how GCC
13656operates.  Some of them work by specifying directories or prefixes to use
13657when searching for various kinds of files.  Some are used to specify other
13658aspects of the compilation environment.
13659
13660Note that you can also specify places to search using options such as
13661@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
13662take precedence over places specified using environment variables, which
13663in turn take precedence over those specified by the configuration of GCC@.
13664@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
13665GNU Compiler Collection (GCC) Internals}.
13666
13667@table @env
13668@item LANG
13669@itemx LC_CTYPE
13670@c @itemx LC_COLLATE
13671@itemx LC_MESSAGES
13672@c @itemx LC_MONETARY
13673@c @itemx LC_NUMERIC
13674@c @itemx LC_TIME
13675@itemx LC_ALL
13676@findex LANG
13677@findex LC_CTYPE
13678@c @findex LC_COLLATE
13679@findex LC_MESSAGES
13680@c @findex LC_MONETARY
13681@c @findex LC_NUMERIC
13682@c @findex LC_TIME
13683@findex LC_ALL
13684@cindex locale
13685These environment variables control the way that GCC uses
13686localization information that allow GCC to work with different
13687national conventions.  GCC inspects the locale categories
13688@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
13689so.  These locale categories can be set to any value supported by your
13690installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
13691Kingdom encoded in UTF-8.
13692
13693The @env{LC_CTYPE} environment variable specifies character
13694classification.  GCC uses it to determine the character boundaries in
13695a string; this is needed for some multibyte encodings that contain quote
13696and escape characters that would otherwise be interpreted as a string
13697end or escape.
13698
13699The @env{LC_MESSAGES} environment variable specifies the language to
13700use in diagnostic messages.
13701
13702If the @env{LC_ALL} environment variable is set, it overrides the value
13703of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
13704and @env{LC_MESSAGES} default to the value of the @env{LANG}
13705environment variable.  If none of these variables are set, GCC
13706defaults to traditional C English behavior.
13707
13708@item TMPDIR
13709@findex TMPDIR
13710If @env{TMPDIR} is set, it specifies the directory to use for temporary
13711files.  GCC uses temporary files to hold the output of one stage of
13712compilation which is to be used as input to the next stage: for example,
13713the output of the preprocessor, which is the input to the compiler
13714proper.
13715
13716@item GCC_EXEC_PREFIX
13717@findex GCC_EXEC_PREFIX
13718If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
13719names of the subprograms executed by the compiler.  No slash is added
13720when this prefix is combined with the name of a subprogram, but you can
13721specify a prefix that ends with a slash if you wish.
13722
13723If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
13724an appropriate prefix to use based on the pathname it was invoked with.
13725
13726If GCC cannot find the subprogram using the specified prefix, it
13727tries looking in the usual places for the subprogram.
13728
13729The default value of @env{GCC_EXEC_PREFIX} is
13730@file{@var{prefix}/lib/gcc/} where @var{prefix} is the value
13731of @code{prefix} when you ran the @file{configure} script.
13732
13733Other prefixes specified with @option{-B} take precedence over this prefix.
13734
13735This prefix is also used for finding files such as @file{crt0.o} that are
13736used for linking.
13737
13738In addition, the prefix is used in an unusual way in finding the
13739directories to search for header files.  For each of the standard
13740directories whose name normally begins with @samp{/usr/local/lib/gcc}
13741(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
13742replacing that beginning with the specified prefix to produce an
13743alternate directory name.  Thus, with @option{-Bfoo/}, GCC will search
13744@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
13745These alternate directories are searched first; the standard directories
13746come next.
13747
13748@item COMPILER_PATH
13749@findex COMPILER_PATH
13750The value of @env{COMPILER_PATH} is a colon-separated list of
13751directories, much like @env{PATH}.  GCC tries the directories thus
13752specified when searching for subprograms, if it can't find the
13753subprograms using @env{GCC_EXEC_PREFIX}.
13754
13755@item LIBRARY_PATH
13756@findex LIBRARY_PATH
13757The value of @env{LIBRARY_PATH} is a colon-separated list of
13758directories, much like @env{PATH}.  When configured as a native compiler,
13759GCC tries the directories thus specified when searching for special
13760linker files, if it can't find them using @env{GCC_EXEC_PREFIX}.  Linking
13761using GCC also uses these directories when searching for ordinary
13762libraries for the @option{-l} option (but directories specified with
13763@option{-L} come first).
13764
13765@item LANG
13766@findex LANG
13767@cindex locale definition
13768This variable is used to pass locale information to the compiler.  One way in
13769which this information is used is to determine the character set to be used
13770when character literals, string literals and comments are parsed in C and C++.
13771When the compiler is configured to allow multibyte characters,
13772the following values for @env{LANG} are recognized:
13773
13774@table @samp
13775@item C-JIS
13776Recognize JIS characters.
13777@item C-SJIS
13778Recognize SJIS characters.
13779@item C-EUCJP
13780Recognize EUCJP characters.
13781@end table
13782
13783If @env{LANG} is not defined, or if it has some other value, then the
13784compiler will use mblen and mbtowc as defined by the default locale to
13785recognize and translate multibyte characters.
13786@end table
13787
13788@noindent
13789Some additional environments variables affect the behavior of the
13790preprocessor.
13791
13792@include cppenv.texi
13793
13794@c man end
13795
13796@node Precompiled Headers
13797@section Using Precompiled Headers
13798@cindex precompiled headers
13799@cindex speed of compilation
13800
13801Often large projects have many header files that are included in every
13802source file.  The time the compiler takes to process these header files
13803over and over again can account for nearly all of the time required to
13804build the project.  To make builds faster, GCC allows users to
13805`precompile' a header file; then, if builds can use the precompiled
13806header file they will be much faster.
13807
13808To create a precompiled header file, simply compile it as you would any
13809other file, if necessary using the @option{-x} option to make the driver
13810treat it as a C or C++ header file.  You will probably want to use a
13811tool like @command{make} to keep the precompiled header up-to-date when
13812the headers it contains change.
13813
13814A precompiled header file will be searched for when @code{#include} is
13815seen in the compilation.  As it searches for the included file
13816(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
13817compiler looks for a precompiled header in each directory just before it
13818looks for the include file in that directory.  The name searched for is
13819the name specified in the @code{#include} with @samp{.gch} appended.  If
13820the precompiled header file can't be used, it is ignored.
13821
13822For instance, if you have @code{#include "all.h"}, and you have
13823@file{all.h.gch} in the same directory as @file{all.h}, then the
13824precompiled header file will be used if possible, and the original
13825header will be used otherwise.
13826
13827Alternatively, you might decide to put the precompiled header file in a
13828directory and use @option{-I} to ensure that directory is searched
13829before (or instead of) the directory containing the original header.
13830Then, if you want to check that the precompiled header file is always
13831used, you can put a file of the same name as the original header in this
13832directory containing an @code{#error} command.
13833
13834This also works with @option{-include}.  So yet another way to use
13835precompiled headers, good for projects not designed with precompiled
13836header files in mind, is to simply take most of the header files used by
13837a project, include them from another header file, precompile that header
13838file, and @option{-include} the precompiled header.  If the header files
13839have guards against multiple inclusion, they will be skipped because
13840they've already been included (in the precompiled header).
13841
13842If you need to precompile the same header file for different
13843languages, targets, or compiler options, you can instead make a
13844@emph{directory} named like @file{all.h.gch}, and put each precompiled
13845header in the directory, perhaps using @option{-o}.  It doesn't matter
13846what you call the files in the directory, every precompiled header in
13847the directory will be considered.  The first precompiled header
13848encountered in the directory that is valid for this compilation will
13849be used; they're searched in no particular order.
13850
13851There are many other possibilities, limited only by your imagination,
13852good sense, and the constraints of your build system.
13853
13854A precompiled header file can be used only when these conditions apply:
13855
13856@itemize
13857@item
13858Only one precompiled header can be used in a particular compilation.
13859
13860@item
13861A precompiled header can't be used once the first C token is seen.  You
13862can have preprocessor directives before a precompiled header; you can
13863even include a precompiled header from inside another header, so long as
13864there are no C tokens before the @code{#include}.
13865
13866@item
13867The precompiled header file must be produced for the same language as
13868the current compilation.  You can't use a C precompiled header for a C++
13869compilation.
13870
13871@item
13872The precompiled header file must have been produced by the same compiler
13873binary as the current compilation is using.
13874
13875@item
13876Any macros defined before the precompiled header is included must
13877either be defined in the same way as when the precompiled header was
13878generated, or must not affect the precompiled header, which usually
13879means that they don't appear in the precompiled header at all.
13880
13881The @option{-D} option is one way to define a macro before a
13882precompiled header is included; using a @code{#define} can also do it.
13883There are also some options that define macros implicitly, like
13884@option{-O} and @option{-Wdeprecated}; the same rule applies to macros
13885defined this way.
13886
13887@item If debugging information is output when using the precompiled
13888header, using @option{-g} or similar, the same kind of debugging information
13889must have been output when building the precompiled header.  However,
13890a precompiled header built using @option{-g} can be used in a compilation
13891when no debugging information is being output.
13892
13893@item The same @option{-m} options must generally be used when building
13894and using the precompiled header.  @xref{Submodel Options},
13895for any cases where this rule is relaxed.
13896
13897@item Each of the following options must be the same when building and using
13898the precompiled header:
13899
13900@gccoptlist{-fexceptions -funit-at-a-time}
13901
13902@item
13903Some other command-line options starting with @option{-f},
13904@option{-p}, or @option{-O} must be defined in the same way as when
13905the precompiled header was generated.  At present, it's not clear
13906which options are safe to change and which are not; the safest choice
13907is to use exactly the same options when generating and using the
13908precompiled header.  The following are known to be safe:
13909
13910@gccoptlist{-fmessage-length= -fpreprocessed
13911-fsched-interblock -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous
13912-fsched-verbose=<number> -fschedule-insns -fvisibility=
13913-pedantic-errors}
13914
13915@end itemize
13916
13917For all of these except the last, the compiler will automatically
13918ignore the precompiled header if the conditions aren't met.  If you
13919find an option combination that doesn't work and doesn't cause the
13920precompiled header to be ignored, please consider filing a bug report,
13921see @ref{Bugs}.
13922
13923If you do use differing options when generating and using the
13924precompiled header, the actual behavior will be a mixture of the
13925behavior for the options.  For instance, if you use @option{-g} to
13926generate the precompiled header but not when using it, you may or may
13927not get debugging information for routines in the precompiled header.
13928
13929@node Running Protoize
13930@section Running Protoize
13931
13932The program @code{protoize} is an optional part of GCC@.  You can use
13933it to add prototypes to a program, thus converting the program to ISO
13934C in one respect.  The companion program @code{unprotoize} does the
13935reverse: it removes argument types from any prototypes that are found.
13936
13937When you run these programs, you must specify a set of source files as
13938command line arguments.  The conversion programs start out by compiling
13939these files to see what functions they define.  The information gathered
13940about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
13941
13942After scanning comes actual conversion.  The specified files are all
13943eligible to be converted; any files they include (whether sources or
13944just headers) are eligible as well.
13945
13946But not all the eligible files are converted.  By default,
13947@code{protoize} and @code{unprotoize} convert only source and header
13948files in the current directory.  You can specify additional directories
13949whose files should be converted with the @option{-d @var{directory}}
13950option.  You can also specify particular files to exclude with the
13951@option{-x @var{file}} option.  A file is converted if it is eligible, its
13952directory name matches one of the specified directory names, and its
13953name within the directory has not been excluded.
13954
13955Basic conversion with @code{protoize} consists of rewriting most
13956function definitions and function declarations to specify the types of
13957the arguments.  The only ones not rewritten are those for varargs
13958functions.
13959
13960@code{protoize} optionally inserts prototype declarations at the
13961beginning of the source file, to make them available for any calls that
13962precede the function's definition.  Or it can insert prototype
13963declarations with block scope in the blocks where undeclared functions
13964are called.
13965
13966Basic conversion with @code{unprotoize} consists of rewriting most
13967function declarations to remove any argument types, and rewriting
13968function definitions to the old-style pre-ISO form.
13969
13970Both conversion programs print a warning for any function declaration or
13971definition that they can't convert.  You can suppress these warnings
13972with @option{-q}.
13973
13974The output from @code{protoize} or @code{unprotoize} replaces the
13975original source file.  The original file is renamed to a name ending
13976with @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
13977without the original @samp{.c} suffix).  If the @samp{.save} (@samp{.sav}
13978for DOS) file already exists, then the source file is simply discarded.
13979
13980@code{protoize} and @code{unprotoize} both depend on GCC itself to
13981scan the program and collect information about the functions it uses.
13982So neither of these programs will work until GCC is installed.
13983
13984Here is a table of the options you can use with @code{protoize} and
13985@code{unprotoize}.  Each option works with both programs unless
13986otherwise stated.
13987
13988@table @code
13989@item -B @var{directory}
13990Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
13991usual directory (normally @file{/usr/local/lib}).  This file contains
13992prototype information about standard system functions.  This option
13993applies only to @code{protoize}.
13994
13995@item -c @var{compilation-options}
13996Use @var{compilation-options} as the options when running @command{gcc} to
13997produce the @samp{.X} files.  The special option @option{-aux-info} is
13998always passed in addition, to tell @command{gcc} to write a @samp{.X} file.
13999
14000Note that the compilation options must be given as a single argument to
14001@code{protoize} or @code{unprotoize}.  If you want to specify several
14002@command{gcc} options, you must quote the entire set of compilation options
14003to make them a single word in the shell.
14004
14005There are certain @command{gcc} arguments that you cannot use, because they
14006would produce the wrong kind of output.  These include @option{-g},
14007@option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
14008the @var{compilation-options}, they are ignored.
14009
14010@item -C
14011Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file
14012systems) instead of @samp{.c}.  This is convenient if you are converting
14013a C program to C++.  This option applies only to @code{protoize}.
14014
14015@item -g
14016Add explicit global declarations.  This means inserting explicit
14017declarations at the beginning of each source file for each function
14018that is called in the file and was not declared.  These declarations
14019precede the first function definition that contains a call to an
14020undeclared function.  This option applies only to @code{protoize}.
14021
14022@item -i @var{string}
14023Indent old-style parameter declarations with the string @var{string}.
14024This option applies only to @code{protoize}.
14025
14026@code{unprotoize} converts prototyped function definitions to old-style
14027function definitions, where the arguments are declared between the
14028argument list and the initial @samp{@{}.  By default, @code{unprotoize}
14029uses five spaces as the indentation.  If you want to indent with just
14030one space instead, use @option{-i " "}.
14031
14032@item -k
14033Keep the @samp{.X} files.  Normally, they are deleted after conversion
14034is finished.
14035
14036@item -l
14037Add explicit local declarations.  @code{protoize} with @option{-l} inserts
14038a prototype declaration for each function in each block which calls the
14039function without any declaration.  This option applies only to
14040@code{protoize}.
14041
14042@item -n
14043Make no real changes.  This mode just prints information about the conversions
14044that would have been done without @option{-n}.
14045
14046@item -N
14047Make no @samp{.save} files.  The original files are simply deleted.
14048Use this option with caution.
14049
14050@item -p @var{program}
14051Use the program @var{program} as the compiler.  Normally, the name
14052@file{gcc} is used.
14053
14054@item -q
14055Work quietly.  Most warnings are suppressed.
14056
14057@item -v
14058Print the version number, just like @option{-v} for @command{gcc}.
14059@end table
14060
14061If you need special compiler options to compile one of your program's
14062source files, then you should generate that file's @samp{.X} file
14063specially, by running @command{gcc} on that source file with the
14064appropriate options and the option @option{-aux-info}.  Then run
14065@code{protoize} on the entire set of files.  @code{protoize} will use
14066the existing @samp{.X} file because it is newer than the source file.
14067For example:
14068
14069@smallexample
14070gcc -Dfoo=bar file1.c -aux-info file1.X
14071protoize *.c
14072@end smallexample
14073
14074@noindent
14075You need to include the special files along with the rest in the
14076@code{protoize} command, even though their @samp{.X} files already
14077exist, because otherwise they won't get converted.
14078
14079@xref{Protoize Caveats}, for more information on how to use
14080@code{protoize} successfully.
14081
14082