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-fno-asm  -fno-builtin  -fno-builtin-@var{function} @gol
168-fhosted  -ffreestanding -fopenmp -fms-extensions @gol
169-trigraphs  -no-integrated-cpp  -traditional  -traditional-cpp @gol
170-fallow-single-precision  -fcond-mismatch @gol
171-fsigned-bitfields  -fsigned-char @gol
172-funsigned-bitfields  -funsigned-char}
173
174@item C++ Language Options
175@xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
176@gccoptlist{-fabi-version=@var{n}  -fno-access-control  -fcheck-new @gol
177-fconserve-space  -ffriend-injection @gol
178-fno-elide-constructors @gol
179-fno-enforce-eh-specs @gol
180-ffor-scope  -fno-for-scope  -fno-gnu-keywords @gol
181-fno-implicit-templates @gol
182-fno-implicit-inline-templates @gol
183-fno-implement-inlines  -fms-extensions @gol
184-fno-nonansi-builtins  -fno-operator-names @gol
185-fno-optional-diags  -fpermissive @gol
186-frepo  -fno-rtti  -fstats  -ftemplate-depth-@var{n} @gol
187-fno-threadsafe-statics -fuse-cxa-atexit  -fno-weak  -nostdinc++ @gol
188-fno-default-inline  -fvisibility-inlines-hidden @gol
189-Wabi  -Wctor-dtor-privacy @gol
190-Wnon-virtual-dtor  -Wreorder @gol
191-Weffc++  -Wno-deprecated  -Wstrict-null-sentinel @gol
192-Wno-non-template-friend  -Wold-style-cast @gol
193-Woverloaded-virtual  -Wno-pmf-conversions @gol
194-Wsign-promo}
195
196@item Language Independent Options
197@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
198@gccoptlist{-fmessage-length=@var{n}  @gol
199-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}  @gol
200-fdiagnostics-show-option}
201
202@item Warning Options
203@xref{Warning Options,,Options to Request or Suppress Warnings}.
204@gccoptlist{-fsyntax-only  -pedantic  -pedantic-errors @gol
205-w  -Wextra  -Wall  -Waddress  -Waggregate-return -Wno-attributes @gol
206-Wc++-compat -Wcast-align  -Wcast-qual  -Wchar-subscripts  -Wcomment @gol
207-Wconversion  -Wno-deprecated-declarations @gol
208-Wdisabled-optimization  -Wno-div-by-zero  -Wno-endif-labels @gol
209-Werror  -Werror=* -Werror-implicit-function-declaration @gol
210-Wfatal-errors  -Wfloat-equal  -Wformat  -Wformat=2 @gol
211-Wno-format-extra-args -Wformat-nonliteral @gol
212-Wformat-security  -Wformat-y2k @gol
213-Wimplicit  -Wimplicit-function-declaration  -Wimplicit-int @gol
214-Wimport  -Wno-import  -Winit-self  -Winline @gol
215-Wno-int-to-pointer-cast @gol
216-Wno-invalid-offsetof  -Winvalid-pch @gol
217-Wlarger-than-@var{len}  -Wunsafe-loop-optimizations  -Wlong-long @gol
218-Wmain  -Wmissing-braces  -Wmissing-field-initializers @gol
219-Wmissing-format-attribute  -Wmissing-include-dirs @gol
220-Wmissing-noreturn @gol
221-Wno-multichar  -Wnonnull  -Wno-overflow @gol
222-Woverlength-strings  -Wpacked  -Wpadded @gol
223-Wparentheses  -Wpointer-arith  -Wno-pointer-to-int-cast @gol
224-Wredundant-decls @gol
225-Wreturn-type  -Wsequence-point  -Wshadow @gol
226-Wsign-compare  -Wstack-protector @gol
227-Wstrict-aliasing -Wstrict-aliasing=2 @gol
228-Wstrict-overflow -Wstrict-overflow=@var{n} @gol
229-Wswitch  -Wswitch-default  -Wswitch-enum @gol
230-Wsystem-headers  -Wtrigraphs  -Wundef  -Wuninitialized @gol
231-Wunknown-pragmas  -Wno-pragmas -Wunreachable-code @gol
232-Wunused  -Wunused-function  -Wunused-label  -Wunused-parameter @gol
233-Wunused-value  -Wunused-variable  -Wvariadic-macros @gol
234-Wvolatile-register-var  -Wwrite-strings}
235
236@item C-only Warning Options
237@gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
238-Wmissing-prototypes  -Wnested-externs  -Wold-style-definition @gol
239-Wstrict-prototypes  -Wtraditional @gol
240-Wdeclaration-after-statement -Wpointer-sign}
241
242@item Debugging Options
243@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
244@gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
245-fdump-noaddr -fdump-unnumbered  -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
246-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
247-fdump-ipa-all -fdump-ipa-cgraph @gol
248-fdump-tree-all @gol
249-fdump-tree-original@r{[}-@var{n}@r{]}  @gol
250-fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
251-fdump-tree-inlined@r{[}-@var{n}@r{]} @gol
252-fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol
253-fdump-tree-ch @gol
254-fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
255-fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
256-fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
257-fdump-tree-dom@r{[}-@var{n}@r{]} @gol
258-fdump-tree-dse@r{[}-@var{n}@r{]} @gol
259-fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
260-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
261-fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
262-fdump-tree-nrv -fdump-tree-vect @gol
263-fdump-tree-sink @gol
264-fdump-tree-sra@r{[}-@var{n}@r{]} @gol
265-fdump-tree-salias @gol
266-fdump-tree-fre@r{[}-@var{n}@r{]} @gol
267-fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
268-ftree-vectorizer-verbose=@var{n} @gol
269-fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
270-feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
271-feliminate-unused-debug-symbols -femit-class-debug-always @gol
272-fmem-report -fprofile-arcs @gol
273-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
274-ftest-coverage  -ftime-report -fvar-tracking @gol
275-g  -g@var{level}  -gcoff -gdwarf-2 @gol
276-ggdb  -gstabs  -gstabs+  -gvms  -gxcoff  -gxcoff+ @gol
277-p  -pg  -print-file-name=@var{library}  -print-libgcc-file-name @gol
278-print-multi-directory  -print-multi-lib @gol
279-print-prog-name=@var{program}  -print-search-dirs  -Q @gol
280-save-temps  -time}
281
282@item Optimization Options
283@xref{Optimize Options,,Options that Control Optimization}.
284@gccoptlist{-falign-functions=@var{n}  -falign-jumps=@var{n} @gol
285-falign-labels=@var{n}  -falign-loops=@var{n}  @gol
286-fbounds-check -fmudflap -fmudflapth -fmudflapir @gol
287-fbranch-probabilities -fprofile-values -fvpt -fbranch-target-load-optimize @gol
288-fbranch-target-load-optimize2 -fbtr-bb-exclusive @gol
289-fcaller-saves  -fcprop-registers  -fcse-follow-jumps @gol
290-fcse-skip-blocks  -fcx-limited-range  -fdata-sections @gol
291-fdelayed-branch  -fdelete-null-pointer-checks -fearly-inlining @gol
292-fexpensive-optimizations  -ffast-math  -ffloat-store @gol
293-fforce-addr  -ffunction-sections @gol
294-fgcse  -fgcse-lm  -fgcse-sm  -fgcse-las  -fgcse-after-reload @gol
295-fcrossjumping  -fif-conversion  -fif-conversion2 @gol
296-finline-functions  -finline-functions-called-once @gol
297-finline-limit=@var{n}  -fkeep-inline-functions @gol
298-fkeep-static-consts  -fmerge-constants  -fmerge-all-constants @gol
299-fmodulo-sched -fno-branch-count-reg @gol
300-fno-default-inline  -fno-defer-pop -fmove-loop-invariants @gol
301-fno-function-cse  -fno-guess-branch-probability @gol
302-fno-inline  -fno-math-errno  -fno-peephole  -fno-peephole2 @gol
303-funsafe-math-optimizations  -funsafe-loop-optimizations  -ffinite-math-only @gol
304-fno-toplevel-reorder -fno-trapping-math  -fno-zero-initialized-in-bss @gol
305-fomit-frame-pointer  -foptimize-register-move @gol
306-foptimize-sibling-calls  -fprefetch-loop-arrays @gol
307-fprofile-generate -fprofile-use @gol
308-fregmove  -frename-registers @gol
309-freorder-blocks  -freorder-blocks-and-partition -freorder-functions @gol
310-frerun-cse-after-loop @gol
311-frounding-math -frtl-abstract-sequences @gol
312-fschedule-insns  -fschedule-insns2 @gol
313-fno-sched-interblock  -fno-sched-spec  -fsched-spec-load @gol
314-fsched-spec-load-dangerous  @gol
315-fsched-stalled-insns=@var{n} -fsched-stalled-insns-dep=@var{n} @gol
316-fsched2-use-superblocks @gol
317-fsched2-use-traces -fsee -freschedule-modulo-scheduled-loops @gol
318-fsection-anchors  -fsignaling-nans  -fsingle-precision-constant @gol
319-fstack-protector  -fstack-protector-all @gol
320-fstrict-aliasing  -fstrict-overflow  -ftracer  -fthread-jumps @gol
321-funroll-all-loops  -funroll-loops  -fpeel-loops @gol
322-fsplit-ivs-in-unroller -funswitch-loops @gol
323-fvariable-expansion-in-unroller @gol
324-ftree-pre  -ftree-ccp  -ftree-dce -ftree-loop-optimize @gol
325-ftree-loop-linear -ftree-loop-im -ftree-loop-ivcanon -fivopts @gol
326-ftree-dominator-opts -ftree-dse -ftree-copyrename -ftree-sink @gol
327-ftree-ch -ftree-sra -ftree-ter -ftree-lrs -ftree-fre -ftree-vectorize @gol
328-ftree-vect-loop-version -ftree-salias -fipa-pta -fweb @gol
329-ftree-copy-prop -ftree-store-ccp -ftree-store-copy-prop -fwhole-program @gol
330--param @var{name}=@var{value}
331-O  -O0  -O1  -O2  -O3  -Os}
332
333@item Preprocessor Options
334@xref{Preprocessor Options,,Options Controlling the Preprocessor}.
335@gccoptlist{-A@var{question}=@var{answer} @gol
336-A-@var{question}@r{[}=@var{answer}@r{]} @gol
337-C  -dD  -dI  -dM  -dN @gol
338-D@var{macro}@r{[}=@var{defn}@r{]}  -E  -H @gol
339-idirafter @var{dir} @gol
340-include @var{file}  -imacros @var{file} @gol
341-iprefix @var{file}  -iwithprefix @var{dir} @gol
342-iwithprefixbefore @var{dir}  -isystem @var{dir} @gol
343-imultilib @var{dir} -isysroot @var{dir} @gol
344-M  -MM  -MF  -MG  -MP  -MQ  -MT  -nostdinc  @gol
345-P  -fworking-directory  -remap @gol
346-trigraphs  -undef  -U@var{macro}  -Wp,@var{option} @gol
347-Xpreprocessor @var{option}}
348
349@item Assembler Option
350@xref{Assembler Options,,Passing Options to the Assembler}.
351@gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
352
353@item Linker Options
354@xref{Link Options,,Options for Linking}.
355@gccoptlist{@var{object-file-name}  -l@var{library} @gol
356-nostartfiles  -nodefaultlibs  -nostdlib -pie -rdynamic @gol
357-s  -static  -static-libgcc  -shared  -shared-libgcc  -symbolic @gol
358-Wl,@var{option}  -Xlinker @var{option} @gol
359-u @var{symbol}}
360
361@item Directory Options
362@xref{Directory Options,,Options for Directory Search}.
363@gccoptlist{-B@var{prefix}  -I@var{dir}  -iquote@var{dir}  -L@var{dir}
364-specs=@var{file}  -I- --sysroot=@var{dir}}
365
366@item Target Options
367@c I wrote this xref this way to avoid overfull hbox. -- rms
368@xref{Target Options}.
369@gccoptlist{-V @var{version}  -b @var{machine}}
370
371@item Machine Dependent Options
372@xref{Submodel Options,,Hardware Models and Configurations}.
373@c This list is ordered alphanumerically by subsection name.
374@c Try and put the significant identifier (CPU or system) first,
375@c so users have a clue at guessing where the ones they want will be.
376
377@emph{ARC Options}
378@gccoptlist{-EB  -EL @gol
379-mmangle-cpu  -mcpu=@var{cpu}  -mtext=@var{text-section} @gol
380-mdata=@var{data-section}  -mrodata=@var{readonly-data-section}}
381
382@emph{ARM Options}
383@gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
384-mabi=@var{name} @gol
385-mapcs-stack-check  -mno-apcs-stack-check @gol
386-mapcs-float  -mno-apcs-float @gol
387-mapcs-reentrant  -mno-apcs-reentrant @gol
388-msched-prolog  -mno-sched-prolog @gol
389-mlittle-endian  -mbig-endian  -mwords-little-endian @gol
390-mfloat-abi=@var{name}  -msoft-float  -mhard-float  -mfpe @gol
391-mthumb-interwork  -mno-thumb-interwork @gol
392-mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
393-mstructure-size-boundary=@var{n} @gol
394-mabort-on-noreturn @gol
395-mlong-calls  -mno-long-calls @gol
396-msingle-pic-base  -mno-single-pic-base @gol
397-mpic-register=@var{reg} @gol
398-mnop-fun-dllimport @gol
399-mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
400-mpoke-function-name @gol
401-mthumb  -marm @gol
402-mtpcs-frame  -mtpcs-leaf-frame @gol
403-mcaller-super-interworking  -mcallee-super-interworking @gol
404-mtp=@var{name}}
405
406@emph{AVR Options}
407@gccoptlist{-mmcu=@var{mcu}  -msize  -minit-stack=@var{n}  -mno-interrupts @gol
408-mcall-prologues  -mno-tablejump  -mtiny-stack  -mint8}
409
410@emph{Blackfin Options}
411@gccoptlist{-momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
412-mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
413-mlow-64k -mno-low64k -mid-shared-library @gol
414-mno-id-shared-library -mshared-library-id=@var{n} @gol
415-mlong-calls  -mno-long-calls}
416
417@emph{CRIS Options}
418@gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}  -mtune=@var{cpu} @gol
419-mmax-stack-frame=@var{n}  -melinux-stacksize=@var{n} @gol
420-metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
421-mstack-align  -mdata-align  -mconst-align @gol
422-m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue  -mno-gotplt @gol
423-melf  -maout  -melinux  -mlinux  -sim  -sim2 @gol
424-mmul-bug-workaround  -mno-mul-bug-workaround}
425
426@emph{CRX Options}
427@gccoptlist{-mmac -mpush-args}
428
429@emph{Darwin Options}
430@gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal @gol
431-arch_only  -bind_at_load  -bundle  -bundle_loader @gol
432-client_name  -compatibility_version  -current_version @gol
433-dead_strip @gol
434-dependency-file  -dylib_file  -dylinker_install_name @gol
435-dynamic  -dynamiclib  -exported_symbols_list @gol
436-filelist  -flat_namespace  -force_cpusubtype_ALL @gol
437-force_flat_namespace  -headerpad_max_install_names @gol
438-image_base  -init  -install_name  -keep_private_externs @gol
439-multi_module  -multiply_defined  -multiply_defined_unused @gol
440-noall_load   -no_dead_strip_inits_and_terms @gol
441-nofixprebinding -nomultidefs  -noprebind  -noseglinkedit @gol
442-pagezero_size  -prebind  -prebind_all_twolevel_modules @gol
443-private_bundle  -read_only_relocs  -sectalign @gol
444-sectobjectsymbols  -whyload  -seg1addr @gol
445-sectcreate  -sectobjectsymbols  -sectorder @gol
446-segaddr -segs_read_only_addr -segs_read_write_addr @gol
447-seg_addr_table  -seg_addr_table_filename  -seglinkedit @gol
448-segprot  -segs_read_only_addr  -segs_read_write_addr @gol
449-single_module  -static  -sub_library  -sub_umbrella @gol
450-twolevel_namespace  -umbrella  -undefined @gol
451-unexported_symbols_list  -weak_reference_mismatches @gol
452-whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
453-mkernel -mone-byte-bool}
454
455@emph{DEC Alpha Options}
456@gccoptlist{-mno-fp-regs  -msoft-float  -malpha-as  -mgas @gol
457-mieee  -mieee-with-inexact  -mieee-conformant @gol
458-mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
459-mtrap-precision=@var{mode}  -mbuild-constants @gol
460-mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
461-mbwx  -mmax  -mfix  -mcix @gol
462-mfloat-vax  -mfloat-ieee @gol
463-mexplicit-relocs  -msmall-data  -mlarge-data @gol
464-msmall-text  -mlarge-text @gol
465-mmemory-latency=@var{time}}
466
467@emph{DEC Alpha/VMS Options}
468@gccoptlist{-mvms-return-codes}
469
470@emph{FRV Options}
471@gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
472-mhard-float  -msoft-float @gol
473-malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
474-mdouble  -mno-double @gol
475-mmedia  -mno-media  -mmuladd  -mno-muladd @gol
476-mfdpic  -minline-plt -mgprel-ro  -multilib-library-pic @gol
477-mlinked-fp  -mlong-calls  -malign-labels @gol
478-mlibrary-pic  -macc-4  -macc-8 @gol
479-mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
480-moptimize-membar -mno-optimize-membar @gol
481-mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
482-mvliw-branch  -mno-vliw-branch @gol
483-mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
484-mno-nested-cond-exec  -mtomcat-stats @gol
485-mTLS -mtls @gol
486-mcpu=@var{cpu}}
487
488@emph{GNU/Linux Options}
489@gccoptlist{-muclibc}
490
491@emph{H8/300 Options}
492@gccoptlist{-mrelax  -mh  -ms  -mn  -mint32  -malign-300}
493
494@emph{HPPA Options}
495@gccoptlist{-march=@var{architecture-type} @gol
496-mbig-switch  -mdisable-fpregs  -mdisable-indexing @gol
497-mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
498-mfixed-range=@var{register-range} @gol
499-mjump-in-delay -mlinker-opt -mlong-calls @gol
500-mlong-load-store  -mno-big-switch  -mno-disable-fpregs @gol
501-mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
502-mno-jump-in-delay  -mno-long-load-store @gol
503-mno-portable-runtime  -mno-soft-float @gol
504-mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
505-mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
506-mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
507-munix=@var{unix-std}  -nolibdld  -static  -threads}
508
509@emph{i386 and x86-64 Options}
510@gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
511-mfpmath=@var{unit} @gol
512-masm=@var{dialect}  -mno-fancy-math-387 @gol
513-mno-fp-ret-in-387  -msoft-float  -msvr3-shlib @gol
514-mno-wide-multiply  -mrtd  -malign-double @gol
515-mpreferred-stack-boundary=@var{num} @gol
516-mmmx  -msse  -msse2 -msse3 -mssse3 -msse4a -m3dnow -mpopcnt -mabm -maes @gol
517-mthreads  -mno-align-stringops  -minline-all-stringops @gol
518-mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
519-m96bit-long-double  -mregparm=@var{num}  -msseregparm @gol
520-mstackrealign @gol
521-momit-leaf-frame-pointer  -mno-red-zone -mno-tls-direct-seg-refs @gol
522-mcmodel=@var{code-model} @gol
523-m32  -m64 -mlarge-data-threshold=@var{num}}
524
525@emph{IA-64 Options}
526@gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
527-mvolatile-asm-stop  -mregister-names  -mno-sdata @gol
528-mconstant-gp  -mauto-pic  -minline-float-divide-min-latency @gol
529-minline-float-divide-max-throughput @gol
530-minline-int-divide-min-latency @gol
531-minline-int-divide-max-throughput  @gol
532-minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
533-mno-dwarf2-asm -mearly-stop-bits @gol
534-mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
535-mtune=@var{cpu-type} -mt -pthread -milp32 -mlp64 @gol
536-mno-sched-br-data-spec -msched-ar-data-spec -mno-sched-control-spec @gol
537-msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
538-msched-ldc -mno-sched-control-ldc -mno-sched-spec-verbose @gol
539-mno-sched-prefer-non-data-spec-insns @gol
540-mno-sched-prefer-non-control-spec-insns @gol
541-mno-sched-count-spec-in-critical-path}
542
543@emph{M32R/D Options}
544@gccoptlist{-m32r2 -m32rx -m32r @gol
545-mdebug @gol
546-malign-loops -mno-align-loops @gol
547-missue-rate=@var{number} @gol
548-mbranch-cost=@var{number} @gol
549-mmodel=@var{code-size-model-type} @gol
550-msdata=@var{sdata-type} @gol
551-mno-flush-func -mflush-func=@var{name} @gol
552-mno-flush-trap -mflush-trap=@var{number} @gol
553-G @var{num}}
554
555@emph{M32C Options}
556@gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
557
558@emph{M680x0 Options}
559@gccoptlist{-m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
560-m68060  -mcpu32  -m5200  -mcfv4e -m68881  -mbitfield  @gol
561-mc68000  -mc68020   @gol
562-mnobitfield  -mrtd  -mshort  -msoft-float  -mpcrel @gol
563-malign-int  -mstrict-align  -msep-data  -mno-sep-data @gol
564-mshared-library-id=n  -mid-shared-library  -mno-id-shared-library}
565
566@emph{M68hc1x Options}
567@gccoptlist{-m6811  -m6812  -m68hc11  -m68hc12   -m68hcs12 @gol
568-mauto-incdec  -minmax  -mlong-calls  -mshort @gol
569-msoft-reg-count=@var{count}}
570
571@emph{MCore Options}
572@gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
573-mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
574-m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
575-mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
576-mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
577
578@emph{MIPS Options}
579@gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
580-mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips64 @gol
581-mips16  -mno-mips16  -mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
582-mshared  -mno-shared  -mxgot  -mno-xgot  -mgp32  -mgp64  @gol
583-mfp32  -mfp64  -mhard-float  -msoft-float  @gol
584-msingle-float  -mdouble-float  -mdsp  -mpaired-single  -mips3d @gol
585-mlong64  -mlong32  -msym32  -mno-sym32 @gol
586-G@var{num}  -membedded-data  -mno-embedded-data @gol
587-muninit-const-in-rodata  -mno-uninit-const-in-rodata @gol
588-msplit-addresses  -mno-split-addresses  @gol
589-mexplicit-relocs  -mno-explicit-relocs  @gol
590-mcheck-zero-division  -mno-check-zero-division @gol
591-mdivide-traps  -mdivide-breaks @gol
592-mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls @gol
593-mmad  -mno-mad  -mfused-madd  -mno-fused-madd  -nocpp @gol
594-mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400 @gol
595-mfix-vr4120  -mno-fix-vr4120  -mfix-vr4130 @gol
596-mfix-sb1  -mno-fix-sb1 @gol
597-mflush-func=@var{func}  -mno-flush-func @gol
598-mbranch-likely  -mno-branch-likely @gol
599-mfp-exceptions -mno-fp-exceptions @gol
600-mvr4130-align -mno-vr4130-align}
601
602@emph{MMIX Options}
603@gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
604-mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
605-melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
606-mno-base-addresses  -msingle-exit  -mno-single-exit}
607
608@emph{MN10300 Options}
609@gccoptlist{-mmult-bug  -mno-mult-bug @gol
610-mam33  -mno-am33 @gol
611-mam33-2  -mno-am33-2 @gol
612-mreturn-pointer-on-d0 @gol
613-mno-crt0  -mrelax}
614
615@emph{MT Options}
616@gccoptlist{-mno-crt0 -mbacc -msim @gol
617-march=@var{cpu-type} }
618
619@emph{PDP-11 Options}
620@gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
621-mbcopy  -mbcopy-builtin  -mint32  -mno-int16 @gol
622-mint16  -mno-int32  -mfloat32  -mno-float64 @gol
623-mfloat64  -mno-float32  -mabshi  -mno-abshi @gol
624-mbranch-expensive  -mbranch-cheap @gol
625-msplit  -mno-split  -munix-asm  -mdec-asm}
626
627@emph{PowerPC Options}
628See RS/6000 and PowerPC Options.
629
630@emph{RS/6000 and PowerPC Options}
631@gccoptlist{-mcpu=@var{cpu-type} @gol
632-mtune=@var{cpu-type} @gol
633-mpower  -mno-power  -mpower2  -mno-power2 @gol
634-mpowerpc  -mpowerpc64  -mno-powerpc @gol
635-maltivec  -mno-altivec @gol
636-mpowerpc-gpopt  -mno-powerpc-gpopt @gol
637-mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
638-mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb  -mfprnd  -mno-fprnd @gol
639-mnew-mnemonics  -mold-mnemonics @gol
640-mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
641-m64  -m32  -mxl-compat  -mno-xl-compat  -mpe @gol
642-malign-power  -malign-natural @gol
643-msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
644-mstring  -mno-string  -mupdate  -mno-update @gol
645-mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
646-mstrict-align  -mno-strict-align  -mrelocatable @gol
647-mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
648-mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
649-mdynamic-no-pic  -maltivec  -mswdiv @gol
650-mprioritize-restricted-insns=@var{priority} @gol
651-msched-costly-dep=@var{dependence_type} @gol
652-minsert-sched-nops=@var{scheme} @gol
653-mcall-sysv  -mcall-netbsd @gol
654-maix-struct-return  -msvr4-struct-return @gol
655-mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
656-misel -mno-isel @gol
657-misel=yes  -misel=no @gol
658-mspe -mno-spe @gol
659-mspe=yes  -mspe=no @gol
660-mvrsave -mno-vrsave @gol
661-mmulhw -mno-mulhw @gol
662-mdlmzb -mno-dlmzb @gol
663-mfloat-gprs=yes  -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
664-mprototype  -mno-prototype @gol
665-msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
666-msdata=@var{opt}  -mvxworks  -mwindiss  -G @var{num}  -pthread}
667
668@emph{S/390 and zSeries Options}
669@gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
670-mhard-float  -msoft-float -mlong-double-64 -mlong-double-128 @gol
671-mbackchain  -mno-backchain -mpacked-stack  -mno-packed-stack @gol
672-msmall-exec  -mno-small-exec  -mmvcle -mno-mvcle @gol
673-m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch @gol
674-mtpf-trace -mno-tpf-trace  -mfused-madd  -mno-fused-madd @gol
675-mwarn-framesize  -mwarn-dynamicstack  -mstack-size -mstack-guard}
676
677@emph{Score Options}
678@gccoptlist{-meb -mel @gol
679-mnhwloop @gol
680-muls @gol
681-mmac @gol
682-mscore5 -mscore5u -mscore7 -mscore7d}
683 
684@emph{SH Options}
685@gccoptlist{-m1  -m2  -m2e  -m3  -m3e @gol
686-m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
687-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
688-m5-64media  -m5-64media-nofpu @gol
689-m5-32media  -m5-32media-nofpu @gol
690-m5-compact  -m5-compact-nofpu @gol
691-mb  -ml  -mdalign  -mrelax @gol
692-mbigtable  -mfmovd  -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
693-mieee  -misize  -mpadstruct  -mspace @gol
694-mprefergot  -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
695-mdivsi3_libfunc=@var{name}  @gol
696-madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
697 -minvalid-symbols}
698
699@emph{SPARC Options}
700@gccoptlist{-mcpu=@var{cpu-type} @gol
701-mtune=@var{cpu-type} @gol
702-mcmodel=@var{code-model} @gol
703-m32  -m64  -mapp-regs  -mno-app-regs @gol
704-mfaster-structs  -mno-faster-structs @gol
705-mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
706-mhard-quad-float  -msoft-quad-float @gol
707-mimpure-text  -mno-impure-text  -mlittle-endian @gol
708-mstack-bias  -mno-stack-bias @gol
709-munaligned-doubles  -mno-unaligned-doubles @gol
710-mv8plus  -mno-v8plus  -mvis  -mno-vis
711-threads -pthreads -pthread}
712
713@emph{System V Options}
714@gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
715
716@emph{TMS320C3x/C4x Options}
717@gccoptlist{-mcpu=@var{cpu}  -mbig  -msmall  -mregparm  -mmemparm @gol
718-mfast-fix  -mmpyi  -mbk  -mti  -mdp-isr-reload @gol
719-mrpts=@var{count}  -mrptb  -mdb  -mloop-unsigned @gol
720-mparallel-insns  -mparallel-mpy  -mpreserve-float}
721
722@emph{V850 Options}
723@gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
724-mprolog-function  -mno-prolog-function  -mspace @gol
725-mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
726-mapp-regs  -mno-app-regs @gol
727-mdisable-callt  -mno-disable-callt @gol
728-mv850e1 @gol
729-mv850e @gol
730-mv850  -mbig-switch}
731
732@emph{VAX Options}
733@gccoptlist{-mg  -mgnu  -munix}
734
735@emph{x86-64 Options}
736See i386 and x86-64 Options.
737
738@emph{Xstormy16 Options}
739@gccoptlist{-msim}
740
741@emph{Xtensa Options}
742@gccoptlist{-mconst16 -mno-const16 @gol
743-mfused-madd  -mno-fused-madd @gol
744-mtext-section-literals  -mno-text-section-literals @gol
745-mtarget-align  -mno-target-align @gol
746-mlongcalls  -mno-longcalls}
747
748@emph{zSeries Options}
749See S/390 and zSeries Options.
750
751@item Code Generation Options
752@xref{Code Gen Options,,Options for Code Generation Conventions}.
753@gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
754-ffixed-@var{reg}  -fexceptions @gol
755-fnon-call-exceptions  -funwind-tables @gol
756-fasynchronous-unwind-tables @gol
757-finhibit-size-directive  -finstrument-functions @gol
758-fno-common  -fno-ident @gol
759-fpcc-struct-return  -fpic  -fPIC -fpie -fPIE @gol
760-fno-jump-tables @gol
761-freg-struct-return  -fshort-enums @gol
762-fshort-double  -fshort-wchar @gol
763-fverbose-asm  -fpack-struct[=@var{n}]  -fstack-check @gol
764-fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
765-fargument-alias  -fargument-noalias @gol
766-fargument-noalias-global  -fargument-noalias-anything
767-fleading-underscore  -ftls-model=@var{model} @gol
768-ftrapv  -fwrapv  -fbounds-check @gol
769-fvisibility}
770@end table
771
772@menu
773* Overall Options::     Controlling the kind of output:
774                        an executable, object files, assembler files,
775                        or preprocessed source.
776* C Dialect Options::   Controlling the variant of C language compiled.
777* C++ Dialect Options:: Variations on C++.
778* Language Independent Options:: Controlling how diagnostics should be
779                        formatted.
780* Warning Options::     How picky should the compiler be?
781* Debugging Options::   Symbol tables, measurements, and debugging dumps.
782* Optimize Options::    How much optimization?
783* Preprocessor Options:: Controlling header files and macro definitions.
784                         Also, getting dependency information for Make.
785* Assembler Options::   Passing options to the assembler.
786* Link Options::        Specifying libraries and so on.
787* Directory Options::   Where to find header files and libraries.
788                        Where to find the compiler executable files.
789* Spec Files::          How to pass switches to sub-processes.
790* Target Options::      Running a cross-compiler, or an old version of GCC.
791@end menu
792
793@node Overall Options
794@section Options Controlling the Kind of Output
795
796Compilation can involve up to four stages: preprocessing, compilation
797proper, assembly and linking, always in that order.  GCC is capable of
798preprocessing and compiling several files either into several
799assembler input files, or into one assembler input file; then each
800assembler input file produces an object file, and linking combines all
801the object files (those newly compiled, and those specified as input)
802into an executable file.
803
804@cindex file name suffix
805For any given input file, the file name suffix determines what kind of
806compilation is done:
807
808@table @gcctabopt
809@item @var{file}.c
810C source code which must be preprocessed.
811
812@item @var{file}.i
813C source code which should not be preprocessed.
814
815@item @var{file}.ii
816C++ source code which should not be preprocessed.
817
818@item @var{file}.h
819C, or C++ header file to be turned into a precompiled header.
820
821@item @var{file}.cc
822@itemx @var{file}.cp
823@itemx @var{file}.cxx
824@itemx @var{file}.cpp
825@itemx @var{file}.CPP
826@itemx @var{file}.c++
827@itemx @var{file}.C
828C++ source code which must be preprocessed.  Note that in @samp{.cxx},
829the last two letters must both be literally @samp{x}.  Likewise,
830@samp{.C} refers to a literal capital C@.
831
832@item @var{file}.hh
833@itemx @var{file}.H
834C++ header file to be turned into a precompiled header.
835
836@item @var{file}.f
837@itemx @var{file}.for
838@itemx @var{file}.FOR
839Fixed form Fortran source code which should not be preprocessed.
840
841@item @var{file}.F
842@itemx @var{file}.fpp
843@itemx @var{file}.FPP
844Fixed form Fortran source code which must be preprocessed (with the traditional
845preprocessor).
846
847@item @var{file}.f90
848@itemx @var{file}.f95
849Free form Fortran source code which should not be preprocessed.
850
851@item @var{file}.F90
852@itemx @var{file}.F95
853Free form Fortran source code which must be preprocessed (with the
854traditional preprocessor).
855
856@c FIXME: Descriptions of Java file types.
857@c @var{file}.java
858@c @var{file}.class
859@c @var{file}.zip
860@c @var{file}.jar
861
862@item @var{file}.ads
863Ada source code file which contains a library unit declaration (a
864declaration of a package, subprogram, or generic, or a generic
865instantiation), or a library unit renaming declaration (a package,
866generic, or subprogram renaming declaration).  Such files are also
867called @dfn{specs}.
868
869@itemx @var{file}.adb
870Ada source code file containing a library unit body (a subprogram or
871package body).  Such files are also called @dfn{bodies}.
872
873@c GCC also knows about some suffixes for languages not yet included:
874@c Pascal:
875@c @var{file}.p
876@c @var{file}.pas
877@c Ratfor:
878@c @var{file}.r
879
880@item @var{file}.s
881Assembler code.
882
883@item @var{file}.S
884Assembler code which must be preprocessed.
885
886@item @var{other}
887An object file to be fed straight into linking.
888Any file name with no recognized suffix is treated this way.
889@end table
890
891@opindex x
892You can specify the input language explicitly with the @option{-x} option:
893
894@table @gcctabopt
895@item -x @var{language}
896Specify explicitly the @var{language} for the following input files
897(rather than letting the compiler choose a default based on the file
898name suffix).  This option applies to all following input files until
899the next @option{-x} option.  Possible values for @var{language} are:
900@smallexample
901c  c-header  c-cpp-output
902c++  c++-header  c++-cpp-output
903assembler  assembler-with-cpp
904ada
905f95  f95-cpp-input
906java
907treelang
908@end smallexample
909
910@item -x none
911Turn off any specification of a language, so that subsequent files are
912handled according to their file name suffixes (as they are if @option{-x}
913has not been used at all).
914
915@item -pass-exit-codes
916@opindex pass-exit-codes
917Normally the @command{gcc} program will exit with the code of 1 if any
918phase of the compiler returns a non-success return code.  If you specify
919@option{-pass-exit-codes}, the @command{gcc} program will instead return with
920numerically highest error produced by any phase that returned an error
921indication.  The C, C++, and Fortran frontends return 4, if an internal
922compiler error is encountered.
923@end table
924
925If you only want some of the stages of compilation, you can use
926@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
927one of the options @option{-c}, @option{-S}, or @option{-E} to say where
928@command{gcc} is to stop.  Note that some combinations (for example,
929@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
930
931@table @gcctabopt
932@item -c
933@opindex c
934Compile or assemble the source files, but do not link.  The linking
935stage simply is not done.  The ultimate output is in the form of an
936object file for each source file.
937
938By default, the object file name for a source file is made by replacing
939the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
940
941Unrecognized input files, not requiring compilation or assembly, are
942ignored.
943
944@item -S
945@opindex S
946Stop after the stage of compilation proper; do not assemble.  The output
947is in the form of an assembler code file for each non-assembler input
948file specified.
949
950By default, the assembler file name for a source file is made by
951replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
952
953Input files that don't require compilation are ignored.
954
955@item -E
956@opindex E
957Stop after the preprocessing stage; do not run the compiler proper.  The
958output is in the form of preprocessed source code, which is sent to the
959standard output.
960
961Input files which don't require preprocessing are ignored.
962
963@cindex output file option
964@item -o @var{file}
965@opindex o
966Place output in file @var{file}.  This applies regardless to whatever
967sort of output is being produced, whether it be an executable file,
968an object file, an assembler file or preprocessed C code.
969
970If @option{-o} is not specified, the default is to put an executable
971file in @file{a.out}, the object file for
972@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
973assembler file in @file{@var{source}.s}, a precompiled header file in
974@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
975standard output.
976
977@item -v
978@opindex v
979Print (on standard error output) the commands executed to run the stages
980of compilation.  Also print the version number of the compiler driver
981program and of the preprocessor and the compiler proper.
982
983@item -###
984@opindex ###
985Like @option{-v} except the commands are not executed and all command
986arguments are quoted.  This is useful for shell scripts to capture the
987driver-generated command lines.
988
989@item -pipe
990@opindex pipe
991Use pipes rather than temporary files for communication between the
992various stages of compilation.  This fails to work on some systems where
993the assembler is unable to read from a pipe; but the GNU assembler has
994no trouble.
995
996@item -combine
997@opindex combine
998If you are compiling multiple source files, this option tells the driver
999to pass all the source files to the compiler at once (for those
1000languages for which the compiler can handle this).  This will allow
1001intermodule analysis (IMA) to be performed by the compiler.  Currently the only
1002language for which this is supported is C@.  If you pass source files for
1003multiple languages to the driver, using this option, the driver will invoke
1004the compiler(s) that support IMA once each, passing each compiler all the
1005source files appropriate for it.  For those languages that do not support
1006IMA this option will be ignored, and the compiler will be invoked once for
1007each source file in that language.  If you use this option in conjunction
1008with @option{-save-temps}, the compiler will generate multiple
1009pre-processed files
1010(one for each source file), but only one (combined) @file{.o} or
1011@file{.s} file.
1012
1013@item --help
1014@opindex help
1015Print (on the standard output) a description of the command line options
1016understood by @command{gcc}.  If the @option{-v} option is also specified
1017then @option{--help} will also be passed on to the various processes
1018invoked by @command{gcc}, so that they can display the command line options
1019they accept.  If the @option{-Wextra} option is also specified then command
1020line options which have no documentation associated with them will also
1021be displayed.
1022
1023@item --target-help
1024@opindex target-help
1025Print (on the standard output) a description of target specific command
1026line options for each tool.
1027
1028@item --version
1029@opindex version
1030Display the version number and copyrights of the invoked GCC@.
1031
1032@include @value{srcdir}/../libiberty/at-file.texi
1033@end table
1034
1035@node Invoking G++
1036@section Compiling C++ Programs
1037
1038@cindex suffixes for C++ source
1039@cindex C++ source file suffixes
1040C++ source files conventionally use one of the suffixes @samp{.C},
1041@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1042@samp{.cxx}; C++ header files often use @samp{.hh} or @samp{.H}; and
1043preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
1044files with these names and compiles them as C++ programs even if you
1045call the compiler the same way as for compiling C programs (usually
1046with the name @command{gcc}).
1047
1048@findex g++
1049@findex c++
1050However, the use of @command{gcc} does not add the C++ library.
1051@command{g++} is a program that calls GCC and treats @samp{.c},
1052@samp{.h} and @samp{.i} files as C++ source files instead of C source
1053files unless @option{-x} is used, and automatically specifies linking
1054against the C++ library.  This program is also useful when
1055precompiling a C header file with a @samp{.h} extension for use in C++
1056compilations.  On many systems, @command{g++} is also installed with
1057the name @command{c++}.
1058
1059@cindex invoking @command{g++}
1060When you compile C++ programs, you may specify many of the same
1061command-line options that you use for compiling programs in any
1062language; or command-line options meaningful for C and related
1063languages; or options that are meaningful only for C++ programs.
1064@xref{C Dialect Options,,Options Controlling C Dialect}, for
1065explanations of options for languages related to C@.
1066@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1067explanations of options that are meaningful only for C++ programs.
1068
1069@node C Dialect Options
1070@section Options Controlling C Dialect
1071@cindex dialect options
1072@cindex language dialect options
1073@cindex options, dialect
1074
1075The following options control the dialect of C (or languages derived
1076from C, such as C++) that the compiler accepts:
1077
1078@table @gcctabopt
1079@cindex ANSI support
1080@cindex ISO support
1081@item -ansi
1082@opindex ansi
1083In C mode, support all ISO C90 programs.  In C++ mode,
1084remove GNU extensions that conflict with ISO C++.
1085
1086This turns off certain features of GCC that are incompatible with ISO
1087C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1088such as the @code{asm} and @code{typeof} keywords, and
1089predefined macros such as @code{unix} and @code{vax} that identify the
1090type of system you are using.  It also enables the undesirable and
1091rarely used ISO trigraph feature.  For the C compiler,
1092it disables recognition of C++ style @samp{//} comments as well as
1093the @code{inline} keyword.
1094
1095The alternate keywords @code{__asm__}, @code{__extension__},
1096@code{__inline__} and @code{__typeof__} continue to work despite
1097@option{-ansi}.  You would not want to use them in an ISO C program, of
1098course, but it is useful to put them in header files that might be included
1099in compilations done with @option{-ansi}.  Alternate predefined macros
1100such as @code{__unix__} and @code{__vax__} are also available, with or
1101without @option{-ansi}.
1102
1103The @option{-ansi} option does not cause non-ISO programs to be
1104rejected gratuitously.  For that, @option{-pedantic} is required in
1105addition to @option{-ansi}.  @xref{Warning Options}.
1106
1107The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1108option is used.  Some header files may notice this macro and refrain
1109from declaring certain functions or defining certain macros that the
1110ISO standard doesn't call for; this is to avoid interfering with any
1111programs that might use these names for other things.
1112
1113Functions which would normally be built in but do not have semantics
1114defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1115functions with @option{-ansi} is used.  @xref{Other Builtins,,Other
1116built-in functions provided by GCC}, for details of the functions
1117affected.
1118
1119@item -std=
1120@opindex std
1121Determine the language standard.  This option is currently only
1122supported when compiling C or C++.  A value for this option must be
1123provided; possible values are
1124
1125@table @samp
1126@item c89
1127@itemx iso9899:1990
1128ISO C90 (same as @option{-ansi}).
1129
1130@item iso9899:199409
1131ISO C90 as modified in amendment 1.
1132
1133@item c99
1134@itemx c9x
1135@itemx iso9899:1999
1136@itemx iso9899:199x
1137ISO C99.  Note that this standard is not yet fully supported; see
1138@w{@uref{http://gcc.gnu.org/gcc-4.2/c99status.html}} for more information.  The
1139names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1140
1141@item gnu89
1142Default, ISO C90 plus GNU extensions (including some C99 features).
1143
1144@item gnu99
1145@itemx gnu9x
1146ISO C99 plus GNU extensions.  When ISO C99 is fully implemented in GCC,
1147this will become the default.  The name @samp{gnu9x} is deprecated.
1148
1149@item c++98
1150The 1998 ISO C++ standard plus amendments.
1151
1152@item gnu++98
1153The same as @option{-std=c++98} plus GNU extensions.  This is the
1154default for C++ code.
1155@end table
1156
1157Even when this option is not specified, you can still use some of the
1158features of newer standards in so far as they do not conflict with
1159previous C standards.  For example, you may use @code{__restrict__} even
1160when @option{-std=c99} is not specified.
1161
1162The @option{-std} options specifying some version of ISO C have the same
1163effects as @option{-ansi}, except that features that were not in ISO C90
1164but are in the specified version (for example, @samp{//} comments and
1165the @code{inline} keyword in ISO C99) are not disabled.
1166
1167@xref{Standards,,Language Standards Supported by GCC}, for details of
1168these standard versions.
1169
1170@item -fgnu89-inline
1171@opindex fgnu89-inline
1172The option @option{-fgnu89-inline} tells GCC to use the traditional
1173GNU semantics for @code{inline} functions when in C99 mode.
1174@xref{Inline,,An Inline Function is As Fast As a Macro}.  Using this
1175option is roughly equivalent to adding the @code{gnu_inline} function
1176attribute to all inline functions (@pxref{Function Attributes}).
1177
1178This option is accepted by GCC versions 4.1.3 and up.  In GCC versions
1179prior to 4.3, C99 inline semantics are not supported, and thus this
1180option is effectively assumed to be present regardless of whether or not
1181it is specified; the only effect of specifying it explicitly is to
1182disable warnings about using inline functions in C99 mode.  Likewise,
1183the option @option{-fno-gnu89-inline} is not supported in versions of
1184GCC before 4.3.  It will be supported only in C99 or gnu99 mode, not in
1185C89 or gnu89 mode.
1186
1187The preprocesor macros @code{__GNUC_GNU_INLINE__} and
1188@code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1189in effect for @code{inline} functions.  @xref{Common Predefined
1190Macros,,,cpp,The C Preprocessor}.
1191
1192@item -aux-info @var{filename}
1193@opindex aux-info
1194Output to the given filename prototyped declarations for all functions
1195declared and/or defined in a translation unit, including those in header
1196files.  This option is silently ignored in any language other than C@.
1197
1198Besides declarations, the file indicates, in comments, the origin of
1199each declaration (source file and line), whether the declaration was
1200implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1201@samp{O} for old, respectively, in the first character after the line
1202number and the colon), and whether it came from a declaration or a
1203definition (@samp{C} or @samp{F}, respectively, in the following
1204character).  In the case of function definitions, a K&R-style list of
1205arguments followed by their declarations is also provided, inside
1206comments, after the declaration.
1207
1208@item -fno-asm
1209@opindex fno-asm
1210Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1211keyword, so that code can use these words as identifiers.  You can use
1212the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1213instead.  @option{-ansi} implies @option{-fno-asm}.
1214
1215In C++, this switch only affects the @code{typeof} keyword, since
1216@code{asm} and @code{inline} are standard keywords.  You may want to
1217use the @option{-fno-gnu-keywords} flag instead, which has the same
1218effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1219switch only affects the @code{asm} and @code{typeof} keywords, since
1220@code{inline} is a standard keyword in ISO C99.
1221
1222@item -fno-builtin
1223@itemx -fno-builtin-@var{function}
1224@opindex fno-builtin
1225@cindex built-in functions
1226Don't recognize built-in functions that do not begin with
1227@samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
1228functions provided by GCC}, for details of the functions affected,
1229including those which are not built-in functions when @option{-ansi} or
1230@option{-std} options for strict ISO C conformance are used because they
1231do not have an ISO standard meaning.
1232
1233GCC normally generates special code to handle certain built-in functions
1234more efficiently; for instance, calls to @code{alloca} may become single
1235instructions that adjust the stack directly, and calls to @code{memcpy}
1236may become inline copy loops.  The resulting code is often both smaller
1237and faster, but since the function calls no longer appear as such, you
1238cannot set a breakpoint on those calls, nor can you change the behavior
1239of the functions by linking with a different library.  In addition,
1240when a function is recognized as a built-in function, GCC may use
1241information about that function to warn about problems with calls to
1242that function, or to generate more efficient code, even if the
1243resulting code still contains calls to that function.  For example,
1244warnings are given with @option{-Wformat} for bad calls to
1245@code{printf}, when @code{printf} is built in, and @code{strlen} is
1246known not to modify global memory.
1247
1248With the @option{-fno-builtin-@var{function}} option
1249only the built-in function @var{function} is
1250disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
1251function is named this is not built-in in this version of GCC, this
1252option is ignored.  There is no corresponding
1253@option{-fbuiltin-@var{function}} option; if you wish to enable
1254built-in functions selectively when using @option{-fno-builtin} or
1255@option{-ffreestanding}, you may define macros such as:
1256
1257@smallexample
1258#define abs(n)          __builtin_abs ((n))
1259#define strcpy(d, s)    __builtin_strcpy ((d), (s))
1260@end smallexample
1261
1262@item -fhosted
1263@opindex fhosted
1264@cindex hosted environment
1265
1266Assert that compilation takes place in a hosted environment.  This implies
1267@option{-fbuiltin}.  A hosted environment is one in which the
1268entire standard library is available, and in which @code{main} has a return
1269type of @code{int}.  Examples are nearly everything except a kernel.
1270This is equivalent to @option{-fno-freestanding}.
1271
1272@item -ffreestanding
1273@opindex ffreestanding
1274@cindex hosted environment
1275
1276Assert that compilation takes place in a freestanding environment.  This
1277implies @option{-fno-builtin}.  A freestanding environment
1278is one in which the standard library may not exist, and program startup may
1279not necessarily be at @code{main}.  The most obvious example is an OS kernel.
1280This is equivalent to @option{-fno-hosted}.
1281
1282@xref{Standards,,Language Standards Supported by GCC}, for details of
1283freestanding and hosted environments.
1284
1285@item -fopenmp
1286@opindex fopenmp
1287@cindex openmp parallel
1288Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1289@code{!$omp} in Fortran.  When @option{-fopenmp} is specified, the
1290compiler generates parallel code according to the OpenMP Application
1291Program Interface v2.5 @w{@uref{http://www.openmp.org/}}.
1292
1293@item -fms-extensions
1294@opindex fms-extensions
1295Accept some non-standard constructs used in Microsoft header files.
1296
1297Some cases of unnamed fields in structures and unions are only
1298accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
1299fields within structs/unions}, for details.
1300
1301@item -trigraphs
1302@opindex trigraphs
1303Support ISO C trigraphs.  The @option{-ansi} option (and @option{-std}
1304options for strict ISO C conformance) implies @option{-trigraphs}.
1305
1306@item -no-integrated-cpp
1307@opindex no-integrated-cpp
1308Performs a compilation in two passes: preprocessing and compiling.  This
1309option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1310@option{-B} option.  The user supplied compilation step can then add in
1311an additional preprocessing step after normal preprocessing but before
1312compiling.  The default is to use the integrated cpp (internal cpp)
1313
1314The semantics of this option will change if "cc1", "cc1plus", and
1315"cc1obj" are merged.
1316
1317@cindex traditional C language
1318@cindex C language, traditional
1319@item -traditional
1320@itemx -traditional-cpp
1321@opindex traditional-cpp
1322@opindex traditional
1323Formerly, these options caused GCC to attempt to emulate a pre-standard
1324C compiler.  They are now only supported with the @option{-E} switch.
1325The preprocessor continues to support a pre-standard mode.  See the GNU
1326CPP manual for details.
1327
1328@item -fcond-mismatch
1329@opindex fcond-mismatch
1330Allow conditional expressions with mismatched types in the second and
1331third arguments.  The value of such an expression is void.  This option
1332is not supported for C++.
1333
1334@item -funsigned-char
1335@opindex funsigned-char
1336Let the type @code{char} be unsigned, like @code{unsigned char}.
1337
1338Each kind of machine has a default for what @code{char} should
1339be.  It is either like @code{unsigned char} by default or like
1340@code{signed char} by default.
1341
1342Ideally, a portable program should always use @code{signed char} or
1343@code{unsigned char} when it depends on the signedness of an object.
1344But many programs have been written to use plain @code{char} and
1345expect it to be signed, or expect it to be unsigned, depending on the
1346machines they were written for.  This option, and its inverse, let you
1347make such a program work with the opposite default.
1348
1349The type @code{char} is always a distinct type from each of
1350@code{signed char} or @code{unsigned char}, even though its behavior
1351is always just like one of those two.
1352
1353@item -fsigned-char
1354@opindex fsigned-char
1355Let the type @code{char} be signed, like @code{signed char}.
1356
1357Note that this is equivalent to @option{-fno-unsigned-char}, which is
1358the negative form of @option{-funsigned-char}.  Likewise, the option
1359@option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1360
1361@item -fsigned-bitfields
1362@itemx -funsigned-bitfields
1363@itemx -fno-signed-bitfields
1364@itemx -fno-unsigned-bitfields
1365@opindex fsigned-bitfields
1366@opindex funsigned-bitfields
1367@opindex fno-signed-bitfields
1368@opindex fno-unsigned-bitfields
1369These options control whether a bit-field is signed or unsigned, when the
1370declaration does not use either @code{signed} or @code{unsigned}.  By
1371default, such a bit-field is signed, because this is consistent: the
1372basic integer types such as @code{int} are signed types.
1373@end table
1374
1375@node C++ Dialect Options
1376@section Options Controlling C++ Dialect
1377
1378@cindex compiler options, C++
1379@cindex C++ options, command line
1380@cindex options, C++
1381This section describes the command-line options that are only meaningful
1382for C++ programs; but you can also use most of the GNU compiler options
1383regardless of what language your program is in.  For example, you
1384might compile a file @code{firstClass.C} like this:
1385
1386@smallexample
1387g++ -g -frepo -O -c firstClass.C
1388@end smallexample
1389
1390@noindent
1391In this example, only @option{-frepo} is an option meant
1392only for C++ programs; you can use the other options with any
1393language supported by GCC@.
1394
1395Here is a list of options that are @emph{only} for compiling C++ programs:
1396
1397@table @gcctabopt
1398
1399@item -fabi-version=@var{n}
1400@opindex fabi-version
1401Use version @var{n} of the C++ ABI@.  Version 2 is the version of the
1402C++ ABI that first appeared in G++ 3.4.  Version 1 is the version of
1403the C++ ABI that first appeared in G++ 3.2.  Version 0 will always be
1404the version that conforms most closely to the C++ ABI specification.
1405Therefore, the ABI obtained using version 0 will change as ABI bugs
1406are fixed.
1407
1408The default is version 2.
1409
1410@item -fno-access-control
1411@opindex fno-access-control
1412Turn off all access checking.  This switch is mainly useful for working
1413around bugs in the access control code.
1414
1415@item -fcheck-new
1416@opindex fcheck-new
1417Check that the pointer returned by @code{operator new} is non-null
1418before attempting to modify the storage allocated.  This check is
1419normally unnecessary because the C++ standard specifies that
1420@code{operator new} will only return @code{0} if it is declared
1421@samp{throw()}, in which case the compiler will always check the
1422return value even without this option.  In all other cases, when
1423@code{operator new} has a non-empty exception specification, memory
1424exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
1425@samp{new (nothrow)}.
1426
1427@item -fconserve-space
1428@opindex fconserve-space
1429Put uninitialized or runtime-initialized global variables into the
1430common segment, as C does.  This saves space in the executable at the
1431cost of not diagnosing duplicate definitions.  If you compile with this
1432flag and your program mysteriously crashes after @code{main()} has
1433completed, you may have an object that is being destroyed twice because
1434two definitions were merged.
1435
1436This option is no longer useful on most targets, now that support has
1437been added for putting variables into BSS without making them common.
1438
1439@item -ffriend-injection
1440@opindex ffriend-injection
1441Inject friend functions into the enclosing namespace, so that they are
1442visible outside the scope of the class in which they are declared.
1443Friend functions were documented to work this way in the old Annotated
1444C++ Reference Manual, and versions of G++ before 4.1 always worked
1445that way.  However, in ISO C++ a friend function which is not declared
1446in an enclosing scope can only be found using argument dependent
1447lookup.  This option causes friends to be injected as they were in
1448earlier releases.
1449
1450This option is for compatibility, and may be removed in a future
1451release of G++.
1452
1453@item -fno-elide-constructors
1454@opindex fno-elide-constructors
1455The C++ standard allows an implementation to omit creating a temporary
1456which is only used to initialize another object of the same type.
1457Specifying this option disables that optimization, and forces G++ to
1458call the copy constructor in all cases.
1459
1460@item -fno-enforce-eh-specs
1461@opindex fno-enforce-eh-specs
1462Don't generate code to check for violation of exception specifications
1463at runtime.  This option violates the C++ standard, but may be useful
1464for reducing code size in production builds, much like defining
1465@samp{NDEBUG}.  This does not give user code permission to throw
1466exceptions in violation of the exception specifications; the compiler
1467will still optimize based on the specifications, so throwing an
1468unexpected exception will result in undefined behavior.
1469
1470@item -ffor-scope
1471@itemx -fno-for-scope
1472@opindex ffor-scope
1473@opindex fno-for-scope
1474If @option{-ffor-scope} is specified, the scope of variables declared in
1475a @i{for-init-statement} is limited to the @samp{for} loop itself,
1476as specified by the C++ standard.
1477If @option{-fno-for-scope} is specified, the scope of variables declared in
1478a @i{for-init-statement} extends to the end of the enclosing scope,
1479as was the case in old versions of G++, and other (traditional)
1480implementations of C++.
1481
1482The default if neither flag is given to follow the standard,
1483but to allow and give a warning for old-style code that would
1484otherwise be invalid, or have different behavior.
1485
1486@item -fno-gnu-keywords
1487@opindex fno-gnu-keywords
1488Do not recognize @code{typeof} as a keyword, so that code can use this
1489word as an identifier.  You can use the keyword @code{__typeof__} instead.
1490@option{-ansi} implies @option{-fno-gnu-keywords}.
1491
1492@item -fno-implicit-templates
1493@opindex fno-implicit-templates
1494Never emit code for non-inline templates which are instantiated
1495implicitly (i.e.@: by use); only emit code for explicit instantiations.
1496@xref{Template Instantiation}, for more information.
1497
1498@item -fno-implicit-inline-templates
1499@opindex fno-implicit-inline-templates
1500Don't emit code for implicit instantiations of inline templates, either.
1501The default is to handle inlines differently so that compiles with and
1502without optimization will need the same set of explicit instantiations.
1503
1504@item -fno-implement-inlines
1505@opindex fno-implement-inlines
1506To save space, do not emit out-of-line copies of inline functions
1507controlled by @samp{#pragma implementation}.  This will cause linker
1508errors if these functions are not inlined everywhere they are called.
1509
1510@item -fms-extensions
1511@opindex fms-extensions
1512Disable pedantic warnings about constructs used in MFC, such as implicit
1513int and getting a pointer to member function via non-standard syntax.
1514
1515@item -fno-nonansi-builtins
1516@opindex fno-nonansi-builtins
1517Disable built-in declarations of functions that are not mandated by
1518ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
1519@code{index}, @code{bzero}, @code{conjf}, and other related functions.
1520
1521@item -fno-operator-names
1522@opindex fno-operator-names
1523Do not treat the operator name keywords @code{and}, @code{bitand},
1524@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1525synonyms as keywords.
1526
1527@item -fno-optional-diags
1528@opindex fno-optional-diags
1529Disable diagnostics that the standard says a compiler does not need to
1530issue.  Currently, the only such diagnostic issued by G++ is the one for
1531a name having multiple meanings within a class.
1532
1533@item -fpermissive
1534@opindex fpermissive
1535Downgrade some diagnostics about nonconformant code from errors to
1536warnings.  Thus, using @option{-fpermissive} will allow some
1537nonconforming code to compile.
1538
1539@item -frepo
1540@opindex frepo
1541Enable automatic template instantiation at link time.  This option also
1542implies @option{-fno-implicit-templates}.  @xref{Template
1543Instantiation}, for more information.
1544
1545@item -fno-rtti
1546@opindex fno-rtti
1547Disable generation of information about every class with virtual
1548functions for use by the C++ runtime type identification features
1549(@samp{dynamic_cast} and @samp{typeid}).  If you don't use those parts
1550of the language, you can save some space by using this flag.  Note that
1551exception handling uses the same information, but it will generate it as
1552needed. The @samp{dynamic_cast} operator can still be used for casts that
1553do not require runtime type information, i.e. casts to @code{void *} or to
1554unambiguous base classes.
1555
1556@item -fstats
1557@opindex fstats
1558Emit statistics about front-end processing at the end of the compilation.
1559This information is generally only useful to the G++ development team.
1560
1561@item -ftemplate-depth-@var{n}
1562@opindex ftemplate-depth
1563Set the maximum instantiation depth for template classes to @var{n}.
1564A limit on the template instantiation depth is needed to detect
1565endless recursions during template class instantiation.  ANSI/ISO C++
1566conforming programs must not rely on a maximum depth greater than 17.
1567
1568@item -fno-threadsafe-statics
1569@opindex fno-threadsafe-statics
1570Do not emit the extra code to use the routines specified in the C++
1571ABI for thread-safe initialization of local statics.  You can use this
1572option to reduce code size slightly in code that doesn't need to be
1573thread-safe.
1574
1575@item -fuse-cxa-atexit
1576@opindex fuse-cxa-atexit
1577Register destructors for objects with static storage duration with the
1578@code{__cxa_atexit} function rather than the @code{atexit} function.
1579This option is required for fully standards-compliant handling of static
1580destructors, but will only work if your C library supports
1581@code{__cxa_atexit}.
1582
1583@item -fno-use-cxa-get-exception-ptr
1584@opindex fno-use-cxa-get-exception-ptr
1585Don't use the @code{__cxa_get_exception_ptr} runtime routine.  This
1586will cause @code{std::uncaught_exception} to be incorrect, but is necessary
1587if the runtime routine is not available.
1588
1589@item -fvisibility-inlines-hidden
1590@opindex fvisibility-inlines-hidden
1591This switch declares that the user does not attempt to compare
1592pointers to inline methods where the addresses of the two functions
1593were taken in different shared objects.
1594
1595The effect of this is that GCC may, effectively, mark inline methods with
1596@code{__attribute__ ((visibility ("hidden")))} so that they do not
1597appear in the export table of a DSO and do not require a PLT indirection
1598when used within the DSO@.  Enabling this option can have a dramatic effect
1599on load and link times of a DSO as it massively reduces the size of the
1600dynamic export table when the library makes heavy use of templates.
1601
1602The behaviour of this switch is not quite the same as marking the
1603methods as hidden directly, because it does not affect static variables
1604local to the function or cause the compiler to deduce that
1605the function is defined in only one shared object.
1606
1607You may mark a method as having a visibility explicitly to negate the
1608effect of the switch for that method.  For example, if you do want to
1609compare pointers to a particular inline method, you might mark it as
1610having default visibility.  Marking the enclosing class with explicit
1611visibility will have no effect.
1612
1613Explicitly instantiated inline methods are unaffected by this option
1614as their linkage might otherwise cross a shared library boundary.
1615@xref{Template Instantiation}.
1616
1617@item -fno-weak
1618@opindex fno-weak
1619Do not use weak symbol support, even if it is provided by the linker.
1620By default, G++ will use weak symbols if they are available.  This
1621option exists only for testing, and should not be used by end-users;
1622it will result in inferior code and has no benefits.  This option may
1623be removed in a future release of G++.
1624
1625@item -nostdinc++
1626@opindex nostdinc++
1627Do not search for header files in the standard directories specific to
1628C++, but do still search the other standard directories.  (This option
1629is used when building the C++ library.)
1630@end table
1631
1632In addition, these optimization, warning, and code generation options
1633have meanings only for C++ programs:
1634
1635@table @gcctabopt
1636@item -fno-default-inline
1637@opindex fno-default-inline
1638Do not assume @samp{inline} for functions defined inside a class scope.
1639@xref{Optimize Options,,Options That Control Optimization}.  Note that these
1640functions will have linkage like inline functions; they just won't be
1641inlined by default.
1642
1643@item -Wabi @r{(C++ only)}
1644@opindex Wabi
1645Warn when G++ generates code that is probably not compatible with the
1646vendor-neutral C++ ABI@.  Although an effort has been made to warn about
1647all such cases, there are probably some cases that are not warned about,
1648even though G++ is generating incompatible code.  There may also be
1649cases where warnings are emitted even though the code that is generated
1650will be compatible.
1651
1652You should rewrite your code to avoid these warnings if you are
1653concerned about the fact that code generated by G++ may not be binary
1654compatible with code generated by other compilers.
1655
1656The known incompatibilities at this point include:
1657
1658@itemize @bullet
1659
1660@item
1661Incorrect handling of tail-padding for bit-fields.  G++ may attempt to
1662pack data into the same byte as a base class.  For example:
1663
1664@smallexample
1665struct A @{ virtual void f(); int f1 : 1; @};
1666struct B : public A @{ int f2 : 1; @};
1667@end smallexample
1668
1669@noindent
1670In this case, G++ will place @code{B::f2} into the same byte
1671as@code{A::f1}; other compilers will not.  You can avoid this problem
1672by explicitly padding @code{A} so that its size is a multiple of the
1673byte size on your platform; that will cause G++ and other compilers to
1674layout @code{B} identically.
1675
1676@item
1677Incorrect handling of tail-padding for virtual bases.  G++ does not use
1678tail padding when laying out virtual bases.  For example:
1679
1680@smallexample
1681struct A @{ virtual void f(); char c1; @};
1682struct B @{ B(); char c2; @};
1683struct C : public A, public virtual B @{@};
1684@end smallexample
1685
1686@noindent
1687In this case, G++ will not place @code{B} into the tail-padding for
1688@code{A}; other compilers will.  You can avoid this problem by
1689explicitly padding @code{A} so that its size is a multiple of its
1690alignment (ignoring virtual base classes); that will cause G++ and other
1691compilers to layout @code{C} identically.
1692
1693@item
1694Incorrect handling of bit-fields with declared widths greater than that
1695of their underlying types, when the bit-fields appear in a union.  For
1696example:
1697
1698@smallexample
1699union U @{ int i : 4096; @};
1700@end smallexample
1701
1702@noindent
1703Assuming that an @code{int} does not have 4096 bits, G++ will make the
1704union too small by the number of bits in an @code{int}.
1705
1706@item
1707Empty classes can be placed at incorrect offsets.  For example:
1708
1709@smallexample
1710struct A @{@};
1711
1712struct B @{
1713  A a;
1714  virtual void f ();
1715@};
1716
1717struct C : public B, public A @{@};
1718@end smallexample
1719
1720@noindent
1721G++ will place the @code{A} base class of @code{C} at a nonzero offset;
1722it should be placed at offset zero.  G++ mistakenly believes that the
1723@code{A} data member of @code{B} is already at offset zero.
1724
1725@item
1726Names of template functions whose types involve @code{typename} or
1727template template parameters can be mangled incorrectly.
1728
1729@smallexample
1730template <typename Q>
1731void f(typename Q::X) @{@}
1732
1733template <template <typename> class Q>
1734void f(typename Q<int>::X) @{@}
1735@end smallexample
1736
1737@noindent
1738Instantiations of these templates may be mangled incorrectly.
1739
1740@end itemize
1741
1742@item -Wctor-dtor-privacy @r{(C++ only)}
1743@opindex Wctor-dtor-privacy
1744Warn when a class seems unusable because all the constructors or
1745destructors in that class are private, and it has neither friends nor
1746public static member functions.
1747
1748@item -Wnon-virtual-dtor @r{(C++ only)}
1749@opindex Wnon-virtual-dtor
1750Warn when a class appears to be polymorphic, thereby requiring a virtual
1751destructor, yet it declares a non-virtual one.  This warning is also
1752enabled if -Weffc++ is specified.
1753
1754@item -Wreorder @r{(C++ only)}
1755@opindex Wreorder
1756@cindex reordering, warning
1757@cindex warning for reordering of member initializers
1758Warn when the order of member initializers given in the code does not
1759match the order in which they must be executed.  For instance:
1760
1761@smallexample
1762struct A @{
1763  int i;
1764  int j;
1765  A(): j (0), i (1) @{ @}
1766@};
1767@end smallexample
1768
1769The compiler will rearrange the member initializers for @samp{i}
1770and @samp{j} to match the declaration order of the members, emitting
1771a warning to that effect.  This warning is enabled by @option{-Wall}.
1772@end table
1773
1774The following @option{-W@dots{}} options are not affected by @option{-Wall}.
1775
1776@table @gcctabopt
1777@item -Weffc++ @r{(C++ only)}
1778@opindex Weffc++
1779Warn about violations of the following style guidelines from Scott Meyers'
1780@cite{Effective C++} book:
1781
1782@itemize @bullet
1783@item
1784Item 11:  Define a copy constructor and an assignment operator for classes
1785with dynamically allocated memory.
1786
1787@item
1788Item 12:  Prefer initialization to assignment in constructors.
1789
1790@item
1791Item 14:  Make destructors virtual in base classes.
1792
1793@item
1794Item 15:  Have @code{operator=} return a reference to @code{*this}.
1795
1796@item
1797Item 23:  Don't try to return a reference when you must return an object.
1798
1799@end itemize
1800
1801Also warn about violations of the following style guidelines from
1802Scott Meyers' @cite{More Effective C++} book:
1803
1804@itemize @bullet
1805@item
1806Item 6:  Distinguish between prefix and postfix forms of increment and
1807decrement operators.
1808
1809@item
1810Item 7:  Never overload @code{&&}, @code{||}, or @code{,}.
1811
1812@end itemize
1813
1814When selecting this option, be aware that the standard library
1815headers do not obey all of these guidelines; use @samp{grep -v}
1816to filter out those warnings.
1817
1818@item -Wno-deprecated @r{(C++ only)}
1819@opindex Wno-deprecated
1820Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
1821
1822@item -Wstrict-null-sentinel @r{(C++ only)}
1823@opindex Wstrict-null-sentinel
1824Warn also about the use of an uncasted @code{NULL} as sentinel.  When
1825compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
1826to @code{__null}.  Although it is a null pointer constant not a null pointer,
1827it is guaranteed to of the same size as a pointer.  But this use is
1828not portable across different compilers.
1829
1830@item -Wno-non-template-friend @r{(C++ only)}
1831@opindex Wno-non-template-friend
1832Disable warnings when non-templatized friend functions are declared
1833within a template.  Since the advent of explicit template specification
1834support in G++, if the name of the friend is an unqualified-id (i.e.,
1835@samp{friend foo(int)}), the C++ language specification demands that the
1836friend declare or define an ordinary, nontemplate function.  (Section
183714.5.3).  Before G++ implemented explicit specification, unqualified-ids
1838could be interpreted as a particular specialization of a templatized
1839function.  Because this non-conforming behavior is no longer the default
1840behavior for G++, @option{-Wnon-template-friend} allows the compiler to
1841check existing code for potential trouble spots and is on by default.
1842This new compiler behavior can be turned off with
1843@option{-Wno-non-template-friend} which keeps the conformant compiler code
1844but disables the helpful warning.
1845
1846@item -Wold-style-cast @r{(C++ only)}
1847@opindex Wold-style-cast
1848Warn if an old-style (C-style) cast to a non-void type is used within
1849a C++ program.  The new-style casts (@samp{dynamic_cast},
1850@samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are
1851less vulnerable to unintended effects and much easier to search for.
1852
1853@item -Woverloaded-virtual @r{(C++ only)}
1854@opindex Woverloaded-virtual
1855@cindex overloaded virtual fn, warning
1856@cindex warning for overloaded virtual fn
1857Warn when a function declaration hides virtual functions from a
1858base class.  For example, in:
1859
1860@smallexample
1861struct A @{
1862  virtual void f();
1863@};
1864
1865struct B: public A @{
1866  void f(int);
1867@};
1868@end smallexample
1869
1870the @code{A} class version of @code{f} is hidden in @code{B}, and code
1871like:
1872
1873@smallexample
1874B* b;
1875b->f();
1876@end smallexample
1877
1878will fail to compile.
1879
1880@item -Wno-pmf-conversions @r{(C++ only)}
1881@opindex Wno-pmf-conversions
1882Disable the diagnostic for converting a bound pointer to member function
1883to a plain pointer.
1884
1885@item -Wsign-promo @r{(C++ only)}
1886@opindex Wsign-promo
1887Warn when overload resolution chooses a promotion from unsigned or
1888enumerated type to a signed type, over a conversion to an unsigned type of
1889the same size.  Previous versions of G++ would try to preserve
1890unsignedness, but the standard mandates the current behavior.
1891
1892@smallexample
1893struct A @{
1894  operator int ();
1895  A& operator = (int);
1896@};
1897
1898main ()
1899@{
1900  A a,b;
1901  a = b;
1902@}
1903@end smallexample
1904
1905In this example, G++ will synthesize a default @samp{A& operator =
1906(const A&);}, while cfront will use the user-defined @samp{operator =}.
1907@end table
1908
1909@node Language Independent Options
1910@section Options to Control Diagnostic Messages Formatting
1911@cindex options to control diagnostics formatting
1912@cindex diagnostic messages
1913@cindex message formatting
1914
1915Traditionally, diagnostic messages have been formatted irrespective of
1916the output device's aspect (e.g.@: its width, @dots{}).  The options described
1917below can be used to control the diagnostic messages formatting
1918algorithm, e.g.@: how many characters per line, how often source location
1919information should be reported.  Right now, only the C++ front end can
1920honor these options.  However it is expected, in the near future, that
1921the remaining front ends would be able to digest them correctly.
1922
1923@table @gcctabopt
1924@item -fmessage-length=@var{n}
1925@opindex fmessage-length
1926Try to format error messages so that they fit on lines of about @var{n}
1927characters.  The default is 72 characters for @command{g++} and 0 for the rest of
1928the front ends supported by GCC@.  If @var{n} is zero, then no
1929line-wrapping will be done; each error message will appear on a single
1930line.
1931
1932@opindex fdiagnostics-show-location
1933@item -fdiagnostics-show-location=once
1934Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
1935reporter to emit @emph{once} source location information; that is, in
1936case the message is too long to fit on a single physical line and has to
1937be wrapped, the source location won't be emitted (as prefix) again,
1938over and over, in subsequent continuation lines.  This is the default
1939behavior.
1940
1941@item -fdiagnostics-show-location=every-line
1942Only meaningful in line-wrapping mode.  Instructs the diagnostic
1943messages reporter to emit the same source location information (as
1944prefix) for physical lines that result from the process of breaking
1945a message which is too long to fit on a single line.
1946
1947@item -fdiagnostics-show-option
1948@opindex fdiagnostics-show-option
1949This option instructs the diagnostic machinery to add text to each
1950diagnostic emitted, which indicates which command line option directly
1951controls that diagnostic, when such an option is known to the
1952diagnostic machinery.
1953
1954@end table
1955
1956@node Warning Options
1957@section Options to Request or Suppress Warnings
1958@cindex options to control warnings
1959@cindex warning messages
1960@cindex messages, warning
1961@cindex suppressing warnings
1962
1963Warnings are diagnostic messages that report constructions which
1964are not inherently erroneous but which are risky or suggest there
1965may have been an error.
1966
1967You can request many specific warnings with options beginning @samp{-W},
1968for example @option{-Wimplicit} to request warnings on implicit
1969declarations.  Each of these specific warning options also has a
1970negative form beginning @samp{-Wno-} to turn off warnings;
1971for example, @option{-Wno-implicit}.  This manual lists only one of the
1972two forms, whichever is not the default.
1973
1974The following options control the amount and kinds of warnings produced
1975by GCC; for further, language-specific options also refer to
1976@ref{C++ Dialect Options}.
1977
1978@table @gcctabopt
1979@cindex syntax checking
1980@item -fsyntax-only
1981@opindex fsyntax-only
1982Check the code for syntax errors, but don't do anything beyond that.
1983
1984@item -pedantic
1985@opindex pedantic
1986Issue all the warnings demanded by strict ISO C and ISO C++;
1987reject all programs that use forbidden extensions, and some other
1988programs that do not follow ISO C and ISO C++.  For ISO C, follows the
1989version of the ISO C standard specified by any @option{-std} option used.
1990
1991Valid ISO C and ISO C++ programs should compile properly with or without
1992this option (though a rare few will require @option{-ansi} or a
1993@option{-std} option specifying the required version of ISO C)@.  However,
1994without this option, certain GNU extensions and traditional C and C++
1995features are supported as well.  With this option, they are rejected.
1996
1997@option{-pedantic} does not cause warning messages for use of the
1998alternate keywords whose names begin and end with @samp{__}.  Pedantic
1999warnings are also disabled in the expression that follows
2000@code{__extension__}.  However, only system header files should use
2001these escape routes; application programs should avoid them.
2002@xref{Alternate Keywords}.
2003
2004Some users try to use @option{-pedantic} to check programs for strict ISO
2005C conformance.  They soon find that it does not do quite what they want:
2006it finds some non-ISO practices, but not all---only those for which
2007ISO C @emph{requires} a diagnostic, and some others for which
2008diagnostics have been added.
2009
2010A feature to report any failure to conform to ISO C might be useful in
2011some instances, but would require considerable additional work and would
2012be quite different from @option{-pedantic}.  We don't have plans to
2013support such a feature in the near future.
2014
2015Where the standard specified with @option{-std} represents a GNU
2016extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
2017corresponding @dfn{base standard}, the version of ISO C on which the GNU
2018extended dialect is based.  Warnings from @option{-pedantic} are given
2019where they are required by the base standard.  (It would not make sense
2020for such warnings to be given only for features not in the specified GNU
2021C dialect, since by definition the GNU dialects of C include all
2022features the compiler supports with the given option, and there would be
2023nothing to warn about.)
2024
2025@item -pedantic-errors
2026@opindex pedantic-errors
2027Like @option{-pedantic}, except that errors are produced rather than
2028warnings.
2029
2030@item -w
2031@opindex w
2032Inhibit all warning messages.
2033
2034@item -Wno-import
2035@opindex Wno-import
2036Inhibit warning messages about the use of @samp{#import}.
2037
2038@item -Wchar-subscripts
2039@opindex Wchar-subscripts
2040Warn if an array subscript has type @code{char}.  This is a common cause
2041of error, as programmers often forget that this type is signed on some
2042machines.
2043This warning is enabled by @option{-Wall}.
2044
2045@item -Wcomment
2046@opindex Wcomment
2047Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
2048comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
2049This warning is enabled by @option{-Wall}.
2050
2051@item -Wfatal-errors
2052@opindex Wfatal-errors
2053This option causes the compiler to abort compilation on the first error
2054occurred rather than trying to keep going and printing further error
2055messages.
2056
2057@item -Wformat
2058@opindex Wformat
2059@opindex ffreestanding
2060@opindex fno-builtin
2061Check calls to @code{printf} and @code{scanf}, etc., to make sure that
2062the arguments supplied have types appropriate to the format string
2063specified, and that the conversions specified in the format string make
2064sense.  This includes standard functions, and others specified by format
2065attributes (@pxref{Function Attributes}), in the @code{printf},
2066@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
2067not in the C standard) families (or other target-specific families).
2068Which functions are checked without format attributes having been
2069specified depends on the standard version selected, and such checks of
2070functions without the attribute specified are disabled by
2071@option{-ffreestanding} or @option{-fno-builtin}.
2072
2073The formats are checked against the format features supported by GNU
2074libc version 2.2.  These include all ISO C90 and C99 features, as well
2075as features from the Single Unix Specification and some BSD and GNU
2076extensions.  Other library implementations may not support all these
2077features; GCC does not support warning about features that go beyond a
2078particular library's limitations.  However, if @option{-pedantic} is used
2079with @option{-Wformat}, warnings will be given about format features not
2080in the selected standard version (but not for @code{strfmon} formats,
2081since those are not in any version of the C standard).  @xref{C Dialect
2082Options,,Options Controlling C Dialect}.
2083
2084Since @option{-Wformat} also checks for null format arguments for
2085several functions, @option{-Wformat} also implies @option{-Wnonnull}.
2086
2087@option{-Wformat} is included in @option{-Wall}.  For more control over some
2088aspects of format checking, the options @option{-Wformat-y2k},
2089@option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
2090@option{-Wformat-nonliteral}, @option{-Wformat-security}, and
2091@option{-Wformat=2} are available, but are not included in @option{-Wall}.
2092
2093@item -Wformat-y2k
2094@opindex Wformat-y2k
2095If @option{-Wformat} is specified, also warn about @code{strftime}
2096formats which may yield only a two-digit year.
2097
2098@item -Wno-format-extra-args
2099@opindex Wno-format-extra-args
2100If @option{-Wformat} is specified, do not warn about excess arguments to a
2101@code{printf} or @code{scanf} format function.  The C standard specifies
2102that such arguments are ignored.
2103
2104Where the unused arguments lie between used arguments that are
2105specified with @samp{$} operand number specifications, normally
2106warnings are still given, since the implementation could not know what
2107type to pass to @code{va_arg} to skip the unused arguments.  However,
2108in the case of @code{scanf} formats, this option will suppress the
2109warning if the unused arguments are all pointers, since the Single
2110Unix Specification says that such unused arguments are allowed.
2111
2112@item -Wno-format-zero-length
2113@opindex Wno-format-zero-length
2114If @option{-Wformat} is specified, do not warn about zero-length formats.
2115The C standard specifies that zero-length formats are allowed.
2116
2117@item -Wformat-nonliteral
2118@opindex Wformat-nonliteral
2119If @option{-Wformat} is specified, also warn if the format string is not a
2120string literal and so cannot be checked, unless the format function
2121takes its format arguments as a @code{va_list}.
2122
2123@item -Wformat-security
2124@opindex Wformat-security
2125If @option{-Wformat} is specified, also warn about uses of format
2126functions that represent possible security problems.  At present, this
2127warns about calls to @code{printf} and @code{scanf} functions where the
2128format string is not a string literal and there are no format arguments,
2129as in @code{printf (foo);}.  This may be a security hole if the format
2130string came from untrusted input and contains @samp{%n}.  (This is
2131currently a subset of what @option{-Wformat-nonliteral} warns about, but
2132in future warnings may be added to @option{-Wformat-security} that are not
2133included in @option{-Wformat-nonliteral}.)
2134
2135@item -Wformat=2
2136@opindex Wformat=2
2137Enable @option{-Wformat} plus format checks not included in
2138@option{-Wformat}.  Currently equivalent to @samp{-Wformat
2139-Wformat-nonliteral -Wformat-security -Wformat-y2k}.
2140
2141@item -Wnonnull
2142@opindex Wnonnull
2143Warn about passing a null pointer for arguments marked as
2144requiring a non-null value by the @code{nonnull} function attribute.
2145
2146@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
2147can be disabled with the @option{-Wno-nonnull} option.
2148
2149@item -Winit-self @r{(C and C++ only)}
2150@opindex Winit-self
2151Warn about uninitialized variables which are initialized with themselves.
2152Note this option can only be used with the @option{-Wuninitialized} option,
2153which in turn only works with @option{-O1} and above.
2154
2155For example, GCC will warn about @code{i} being uninitialized in the
2156following snippet only when @option{-Winit-self} has been specified:
2157@smallexample
2158@group
2159int f()
2160@{
2161  int i = i;
2162  return i;
2163@}
2164@end group
2165@end smallexample
2166
2167@item -Wimplicit-int
2168@opindex Wimplicit-int
2169Warn when a declaration does not specify a type.
2170This warning is enabled by @option{-Wall}.
2171
2172@item -Wimplicit-function-declaration
2173@itemx -Werror-implicit-function-declaration
2174@opindex Wimplicit-function-declaration
2175@opindex Werror-implicit-function-declaration
2176Give a warning (or error) whenever a function is used before being
2177declared.  The form @option{-Wno-error-implicit-function-declaration}
2178is not supported.
2179This warning is enabled by @option{-Wall} (as a warning, not an error).
2180
2181@item -Wimplicit
2182@opindex Wimplicit
2183Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
2184This warning is enabled by @option{-Wall}.
2185
2186@item -Wmain
2187@opindex Wmain
2188Warn if the type of @samp{main} is suspicious.  @samp{main} should be a
2189function with external linkage, returning int, taking either zero
2190arguments, two, or three arguments of appropriate types.
2191This warning is enabled by @option{-Wall}.
2192
2193@item -Wmissing-braces
2194@opindex Wmissing-braces
2195Warn if an aggregate or union initializer is not fully bracketed.  In
2196the following example, the initializer for @samp{a} is not fully
2197bracketed, but that for @samp{b} is fully bracketed.
2198
2199@smallexample
2200int a[2][2] = @{ 0, 1, 2, 3 @};
2201int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
2202@end smallexample
2203
2204This warning is enabled by @option{-Wall}.
2205
2206@item -Wmissing-include-dirs @r{(C and C++ only)}
2207@opindex Wmissing-include-dirs
2208Warn if a user-supplied include directory does not exist.
2209
2210@item -Wparentheses
2211@opindex Wparentheses
2212Warn if parentheses are omitted in certain contexts, such
2213as when there is an assignment in a context where a truth value
2214is expected, or when operators are nested whose precedence people
2215often get confused about.  Only the warning for an assignment used as
2216a truth value is supported when compiling C++; the other warnings are
2217only supported when compiling C@.
2218
2219Also warn if a comparison like @samp{x<=y<=z} appears; this is
2220equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
2221interpretation from that of ordinary mathematical notation.
2222
2223Also warn about constructions where there may be confusion to which
2224@code{if} statement an @code{else} branch belongs.  Here is an example of
2225such a case:
2226
2227@smallexample
2228@group
2229@{
2230  if (a)
2231    if (b)
2232      foo ();
2233  else
2234    bar ();
2235@}
2236@end group
2237@end smallexample
2238
2239In C, every @code{else} branch belongs to the innermost possible @code{if}
2240statement, which in this example is @code{if (b)}.  This is often not
2241what the programmer expected, as illustrated in the above example by
2242indentation the programmer chose.  When there is the potential for this
2243confusion, GCC will issue a warning when this flag is specified.
2244To eliminate the warning, add explicit braces around the innermost
2245@code{if} statement so there is no way the @code{else} could belong to
2246the enclosing @code{if}.  The resulting code would look like this:
2247
2248@smallexample
2249@group
2250@{
2251  if (a)
2252    @{
2253      if (b)
2254        foo ();
2255      else
2256        bar ();
2257    @}
2258@}
2259@end group
2260@end smallexample
2261
2262This warning is enabled by @option{-Wall}.
2263
2264@item -Wsequence-point
2265@opindex Wsequence-point
2266Warn about code that may have undefined semantics because of violations
2267of sequence point rules in the C and C++ standards.
2268
2269The C and C++ standards defines the order in which expressions in a C/C++
2270program are evaluated in terms of @dfn{sequence points}, which represent
2271a partial ordering between the execution of parts of the program: those
2272executed before the sequence point, and those executed after it.  These
2273occur after the evaluation of a full expression (one which is not part
2274of a larger expression), after the evaluation of the first operand of a
2275@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
2276function is called (but after the evaluation of its arguments and the
2277expression denoting the called function), and in certain other places.
2278Other than as expressed by the sequence point rules, the order of
2279evaluation of subexpressions of an expression is not specified.  All
2280these rules describe only a partial order rather than a total order,
2281since, for example, if two functions are called within one expression
2282with no sequence point between them, the order in which the functions
2283are called is not specified.  However, the standards committee have
2284ruled that function calls do not overlap.
2285
2286It is not specified when between sequence points modifications to the
2287values of objects take effect.  Programs whose behavior depends on this
2288have undefined behavior; the C and C++ standards specify that ``Between
2289the previous and next sequence point an object shall have its stored
2290value modified at most once by the evaluation of an expression.  
2291Furthermore, the prior value shall be read only to determine the value
2292to be stored.''.  If a program breaks these rules, the results on any
2293particular implementation are entirely unpredictable.
2294
2295Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
2296= b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
2297diagnosed by this option, and it may give an occasional false positive
2298result, but in general it has been found fairly effective at detecting
2299this sort of problem in programs.
2300
2301The standard is worded confusingly, therefore there is some debate
2302over the precise meaning of the sequence point rules in subtle cases.
2303Links to discussions of the problem, including proposed formal
2304definitions, may be found on the GCC readings page, at
2305@w{@uref{http://gcc.gnu.org/readings.html}}.
2306
2307This warning is enabled by @option{-Wall} for C and C++.
2308
2309@item -Wreturn-type
2310@opindex Wreturn-type
2311Warn whenever a function is defined with a return-type that defaults to
2312@code{int}.  Also warn about any @code{return} statement with no
2313return-value in a function whose return-type is not @code{void}.
2314
2315For C, also warn if the return type of a function has a type qualifier
2316such as @code{const}.  Such a type qualifier has no effect, since the
2317value returned by a function is not an lvalue.  ISO C prohibits
2318qualified @code{void} return types on function definitions, so such
2319return types always receive a warning even without this option.
2320
2321For C++, a function without return type always produces a diagnostic
2322message, even when @option{-Wno-return-type} is specified.  The only
2323exceptions are @samp{main} and functions defined in system headers.
2324
2325This warning is enabled by @option{-Wall}.
2326
2327@item -Wswitch
2328@opindex Wswitch
2329Warn whenever a @code{switch} statement has an index of enumerated type
2330and lacks a @code{case} for one or more of the named codes of that
2331enumeration.  (The presence of a @code{default} label prevents this
2332warning.)  @code{case} labels outside the enumeration range also
2333provoke warnings when this option is used.
2334This warning is enabled by @option{-Wall}.
2335
2336@item -Wswitch-default
2337@opindex Wswitch-switch
2338Warn whenever a @code{switch} statement does not have a @code{default}
2339case.
2340
2341@item -Wswitch-enum
2342@opindex Wswitch-enum
2343Warn whenever a @code{switch} statement has an index of enumerated type
2344and lacks a @code{case} for one or more of the named codes of that
2345enumeration.  @code{case} labels outside the enumeration range also
2346provoke warnings when this option is used.
2347
2348@item -Wtrigraphs
2349@opindex Wtrigraphs
2350Warn if any trigraphs are encountered that might change the meaning of
2351the program (trigraphs within comments are not warned about).
2352This warning is enabled by @option{-Wall}.
2353
2354@item -Wunused-function
2355@opindex Wunused-function
2356Warn whenever a static function is declared but not defined or a
2357non-inline static function is unused.
2358This warning is enabled by @option{-Wall}.
2359
2360@item -Wunused-label
2361@opindex Wunused-label
2362Warn whenever a label is declared but not used.
2363This warning is enabled by @option{-Wall}.
2364
2365To suppress this warning use the @samp{unused} attribute
2366(@pxref{Variable Attributes}).
2367
2368@item -Wunused-parameter
2369@opindex Wunused-parameter
2370Warn whenever a function parameter is unused aside from its declaration.
2371
2372To suppress this warning use the @samp{unused} attribute
2373(@pxref{Variable Attributes}).
2374
2375@item -Wunused-variable
2376@opindex Wunused-variable
2377Warn whenever a local variable or non-constant static variable is unused
2378aside from its declaration.
2379This warning is enabled by @option{-Wall}.
2380
2381To suppress this warning use the @samp{unused} attribute
2382(@pxref{Variable Attributes}).
2383
2384@item -Wunused-value
2385@opindex Wunused-value
2386Warn whenever a statement computes a result that is explicitly not used.
2387This warning is enabled by @option{-Wall}.
2388
2389To suppress this warning cast the expression to @samp{void}.
2390
2391@item -Wunused
2392@opindex Wunused
2393All the above @option{-Wunused} options combined.
2394
2395In order to get a warning about an unused function parameter, you must
2396either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
2397@samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
2398
2399@item -Wuninitialized
2400@opindex Wuninitialized
2401Warn if an automatic variable is used without first being initialized or
2402if a variable may be clobbered by a @code{setjmp} call.
2403
2404These warnings are possible only in optimizing compilation,
2405because they require data flow information that is computed only
2406when optimizing.  If you do not specify @option{-O}, you will not get 
2407these warnings. Instead, GCC will issue a warning about @option{-Wuninitialized}
2408requiring @option{-O}.
2409
2410If you want to warn about code which uses the uninitialized value of the
2411variable in its own initializer, use the @option{-Winit-self} option.
2412
2413These warnings occur for individual uninitialized or clobbered
2414elements of structure, union or array variables as well as for
2415variables which are uninitialized or clobbered as a whole.  They do
2416not occur for variables or elements declared @code{volatile}.  Because
2417these warnings depend on optimization, the exact variables or elements
2418for which there are warnings will depend on the precise optimization
2419options and version of GCC used.
2420
2421Note that there may be no warning about a variable that is used only
2422to compute a value that itself is never used, because such
2423computations may be deleted by data flow analysis before the warnings
2424are printed.
2425
2426These warnings are made optional because GCC is not smart
2427enough to see all the reasons why the code might be correct
2428despite appearing to have an error.  Here is one example of how
2429this can happen:
2430
2431@smallexample
2432@group
2433@{
2434  int x;
2435  switch (y)
2436    @{
2437    case 1: x = 1;
2438      break;
2439    case 2: x = 4;
2440      break;
2441    case 3: x = 5;
2442    @}
2443  foo (x);
2444@}
2445@end group
2446@end smallexample
2447
2448@noindent
2449If the value of @code{y} is always 1, 2 or 3, then @code{x} is
2450always initialized, but GCC doesn't know this.  Here is
2451another common case:
2452
2453@smallexample
2454@{
2455  int save_y;
2456  if (change_y) save_y = y, y = new_y;
2457  @dots{}
2458  if (change_y) y = save_y;
2459@}
2460@end smallexample
2461
2462@noindent
2463This has no bug because @code{save_y} is used only if it is set.
2464
2465@cindex @code{longjmp} warnings
2466This option also warns when a non-volatile automatic variable might be
2467changed by a call to @code{longjmp}.  These warnings as well are possible
2468only in optimizing compilation.
2469
2470The compiler sees only the calls to @code{setjmp}.  It cannot know
2471where @code{longjmp} will be called; in fact, a signal handler could
2472call it at any point in the code.  As a result, you may get a warning
2473even when there is in fact no problem because @code{longjmp} cannot
2474in fact be called at the place which would cause a problem.
2475
2476Some spurious warnings can be avoided if you declare all the functions
2477you use that never return as @code{noreturn}.  @xref{Function
2478Attributes}.
2479
2480This warning is enabled by @option{-Wall}.
2481
2482@item -Wunknown-pragmas
2483@opindex Wunknown-pragmas
2484@cindex warning for unknown pragmas
2485@cindex unknown pragmas, warning
2486@cindex pragmas, warning of unknown
2487Warn when a #pragma directive is encountered which is not understood by
2488GCC@.  If this command line option is used, warnings will even be issued
2489for unknown pragmas in system header files.  This is not the case if
2490the warnings were only enabled by the @option{-Wall} command line option.
2491
2492@item -Wno-pragmas
2493@opindex Wno-pragmas
2494@opindex Wpragmas
2495Do not warn about misuses of pragmas, such as incorrect parameters,
2496invalid syntax, or conflicts between pragmas.  See also
2497@samp{-Wunknown-pragmas}.
2498
2499@item -Wstrict-aliasing
2500@opindex Wstrict-aliasing
2501This option is only active when @option{-fstrict-aliasing} is active.
2502It warns about code which might break the strict aliasing rules that the
2503compiler is using for optimization.  The warning does not catch all
2504cases, but does attempt to catch the more common pitfalls.  It is
2505included in @option{-Wall}.
2506
2507@item -Wstrict-aliasing=2
2508@opindex Wstrict-aliasing=2
2509This option is only active when @option{-fstrict-aliasing} is active.
2510It warns about code which might break the strict aliasing rules that the
2511compiler is using for optimization.  This warning catches more cases than
2512@option{-Wstrict-aliasing}, but it will also give a warning for some ambiguous
2513cases that are safe.
2514
2515@item -Wstrict-overflow
2516@item -Wstrict-overflow=@var{n}
2517@opindex Wstrict-overflow
2518This option is only active when @option{-fstrict-overflow} is active.
2519It warns about cases where the compiler optimizes based on the
2520assumption that signed overflow does not occur.  Note that it does not
2521warn about all cases where the code might overflow: it only warns
2522about cases where the compiler implements some optimization.  Thus
2523this warning depends on the optimization level.
2524
2525An optimization which assumes that signed overflow does not occur is
2526perfectly safe if the values of the variables involved are such that
2527overflow never does, in fact, occur.  Therefore this warning can
2528easily give a false positive: a warning about code which is not
2529actually a problem.  To help focus on important issues, several
2530warning levels are defined.  No warnings are issued for the use of
2531undefined signed overflow when estimating how many iterations a loop
2532will require, in particular when determining whether a loop will be
2533executed at all.
2534
2535@table @option
2536@item -Wstrict-overflow=1
2537Warn about cases which are both questionable and easy to avoid.  For
2538example: @code{x + 1 > x}; with @option{-fstrict-overflow}, the
2539compiler will simplify this to @code{1}.  This level of
2540@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
2541are not, and must be explicitly requested.
2542
2543@item -Wstrict-overflow=2
2544Also warn about other cases where a comparison is simplified to a
2545constant.  For example: @code{abs (x) >= 0}.  This can only be
2546simplified when @option{-fstrict-overflow} is in effect, because
2547@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
2548zero.  @option{-Wstrict-overflow} (with no level) is the same as
2549@option{-Wstrict-overflow=2}.
2550
2551@item -Wstrict-overflow=3
2552Also warn about other cases where a comparison is simplified.  For
2553example: @code{x + 1 > 1} will be simplified to @code{x > 0}.
2554
2555@item -Wstrict-overflow=4
2556Also warn about other simplifications not covered by the above cases.
2557For example: @code{(x * 10) / 5} will be simplified to @code{x * 2}.
2558
2559@item -Wstrict-overflow=5
2560Also warn about cases where the compiler reduces the magnitude of a
2561constant involved in a comparison.  For example: @code{x + 2 > y} will
2562be simplified to @code{x + 1 >= y}.  This is reported only at the
2563highest warning level because this simplification applies to many
2564comparisons, so this warning level will give a very large number of
2565false positives.
2566@end table
2567
2568@item -Wall
2569@opindex Wall
2570All of the above @samp{-W} options combined.  This enables all the
2571warnings about constructions that some users consider questionable, and
2572that are easy to avoid (or modify to prevent the warning), even in
2573conjunction with macros.  This also enables some language-specific
2574warnings described in @ref{C++ Dialect Options}.
2575@end table
2576
2577The following @option{-W@dots{}} options are not implied by @option{-Wall}.
2578Some of them warn about constructions that users generally do not
2579consider questionable, but which occasionally you might wish to check
2580for; others warn about constructions that are necessary or hard to avoid
2581in some cases, and there is no simple way to modify the code to suppress
2582the warning.
2583
2584@table @gcctabopt
2585@item -Wextra
2586@opindex W
2587@opindex Wextra
2588(This option used to be called @option{-W}.  The older name is still
2589supported, but the newer name is more descriptive.)  Print extra warning
2590messages for these events:
2591
2592@itemize @bullet
2593@item
2594A function can return either with or without a value.  (Falling
2595off the end of the function body is considered returning without
2596a value.)  For example, this function would evoke such a
2597warning:
2598
2599@smallexample
2600@group
2601foo (a)
2602@{
2603  if (a > 0)
2604    return a;
2605@}
2606@end group
2607@end smallexample
2608
2609@item
2610An expression-statement or the left-hand side of a comma expression
2611contains no side effects.
2612To suppress the warning, cast the unused expression to void.
2613For example, an expression such as @samp{x[i,j]} will cause a warning,
2614but @samp{x[(void)i,j]} will not.
2615
2616@item
2617An unsigned value is compared against zero with @samp{<} or @samp{>=}.
2618
2619@item
2620Storage-class specifiers like @code{static} are not the first things in
2621a declaration.  According to the C Standard, this usage is obsolescent.
2622
2623@item
2624If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
2625arguments.
2626
2627@item
2628A comparison between signed and unsigned values could produce an
2629incorrect result when the signed value is converted to unsigned.
2630(But don't warn if @option{-Wno-sign-compare} is also specified.)
2631
2632@item
2633An aggregate has an initializer which does not initialize all members.
2634This warning can be independently controlled by
2635@option{-Wmissing-field-initializers}.
2636
2637@item
2638An initialized field without side effects is overridden when using
2639designated initializers (@pxref{Designated Inits, , Designated
2640Initializers}).  This warning can be independently controlled by
2641@option{-Woverride-init}.
2642
2643@item
2644A function parameter is declared without a type specifier in K&R-style
2645functions:
2646
2647@smallexample
2648void foo(bar) @{ @}
2649@end smallexample
2650
2651@item
2652An empty body occurs in an @samp{if} or @samp{else} statement.
2653
2654@item
2655A pointer is compared against integer zero with @samp{<}, @samp{<=},
2656@samp{>}, or @samp{>=}.
2657
2658@item
2659A variable might be changed by @samp{longjmp} or @samp{vfork}.
2660
2661@item @r{(C++ only)}
2662An enumerator and a non-enumerator both appear in a conditional expression.
2663
2664@item @r{(C++ only)}
2665A non-static reference or non-static @samp{const} member appears in a
2666class without constructors.
2667
2668@item @r{(C++ only)}
2669Ambiguous virtual bases.
2670
2671@item @r{(C++ only)}
2672Subscripting an array which has been declared @samp{register}.
2673
2674@item @r{(C++ only)}
2675Taking the address of a variable which has been declared @samp{register}.
2676
2677@item @r{(C++ only)}
2678A base class is not initialized in a derived class' copy constructor.
2679@end itemize
2680
2681@item -Wno-div-by-zero
2682@opindex Wno-div-by-zero
2683@opindex Wdiv-by-zero
2684Do not warn about compile-time integer division by zero.  Floating point
2685division by zero is not warned about, as it can be a legitimate way of
2686obtaining infinities and NaNs.
2687
2688@item -Wsystem-headers
2689@opindex Wsystem-headers
2690@cindex warnings from system headers
2691@cindex system headers, warnings from
2692Print warning messages for constructs found in system header files.
2693Warnings from system headers are normally suppressed, on the assumption
2694that they usually do not indicate real problems and would only make the
2695compiler output harder to read.  Using this command line option tells
2696GCC to emit warnings from system headers as if they occurred in user
2697code.  However, note that using @option{-Wall} in conjunction with this
2698option will @emph{not} warn about unknown pragmas in system
2699headers---for that, @option{-Wunknown-pragmas} must also be used.
2700
2701@item -Wfloat-equal
2702@opindex Wfloat-equal
2703Warn if floating point values are used in equality comparisons.
2704
2705The idea behind this is that sometimes it is convenient (for the
2706programmer) to consider floating-point values as approximations to
2707infinitely precise real numbers.  If you are doing this, then you need
2708to compute (by analyzing the code, or in some other way) the maximum or
2709likely maximum error that the computation introduces, and allow for it
2710when performing comparisons (and when producing output, but that's a
2711different problem).  In particular, instead of testing for equality, you
2712would check to see whether the two values have ranges that overlap; and
2713this is done with the relational operators, so equality comparisons are
2714probably mistaken.
2715
2716@item -Wtraditional @r{(C only)}
2717@opindex Wtraditional
2718Warn about certain constructs that behave differently in traditional and
2719ISO C@.  Also warn about ISO C constructs that have no traditional C
2720equivalent, and/or problematic constructs which should be avoided.
2721
2722@itemize @bullet
2723@item
2724Macro parameters that appear within string literals in the macro body.
2725In traditional C macro replacement takes place within string literals,
2726but does not in ISO C@.
2727
2728@item
2729In traditional C, some preprocessor directives did not exist.
2730Traditional preprocessors would only consider a line to be a directive
2731if the @samp{#} appeared in column 1 on the line.  Therefore
2732@option{-Wtraditional} warns about directives that traditional C
2733understands but would ignore because the @samp{#} does not appear as the
2734first character on the line.  It also suggests you hide directives like
2735@samp{#pragma} not understood by traditional C by indenting them.  Some
2736traditional implementations would not recognize @samp{#elif}, so it
2737suggests avoiding it altogether.
2738
2739@item
2740A function-like macro that appears without arguments.
2741
2742@item
2743The unary plus operator.
2744
2745@item
2746The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
2747constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
2748constants.)  Note, these suffixes appear in macros defined in the system
2749headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
2750Use of these macros in user code might normally lead to spurious
2751warnings, however GCC's integrated preprocessor has enough context to
2752avoid warning in these cases.
2753
2754@item
2755A function declared external in one block and then used after the end of
2756the block.
2757
2758@item
2759A @code{switch} statement has an operand of type @code{long}.
2760
2761@item
2762A non-@code{static} function declaration follows a @code{static} one.
2763This construct is not accepted by some traditional C compilers.
2764
2765@item
2766The ISO type of an integer constant has a different width or
2767signedness from its traditional type.  This warning is only issued if
2768the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
2769typically represent bit patterns, are not warned about.
2770
2771@item
2772Usage of ISO string concatenation is detected.
2773
2774@item
2775Initialization of automatic aggregates.
2776
2777@item
2778Identifier conflicts with labels.  Traditional C lacks a separate
2779namespace for labels.
2780
2781@item
2782Initialization of unions.  If the initializer is zero, the warning is
2783omitted.  This is done under the assumption that the zero initializer in
2784user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
2785initializer warnings and relies on default initialization to zero in the
2786traditional C case.
2787
2788@item
2789Conversions by prototypes between fixed/floating point values and vice
2790versa.  The absence of these prototypes when compiling with traditional
2791C would cause serious problems.  This is a subset of the possible
2792conversion warnings, for the full set use @option{-Wconversion}.
2793
2794@item
2795Use of ISO C style function definitions.  This warning intentionally is
2796@emph{not} issued for prototype declarations or variadic functions
2797because these ISO C features will appear in your code when using
2798libiberty's traditional C compatibility macros, @code{PARAMS} and
2799@code{VPARAMS}.  This warning is also bypassed for nested functions
2800because that feature is already a GCC extension and thus not relevant to
2801traditional C compatibility.
2802@end itemize
2803
2804@item -Wdeclaration-after-statement @r{(C only)}
2805@opindex Wdeclaration-after-statement
2806Warn when a declaration is found after a statement in a block.  This
2807construct, known from C++, was introduced with ISO C99 and is by default
2808allowed in GCC@.  It is not supported by ISO C90 and was not supported by
2809GCC versions before GCC 3.0.  @xref{Mixed Declarations}.
2810
2811@item -Wundef
2812@opindex Wundef
2813Warn if an undefined identifier is evaluated in an @samp{#if} directive.
2814
2815@item -Wno-endif-labels
2816@opindex Wno-endif-labels
2817@opindex Wendif-labels
2818Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
2819
2820@item -Wshadow
2821@opindex Wshadow
2822Warn whenever a local variable shadows another local variable, parameter or
2823global variable or whenever a built-in function is shadowed.
2824
2825@item -Wlarger-than-@var{len}
2826@opindex Wlarger-than
2827Warn whenever an object of larger than @var{len} bytes is defined.
2828
2829@item -Wunsafe-loop-optimizations
2830@opindex Wunsafe-loop-optimizations
2831Warn if the loop cannot be optimized because the compiler could not
2832assume anything on the bounds of the loop indices.  With
2833@option{-funsafe-loop-optimizations} warn if the compiler made
2834such assumptions.
2835
2836@item -Wpointer-arith
2837@opindex Wpointer-arith
2838Warn about anything that depends on the ``size of'' a function type or
2839of @code{void}.  GNU C assigns these types a size of 1, for
2840convenience in calculations with @code{void *} pointers and pointers
2841to functions.
2842
2843@item -Wbad-function-cast @r{(C only)}
2844@opindex Wbad-function-cast
2845Warn whenever a function call is cast to a non-matching type.
2846For example, warn if @code{int malloc()} is cast to @code{anything *}.
2847
2848@item -Wc++-compat
2849Warn about ISO C constructs that are outside of the common subset of
2850ISO C and ISO C++, e.g.@: request for implicit conversion from
2851@code{void *} to a pointer to non-@code{void} type.
2852
2853@item -Wcast-qual
2854@opindex Wcast-qual
2855Warn whenever a pointer is cast so as to remove a type qualifier from
2856the target type.  For example, warn if a @code{const char *} is cast
2857to an ordinary @code{char *}.
2858
2859@item -Wcast-align
2860@opindex Wcast-align
2861Warn whenever a pointer is cast such that the required alignment of the
2862target is increased.  For example, warn if a @code{char *} is cast to
2863an @code{int *} on machines where integers can only be accessed at
2864two- or four-byte boundaries.
2865
2866@item -Wwrite-strings
2867@opindex Wwrite-strings
2868When compiling C, give string constants the type @code{const
2869char[@var{length}]} so that
2870copying the address of one into a non-@code{const} @code{char *}
2871pointer will get a warning; when compiling C++, warn about the
2872deprecated conversion from string literals to @code{char *}.  This
2873warning, by default, is enabled for C++ programs.
2874These warnings will help you find at
2875compile time code that can try to write into a string constant, but
2876only if you have been very careful about using @code{const} in
2877declarations and prototypes.  Otherwise, it will just be a nuisance;
2878this is why we did not make @option{-Wall} request these warnings.
2879
2880@item -Wconversion
2881@opindex Wconversion
2882Warn if a prototype causes a type conversion that is different from what
2883would happen to the same argument in the absence of a prototype.  This
2884includes conversions of fixed point to floating and vice versa, and
2885conversions changing the width or signedness of a fixed point argument
2886except when the same as the default promotion.
2887
2888Also, warn if a negative integer constant expression is implicitly
2889converted to an unsigned type.  For example, warn about the assignment
2890@code{x = -1} if @code{x} is unsigned.  But do not warn about explicit
2891casts like @code{(unsigned) -1}.
2892
2893@item -Wsign-compare
2894@opindex Wsign-compare
2895@cindex warning for comparison of signed and unsigned values
2896@cindex comparison of signed and unsigned values, warning
2897@cindex signed and unsigned values, comparison warning
2898Warn when a comparison between signed and unsigned values could produce
2899an incorrect result when the signed value is converted to unsigned.
2900This warning is also enabled by @option{-Wextra}; to get the other warnings
2901of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
2902
2903@item -Waddress
2904@opindex Waddress
2905@opindex Wno-address
2906Warn about suspicious uses of memory addresses. These include using
2907the address of a function in a conditional expression, such as
2908@code{void func(void); if (func)}, and comparisons against the memory
2909address of a string literal, such as @code{if (x == "abc")}.  Such
2910uses typically indicate a programmer error: the address of a function
2911always evaluates to true, so their use in a conditional usually
2912indicate that the programmer forgot the parentheses in a function
2913call; and comparisons against string literals result in unspecified
2914behavior and are not portable in C, so they usually indicate that the
2915programmer intended to use @code{strcmp}.  This warning is enabled by
2916@option{-Wall}.
2917
2918@item -Waggregate-return
2919@opindex Waggregate-return
2920Warn if any functions that return structures or unions are defined or
2921called.  (In languages where you can return an array, this also elicits
2922a warning.)
2923
2924@item -Wno-attributes
2925@opindex Wno-attributes
2926@opindex Wattributes
2927Do not warn if an unexpected @code{__attribute__} is used, such as
2928unrecognized attributes, function attributes applied to variables,
2929etc.  This will not stop errors for incorrect use of supported
2930attributes.
2931
2932@item -Wstrict-prototypes @r{(C only)}
2933@opindex Wstrict-prototypes
2934Warn if a function is declared or defined without specifying the
2935argument types.  (An old-style function definition is permitted without
2936a warning if preceded by a declaration which specifies the argument
2937types.)
2938
2939@item -Wold-style-definition @r{(C only)}
2940@opindex Wold-style-definition
2941Warn if an old-style function definition is used.  A warning is given
2942even if there is a previous prototype.
2943
2944@item -Wmissing-prototypes @r{(C only)}
2945@opindex Wmissing-prototypes
2946Warn if a global function is defined without a previous prototype
2947declaration.  This warning is issued even if the definition itself
2948provides a prototype.  The aim is to detect global functions that fail
2949to be declared in header files.
2950
2951@item -Wmissing-declarations @r{(C only)}
2952@opindex Wmissing-declarations
2953Warn if a global function is defined without a previous declaration.
2954Do so even if the definition itself provides a prototype.
2955Use this option to detect global functions that are not declared in
2956header files.
2957
2958@item -Wmissing-field-initializers
2959@opindex Wmissing-field-initializers
2960@opindex W
2961@opindex Wextra
2962Warn if a structure's initializer has some fields missing.  For
2963example, the following code would cause such a warning, because
2964@code{x.h} is implicitly zero:
2965
2966@smallexample
2967struct s @{ int f, g, h; @};
2968struct s x = @{ 3, 4 @};
2969@end smallexample
2970
2971This option does not warn about designated initializers, so the following
2972modification would not trigger a warning:
2973
2974@smallexample
2975struct s @{ int f, g, h; @};
2976struct s x = @{ .f = 3, .g = 4 @};
2977@end smallexample
2978
2979This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
2980warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}.
2981
2982@item -Wmissing-noreturn
2983@opindex Wmissing-noreturn
2984Warn about functions which might be candidates for attribute @code{noreturn}.
2985Note these are only possible candidates, not absolute ones.  Care should
2986be taken to manually verify functions actually do not ever return before
2987adding the @code{noreturn} attribute, otherwise subtle code generation
2988bugs could be introduced.  You will not get a warning for @code{main} in
2989hosted C environments.
2990
2991@item -Wmissing-format-attribute
2992@opindex Wmissing-format-attribute
2993@opindex Wformat
2994Warn about function pointers which might be candidates for @code{format}
2995attributes.  Note these are only possible candidates, not absolute ones.
2996GCC will guess that function pointers with @code{format} attributes that
2997are used in assignment, initialization, parameter passing or return
2998statements should have a corresponding @code{format} attribute in the
2999resulting type.  I.e.@: the left-hand side of the assignment or
3000initialization, the type of the parameter variable, or the return type
3001of the containing function respectively should also have a @code{format}
3002attribute to avoid the warning.
3003
3004GCC will also warn about function definitions which might be
3005candidates for @code{format} attributes.  Again, these are only
3006possible candidates.  GCC will guess that @code{format} attributes
3007might be appropriate for any function that calls a function like
3008@code{vprintf} or @code{vscanf}, but this might not always be the
3009case, and some functions for which @code{format} attributes are
3010appropriate may not be detected.
3011
3012@item -Wno-multichar
3013@opindex Wno-multichar
3014@opindex Wmultichar
3015Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
3016Usually they indicate a typo in the user's code, as they have
3017implementation-defined values, and should not be used in portable code.
3018
3019@item -Wnormalized=<none|id|nfc|nfkc>
3020@opindex Wnormalized
3021@cindex NFC
3022@cindex NFKC
3023@cindex character set, input normalization
3024In ISO C and ISO C++, two identifiers are different if they are
3025different sequences of characters.  However, sometimes when characters
3026outside the basic ASCII character set are used, you can have two
3027different character sequences that look the same.  To avoid confusion,
3028the ISO 10646 standard sets out some @dfn{normalization rules} which
3029when applied ensure that two sequences that look the same are turned into
3030the same sequence.  GCC can warn you if you are using identifiers which
3031have not been normalized; this option controls that warning.
3032
3033There are four levels of warning that GCC supports.  The default is
3034@option{-Wnormalized=nfc}, which warns about any identifier which is
3035not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
3036recommended form for most uses.
3037
3038Unfortunately, there are some characters which ISO C and ISO C++ allow
3039in identifiers that when turned into NFC aren't allowable as
3040identifiers.  That is, there's no way to use these symbols in portable
3041ISO C or C++ and have all your identifiers in NFC.
3042@option{-Wnormalized=id} suppresses the warning for these characters.
3043It is hoped that future versions of the standards involved will correct
3044this, which is why this option is not the default.
3045
3046You can switch the warning off for all characters by writing
3047@option{-Wnormalized=none}.  You would only want to do this if you
3048were using some other normalization scheme (like ``D''), because
3049otherwise you can easily create bugs that are literally impossible to see.
3050
3051Some characters in ISO 10646 have distinct meanings but look identical
3052in some fonts or display methodologies, especially once formatting has
3053been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
3054LETTER N'', will display just like a regular @code{n} which has been
3055placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
3056normalization scheme to convert all these into a standard form as
3057well, and GCC will warn if your code is not in NFKC if you use
3058@option{-Wnormalized=nfkc}.  This warning is comparable to warning
3059about every identifier that contains the letter O because it might be
3060confused with the digit 0, and so is not the default, but may be
3061useful as a local coding convention if the programming environment is
3062unable to be fixed to display these characters distinctly.
3063
3064@item -Wno-deprecated-declarations
3065@opindex Wno-deprecated-declarations
3066Do not warn about uses of functions (@pxref{Function Attributes}),
3067variables (@pxref{Variable Attributes}), and types (@pxref{Type
3068Attributes}) marked as deprecated by using the @code{deprecated}
3069attribute.
3070
3071@item -Wno-overflow
3072@opindex Wno-overflow
3073Do not warn about compile-time overflow in constant expressions.
3074
3075@item -Woverride-init
3076@opindex Woverride-init
3077@opindex W
3078@opindex Wextra
3079Warn if an initialized field without side effects is overridden when
3080using designated initializers (@pxref{Designated Inits, , Designated
3081Initializers}).
3082
3083This warning is included in @option{-Wextra}.  To get other
3084@option{-Wextra} warnings without this one, use @samp{-Wextra
3085-Wno-override-init}.
3086
3087@item -Wpacked
3088@opindex Wpacked
3089Warn if a structure is given the packed attribute, but the packed
3090attribute has no effect on the layout or size of the structure.
3091Such structures may be mis-aligned for little benefit.  For
3092instance, in this code, the variable @code{f.x} in @code{struct bar}
3093will be misaligned even though @code{struct bar} does not itself
3094have the packed attribute:
3095
3096@smallexample
3097@group
3098struct foo @{
3099  int x;
3100  char a, b, c, d;
3101@} __attribute__((packed));
3102struct bar @{
3103  char z;
3104  struct foo f;
3105@};
3106@end group
3107@end smallexample
3108
3109@item -Wpadded
3110@opindex Wpadded
3111Warn if padding is included in a structure, either to align an element
3112of the structure or to align the whole structure.  Sometimes when this
3113happens it is possible to rearrange the fields of the structure to
3114reduce the padding and so make the structure smaller.
3115
3116@item -Wredundant-decls
3117@opindex Wredundant-decls
3118Warn if anything is declared more than once in the same scope, even in
3119cases where multiple declaration is valid and changes nothing.
3120
3121@item -Wnested-externs @r{(C only)}
3122@opindex Wnested-externs
3123Warn if an @code{extern} declaration is encountered within a function.
3124
3125@item -Wunreachable-code
3126@opindex Wunreachable-code
3127Warn if the compiler detects that code will never be executed.
3128
3129This option is intended to warn when the compiler detects that at
3130least a whole line of source code will never be executed, because
3131some condition is never satisfied or because it is after a
3132procedure that never returns.
3133
3134It is possible for this option to produce a warning even though there
3135are circumstances under which part of the affected line can be executed,
3136so care should be taken when removing apparently-unreachable code.
3137
3138For instance, when a function is inlined, a warning may mean that the
3139line is unreachable in only one inlined copy of the function.
3140
3141This option is not made part of @option{-Wall} because in a debugging
3142version of a program there is often substantial code which checks
3143correct functioning of the program and is, hopefully, unreachable
3144because the program does work.  Another common use of unreachable
3145code is to provide behavior which is selectable at compile-time.
3146
3147@item -Winline
3148@opindex Winline
3149Warn if a function can not be inlined and it was declared as inline.
3150Even with this option, the compiler will not warn about failures to
3151inline functions declared in system headers.
3152
3153The compiler uses a variety of heuristics to determine whether or not
3154to inline a function.  For example, the compiler takes into account
3155the size of the function being inlined and the amount of inlining
3156that has already been done in the current function.  Therefore,
3157seemingly insignificant changes in the source program can cause the
3158warnings produced by @option{-Winline} to appear or disappear.
3159
3160@item -Wno-invalid-offsetof @r{(C++ only)}
3161@opindex Wno-invalid-offsetof
3162Suppress warnings from applying the @samp{offsetof} macro to a non-POD
3163type.  According to the 1998 ISO C++ standard, applying @samp{offsetof}
3164to a non-POD type is undefined.  In existing C++ implementations,
3165however, @samp{offsetof} typically gives meaningful results even when
3166applied to certain kinds of non-POD types. (Such as a simple
3167@samp{struct} that fails to be a POD type only by virtue of having a
3168constructor.)  This flag is for users who are aware that they are
3169writing nonportable code and who have deliberately chosen to ignore the
3170warning about it.
3171
3172The restrictions on @samp{offsetof} may be relaxed in a future version
3173of the C++ standard.
3174
3175@item -Wno-int-to-pointer-cast @r{(C only)}
3176@opindex Wno-int-to-pointer-cast
3177Suppress warnings from casts to pointer type of an integer of a
3178different size.
3179
3180@item -Wno-pointer-to-int-cast @r{(C only)}
3181@opindex Wno-pointer-to-int-cast
3182Suppress warnings from casts from a pointer to an integer type of a
3183different size.
3184
3185@item -Winvalid-pch
3186@opindex Winvalid-pch
3187Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
3188the search path but can't be used.
3189
3190@item -Wlong-long
3191@opindex Wlong-long
3192@opindex Wno-long-long
3193Warn if @samp{long long} type is used.  This is default.  To inhibit
3194the warning messages, use @option{-Wno-long-long}.  Flags
3195@option{-Wlong-long} and @option{-Wno-long-long} are taken into account
3196only when @option{-pedantic} flag is used.
3197
3198@item -Wvariadic-macros
3199@opindex Wvariadic-macros
3200@opindex Wno-variadic-macros
3201Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
3202alternate syntax when in pedantic ISO C99 mode.  This is default.
3203To inhibit the warning messages, use @option{-Wno-variadic-macros}.
3204
3205@item -Wvolatile-register-var
3206@opindex Wvolatile-register-var
3207@opindex Wno-volatile-register-var
3208Warn if a register variable is declared volatile.  The volatile
3209modifier does not inhibit all optimizations that may eliminate reads
3210and/or writes to register variables.
3211
3212@item -Wdisabled-optimization
3213@opindex Wdisabled-optimization
3214Warn if a requested optimization pass is disabled.  This warning does
3215not generally indicate that there is anything wrong with your code; it
3216merely indicates that GCC's optimizers were unable to handle the code
3217effectively.  Often, the problem is that your code is too big or too
3218complex; GCC will refuse to optimize programs when the optimization
3219itself is likely to take inordinate amounts of time.
3220
3221@item -Wpointer-sign
3222@opindex Wpointer-sign
3223@opindex Wno-pointer-sign
3224Warn for pointer argument passing or assignment with different signedness.
3225This option is only supported for C.  It is implied by @option{-Wall}
3226and by @option{-pedantic}, which can be disabled with
3227@option{-Wno-pointer-sign}.
3228
3229@item -Werror
3230@opindex Werror
3231Make all warnings into errors.
3232
3233@item -Werror=
3234@opindex Werror=
3235Make the specified warning into an errors.  The specifier for a
3236warning is appended, for example @option{-Werror=switch} turns the
3237warnings controlled by @option{-Wswitch} into errors.  This switch
3238takes a negative form, to be used to negate @option{-Werror} for
3239specific warnings, for example @option{-Wno-error=switch} makes
3240@option{-Wswitch} warnings not be errors, even when @option{-Werror}
3241is in effect.  You can use the @option{-fdiagnostics-show-option}
3242option to have each controllable warning amended with the option which
3243controls it, to determine what to use with this option.
3244
3245Note that specifying @option{-Werror=}@var{foo} automatically implies
3246@option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
3247imply anything.
3248
3249@item -Wstack-protector
3250@opindex Wstack-protector
3251This option is only active when @option{-fstack-protector} is active.  It
3252warns about functions that will not be protected against stack smashing.
3253
3254@item -Woverlength-strings
3255@opindex Woverlength-strings
3256Warn about string constants which are longer than the ``minimum
3257maximum'' length specified in the C standard.  Modern compilers
3258generally allow string constants which are much longer than the
3259standard's minimum limit, but very portable programs should avoid
3260using longer strings.
3261
3262The limit applies @emph{after} string constant concatenation, and does
3263not count the trailing NUL@.  In C89, the limit was 509 characters; in
3264C99, it was raised to 4095.  C++98 does not specify a normative
3265minimum maximum, so we do not diagnose overlength strings in C++@.
3266
3267This option is implied by @option{-pedantic}, and can be disabled with
3268@option{-Wno-overlength-strings}.
3269@end table
3270
3271@node Debugging Options
3272@section Options for Debugging Your Program or GCC
3273@cindex options, debugging
3274@cindex debugging information options
3275
3276GCC has various special options that are used for debugging
3277either your program or GCC:
3278
3279@table @gcctabopt
3280@item -g
3281@opindex g
3282Produce debugging information in the operating system's native format
3283(stabs, COFF, XCOFF, or DWARF 2)@.  GDB can work with this debugging
3284information.
3285
3286On most systems that use stabs format, @option{-g} enables use of extra
3287debugging information that only GDB can use; this extra information
3288makes debugging work better in GDB but will probably make other debuggers
3289crash or
3290refuse to read the program.  If you want to control for certain whether
3291to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
3292@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
3293
3294GCC allows you to use @option{-g} with
3295@option{-O}.  The shortcuts taken by optimized code may occasionally
3296produce surprising results: some variables you declared may not exist
3297at all; flow of control may briefly move where you did not expect it;
3298some statements may not be executed because they compute constant
3299results or their values were already at hand; some statements may
3300execute in different places because they were moved out of loops.
3301
3302Nevertheless it proves possible to debug optimized output.  This makes
3303it reasonable to use the optimizer for programs that might have bugs.
3304
3305The following options are useful when GCC is generated with the
3306capability for more than one debugging format.
3307
3308@item -ggdb
3309@opindex ggdb
3310Produce debugging information for use by GDB@.  This means to use the
3311most expressive format available (DWARF 2, stabs, or the native format
3312if neither of those are supported), including GDB extensions if at all
3313possible.
3314
3315@item -gstabs
3316@opindex gstabs
3317Produce debugging information in stabs format (if that is supported),
3318without GDB extensions.  This is the format used by DBX on most BSD
3319systems.  On MIPS, Alpha and System V Release 4 systems this option
3320produces stabs debugging output which is not understood by DBX or SDB@.
3321On System V Release 4 systems this option requires the GNU assembler.
3322
3323@item -feliminate-unused-debug-symbols
3324@opindex feliminate-unused-debug-symbols
3325Produce debugging information in stabs format (if that is supported),
3326for only symbols that are actually used.
3327
3328@item -femit-class-debug-always
3329Instead of emitting debugging information for a C++ class in only one
3330object file, emit it in all object files using the class.  This option
3331should be used only with debuggers that are unable to handle the way GCC
3332normally emits debugging information for classes because using this
3333option will increase the size of debugging information by as much as a
3334factor of two.
3335
3336@item -gstabs+
3337@opindex gstabs+
3338Produce debugging information in stabs format (if that is supported),
3339using GNU extensions understood only by the GNU debugger (GDB)@.  The
3340use of these extensions is likely to make other debuggers crash or
3341refuse to read the program.
3342
3343@item -gcoff
3344@opindex gcoff
3345Produce debugging information in COFF format (if that is supported).
3346This is the format used by SDB on most System V systems prior to
3347System V Release 4.
3348
3349@item -gxcoff
3350@opindex gxcoff
3351Produce debugging information in XCOFF format (if that is supported).
3352This is the format used by the DBX debugger on IBM RS/6000 systems.
3353
3354@item -gxcoff+
3355@opindex gxcoff+
3356Produce debugging information in XCOFF format (if that is supported),
3357using GNU extensions understood only by the GNU debugger (GDB)@.  The
3358use of these extensions is likely to make other debuggers crash or
3359refuse to read the program, and may cause assemblers other than the GNU
3360assembler (GAS) to fail with an error.
3361
3362@item -gdwarf-2
3363@opindex gdwarf-2
3364Produce debugging information in DWARF version 2 format (if that is
3365supported).  This is the format used by DBX on IRIX 6.  With this
3366option, GCC uses features of DWARF version 3 when they are useful;
3367version 3 is upward compatible with version 2, but may still cause
3368problems for older debuggers.
3369
3370@item -gvms
3371@opindex gvms
3372Produce debugging information in VMS debug format (if that is
3373supported).  This is the format used by DEBUG on VMS systems.
3374
3375@item -g@var{level}
3376@itemx -ggdb@var{level}
3377@itemx -gstabs@var{level}
3378@itemx -gcoff@var{level}
3379@itemx -gxcoff@var{level}
3380@itemx -gvms@var{level}
3381Request debugging information and also use @var{level} to specify how
3382much information.  The default level is 2.
3383
3384Level 1 produces minimal information, enough for making backtraces in
3385parts of the program that you don't plan to debug.  This includes
3386descriptions of functions and external variables, but no information
3387about local variables and no line numbers.
3388
3389Level 3 includes extra information, such as all the macro definitions
3390present in the program.  Some debuggers support macro expansion when
3391you use @option{-g3}.
3392
3393@option{-gdwarf-2} does not accept a concatenated debug level, because
3394GCC used to support an option @option{-gdwarf} that meant to generate
3395debug information in version 1 of the DWARF format (which is very
3396different from version 2), and it would have been too confusing.  That
3397debug format is long obsolete, but the option cannot be changed now.
3398Instead use an additional @option{-g@var{level}} option to change the
3399debug level for DWARF2.
3400
3401@item -feliminate-dwarf2-dups
3402@opindex feliminate-dwarf2-dups
3403Compress DWARF2 debugging information by eliminating duplicated
3404information about each symbol.  This option only makes sense when
3405generating DWARF2 debugging information with @option{-gdwarf-2}.
3406
3407@cindex @command{prof}
3408@item -p
3409@opindex p
3410Generate extra code to write profile information suitable for the
3411analysis program @command{prof}.  You must use this option when compiling
3412the source files you want data about, and you must also use it when
3413linking.
3414
3415@cindex @command{gprof}
3416@item -pg
3417@opindex pg
3418Generate extra code to write profile information suitable for the
3419analysis program @command{gprof}.  You must use this option when compiling
3420the source files you want data about, and you must also use it when
3421linking.
3422
3423@item -Q
3424@opindex Q
3425Makes the compiler print out each function name as it is compiled, and
3426print some statistics about each pass when it finishes.
3427
3428@item -ftime-report
3429@opindex ftime-report
3430Makes the compiler print some statistics about the time consumed by each
3431pass when it finishes.
3432
3433@item -fmem-report
3434@opindex fmem-report
3435Makes the compiler print some statistics about permanent memory
3436allocation when it finishes.
3437
3438@item -fprofile-arcs
3439@opindex fprofile-arcs
3440Add code so that program flow @dfn{arcs} are instrumented.  During
3441execution the program records how many times each branch and call is
3442executed and how many times it is taken or returns.  When the compiled
3443program exits it saves this data to a file called
3444@file{@var{auxname}.gcda} for each source file.  The data may be used for
3445profile-directed optimizations (@option{-fbranch-probabilities}), or for
3446test coverage analysis (@option{-ftest-coverage}).  Each object file's
3447@var{auxname} is generated from the name of the output file, if
3448explicitly specified and it is not the final executable, otherwise it is
3449the basename of the source file.  In both cases any suffix is removed
3450(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
3451@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
3452@xref{Cross-profiling}.
3453
3454@cindex @command{gcov}
3455@item --coverage
3456@opindex coverage
3457
3458This option is used to compile and link code instrumented for coverage
3459analysis.  The option is a synonym for @option{-fprofile-arcs}
3460@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
3461linking).  See the documentation for those options for more details.
3462
3463@itemize
3464
3465@item
3466Compile the source files with @option{-fprofile-arcs} plus optimization
3467and code generation options.  For test coverage analysis, use the
3468additional @option{-ftest-coverage} option.  You do not need to profile
3469every source file in a program.
3470
3471@item
3472Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
3473(the latter implies the former).
3474
3475@item
3476Run the program on a representative workload to generate the arc profile
3477information.  This may be repeated any number of times.  You can run
3478concurrent instances of your program, and provided that the file system
3479supports locking, the data files will be correctly updated.  Also
3480@code{fork} calls are detected and correctly handled (double counting
3481will not happen).
3482
3483@item
3484For profile-directed optimizations, compile the source files again with
3485the same optimization and code generation options plus
3486@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
3487Control Optimization}).
3488
3489@item
3490For test coverage analysis, use @command{gcov} to produce human readable
3491information from the @file{.gcno} and @file{.gcda} files.  Refer to the
3492@command{gcov} documentation for further information.
3493
3494@end itemize
3495
3496With @option{-fprofile-arcs}, for each function of your program GCC
3497creates a program flow graph, then finds a spanning tree for the graph.
3498Only arcs that are not on the spanning tree have to be instrumented: the
3499compiler adds code to count the number of times that these arcs are
3500executed.  When an arc is the only exit or only entrance to a block, the
3501instrumentation code can be added to the block; otherwise, a new basic
3502block must be created to hold the instrumentation code.
3503
3504@need 2000
3505@item -ftest-coverage
3506@opindex ftest-coverage
3507Produce a notes file that the @command{gcov} code-coverage utility
3508(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
3509show program coverage.  Each source file's note file is called
3510@file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
3511above for a description of @var{auxname} and instructions on how to
3512generate test coverage data.  Coverage data will match the source files
3513more closely, if you do not optimize.
3514
3515@item -d@var{letters}
3516@item -fdump-rtl-@var{pass}
3517@opindex d
3518Says to make debugging dumps during compilation at times specified by
3519@var{letters}.    This is used for debugging the RTL-based passes of the
3520compiler.  The file names for most of the dumps are made by appending a
3521pass number and a word to the @var{dumpname}.  @var{dumpname} is generated
3522from the name of the output file, if explicitly specified and it is not
3523an executable, otherwise it is the basename of the source file.
3524
3525Most debug dumps can be enabled either passing a letter to the @option{-d}
3526option, or with a long @option{-fdump-rtl} switch; here are the possible
3527letters for use in @var{letters} and @var{pass}, and their meanings:
3528
3529@table @gcctabopt
3530@item -dA
3531@opindex dA
3532Annotate the assembler output with miscellaneous debugging information.
3533
3534@item -dB
3535@itemx -fdump-rtl-bbro
3536@opindex dB
3537@opindex fdump-rtl-bbro
3538Dump after block reordering, to @file{@var{file}.148r.bbro}.
3539
3540@item -dc
3541@itemx -fdump-rtl-combine
3542@opindex dc
3543@opindex fdump-rtl-combine
3544Dump after instruction combination, to the file @file{@var{file}.129r.combine}.
3545
3546@item -dC
3547@itemx -fdump-rtl-ce1
3548@itemx -fdump-rtl-ce2
3549@opindex dC
3550@opindex fdump-rtl-ce1
3551@opindex fdump-rtl-ce2
3552@option{-dC} and @option{-fdump-rtl-ce1} enable dumping after the
3553first if conversion, to the file @file{@var{file}.117r.ce1}.  @option{-dC}
3554and @option{-fdump-rtl-ce2} enable dumping after the second if
3555conversion, to the file @file{@var{file}.130r.ce2}.
3556
3557@item -dd
3558@itemx -fdump-rtl-btl
3559@itemx -fdump-rtl-dbr
3560@opindex dd
3561@opindex fdump-rtl-btl
3562@opindex fdump-rtl-dbr
3563@option{-dd} and @option{-fdump-rtl-btl} enable dumping after branch
3564target load optimization, to @file{@var{file}.31.btl}.  @option{-dd}
3565and @option{-fdump-rtl-dbr} enable dumping after delayed branch
3566scheduling, to @file{@var{file}.36.dbr}.
3567
3568@item -dD
3569@opindex dD
3570Dump all macro definitions, at the end of preprocessing, in addition to
3571normal output.
3572
3573@item -dE
3574@itemx -fdump-rtl-ce3
3575@opindex dE
3576@opindex fdump-rtl-ce3
3577Dump after the third if conversion, to @file{@var{file}.146r.ce3}.
3578
3579@item -df
3580@itemx -fdump-rtl-cfg
3581@itemx -fdump-rtl-life
3582@opindex df
3583@opindex fdump-rtl-cfg
3584@opindex fdump-rtl-life
3585@option{-df} and @option{-fdump-rtl-cfg} enable dumping after control
3586and data flow analysis, to @file{@var{file}.116r.cfg}.  @option{-df}
3587and @option{-fdump-rtl-cfg} enable dumping dump after life analysis,
3588to @file{@var{file}.128r.life1} and @file{@var{file}.135r.life2}.
3589
3590@item -dg
3591@itemx -fdump-rtl-greg
3592@opindex dg
3593@opindex fdump-rtl-greg
3594Dump after global register allocation, to @file{@var{file}.139r.greg}.
3595
3596@item -dG
3597@itemx -fdump-rtl-gcse
3598@itemx -fdump-rtl-bypass
3599@opindex dG
3600@opindex fdump-rtl-gcse
3601@opindex fdump-rtl-bypass
3602@option{-dG} and @option{-fdump-rtl-gcse} enable dumping after GCSE, to
3603@file{@var{file}.114r.gcse}.  @option{-dG} and @option{-fdump-rtl-bypass}
3604enable dumping after jump bypassing and control flow optimizations, to
3605@file{@var{file}.115r.bypass}.
3606
3607@item -dh
3608@itemx -fdump-rtl-eh
3609@opindex dh
3610@opindex fdump-rtl-eh
3611Dump after finalization of EH handling code, to @file{@var{file}.02.eh}.
3612
3613@item -di
3614@itemx -fdump-rtl-sibling
3615@opindex di
3616@opindex fdump-rtl-sibling
3617Dump after sibling call optimizations, to @file{@var{file}.106r.sibling}.
3618
3619@item -dj
3620@itemx -fdump-rtl-jump
3621@opindex dj
3622@opindex fdump-rtl-jump
3623Dump after the first jump optimization, to @file{@var{file}.112r.jump}.
3624
3625@item -dk
3626@itemx -fdump-rtl-stack
3627@opindex dk
3628@opindex fdump-rtl-stack
3629Dump after conversion from registers to stack, to @file{@var{file}.152r.stack}.
3630
3631@item -dl
3632@itemx -fdump-rtl-lreg
3633@opindex dl
3634@opindex fdump-rtl-lreg
3635Dump after local register allocation, to @file{@var{file}.138r.lreg}.
3636
3637@item -dL
3638@itemx -fdump-rtl-loop2
3639@opindex dL
3640@opindex fdump-rtl-loop2
3641@option{-dL} and @option{-fdump-rtl-loop2} enable dumping after the
3642loop optimization pass, to @file{@var{file}.119r.loop2},
3643@file{@var{file}.120r.loop2_init},
3644@file{@var{file}.121r.loop2_invariant}, and
3645@file{@var{file}.125r.loop2_done}.
3646
3647@item -dm
3648@itemx -fdump-rtl-sms
3649@opindex dm
3650@opindex fdump-rtl-sms
3651Dump after modulo scheduling, to @file{@var{file}.136r.sms}.
3652
3653@item -dM
3654@itemx -fdump-rtl-mach
3655@opindex dM
3656@opindex fdump-rtl-mach
3657Dump after performing the machine dependent reorganization pass, to
3658@file{@var{file}.155r.mach}.
3659
3660@item -dn
3661@itemx -fdump-rtl-rnreg
3662@opindex dn
3663@opindex fdump-rtl-rnreg
3664Dump after register renumbering, to @file{@var{file}.147r.rnreg}.
3665
3666@item -dN
3667@itemx -fdump-rtl-regmove
3668@opindex dN
3669@opindex fdump-rtl-regmove
3670Dump after the register move pass, to @file{@var{file}.132r.regmove}.
3671
3672@item -do
3673@itemx -fdump-rtl-postreload
3674@opindex do
3675@opindex fdump-rtl-postreload
3676Dump after post-reload optimizations, to @file{@var{file}.24.postreload}.
3677
3678@item -dr
3679@itemx -fdump-rtl-expand
3680@opindex dr
3681@opindex fdump-rtl-expand
3682Dump after RTL generation, to @file{@var{file}.104r.expand}.
3683
3684@item -dR
3685@itemx -fdump-rtl-sched2
3686@opindex dR
3687@opindex fdump-rtl-sched2
3688Dump after the second scheduling pass, to @file{@var{file}.150r.sched2}.
3689
3690@item -ds
3691@itemx -fdump-rtl-cse
3692@opindex ds
3693@opindex fdump-rtl-cse
3694Dump after CSE (including the jump optimization that sometimes follows
3695CSE), to @file{@var{file}.113r.cse}.
3696
3697@item -dS
3698@itemx -fdump-rtl-sched
3699@opindex dS
3700@opindex fdump-rtl-sched
3701Dump after the first scheduling pass, to @file{@var{file}.21.sched}.
3702
3703@item -dt
3704@itemx -fdump-rtl-cse2
3705@opindex dt
3706@opindex fdump-rtl-cse2
3707Dump after the second CSE pass (including the jump optimization that
3708sometimes follows CSE), to @file{@var{file}.127r.cse2}.
3709
3710@item -dT
3711@itemx -fdump-rtl-tracer
3712@opindex dT
3713@opindex fdump-rtl-tracer
3714Dump after running tracer, to @file{@var{file}.118r.tracer}.
3715
3716@item -dV
3717@itemx -fdump-rtl-vpt
3718@itemx -fdump-rtl-vartrack
3719@opindex dV
3720@opindex fdump-rtl-vpt
3721@opindex fdump-rtl-vartrack
3722@option{-dV} and @option{-fdump-rtl-vpt} enable dumping after the value
3723profile transformations, to @file{@var{file}.10.vpt}.  @option{-dV}
3724and @option{-fdump-rtl-vartrack} enable dumping after variable tracking,
3725to @file{@var{file}.154r.vartrack}.
3726
3727@item -dw
3728@itemx -fdump-rtl-flow2
3729@opindex dw
3730@opindex fdump-rtl-flow2
3731Dump after the second flow pass, to @file{@var{file}.142r.flow2}.
3732
3733@item -dz
3734@itemx -fdump-rtl-peephole2
3735@opindex dz
3736@opindex fdump-rtl-peephole2
3737Dump after the peephole pass, to @file{@var{file}.145r.peephole2}.
3738
3739@item -dZ
3740@itemx -fdump-rtl-web
3741@opindex dZ
3742@opindex fdump-rtl-web
3743Dump after live range splitting, to @file{@var{file}.126r.web}.
3744
3745@item -da
3746@itemx -fdump-rtl-all
3747@opindex da
3748@opindex fdump-rtl-all
3749Produce all the dumps listed above.
3750
3751@item -dH
3752@opindex dH
3753Produce a core dump whenever an error occurs.
3754
3755@item -dm
3756@opindex dm
3757Print statistics on memory usage, at the end of the run, to
3758standard error.
3759
3760@item -dp
3761@opindex dp
3762Annotate the assembler output with a comment indicating which
3763pattern and alternative was used.  The length of each instruction is
3764also printed.
3765
3766@item -dP
3767@opindex dP
3768Dump the RTL in the assembler output as a comment before each instruction.
3769Also turns on @option{-dp} annotation.
3770
3771@item -dv
3772@opindex dv
3773For each of the other indicated dump files (either with @option{-d} or
3774@option{-fdump-rtl-@var{pass}}), dump a representation of the control flow
3775graph suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
3776
3777@item -dx
3778@opindex dx
3779Just generate RTL for a function instead of compiling it.  Usually used
3780with @samp{r} (@option{-fdump-rtl-expand}).
3781
3782@item -dy
3783@opindex dy
3784Dump debugging information during parsing, to standard error.
3785@end table
3786
3787@item -fdump-noaddr
3788@opindex fdump-noaddr
3789When doing debugging dumps (see @option{-d} option above), suppress
3790address output.  This makes it more feasible to use diff on debugging
3791dumps for compiler invocations with different compiler binaries and/or
3792different text / bss / data / heap / stack / dso start locations.
3793
3794@item -fdump-unnumbered
3795@opindex fdump-unnumbered
3796When doing debugging dumps (see @option{-d} option above), suppress instruction
3797numbers, line number note and address output.  This makes it more feasible to
3798use diff on debugging dumps for compiler invocations with different
3799options, in particular with and without @option{-g}.
3800
3801@item -fdump-translation-unit @r{(C++ only)}
3802@itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
3803@opindex fdump-translation-unit
3804Dump a representation of the tree structure for the entire translation
3805unit to a file.  The file name is made by appending @file{.tu} to the
3806source file name.  If the @samp{-@var{options}} form is used, @var{options}
3807controls the details of the dump as described for the
3808@option{-fdump-tree} options.
3809
3810@item -fdump-class-hierarchy @r{(C++ only)}
3811@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
3812@opindex fdump-class-hierarchy
3813Dump a representation of each class's hierarchy and virtual function
3814table layout to a file.  The file name is made by appending @file{.class}
3815to the source file name.  If the @samp{-@var{options}} form is used,
3816@var{options} controls the details of the dump as described for the
3817@option{-fdump-tree} options.
3818
3819@item -fdump-ipa-@var{switch}
3820@opindex fdump-ipa
3821Control the dumping at various stages of inter-procedural analysis
3822language tree to a file.  The file name is generated by appending a switch
3823specific suffix to the source file name.  The following dumps are possible:
3824
3825@table @samp
3826@item all
3827Enables all inter-procedural analysis dumps; currently the only produced
3828dump is the @samp{cgraph} dump.
3829
3830@item cgraph
3831Dumps information about call-graph optimization, unused function removal,
3832and inlining decisions.
3833@end table
3834
3835@item -fdump-tree-@var{switch}
3836@itemx -fdump-tree-@var{switch}-@var{options}
3837@opindex fdump-tree
3838Control the dumping at various stages of processing the intermediate
3839language tree to a file.  The file name is generated by appending a switch
3840specific suffix to the source file name.  If the @samp{-@var{options}}
3841form is used, @var{options} is a list of @samp{-} separated options that
3842control the details of the dump.  Not all options are applicable to all
3843dumps, those which are not meaningful will be ignored.  The following
3844options are available
3845
3846@table @samp
3847@item address
3848Print the address of each node.  Usually this is not meaningful as it
3849changes according to the environment and source file.  Its primary use
3850is for tying up a dump file with a debug environment.
3851@item slim
3852Inhibit dumping of members of a scope or body of a function merely
3853because that scope has been reached.  Only dump such items when they
3854are directly reachable by some other path.  When dumping pretty-printed
3855trees, this option inhibits dumping the bodies of control structures.
3856@item raw
3857Print a raw representation of the tree.  By default, trees are
3858pretty-printed into a C-like representation.
3859@item details
3860Enable more detailed dumps (not honored by every dump option).
3861@item stats
3862Enable dumping various statistics about the pass (not honored by every dump
3863option).
3864@item blocks
3865Enable showing basic block boundaries (disabled in raw dumps).
3866@item vops
3867Enable showing virtual operands for every statement.
3868@item lineno
3869Enable showing line numbers for statements.
3870@item uid
3871Enable showing the unique ID (@code{DECL_UID}) for each variable.
3872@item all
3873Turn on all options, except @option{raw}, @option{slim} and @option{lineno}.
3874@end table
3875
3876The following tree dumps are possible:
3877@table @samp
3878
3879@item original
3880Dump before any tree based optimization, to @file{@var{file}.original}.
3881
3882@item optimized
3883Dump after all tree based optimization, to @file{@var{file}.optimized}.
3884
3885@item inlined
3886Dump after function inlining, to @file{@var{file}.inlined}.
3887
3888@item gimple
3889@opindex fdump-tree-gimple
3890Dump each function before and after the gimplification pass to a file.  The
3891file name is made by appending @file{.gimple} to the source file name.
3892
3893@item cfg
3894@opindex fdump-tree-cfg
3895Dump the control flow graph of each function to a file.  The file name is
3896made by appending @file{.cfg} to the source file name.
3897
3898@item vcg
3899@opindex fdump-tree-vcg
3900Dump the control flow graph of each function to a file in VCG format.  The
3901file name is made by appending @file{.vcg} to the source file name.  Note
3902that if the file contains more than one function, the generated file cannot
3903be used directly by VCG@.  You will need to cut and paste each function's
3904graph into its own separate file first.
3905
3906@item ch
3907@opindex fdump-tree-ch
3908Dump each function after copying loop headers.  The file name is made by
3909appending @file{.ch} to the source file name.
3910
3911@item ssa
3912@opindex fdump-tree-ssa
3913Dump SSA related information to a file.  The file name is made by appending
3914@file{.ssa} to the source file name.
3915
3916@item salias
3917@opindex fdump-tree-salias
3918Dump structure aliasing variable information to a file.  This file name
3919is made by appending @file{.salias} to the source file name.
3920
3921@item alias
3922@opindex fdump-tree-alias
3923Dump aliasing information for each function.  The file name is made by
3924appending @file{.alias} to the source file name.
3925
3926@item ccp
3927@opindex fdump-tree-ccp
3928Dump each function after CCP@.  The file name is made by appending
3929@file{.ccp} to the source file name.
3930
3931@item storeccp
3932@opindex fdump-tree-storeccp
3933Dump each function after STORE-CCP.  The file name is made by appending
3934@file{.storeccp} to the source file name.
3935
3936@item pre
3937@opindex fdump-tree-pre
3938Dump trees after partial redundancy elimination.  The file name is made
3939by appending @file{.pre} to the source file name.
3940
3941@item fre
3942@opindex fdump-tree-fre
3943Dump trees after full redundancy elimination.  The file name is made
3944by appending @file{.fre} to the source file name.
3945
3946@item copyprop
3947@opindex fdump-tree-copyprop
3948Dump trees after copy propagation.  The file name is made
3949by appending @file{.copyprop} to the source file name.
3950
3951@item store_copyprop
3952@opindex fdump-tree-store_copyprop
3953Dump trees after store copy-propagation.  The file name is made
3954by appending @file{.store_copyprop} to the source file name.
3955
3956@item dce
3957@opindex fdump-tree-dce
3958Dump each function after dead code elimination.  The file name is made by
3959appending @file{.dce} to the source file name.
3960
3961@item mudflap
3962@opindex fdump-tree-mudflap
3963Dump each function after adding mudflap instrumentation.  The file name is
3964made by appending @file{.mudflap} to the source file name.
3965
3966@item sra
3967@opindex fdump-tree-sra
3968Dump each function after performing scalar replacement of aggregates.  The
3969file name is made by appending @file{.sra} to the source file name.
3970
3971@item sink
3972@opindex fdump-tree-sink
3973Dump each function after performing code sinking.  The file name is made
3974by appending @file{.sink} to the source file name. 
3975
3976@item dom
3977@opindex fdump-tree-dom
3978Dump each function after applying dominator tree optimizations.  The file
3979name is made by appending @file{.dom} to the source file name.
3980
3981@item dse
3982@opindex fdump-tree-dse
3983Dump each function after applying dead store elimination.  The file
3984name is made by appending @file{.dse} to the source file name.
3985
3986@item phiopt
3987@opindex fdump-tree-phiopt
3988Dump each function after optimizing PHI nodes into straightline code.  The file
3989name is made by appending @file{.phiopt} to the source file name.
3990
3991@item forwprop
3992@opindex fdump-tree-forwprop
3993Dump each function after forward propagating single use variables.  The file
3994name is made by appending @file{.forwprop} to the source file name.
3995
3996@item copyrename
3997@opindex fdump-tree-copyrename
3998Dump each function after applying the copy rename optimization.  The file
3999name is made by appending @file{.copyrename} to the source file name.
4000
4001@item nrv
4002@opindex fdump-tree-nrv
4003Dump each function after applying the named return value optimization on
4004generic trees.  The file name is made by appending @file{.nrv} to the source
4005file name.
4006
4007@item vect
4008@opindex fdump-tree-vect
4009Dump each function after applying vectorization of loops.  The file name is
4010made by appending @file{.vect} to the source file name.
4011
4012@item vrp
4013@opindex fdump-tree-vrp
4014Dump each function after Value Range Propagation (VRP).  The file name
4015is made by appending @file{.vrp} to the source file name.
4016
4017@item all
4018@opindex fdump-tree-all
4019Enable all the available tree dumps with the flags provided in this option.
4020@end table
4021
4022@item -ftree-vectorizer-verbose=@var{n}
4023@opindex ftree-vectorizer-verbose
4024This option controls the amount of debugging output the vectorizer prints.
4025This information is written to standard error, unless 
4026@option{-fdump-tree-all} or @option{-fdump-tree-vect} is specified, 
4027in which case it is output to the usual dump listing file, @file{.vect}.
4028For @var{n}=0 no diagnostic information is reported.
4029If @var{n}=1 the vectorizer reports each loop that got vectorized, 
4030and the total number of loops that got vectorized.
4031If @var{n}=2 the vectorizer also reports non-vectorized loops that passed 
4032the first analysis phase (vect_analyze_loop_form) - i.e. countable, 
4033inner-most, single-bb, single-entry/exit loops.  This is the same verbosity 
4034level that @option{-fdump-tree-vect-stats} uses.
4035Higher verbosity levels mean either more information dumped for each 
4036reported loop, or same amount of information reported for more loops:
4037If @var{n}=3, alignment related information is added to the reports.
4038If @var{n}=4, data-references related information (e.g. memory dependences, 
4039memory access-patterns) is added to the reports.
4040If @var{n}=5, the vectorizer reports also non-vectorized inner-most loops 
4041that did not pass the first analysis phase (i.e. may not be countable, or 
4042may have complicated control-flow).
4043If @var{n}=6, the vectorizer reports also non-vectorized nested loops.
4044For @var{n}=7, all the information the vectorizer generates during its 
4045analysis and transformation is reported.  This is the same verbosity level
4046that @option{-fdump-tree-vect-details} uses.
4047
4048@item -frandom-seed=@var{string}
4049@opindex frandom-string
4050This option provides a seed that GCC uses when it would otherwise use
4051random numbers.  It is used to generate certain symbol names
4052that have to be different in every compiled file.  It is also used to
4053place unique stamps in coverage data files and the object files that
4054produce them.  You can use the @option{-frandom-seed} option to produce
4055reproducibly identical object files.
4056
4057The @var{string} should be different for every file you compile.
4058
4059@item -fsched-verbose=@var{n}
4060@opindex fsched-verbose
4061On targets that use instruction scheduling, this option controls the
4062amount of debugging output the scheduler prints.  This information is
4063written to standard error, unless @option{-dS} or @option{-dR} is
4064specified, in which case it is output to the usual dump
4065listing file, @file{.sched} or @file{.sched2} respectively.  However
4066for @var{n} greater than nine, the output is always printed to standard
4067error.
4068
4069For @var{n} greater than zero, @option{-fsched-verbose} outputs the
4070same information as @option{-dRS}.  For @var{n} greater than one, it
4071also output basic block probabilities, detailed ready list information
4072and unit/insn info.  For @var{n} greater than two, it includes RTL
4073at abort point, control-flow and regions info.  And for @var{n} over
4074four, @option{-fsched-verbose} also includes dependence info.
4075
4076@item -save-temps
4077@opindex save-temps
4078Store the usual ``temporary'' intermediate files permanently; place them
4079in the current directory and name them based on the source file.  Thus,
4080compiling @file{foo.c} with @samp{-c -save-temps} would produce files
4081@file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
4082preprocessed @file{foo.i} output file even though the compiler now
4083normally uses an integrated preprocessor.
4084
4085When used in combination with the @option{-x} command line option,
4086@option{-save-temps} is sensible enough to avoid over writing an
4087input source file with the same extension as an intermediate file.
4088The corresponding intermediate file may be obtained by renaming the
4089source file before using @option{-save-temps}.
4090
4091@item -time
4092@opindex time
4093Report the CPU time taken by each subprocess in the compilation
4094sequence.  For C source files, this is the compiler proper and assembler
4095(plus the linker if linking is done).  The output looks like this:
4096
4097@smallexample
4098# cc1 0.12 0.01
4099# as 0.00 0.01
4100@end smallexample
4101
4102The first number on each line is the ``user time'', that is time spent
4103executing the program itself.  The second number is ``system time'',
4104time spent executing operating system routines on behalf of the program.
4105Both numbers are in seconds.
4106
4107@item -fvar-tracking
4108@opindex fvar-tracking
4109Run variable tracking pass.  It computes where variables are stored at each
4110position in code.  Better debugging information is then generated
4111(if the debugging information format supports this information).
4112
4113It is enabled by default when compiling with optimization (@option{-Os},
4114@option{-O}, @option{-O2}, ...), debugging information (@option{-g}) and
4115the debug info format supports it.
4116
4117@item -print-file-name=@var{library}
4118@opindex print-file-name
4119Print the full absolute name of the library file @var{library} that
4120would be used when linking---and don't do anything else.  With this
4121option, GCC does not compile or link anything; it just prints the
4122file name.
4123
4124@item -print-multi-directory
4125@opindex print-multi-directory
4126Print the directory name corresponding to the multilib selected by any
4127other switches present in the command line.  This directory is supposed
4128to exist in @env{GCC_EXEC_PREFIX}.
4129
4130@item -print-multi-lib
4131@opindex print-multi-lib
4132Print the mapping from multilib directory names to compiler switches
4133that enable them.  The directory name is separated from the switches by
4134@samp{;}, and each switch starts with an @samp{@@} instead of the
4135@samp{-}, without spaces between multiple switches.  This is supposed to
4136ease shell-processing.
4137
4138@item -print-prog-name=@var{program}
4139@opindex print-prog-name
4140Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
4141
4142@item -print-libgcc-file-name
4143@opindex print-libgcc-file-name
4144Same as @option{-print-file-name=libgcc.a}.
4145
4146This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
4147but you do want to link with @file{libgcc.a}.  You can do
4148
4149@smallexample
4150gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
4151@end smallexample
4152
4153@item -print-search-dirs
4154@opindex print-search-dirs
4155Print the name of the configured installation directory and a list of
4156program and library directories @command{gcc} will search---and don't do anything else.
4157
4158This is useful when @command{gcc} prints the error message
4159@samp{installation problem, cannot exec cpp0: No such file or directory}.
4160To resolve this you either need to put @file{cpp0} and the other compiler
4161components where @command{gcc} expects to find them, or you can set the environment
4162variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
4163Don't forget the trailing @samp{/}.
4164@xref{Environment Variables}.
4165
4166@item -dumpmachine
4167@opindex dumpmachine
4168Print the compiler's target machine (for example,
4169@samp{i686-pc-linux-gnu})---and don't do anything else.
4170
4171@item -dumpversion
4172@opindex dumpversion
4173Print the compiler version (for example, @samp{3.0})---and don't do
4174anything else.
4175
4176@item -dumpspecs
4177@opindex dumpspecs
4178Print the compiler's built-in specs---and don't do anything else.  (This
4179is used when GCC itself is being built.)  @xref{Spec Files}.
4180
4181@item -feliminate-unused-debug-types
4182@opindex feliminate-unused-debug-types
4183Normally, when producing DWARF2 output, GCC will emit debugging
4184information for all types declared in a compilation
4185unit, regardless of whether or not they are actually used
4186in that compilation unit.  Sometimes this is useful, such as
4187if, in the debugger, you want to cast a value to a type that is
4188not actually used in your program (but is declared).  More often,
4189however, this results in a significant amount of wasted space.
4190With this option, GCC will avoid producing debug symbol output
4191for types that are nowhere used in the source file being compiled.
4192@end table
4193
4194@node Optimize Options
4195@section Options That Control Optimization
4196@cindex optimize options
4197@cindex options, optimization
4198
4199These options control various sorts of optimizations.
4200
4201Without any optimization option, the compiler's goal is to reduce the
4202cost of compilation and to make debugging produce the expected
4203results.  Statements are independent: if you stop the program with a
4204breakpoint between statements, you can then assign a new value to any
4205variable or change the program counter to any other statement in the
4206function and get exactly the results you would expect from the source
4207code.
4208
4209Turning on optimization flags makes the compiler attempt to improve
4210the performance and/or code size at the expense of compilation time
4211and possibly the ability to debug the program.
4212
4213The compiler performs optimization based on the knowledge it has of
4214the program.  Optimization levels @option{-O} and above, in
4215particular, enable @emph{unit-at-a-time} mode, which allows the
4216compiler to consider information gained from later functions in
4217the file when compiling a function.  Compiling multiple files at
4218once to a single output file in @emph{unit-at-a-time} mode allows
4219the compiler to use information gained from all of the files when
4220compiling each of them.
4221
4222Not all optimizations are controlled directly by a flag.  Only
4223optimizations that have a flag are listed.
4224
4225@table @gcctabopt
4226@item -O
4227@itemx -O1
4228@opindex O
4229@opindex O1
4230Optimize.  Optimizing compilation takes somewhat more time, and a lot
4231more memory for a large function.
4232
4233With @option{-O}, the compiler tries to reduce code size and execution
4234time, without performing any optimizations that take a great deal of
4235compilation time.
4236
4237@option{-O} turns on the following optimization flags:
4238@gccoptlist{-fdefer-pop @gol
4239-fdelayed-branch @gol
4240-fguess-branch-probability @gol
4241-fcprop-registers @gol
4242-fif-conversion @gol
4243-fif-conversion2 @gol
4244-ftree-ccp @gol
4245-ftree-dce @gol
4246-ftree-dominator-opts @gol
4247-ftree-dse @gol
4248-ftree-ter @gol
4249-ftree-lrs @gol
4250-ftree-sra @gol
4251-ftree-copyrename @gol
4252-ftree-fre @gol
4253-ftree-ch @gol
4254-funit-at-a-time @gol
4255-fmerge-constants}
4256
4257@option{-O} also turns on @option{-fomit-frame-pointer} on machines
4258where doing so does not interfere with debugging.
4259
4260@item -O2
4261@opindex O2
4262Optimize even more.  GCC performs nearly all supported optimizations
4263that do not involve a space-speed tradeoff.  The compiler does not
4264perform loop unrolling or function inlining when you specify @option{-O2}.
4265As compared to @option{-O}, this option increases both compilation time
4266and the performance of the generated code.
4267
4268@option{-O2} turns on all optimization flags specified by @option{-O}.  It
4269also turns on the following optimization flags:
4270@gccoptlist{-fthread-jumps @gol
4271-fcrossjumping @gol
4272-foptimize-sibling-calls @gol
4273-fcse-follow-jumps  -fcse-skip-blocks @gol
4274-fgcse  -fgcse-lm  @gol
4275-fexpensive-optimizations @gol
4276-frerun-cse-after-loop  @gol
4277-fcaller-saves @gol
4278-fpeephole2 @gol
4279-fschedule-insns  -fschedule-insns2 @gol
4280-fsched-interblock  -fsched-spec @gol
4281-fregmove @gol
4282-fstrict-aliasing -fstrict-overflow @gol
4283-fdelete-null-pointer-checks @gol
4284-freorder-blocks  -freorder-functions @gol
4285-falign-functions  -falign-jumps @gol
4286-falign-loops  -falign-labels @gol
4287-ftree-vrp @gol
4288-ftree-pre}
4289
4290Please note the warning under @option{-fgcse} about
4291invoking @option{-O2} on programs that use computed gotos.
4292
4293@option{-O2} doesn't turn on @option{-ftree-vrp} for the Ada compiler.
4294This option must be explicitly specified on the command line to be
4295enabled for the Ada compiler.
4296
4297@item -O3
4298@opindex O3
4299Optimize yet more.  @option{-O3} turns on all optimizations specified by
4300@option{-O2} and also turns on the @option{-finline-functions},
4301@option{-funswitch-loops} and @option{-fgcse-after-reload} options.
4302
4303@item -O0
4304@opindex O0
4305Do not optimize.  This is the default.
4306
4307@item -Os
4308@opindex Os
4309Optimize for size.  @option{-Os} enables all @option{-O2} optimizations that
4310do not typically increase code size.  It also performs further
4311optimizations designed to reduce code size.
4312
4313@option{-Os} disables the following optimization flags:
4314@gccoptlist{-falign-functions  -falign-jumps  -falign-loops @gol
4315-falign-labels  -freorder-blocks  -freorder-blocks-and-partition @gol
4316-fprefetch-loop-arrays  -ftree-vect-loop-version}
4317
4318If you use multiple @option{-O} options, with or without level numbers,
4319the last such option is the one that is effective.
4320@end table
4321
4322Options of the form @option{-f@var{flag}} specify machine-independent
4323flags.  Most flags have both positive and negative forms; the negative
4324form of @option{-ffoo} would be @option{-fno-foo}.  In the table
4325below, only one of the forms is listed---the one you typically will
4326use.  You can figure out the other form by either removing @samp{no-}
4327or adding it.
4328
4329The following options control specific optimizations.  They are either
4330activated by @option{-O} options or are related to ones that are.  You
4331can use the following flags in the rare cases when ``fine-tuning'' of
4332optimizations to be performed is desired.
4333
4334@table @gcctabopt
4335@item -fno-default-inline
4336@opindex fno-default-inline
4337Do not make member functions inline by default merely because they are
4338defined inside the class scope (C++ only).  Otherwise, when you specify
4339@w{@option{-O}}, member functions defined inside class scope are compiled
4340inline by default; i.e., you don't need to add @samp{inline} in front of
4341the member function name.
4342
4343@item -fno-defer-pop
4344@opindex fno-defer-pop
4345Always pop the arguments to each function call as soon as that function
4346returns.  For machines which must pop arguments after a function call,
4347the compiler normally lets arguments accumulate on the stack for several
4348function calls and pops them all at once.
4349
4350Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4351
4352@item -fforce-mem
4353@opindex fforce-mem
4354Force memory operands to be copied into registers before doing
4355arithmetic on them.  This produces better code by making all memory
4356references potential common subexpressions.  When they are not common
4357subexpressions, instruction combination should eliminate the separate
4358register-load. This option is now a nop and will be removed in 4.3.
4359
4360@item -fforce-addr
4361@opindex fforce-addr
4362Force memory address constants to be copied into registers before
4363doing arithmetic on them.
4364
4365@item -fomit-frame-pointer
4366@opindex fomit-frame-pointer
4367Don't keep the frame pointer in a register for functions that
4368don't need one.  This avoids the instructions to save, set up and
4369restore frame pointers; it also makes an extra register available
4370in many functions.  @strong{It also makes debugging impossible on
4371some machines.}
4372
4373On some machines, such as the VAX, this flag has no effect, because
4374the standard calling sequence automatically handles the frame pointer
4375and nothing is saved by pretending it doesn't exist.  The
4376machine-description macro @code{FRAME_POINTER_REQUIRED} controls
4377whether a target machine supports this flag.  @xref{Registers,,Register
4378Usage, gccint, GNU Compiler Collection (GCC) Internals}.
4379
4380Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4381
4382@item -foptimize-sibling-calls
4383@opindex foptimize-sibling-calls
4384Optimize sibling and tail recursive calls.
4385
4386Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4387
4388@item -fno-inline
4389@opindex fno-inline
4390Don't pay attention to the @code{inline} keyword.  Normally this option
4391is used to keep the compiler from expanding any functions inline.
4392Note that if you are not optimizing, no functions can be expanded inline.
4393
4394@item -finline-functions
4395@opindex finline-functions
4396Integrate all simple functions into their callers.  The compiler
4397heuristically decides which functions are simple enough to be worth
4398integrating in this way.
4399
4400If all calls to a given function are integrated, and the function is
4401declared @code{static}, then the function is normally not output as
4402assembler code in its own right.
4403
4404Enabled at level @option{-O3}.
4405
4406@item -finline-functions-called-once
4407@opindex finline-functions-called-once
4408Consider all @code{static} functions called once for inlining into their
4409caller even if they are not marked @code{inline}.  If a call to a given
4410function is integrated, then the function is not output as assembler code
4411in its own right.
4412
4413Enabled if @option{-funit-at-a-time} is enabled.
4414
4415@item -fearly-inlining
4416@opindex fearly-inlining
4417Inline functions marked by @code{always_inline} and functions whose body seems
4418smaller than the function call overhead early before doing
4419@option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
4420makes profiling significantly cheaper and usually inlining faster on programs
4421having large chains of nested wrapper functions.
4422
4423Enabled by default.
4424
4425@item -finline-limit=@var{n}
4426@opindex finline-limit
4427By default, GCC limits the size of functions that can be inlined.  This flag
4428allows the control of this limit for functions that are explicitly marked as
4429inline (i.e., marked with the inline keyword or defined within the class
4430definition in c++).  @var{n} is the size of functions that can be inlined in
4431number of pseudo instructions (not counting parameter handling).  The default
4432value of @var{n} is 600.
4433Increasing this value can result in more inlined code at
4434the cost of compilation time and memory consumption.  Decreasing usually makes
4435the compilation faster and less code will be inlined (which presumably
4436means slower programs).  This option is particularly useful for programs that
4437use inlining heavily such as those based on recursive templates with C++.
4438
4439Inlining is actually controlled by a number of parameters, which may be
4440specified individually by using @option{--param @var{name}=@var{value}}.
4441The @option{-finline-limit=@var{n}} option sets some of these parameters
4442as follows:
4443
4444@table @gcctabopt
4445@item max-inline-insns-single
4446 is set to @var{n}/2.
4447@item max-inline-insns-auto
4448 is set to @var{n}/2.
4449@item min-inline-insns
4450 is set to 130 or @var{n}/4, whichever is smaller.
4451@item max-inline-insns-rtl
4452 is set to @var{n}.
4453@end table
4454
4455See below for a documentation of the individual
4456parameters controlling inlining.
4457
4458@emph{Note:} pseudo instruction represents, in this particular context, an
4459abstract measurement of function's size.  In no way does it represent a count
4460of assembly instructions and as such its exact meaning might change from one
4461release to an another.
4462
4463@item -fkeep-inline-functions
4464@opindex fkeep-inline-functions
4465In C, emit @code{static} functions that are declared @code{inline}
4466into the object file, even if the function has been inlined into all
4467of its callers.  This switch does not affect functions using the
4468@code{extern inline} extension in GNU C@.  In C++, emit any and all
4469inline functions into the object file.
4470
4471@item -fkeep-static-consts
4472@opindex fkeep-static-consts
4473Emit variables declared @code{static const} when optimization isn't turned
4474on, even if the variables aren't referenced.
4475
4476GCC enables this option by default.  If you want to force the compiler to
4477check if the variable was referenced, regardless of whether or not
4478optimization is turned on, use the @option{-fno-keep-static-consts} option.
4479
4480@item -fmerge-constants
4481Attempt to merge identical constants (string constants and floating point
4482constants) across compilation units.
4483
4484This option is the default for optimized compilation if the assembler and
4485linker support it.  Use @option{-fno-merge-constants} to inhibit this
4486behavior.
4487
4488Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4489
4490@item -fmerge-all-constants
4491Attempt to merge identical constants and identical variables.
4492
4493This option implies @option{-fmerge-constants}.  In addition to
4494@option{-fmerge-constants} this considers e.g.@: even constant initialized
4495arrays or initialized constant variables with integral or floating point
4496types.  Languages like C or C++ require each non-automatic variable to
4497have distinct location, so using this option will result in non-conforming
4498behavior.
4499
4500@item -fmodulo-sched
4501@opindex fmodulo-sched
4502Perform swing modulo scheduling immediately before the first scheduling
4503pass.  This pass looks at innermost loops and reorders their
4504instructions by overlapping different iterations.
4505
4506@item -fno-branch-count-reg
4507@opindex fno-branch-count-reg
4508Do not use ``decrement and branch'' instructions on a count register,
4509but instead generate a sequence of instructions that decrement a
4510register, compare it against zero, then branch based upon the result.
4511This option is only meaningful on architectures that support such
4512instructions, which include x86, PowerPC, IA-64 and S/390.
4513
4514The default is @option{-fbranch-count-reg}.
4515
4516@item -fno-function-cse
4517@opindex fno-function-cse
4518Do not put function addresses in registers; make each instruction that
4519calls a constant function contain the function's address explicitly.
4520
4521This option results in less efficient code, but some strange hacks
4522that alter the assembler output may be confused by the optimizations
4523performed when this option is not used.
4524
4525The default is @option{-ffunction-cse}
4526
4527@item -fno-zero-initialized-in-bss
4528@opindex fno-zero-initialized-in-bss
4529If the target supports a BSS section, GCC by default puts variables that
4530are initialized to zero into BSS@.  This can save space in the resulting
4531code.
4532
4533This option turns off this behavior because some programs explicitly
4534rely on variables going to the data section.  E.g., so that the
4535resulting executable can find the beginning of that section and/or make
4536assumptions based on that.
4537
4538The default is @option{-fzero-initialized-in-bss}.
4539
4540@item -fbounds-check
4541@opindex fbounds-check
4542For front-ends that support it, generate additional code to check that
4543indices used to access arrays are within the declared range.  This is
4544currently only supported by the Java and Fortran front-ends, where
4545this option defaults to true and false respectively.
4546
4547@item -fmudflap -fmudflapth -fmudflapir
4548@opindex fmudflap
4549@opindex fmudflapth
4550@opindex fmudflapir
4551@cindex bounds checking
4552@cindex mudflap
4553For front-ends that support it (C and C++), instrument all risky
4554pointer/array dereferencing operations, some standard library
4555string/heap functions, and some other associated constructs with
4556range/validity tests.  Modules so instrumented should be immune to
4557buffer overflows, invalid heap use, and some other classes of C/C++
4558programming errors.  The instrumentation relies on a separate runtime
4559library (@file{libmudflap}), which will be linked into a program if
4560@option{-fmudflap} is given at link time.  Run-time behavior of the
4561instrumented program is controlled by the @env{MUDFLAP_OPTIONS}
4562environment variable.  See @code{env MUDFLAP_OPTIONS=-help a.out}
4563for its options.
4564
4565Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to
4566link if your program is multi-threaded.  Use @option{-fmudflapir}, in
4567addition to @option{-fmudflap} or @option{-fmudflapth}, if
4568instrumentation should ignore pointer reads.  This produces less
4569instrumentation (and therefore faster execution) and still provides
4570some protection against outright memory corrupting writes, but allows
4571erroneously read data to propagate within a program.
4572
4573@item -fthread-jumps
4574@opindex fthread-jumps
4575Perform optimizations where we check to see if a jump branches to a
4576location where another comparison subsumed by the first is found.  If
4577so, the first branch is redirected to either the destination of the
4578second branch or a point immediately following it, depending on whether
4579the condition is known to be true or false.
4580
4581Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4582
4583@item -fcse-follow-jumps
4584@opindex fcse-follow-jumps
4585In common subexpression elimination, scan through jump instructions
4586when the target of the jump is not reached by any other path.  For
4587example, when CSE encounters an @code{if} statement with an
4588@code{else} clause, CSE will follow the jump when the condition
4589tested is false.
4590
4591Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4592
4593@item -fcse-skip-blocks
4594@opindex fcse-skip-blocks
4595This is similar to @option{-fcse-follow-jumps}, but causes CSE to
4596follow jumps which conditionally skip over blocks.  When CSE
4597encounters a simple @code{if} statement with no else clause,
4598@option{-fcse-skip-blocks} causes CSE to follow the jump around the
4599body of the @code{if}.
4600
4601Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4602
4603@item -frerun-cse-after-loop
4604@opindex frerun-cse-after-loop
4605Re-run common subexpression elimination after loop optimizations has been
4606performed.
4607
4608Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4609
4610@item -fgcse
4611@opindex fgcse
4612Perform a global common subexpression elimination pass.
4613This pass also performs global constant and copy propagation.
4614
4615@emph{Note:} When compiling a program using computed gotos, a GCC
4616extension, you may get better runtime performance if you disable
4617the global common subexpression elimination pass by adding
4618@option{-fno-gcse} to the command line.
4619
4620Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4621
4622@item -fgcse-lm
4623@opindex fgcse-lm
4624When @option{-fgcse-lm} is enabled, global common subexpression elimination will
4625attempt to move loads which are only killed by stores into themselves.  This
4626allows a loop containing a load/store sequence to be changed to a load outside
4627the loop, and a copy/store within the loop.
4628
4629Enabled by default when gcse is enabled.
4630
4631@item -fgcse-sm
4632@opindex fgcse-sm
4633When @option{-fgcse-sm} is enabled, a store motion pass is run after
4634global common subexpression elimination.  This pass will attempt to move
4635stores out of loops.  When used in conjunction with @option{-fgcse-lm},
4636loops containing a load/store sequence can be changed to a load before
4637the loop and a store after the loop.
4638
4639Not enabled at any optimization level.
4640
4641@item -fgcse-las
4642@opindex fgcse-las
4643When @option{-fgcse-las} is enabled, the global common subexpression
4644elimination pass eliminates redundant loads that come after stores to the
4645same memory location (both partial and full redundancies).
4646
4647Not enabled at any optimization level.
4648
4649@item -fgcse-after-reload
4650@opindex fgcse-after-reload
4651When @option{-fgcse-after-reload} is enabled, a redundant load elimination
4652pass is performed after reload.  The purpose of this pass is to cleanup
4653redundant spilling.
4654
4655@item -funsafe-loop-optimizations
4656@opindex funsafe-loop-optimizations
4657If given, the loop optimizer will assume that loop indices do not
4658overflow, and that the loops with nontrivial exit condition are not
4659infinite.  This enables a wider range of loop optimizations even if
4660the loop optimizer itself cannot prove that these assumptions are valid.
4661Using @option{-Wunsafe-loop-optimizations}, the compiler will warn you
4662if it finds this kind of loop.
4663
4664@item -fcrossjumping
4665@opindex crossjumping
4666Perform cross-jumping transformation.  This transformation unifies equivalent code and save code size.  The
4667resulting code may or may not perform better than without cross-jumping.
4668
4669Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4670
4671@item -fif-conversion
4672@opindex if-conversion
4673Attempt to transform conditional jumps into branch-less equivalents.  This
4674include use of conditional moves, min, max, set flags and abs instructions, and
4675some tricks doable by standard arithmetics.  The use of conditional execution
4676on chips where it is available is controlled by @code{if-conversion2}.
4677
4678Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4679
4680@item -fif-conversion2
4681@opindex if-conversion2
4682Use conditional execution (where available) to transform conditional jumps into
4683branch-less equivalents.
4684
4685Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4686
4687@item -fdelete-null-pointer-checks
4688@opindex fdelete-null-pointer-checks
4689Use global dataflow analysis to identify and eliminate useless checks
4690for null pointers.  The compiler assumes that dereferencing a null
4691pointer would have halted the program.  If a pointer is checked after
4692it has already been dereferenced, it cannot be null.
4693
4694In some environments, this assumption is not true, and programs can
4695safely dereference null pointers.  Use
4696@option{-fno-delete-null-pointer-checks} to disable this optimization
4697for programs which depend on that behavior.
4698
4699Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4700
4701@item -fexpensive-optimizations
4702@opindex fexpensive-optimizations
4703Perform a number of minor optimizations that are relatively expensive.
4704
4705Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4706
4707@item -foptimize-register-move
4708@itemx -fregmove
4709@opindex foptimize-register-move
4710@opindex fregmove
4711Attempt to reassign register numbers in move instructions and as
4712operands of other simple instructions in order to maximize the amount of
4713register tying.  This is especially helpful on machines with two-operand
4714instructions.
4715
4716Note @option{-fregmove} and @option{-foptimize-register-move} are the same
4717optimization.
4718
4719Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4720
4721@item -fdelayed-branch
4722@opindex fdelayed-branch
4723If supported for the target machine, attempt to reorder instructions
4724to exploit instruction slots available after delayed branch
4725instructions.
4726
4727Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4728
4729@item -fschedule-insns
4730@opindex fschedule-insns
4731If supported for the target machine, attempt to reorder instructions to
4732eliminate execution stalls due to required data being unavailable.  This
4733helps machines that have slow floating point or memory load instructions
4734by allowing other instructions to be issued until the result of the load
4735or floating point instruction is required.
4736
4737Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4738
4739@item -fschedule-insns2
4740@opindex fschedule-insns2
4741Similar to @option{-fschedule-insns}, but requests an additional pass of
4742instruction scheduling after register allocation has been done.  This is
4743especially useful on machines with a relatively small number of
4744registers and where memory load instructions take more than one cycle.
4745
4746Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4747
4748@item -fno-sched-interblock
4749@opindex fno-sched-interblock
4750Don't schedule instructions across basic blocks.  This is normally
4751enabled by default when scheduling before register allocation, i.e.@:
4752with @option{-fschedule-insns} or at @option{-O2} or higher.
4753
4754@item -fno-sched-spec
4755@opindex fno-sched-spec
4756Don't allow speculative motion of non-load instructions.  This is normally
4757enabled by default when scheduling before register allocation, i.e.@:
4758with @option{-fschedule-insns} or at @option{-O2} or higher.
4759
4760@item -fsched-spec-load
4761@opindex fsched-spec-load
4762Allow speculative motion of some load instructions.  This only makes
4763sense when scheduling before register allocation, i.e.@: with
4764@option{-fschedule-insns} or at @option{-O2} or higher.
4765
4766@item -fsched-spec-load-dangerous
4767@opindex fsched-spec-load-dangerous
4768Allow speculative motion of more load instructions.  This only makes
4769sense when scheduling before register allocation, i.e.@: with
4770@option{-fschedule-insns} or at @option{-O2} or higher.
4771
4772@item -fsched-stalled-insns=@var{n}
4773@opindex fsched-stalled-insns
4774Define how many insns (if any) can be moved prematurely from the queue
4775of stalled insns into the ready list, during the second scheduling pass.
4776
4777@item -fsched-stalled-insns-dep=@var{n}
4778@opindex fsched-stalled-insns-dep
4779Define how many insn groups (cycles) will be examined for a dependency
4780on a stalled insn that is candidate for premature removal from the queue
4781of stalled insns.  Has an effect only during the second scheduling pass,
4782and only if @option{-fsched-stalled-insns} is used and its value is not zero.
4783
4784@item -fsched2-use-superblocks
4785@opindex fsched2-use-superblocks
4786When scheduling after register allocation, do use superblock scheduling
4787algorithm.  Superblock scheduling allows motion across basic block boundaries
4788resulting on faster schedules.  This option is experimental, as not all machine
4789descriptions used by GCC model the CPU closely enough to avoid unreliable
4790results from the algorithm.
4791
4792This only makes sense when scheduling after register allocation, i.e.@: with
4793@option{-fschedule-insns2} or at @option{-O2} or higher.
4794
4795@item -fsched2-use-traces
4796@opindex fsched2-use-traces
4797Use @option{-fsched2-use-superblocks} algorithm when scheduling after register
4798allocation and additionally perform code duplication in order to increase the
4799size of superblocks using tracer pass.  See @option{-ftracer} for details on
4800trace formation.
4801
4802This mode should produce faster but significantly longer programs.  Also
4803without @option{-fbranch-probabilities} the traces constructed may not
4804match the reality and hurt the performance.  This only makes
4805sense when scheduling after register allocation, i.e.@: with
4806@option{-fschedule-insns2} or at @option{-O2} or higher.
4807
4808@item -fsee
4809@opindex fsee
4810Eliminates redundant extension instructions and move the non redundant
4811ones to optimal placement using LCM.
4812
4813@item -freschedule-modulo-scheduled-loops
4814@opindex fscheduling-in-modulo-scheduled-loops
4815The modulo scheduling comes before the traditional scheduling, if a loop was modulo scheduled
4816we may want to prevent the later scheduling passes from changing its schedule, we use this
4817option to control that.
4818
4819@item -fcaller-saves
4820@opindex fcaller-saves
4821Enable values to be allocated in registers that will be clobbered by
4822function calls, by emitting extra instructions to save and restore the
4823registers around such calls.  Such allocation is done only when it
4824seems to result in better code than would otherwise be produced.
4825
4826This option is always enabled by default on certain machines, usually
4827those which have no call-preserved registers to use instead.
4828
4829Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4830
4831@item -ftree-pre
4832Perform Partial Redundancy Elimination (PRE) on trees.  This flag is
4833enabled by default at @option{-O2} and @option{-O3}.
4834
4835@item -ftree-fre
4836Perform Full Redundancy Elimination (FRE) on trees.  The difference
4837between FRE and PRE is that FRE only considers expressions
4838that are computed on all paths leading to the redundant computation.
4839This analysis faster than PRE, though it exposes fewer redundancies.
4840This flag is enabled by default at @option{-O} and higher.
4841
4842@item -ftree-copy-prop
4843Perform copy propagation on trees.  This pass eliminates unnecessary
4844copy operations.  This flag is enabled by default at @option{-O} and
4845higher.
4846
4847@item -ftree-store-copy-prop
4848Perform copy propagation of memory loads and stores.  This pass
4849eliminates unnecessary copy operations in memory references
4850(structures, global variables, arrays, etc).  This flag is enabled by
4851default at @option{-O2} and higher.
4852
4853@item -ftree-salias
4854Perform structural alias analysis on trees.  This flag
4855is enabled by default at @option{-O} and higher.
4856
4857@item -fipa-pta
4858Perform interprocedural pointer analysis.
4859
4860@item -ftree-sink
4861Perform forward store motion  on trees.  This flag is
4862enabled by default at @option{-O} and higher.
4863
4864@item -ftree-ccp
4865Perform sparse conditional constant propagation (CCP) on trees.  This
4866pass only operates on local scalar variables and is enabled by default
4867at @option{-O} and higher.
4868
4869@item -ftree-store-ccp
4870Perform sparse conditional constant propagation (CCP) on trees.  This
4871pass operates on both local scalar variables and memory stores and
4872loads (global variables, structures, arrays, etc).  This flag is
4873enabled by default at @option{-O2} and higher.
4874
4875@item -ftree-dce
4876Perform dead code elimination (DCE) on trees.  This flag is enabled by
4877default at @option{-O} and higher.
4878
4879@item -ftree-dominator-opts
4880Perform a variety of simple scalar cleanups (constant/copy
4881propagation, redundancy elimination, range propagation and expression
4882simplification) based on a dominator tree traversal.  This also
4883performs jump threading (to reduce jumps to jumps). This flag is
4884enabled by default at @option{-O} and higher.
4885
4886@item -ftree-ch
4887Perform loop header copying on trees.  This is beneficial since it increases
4888effectiveness of code motion optimizations.  It also saves one jump.  This flag
4889is enabled by default at @option{-O} and higher.  It is not enabled
4890for @option{-Os}, since it usually increases code size.
4891
4892@item -ftree-loop-optimize
4893Perform loop optimizations on trees.  This flag is enabled by default
4894at @option{-O} and higher.
4895
4896@item -ftree-loop-linear
4897Perform linear loop transformations on tree.  This flag can improve cache
4898performance and allow further loop optimizations to take place.
4899
4900@item -ftree-loop-im
4901Perform loop invariant motion on trees.  This pass moves only invariants that
4902would be hard to handle at RTL level (function calls, operations that expand to
4903nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
4904operands of conditions that are invariant out of the loop, so that we can use
4905just trivial invariantness analysis in loop unswitching.  The pass also includes
4906store motion.
4907
4908@item -ftree-loop-ivcanon
4909Create a canonical counter for number of iterations in the loop for that
4910determining number of iterations requires complicated analysis.  Later
4911optimizations then may determine the number easily.  Useful especially
4912in connection with unrolling.
4913
4914@item -fivopts
4915Perform induction variable optimizations (strength reduction, induction
4916variable merging and induction variable elimination) on trees.
4917
4918@item -ftree-sra
4919Perform scalar replacement of aggregates.  This pass replaces structure
4920references with scalars to prevent committing structures to memory too
4921early.  This flag is enabled by default at @option{-O} and higher.
4922
4923@item -ftree-copyrename
4924Perform copy renaming on trees.  This pass attempts to rename compiler
4925temporaries to other variables at copy locations, usually resulting in
4926variable names which more closely resemble the original variables.  This flag
4927is enabled by default at @option{-O} and higher.
4928
4929@item -ftree-ter
4930Perform temporary expression replacement during the SSA->normal phase.  Single
4931use/single def temporaries are replaced at their use location with their
4932defining expression.  This results in non-GIMPLE code, but gives the expanders
4933much more complex trees to work on resulting in better RTL generation.  This is
4934enabled by default at @option{-O} and higher.
4935
4936@item -ftree-lrs
4937Perform live range splitting during the SSA->normal phase.  Distinct live
4938ranges of a variable are split into unique variables, allowing for better
4939optimization later.  This is enabled by default at @option{-O} and higher.
4940
4941@item -ftree-vectorize
4942Perform loop vectorization on trees.
4943
4944@item -ftree-vect-loop-version
4945@opindex ftree-vect-loop-version
4946Perform loop versioning when doing loop vectorization on trees.  When a loop
4947appears to be vectorizable except that data alignment or data dependence cannot
4948be determined at compile time then vectorized and non-vectorized versions of
4949the loop are generated along with runtime checks for alignment or dependence
4950to control which version is executed.  This option is enabled by default
4951except at level @option{-Os} where it is disabled.
4952
4953@item -ftree-vrp
4954Perform Value Range Propagation on trees.  This is similar to the
4955constant propagation pass, but instead of values, ranges of values are
4956propagated.  This allows the optimizers to remove unnecessary range
4957checks like array bound checks and null pointer checks.  This is
4958enabled by default at @option{-O2} and higher.  Null pointer check
4959elimination is only done if @option{-fdelete-null-pointer-checks} is
4960enabled.
4961
4962@item -ftracer
4963@opindex ftracer
4964Perform tail duplication to enlarge superblock size.  This transformation
4965simplifies the control flow of the function allowing other optimizations to do
4966better job.
4967
4968@item -funroll-loops
4969@opindex funroll-loops
4970Unroll loops whose number of iterations can be determined at compile
4971time or upon entry to the loop.  @option{-funroll-loops} implies
4972@option{-frerun-cse-after-loop}.  This option makes code larger,
4973and may or may not make it run faster.
4974
4975@item -funroll-all-loops
4976@opindex funroll-all-loops
4977Unroll all loops, even if their number of iterations is uncertain when
4978the loop is entered.  This usually makes programs run more slowly.
4979@option{-funroll-all-loops} implies the same options as
4980@option{-funroll-loops},
4981
4982@item -fsplit-ivs-in-unroller
4983@opindex fsplit-ivs-in-unroller
4984Enables expressing of values of induction variables in later iterations
4985of the unrolled loop using the value in the first iteration.  This breaks
4986long dependency chains, thus improving efficiency of the scheduling passes.
4987
4988Combination of @option{-fweb} and CSE is often sufficient to obtain the
4989same effect.  However in cases the loop body is more complicated than
4990a single basic block, this is not reliable.  It also does not work at all
4991on some of the architectures due to restrictions in the CSE pass.
4992
4993This optimization is enabled by default.
4994
4995@item -fvariable-expansion-in-unroller
4996@opindex fvariable-expansion-in-unroller
4997With this option, the compiler will create multiple copies of some
4998local variables when unrolling a loop which can result in superior code.
4999
5000@item -fprefetch-loop-arrays
5001@opindex fprefetch-loop-arrays
5002If supported by the target machine, generate instructions to prefetch
5003memory to improve the performance of loops that access large arrays.
5004
5005This option may generate better or worse code; results are highly
5006dependent on the structure of loops within the source code.
5007
5008Disabled at level @option{-Os}.
5009
5010@item -fno-peephole
5011@itemx -fno-peephole2
5012@opindex fno-peephole
5013@opindex fno-peephole2
5014Disable any machine-specific peephole optimizations.  The difference
5015between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
5016are implemented in the compiler; some targets use one, some use the
5017other, a few use both.
5018
5019@option{-fpeephole} is enabled by default.
5020@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5021
5022@item -fno-guess-branch-probability
5023@opindex fno-guess-branch-probability
5024Do not guess branch probabilities using heuristics.
5025
5026GCC will use heuristics to guess branch probabilities if they are
5027not provided by profiling feedback (@option{-fprofile-arcs}).  These
5028heuristics are based on the control flow graph.  If some branch probabilities
5029are specified by @samp{__builtin_expect}, then the heuristics will be
5030used to guess branch probabilities for the rest of the control flow graph,
5031taking the @samp{__builtin_expect} info into account.  The interactions
5032between the heuristics and @samp{__builtin_expect} can be complex, and in
5033some cases, it may be useful to disable the heuristics so that the effects
5034of @samp{__builtin_expect} are easier to understand.
5035
5036The default is @option{-fguess-branch-probability} at levels
5037@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5038
5039@item -freorder-blocks
5040@opindex freorder-blocks
5041Reorder basic blocks in the compiled function in order to reduce number of
5042taken branches and improve code locality.
5043
5044Enabled at levels @option{-O2}, @option{-O3}.
5045
5046@item -freorder-blocks-and-partition
5047@opindex freorder-blocks-and-partition
5048In addition to reordering basic blocks in the compiled function, in order
5049to reduce number of taken branches, partitions hot and cold basic blocks
5050into separate sections of the assembly and .o files, to improve
5051paging and cache locality performance.
5052
5053This optimization is automatically turned off in the presence of
5054exception handling, for linkonce sections, for functions with a user-defined
5055section attribute and on any architecture that does not support named
5056sections.
5057
5058@item -freorder-functions
5059@opindex freorder-functions
5060Reorder functions in the object file in order to
5061improve code locality.  This is implemented by using special
5062subsections @code{.text.hot} for most frequently executed functions and
5063@code{.text.unlikely} for unlikely executed functions.  Reordering is done by
5064the linker so object file format must support named sections and linker must
5065place them in a reasonable way.
5066
5067Also profile feedback must be available in to make this option effective.  See
5068@option{-fprofile-arcs} for details.
5069
5070Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5071
5072@item -fstrict-aliasing
5073@opindex fstrict-aliasing
5074Allows the compiler to assume the strictest aliasing rules applicable to
5075the language being compiled.  For C (and C++), this activates
5076optimizations based on the type of expressions.  In particular, an
5077object of one type is assumed never to reside at the same address as an
5078object of a different type, unless the types are almost the same.  For
5079example, an @code{unsigned int} can alias an @code{int}, but not a
5080@code{void*} or a @code{double}.  A character type may alias any other
5081type.
5082
5083Pay special attention to code like this:
5084@smallexample
5085union a_union @{
5086  int i;
5087  double d;
5088@};
5089
5090int f() @{
5091  a_union t;
5092  t.d = 3.0;
5093  return t.i;
5094@}
5095@end smallexample
5096The practice of reading from a different union member than the one most
5097recently written to (called ``type-punning'') is common.  Even with
5098@option{-fstrict-aliasing}, type-punning is allowed, provided the memory
5099is accessed through the union type.  So, the code above will work as
5100expected.  However, this code might not:
5101@smallexample
5102int f() @{
5103  a_union t;
5104  int* ip;
5105  t.d = 3.0;
5106  ip = &t.i;
5107  return *ip;
5108@}
5109@end smallexample
5110
5111Every language that wishes to perform language-specific alias analysis
5112should define a function that computes, given an @code{tree}
5113node, an alias set for the node.  Nodes in different alias sets are not
5114allowed to alias.  For an example, see the C front-end function
5115@code{c_get_alias_set}.
5116
5117Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5118
5119@item -fstrict-overflow
5120@opindex fstrict-overflow
5121Allow the compiler to assume strict signed overflow rules, depending
5122on the language being compiled.  For C (and C++) this means that
5123overflow when doing arithmetic with signed numbers is undefined, which
5124means that the compiler may assume that it will not happen.  This
5125permits various optimizations.  For example, the compiler will assume
5126that an expression like @code{i + 10 > i} will always be true for
5127signed @code{i}.  This assumption is only valid if signed overflow is
5128undefined, as the expression is false if @code{i + 10} overflows when
5129using twos complement arithmetic.  When this option is in effect any
5130attempt to determine whether an operation on signed numbers will
5131overflow must be written carefully to not actually involve overflow.
5132
5133See also the @option{-fwrapv} option.  Using @option{-fwrapv} means
5134that signed overflow is fully defined: it wraps.  When
5135@option{-fwrapv} is used, there is no difference between
5136@option{-fstrict-overflow} and @option{-fno-strict-overflow}.  With
5137@option{-fwrapv} certain types of overflow are permitted.  For
5138example, if the compiler gets an overflow when doing arithmetic on
5139constants, the overflowed value can still be used with
5140@option{-fwrapv}, but not otherwise.
5141
5142The @option{-fstrict-overflow} option is enabled at levels
5143@option{-O2}, @option{-O3}, @option{-Os}.
5144
5145@item -falign-functions
5146@itemx -falign-functions=@var{n}
5147@opindex falign-functions
5148Align the start of functions to the next power-of-two greater than
5149@var{n}, skipping up to @var{n} bytes.  For instance,
5150@option{-falign-functions=32} aligns functions to the next 32-byte
5151boundary, but @option{-falign-functions=24} would align to the next
515232-byte boundary only if this can be done by skipping 23 bytes or less.
5153
5154@option{-fno-align-functions} and @option{-falign-functions=1} are
5155equivalent and mean that functions will not be aligned.
5156
5157Some assemblers only support this flag when @var{n} is a power of two;
5158in that case, it is rounded up.
5159
5160If @var{n} is not specified or is zero, use a machine-dependent default.
5161
5162Enabled at levels @option{-O2}, @option{-O3}.
5163
5164@item -falign-labels
5165@itemx -falign-labels=@var{n}
5166@opindex falign-labels
5167Align all branch targets to a power-of-two boundary, skipping up to
5168@var{n} bytes like @option{-falign-functions}.  This option can easily
5169make code slower, because it must insert dummy operations for when the
5170branch target is reached in the usual flow of the code.
5171
5172@option{-fno-align-labels} and @option{-falign-labels=1} are
5173equivalent and mean that labels will not be aligned.
5174
5175If @option{-falign-loops} or @option{-falign-jumps} are applicable and
5176are greater than this value, then their values are used instead.
5177
5178If @var{n} is not specified or is zero, use a machine-dependent default
5179which is very likely to be @samp{1}, meaning no alignment.
5180
5181Enabled at levels @option{-O2}, @option{-O3}.
5182
5183@item -falign-loops
5184@itemx -falign-loops=@var{n}
5185@opindex falign-loops
5186Align loops to a power-of-two boundary, skipping up to @var{n} bytes
5187like @option{-falign-functions}.  The hope is that the loop will be
5188executed many times, which will make up for any execution of the dummy
5189operations.
5190
5191@option{-fno-align-loops} and @option{-falign-loops=1} are
5192equivalent and mean that loops will not be aligned.
5193
5194If @var{n} is not specified or is zero, use a machine-dependent default.
5195
5196Enabled at levels @option{-O2}, @option{-O3}.
5197
5198@item -falign-jumps
5199@itemx -falign-jumps=@var{n}
5200@opindex falign-jumps
5201Align branch targets to a power-of-two boundary, for branch targets
5202where the targets can only be reached by jumping, skipping up to @var{n}
5203bytes like @option{-falign-functions}.  In this case, no dummy operations
5204need be executed.
5205
5206@option{-fno-align-jumps} and @option{-falign-jumps=1} are
5207equivalent and mean that loops will not be aligned.
5208
5209If @var{n} is not specified or is zero, use a machine-dependent default.
5210
5211Enabled at levels @option{-O2}, @option{-O3}.
5212
5213@item -funit-at-a-time
5214@opindex funit-at-a-time
5215Parse the whole compilation unit before starting to produce code.
5216This allows some extra optimizations to take place but consumes
5217more memory (in general).  There are some compatibility issues
5218with @emph{unit-at-a-time} mode:
5219@itemize @bullet
5220@item
5221enabling @emph{unit-at-a-time} mode may change the order
5222in which functions, variables, and top-level @code{asm} statements
5223are emitted, and will likely break code relying on some particular
5224ordering.  The majority of such top-level @code{asm} statements,
5225though, can be replaced by @code{section} attributes.  The
5226@option{fno-toplevel-reorder} option may be used to keep the ordering
5227used in the input file, at the cost of some optimizations.
5228
5229@item
5230@emph{unit-at-a-time} mode removes unreferenced static variables
5231and functions.  This may result in undefined references
5232when an @code{asm} statement refers directly to variables or functions
5233that are otherwise unused.  In that case either the variable/function
5234shall be listed as an operand of the @code{asm} statement operand or,
5235in the case of top-level @code{asm} statements the attribute @code{used}
5236shall be used on the declaration.
5237
5238@item
5239Static functions now can use non-standard passing conventions that
5240may break @code{asm} statements calling functions directly.  Again,
5241attribute @code{used} will prevent this behavior.
5242@end itemize
5243
5244As a temporary workaround, @option{-fno-unit-at-a-time} can be used,
5245but this scheme may not be supported by future releases of GCC@.
5246
5247Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5248
5249@item -fno-toplevel-reorder
5250Do not reorder top-level functions, variables, and @code{asm}
5251statements.  Output them in the same order that they appear in the
5252input file.  When this option is used, unreferenced static variables
5253will not be removed.  This option is intended to support existing code
5254which relies on a particular ordering.  For new code, it is better to
5255use attributes.
5256
5257@item -fweb
5258@opindex fweb
5259Constructs webs as commonly used for register allocation purposes and assign
5260each web individual pseudo register.  This allows the register allocation pass
5261to operate on pseudos directly, but also strengthens several other optimization
5262passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
5263however, make debugging impossible, since variables will no longer stay in a
5264``home register''.
5265
5266Enabled by default with @option{-funroll-loops}.
5267
5268@item -fwhole-program
5269@opindex fwhole-program
5270Assume that the current compilation unit represents whole program being
5271compiled.  All public functions and variables with the exception of @code{main}
5272and those merged by attribute @code{externally_visible} become static functions
5273and in a affect gets more aggressively optimized by interprocedural optimizers.
5274While this option is equivalent to proper use of @code{static} keyword for
5275programs consisting of single file, in combination with option
5276@option{--combine} this flag can be used to compile most of smaller scale C
5277programs since the functions and variables become local for the whole combined
5278compilation unit, not for the single source file itself.
5279
5280
5281@item -fno-cprop-registers
5282@opindex fno-cprop-registers
5283After register allocation and post-register allocation instruction splitting,
5284we perform a copy-propagation pass to try to reduce scheduling dependencies
5285and occasionally eliminate the copy.
5286
5287Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5288
5289@item -fprofile-generate
5290@opindex fprofile-generate
5291
5292Enable options usually used for instrumenting application to produce
5293profile useful for later recompilation with profile feedback based
5294optimization.  You must use @option{-fprofile-generate} both when
5295compiling and when linking your program.
5296
5297The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
5298
5299@item -fprofile-use
5300@opindex fprofile-use
5301Enable profile feedback directed optimizations, and optimizations
5302generally profitable only with profile feedback available.
5303
5304The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
5305@code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}
5306
5307@end table
5308
5309The following options control compiler behavior regarding floating
5310point arithmetic.  These options trade off between speed and
5311correctness.  All must be specifically enabled.
5312
5313@table @gcctabopt
5314@item -ffloat-store
5315@opindex ffloat-store
5316Do not store floating point variables in registers, and inhibit other
5317options that might change whether a floating point value is taken from a
5318register or memory.
5319
5320@cindex floating point precision
5321This option prevents undesirable excess precision on machines such as
5322the 68000 where the floating registers (of the 68881) keep more
5323precision than a @code{double} is supposed to have.  Similarly for the
5324x86 architecture.  For most programs, the excess precision does only
5325good, but a few programs rely on the precise definition of IEEE floating
5326point.  Use @option{-ffloat-store} for such programs, after modifying
5327them to store all pertinent intermediate computations into variables.
5328
5329@item -ffast-math
5330@opindex ffast-math
5331Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @*
5332@option{-fno-trapping-math}, @option{-ffinite-math-only},
5333@option{-fno-rounding-math}, @option{-fno-signaling-nans}
5334and @option{fcx-limited-range}.
5335
5336This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
5337
5338This option should never be turned on by any @option{-O} option since
5339it can result in incorrect output for programs which depend on
5340an exact implementation of IEEE or ISO rules/specifications for
5341math functions.
5342
5343@item -fno-math-errno
5344@opindex fno-math-errno
5345Do not set ERRNO after calling math functions that are executed
5346with a single instruction, e.g., sqrt.  A program that relies on
5347IEEE exceptions for math error handling may want to use this flag
5348for speed while maintaining IEEE arithmetic compatibility.
5349
5350This option should never be turned on by any @option{-O} option since
5351it can result in incorrect output for programs which depend on
5352an exact implementation of IEEE or ISO rules/specifications for
5353math functions.
5354
5355The default is @option{-fmath-errno}.
5356
5357On Darwin and FreeBSD systems, the math library never sets @code{errno}.
5358There is therefore
5359no reason for the compiler to consider the possibility that it might,
5360and @option{-fno-math-errno} is the default.
5361
5362@item -funsafe-math-optimizations
5363@opindex funsafe-math-optimizations
5364Allow optimizations for floating-point arithmetic that (a) assume
5365that arguments and results are valid and (b) may violate IEEE or
5366ANSI standards.  When used at link-time, it may include libraries
5367or startup files that change the default FPU control word or other
5368similar optimizations.
5369
5370This option should never be turned on by any @option{-O} option since
5371it can result in incorrect output for programs which depend on
5372an exact implementation of IEEE or ISO rules/specifications for
5373math functions.
5374
5375The default is @option{-fno-unsafe-math-optimizations}.
5376
5377@item -ffinite-math-only
5378@opindex ffinite-math-only
5379Allow optimizations for floating-point arithmetic that assume
5380that arguments and results are not NaNs or +-Infs.
5381
5382This option should never be turned on by any @option{-O} option since
5383it can result in incorrect output for programs which depend on
5384an exact implementation of IEEE or ISO rules/specifications.
5385
5386The default is @option{-fno-finite-math-only}.
5387
5388@item -fno-trapping-math
5389@opindex fno-trapping-math
5390Compile code assuming that floating-point operations cannot generate
5391user-visible traps.  These traps include division by zero, overflow,
5392underflow, inexact result and invalid operation.  This option implies
5393@option{-fno-signaling-nans}.  Setting this option may allow faster
5394code if one relies on ``non-stop'' IEEE arithmetic, for example.
5395
5396This option should never be turned on by any @option{-O} option since
5397it can result in incorrect output for programs which depend on
5398an exact implementation of IEEE or ISO rules/specifications for
5399math functions.
5400
5401The default is @option{-ftrapping-math}.
5402
5403@item -frounding-math
5404@opindex frounding-math
5405Disable transformations and optimizations that assume default floating
5406point rounding behavior.  This is round-to-zero for all floating point
5407to integer conversions, and round-to-nearest for all other arithmetic
5408truncations.  This option should be specified for programs that change
5409the FP rounding mode dynamically, or that may be executed with a
5410non-default rounding mode.  This option disables constant folding of
5411floating point expressions at compile-time (which may be affected by
5412rounding mode) and arithmetic transformations that are unsafe in the
5413presence of sign-dependent rounding modes.
5414
5415The default is @option{-fno-rounding-math}.
5416
5417This option is experimental and does not currently guarantee to
5418disable all GCC optimizations that are affected by rounding mode.
5419Future versions of GCC may provide finer control of this setting
5420using C99's @code{FENV_ACCESS} pragma.  This command line option
5421will be used to specify the default state for @code{FENV_ACCESS}.
5422
5423@item -frtl-abstract-sequences
5424@opindex frtl-abstract-sequences
5425It is a size optimization method. This option is to find identical
5426sequences of code, which can be turned into pseudo-procedures  and
5427then  replace  all  occurrences with  calls to  the  newly created
5428subroutine. It is kind of an opposite of @option{-finline-functions}.
5429This optimization runs at RTL level.
5430
5431@item -fsignaling-nans
5432@opindex fsignaling-nans
5433Compile code assuming that IEEE signaling NaNs may generate user-visible
5434traps during floating-point operations.  Setting this option disables
5435optimizations that may change the number of exceptions visible with
5436signaling NaNs.  This option implies @option{-ftrapping-math}.
5437
5438This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
5439be defined.
5440
5441The default is @option{-fno-signaling-nans}.
5442
5443This option is experimental and does not currently guarantee to
5444disable all GCC optimizations that affect signaling NaN behavior.
5445
5446@item -fsingle-precision-constant
5447@opindex fsingle-precision-constant
5448Treat floating point constant as single precision constant instead of
5449implicitly converting it to double precision constant.
5450
5451@item -fcx-limited-range
5452@itemx -fno-cx-limited-range
5453@opindex fcx-limited-range
5454@opindex fno-cx-limited-range
5455When enabled, this option states that a range reduction step is not
5456needed when performing complex division.  The default is
5457@option{-fno-cx-limited-range}, but is enabled by @option{-ffast-math}.
5458
5459This option controls the default setting of the ISO C99 
5460@code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
5461all languages.
5462
5463@end table
5464
5465The following options control optimizations that may improve
5466performance, but are not enabled by any @option{-O} options.  This
5467section includes experimental options that may produce broken code.
5468
5469@table @gcctabopt
5470@item -fbranch-probabilities
5471@opindex fbranch-probabilities
5472After running a program compiled with @option{-fprofile-arcs}
5473(@pxref{Debugging Options,, Options for Debugging Your Program or
5474@command{gcc}}), you can compile it a second time using
5475@option{-fbranch-probabilities}, to improve optimizations based on
5476the number of times each branch was taken.  When the program
5477compiled with @option{-fprofile-arcs} exits it saves arc execution
5478counts to a file called @file{@var{sourcename}.gcda} for each source
5479file  The information in this data file is very dependent on the
5480structure of the generated code, so you must use the same source code
5481and the same optimization options for both compilations.
5482
5483With @option{-fbranch-probabilities}, GCC puts a
5484@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
5485These can be used to improve optimization.  Currently, they are only
5486used in one place: in @file{reorg.c}, instead of guessing which path a
5487branch is mostly to take, the @samp{REG_BR_PROB} values are used to
5488exactly determine which path is taken more often.
5489
5490@item -fprofile-values
5491@opindex fprofile-values
5492If combined with @option{-fprofile-arcs}, it adds code so that some
5493data about values of expressions in the program is gathered.
5494
5495With @option{-fbranch-probabilities}, it reads back the data gathered
5496from profiling values of expressions and adds @samp{REG_VALUE_PROFILE}
5497notes to instructions for their later usage in optimizations.
5498
5499Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
5500
5501@item -fvpt
5502@opindex fvpt
5503If combined with @option{-fprofile-arcs}, it instructs the compiler to add
5504a code to gather information about values of expressions.
5505
5506With @option{-fbranch-probabilities}, it reads back the data gathered
5507and actually performs the optimizations based on them.
5508Currently the optimizations include specialization of division operation
5509using the knowledge about the value of the denominator.
5510
5511@item -frename-registers
5512@opindex frename-registers
5513Attempt to avoid false dependencies in scheduled code by making use
5514of registers left over after register allocation.  This optimization
5515will most benefit processors with lots of registers.  Depending on the
5516debug information format adopted by the target, however, it can
5517make debugging impossible, since variables will no longer stay in
5518a ``home register''.
5519
5520Enabled by default with @option{-funroll-loops}.
5521
5522@item -ftracer
5523@opindex ftracer
5524Perform tail duplication to enlarge superblock size.  This transformation
5525simplifies the control flow of the function allowing other optimizations to do
5526better job.
5527
5528Enabled with @option{-fprofile-use}.
5529
5530@item -funroll-loops
5531@opindex funroll-loops
5532Unroll loops whose number of iterations can be determined at compile time or
5533upon entry to the loop.  @option{-funroll-loops} implies
5534@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}. 
5535It also turns on complete loop peeling (i.e.@: complete removal of loops with
5536small constant number of iterations).  This option makes code larger, and may
5537or may not make it run faster.
5538
5539Enabled with @option{-fprofile-use}.
5540
5541@item -funroll-all-loops
5542@opindex funroll-all-loops
5543Unroll all loops, even if their number of iterations is uncertain when
5544the loop is entered.  This usually makes programs run more slowly.
5545@option{-funroll-all-loops} implies the same options as
5546@option{-funroll-loops}.
5547
5548@item -fpeel-loops
5549@opindex fpeel-loops
5550Peels the loops for that there is enough information that they do not
5551roll much (from profile feedback).  It also turns on complete loop peeling
5552(i.e.@: complete removal of loops with small constant number of iterations).
5553
5554Enabled with @option{-fprofile-use}.
5555
5556@item -fmove-loop-invariants
5557@opindex fmove-loop-invariants
5558Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
5559at level @option{-O1}
5560
5561@item -funswitch-loops
5562@opindex funswitch-loops
5563Move branches with loop invariant conditions out of the loop, with duplicates
5564of the loop on both branches (modified according to result of the condition).
5565
5566@item -ffunction-sections
5567@itemx -fdata-sections
5568@opindex ffunction-sections
5569@opindex fdata-sections
5570Place each function or data item into its own section in the output
5571file if the target supports arbitrary sections.  The name of the
5572function or the name of the data item determines the section's name
5573in the output file.
5574
5575Use these options on systems where the linker can perform optimizations
5576to improve locality of reference in the instruction space.  Most systems
5577using the ELF object format and SPARC processors running Solaris 2 have
5578linkers with such optimizations.  AIX may have these optimizations in
5579the future.
5580
5581Only use these options when there are significant benefits from doing
5582so.  When you specify these options, the assembler and linker will
5583create larger object and executable files and will also be slower.
5584You will not be able to use @code{gprof} on all systems if you
5585specify this option and you may have problems with debugging if
5586you specify both this option and @option{-g}.
5587
5588@item -fbranch-target-load-optimize
5589@opindex fbranch-target-load-optimize
5590Perform branch target register load optimization before prologue / epilogue
5591threading.
5592The use of target registers can typically be exposed only during reload,
5593thus hoisting loads out of loops and doing inter-block scheduling needs
5594a separate optimization pass.
5595
5596@item -fbranch-target-load-optimize2
5597@opindex fbranch-target-load-optimize2
5598Perform branch target register load optimization after prologue / epilogue
5599threading.
5600
5601@item -fbtr-bb-exclusive
5602@opindex fbtr-bb-exclusive
5603When performing branch target register load optimization, don't reuse
5604branch target registers in within any basic block.
5605
5606@item -fstack-protector
5607Emit extra code to check for buffer overflows, such as stack smashing
5608attacks.  This is done by adding a guard variable to functions with
5609vulnerable objects.  This includes functions that call alloca, and
5610functions with buffers larger than 8 bytes.  The guards are initialized
5611when a function is entered and then checked when the function exits.
5612If a guard check fails, an error message is printed and the program exits.
5613
5614@item -fstack-protector-all
5615Like @option{-fstack-protector} except that all functions are protected.
5616
5617@item -fsection-anchors
5618@opindex fsection-anchors
5619Try to reduce the number of symbolic address calculations by using
5620shared ``anchor'' symbols to address nearby objects.  This transformation
5621can help to reduce the number of GOT entries and GOT accesses on some
5622targets.
5623
5624For example, the implementation of the following function @code{foo}:
5625
5626@smallexample
5627static int a, b, c;
5628int foo (void) @{ return a + b + c; @}
5629@end smallexample
5630
5631would usually calculate the addresses of all three variables, but if you
5632compile it with @option{-fsection-anchors}, it will access the variables
5633from a common anchor point instead.  The effect is similar to the
5634following pseudocode (which isn't valid C):
5635
5636@smallexample
5637int foo (void)
5638@{
5639  register int *xr = &x;
5640  return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
5641@}
5642@end smallexample
5643
5644Not all targets support this option.
5645
5646@item --param @var{name}=@var{value}
5647@opindex param
5648In some places, GCC uses various constants to control the amount of
5649optimization that is done.  For example, GCC will not inline functions
5650that contain more that a certain number of instructions.  You can
5651control some of these constants on the command-line using the
5652@option{--param} option.
5653
5654The names of specific parameters, and the meaning of the values, are
5655tied to the internals of the compiler, and are subject to change
5656without notice in future releases.
5657
5658In each case, the @var{value} is an integer.  The allowable choices for
5659@var{name} are given in the following table:
5660
5661@table @gcctabopt
5662@item salias-max-implicit-fields
5663The maximum number of fields in a variable without direct
5664structure accesses for which structure aliasing will consider trying 
5665to track each field.  The default is 5
5666
5667@item salias-max-array-elements
5668The maximum number of elements an array can have and its elements
5669still be tracked individually by structure aliasing. The default is 4
5670
5671@item sra-max-structure-size
5672The maximum structure size, in bytes, at which the scalar replacement
5673of aggregates (SRA) optimization will perform block copies.  The
5674default value, 0, implies that GCC will select the most appropriate
5675size itself.
5676
5677@item sra-field-structure-ratio
5678The threshold ratio (as a percentage) between instantiated fields and
5679the complete structure size.  We say that if the ratio of the number
5680of bytes in instantiated fields to the number of bytes in the complete
5681structure exceeds this parameter, then block copies are not used.  The
5682default is 75.
5683
5684@item max-crossjump-edges
5685The maximum number of incoming edges to consider for crossjumping.
5686The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
5687the number of edges incoming to each block.  Increasing values mean
5688more aggressive optimization, making the compile time increase with
5689probably small improvement in executable size.
5690
5691@item min-crossjump-insns
5692The minimum number of instructions which must be matched at the end
5693of two blocks before crossjumping will be performed on them.  This
5694value is ignored in the case where all instructions in the block being
5695crossjumped from are matched.  The default value is 5.
5696
5697@item max-grow-copy-bb-insns
5698The maximum code size expansion factor when copying basic blocks
5699instead of jumping.  The expansion is relative to a jump instruction.
5700The default value is 8.
5701
5702@item max-goto-duplication-insns
5703The maximum number of instructions to duplicate to a block that jumps
5704to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
5705passes, GCC factors computed gotos early in the compilation process,
5706and unfactors them as late as possible.  Only computed jumps at the
5707end of a basic blocks with no more than max-goto-duplication-insns are
5708unfactored.  The default value is 8.
5709
5710@item max-delay-slot-insn-search
5711The maximum number of instructions to consider when looking for an
5712instruction to fill a delay slot.  If more than this arbitrary number of
5713instructions is searched, the time savings from filling the delay slot
5714will be minimal so stop searching.  Increasing values mean more
5715aggressive optimization, making the compile time increase with probably
5716small improvement in executable run time.
5717
5718@item max-delay-slot-live-search
5719When trying to fill delay slots, the maximum number of instructions to
5720consider when searching for a block with valid live register
5721information.  Increasing this arbitrarily chosen value means more
5722aggressive optimization, increasing the compile time.  This parameter
5723should be removed when the delay slot code is rewritten to maintain the
5724control-flow graph.
5725
5726@item max-gcse-memory
5727The approximate maximum amount of memory that will be allocated in
5728order to perform the global common subexpression elimination
5729optimization.  If more memory than specified is required, the
5730optimization will not be done.
5731
5732@item max-gcse-passes
5733The maximum number of passes of GCSE to run.  The default is 1.
5734
5735@item max-pending-list-length
5736The maximum number of pending dependencies scheduling will allow
5737before flushing the current state and starting over.  Large functions
5738with few branches or calls can create excessively large lists which
5739needlessly consume memory and resources.
5740
5741@item max-inline-insns-single
5742Several parameters control the tree inliner used in gcc.
5743This number sets the maximum number of instructions (counted in GCC's
5744internal representation) in a single function that the tree inliner
5745will consider for inlining.  This only affects functions declared
5746inline and methods implemented in a class declaration (C++).
5747The default value is 450.
5748
5749@item max-inline-insns-auto
5750When you use @option{-finline-functions} (included in @option{-O3}),
5751a lot of functions that would otherwise not be considered for inlining
5752by the compiler will be investigated.  To those functions, a different
5753(more restrictive) limit compared to functions declared inline can
5754be applied.
5755The default value is 90.
5756
5757@item large-function-insns
5758The limit specifying really large functions.  For functions larger than this
5759limit after inlining inlining is constrained by
5760@option{--param large-function-growth}.  This parameter is useful primarily
5761to avoid extreme compilation time caused by non-linear algorithms used by the
5762backend.
5763This parameter is ignored when @option{-funit-at-a-time} is not used.
5764The default value is 2700.
5765
5766@item large-function-growth
5767Specifies maximal growth of large function caused by inlining in percents.
5768This parameter is ignored when @option{-funit-at-a-time} is not used.
5769The default value is 100 which limits large function growth to 2.0 times
5770the original size.
5771
5772@item large-unit-insns
5773The limit specifying large translation unit.  Growth caused by inlining of
5774units larger than this limit is limited by @option{--param inline-unit-growth}.
5775For small units this might be too tight (consider unit consisting of function A
5776that is inline and B that just calls A three time.  If B is small relative to
5777A, the growth of unit is 300\% and yet such inlining is very sane.  For very
5778large units consisting of small inlininable functions however the overall unit
5779growth limit is needed to avoid exponential explosion of code size.  Thus for
5780smaller units, the size is increased to @option{--param large-unit-insns}
5781before applying @option{--param inline-unit-growth}.  The default is 10000
5782
5783@item inline-unit-growth
5784Specifies maximal overall growth of the compilation unit caused by inlining.
5785This parameter is ignored when @option{-funit-at-a-time} is not used.
5786The default value is 50 which limits unit growth to 1.5 times the original
5787size.
5788
5789@item max-inline-insns-recursive
5790@itemx max-inline-insns-recursive-auto
5791Specifies maximum number of instructions out-of-line copy of self recursive inline
5792function can grow into by performing recursive inlining.
5793
5794For functions declared inline @option{--param max-inline-insns-recursive} is
5795taken into account.  For function not declared inline, recursive inlining
5796happens only when @option{-finline-functions} (included in @option{-O3}) is
5797enabled and @option{--param max-inline-insns-recursive-auto} is used.  The
5798default value is 450.
5799
5800@item max-inline-recursive-depth
5801@itemx max-inline-recursive-depth-auto
5802Specifies maximum recursion depth used by the recursive inlining.
5803
5804For functions declared inline @option{--param max-inline-recursive-depth} is
5805taken into account.  For function not declared inline, recursive inlining
5806happens only when @option{-finline-functions} (included in @option{-O3}) is
5807enabled and @option{--param max-inline-recursive-depth-auto} is used.  The
5808default value is 450.
5809
5810@item min-inline-recursive-probability
5811Recursive inlining is profitable only for function having deep recursion
5812in average and can hurt for function having little recursion depth by
5813increasing the prologue size or complexity of function body to other
5814optimizers.
5815
5816When profile feedback is available (see @option{-fprofile-generate}) the actual
5817recursion depth can be guessed from probability that function will recurse via
5818given call expression.  This parameter limits inlining only to call expression
5819whose probability exceeds given threshold (in percents).  The default value is
582010.
5821
5822@item inline-call-cost
5823Specify cost of call instruction relative to simple arithmetics operations
5824(having cost of 1).  Increasing this cost disqualifies inlining of non-leaf
5825functions and at the same time increases size of leaf function that is believed to
5826reduce function size by being inlined.  In effect it increases amount of
5827inlining for code having large abstraction penalty (many functions that just
5828pass the arguments to other functions) and decrease inlining for code with low
5829abstraction penalty.  The default value is 16.
5830
5831@item max-unrolled-insns
5832The maximum number of instructions that a loop should have if that loop
5833is unrolled, and if the loop is unrolled, it determines how many times
5834the loop code is unrolled.
5835
5836@item max-average-unrolled-insns
5837The maximum number of instructions biased by probabilities of their execution
5838that a loop should have if that loop is unrolled, and if the loop is unrolled,
5839it determines how many times the loop code is unrolled.
5840
5841@item max-unroll-times
5842The maximum number of unrollings of a single loop.
5843
5844@item max-peeled-insns
5845The maximum number of instructions that a loop should have if that loop
5846is peeled, and if the loop is peeled, it determines how many times
5847the loop code is peeled.
5848
5849@item max-peel-times
5850The maximum number of peelings of a single loop.
5851
5852@item max-completely-peeled-insns
5853The maximum number of insns of a completely peeled loop.
5854
5855@item max-completely-peel-times
5856The maximum number of iterations of a loop to be suitable for complete peeling.
5857
5858@item max-unswitch-insns
5859The maximum number of insns of an unswitched loop.
5860
5861@item max-unswitch-level
5862The maximum number of branches unswitched in a single loop.
5863
5864@item lim-expensive
5865The minimum cost of an expensive expression in the loop invariant motion.
5866
5867@item iv-consider-all-candidates-bound
5868Bound on number of candidates for induction variables below that
5869all candidates are considered for each use in induction variable
5870optimizations.  Only the most relevant candidates are considered
5871if there are more candidates, to avoid quadratic time complexity.
5872
5873@item iv-max-considered-uses
5874The induction variable optimizations give up on loops that contain more
5875induction variable uses.
5876
5877@item iv-always-prune-cand-set-bound
5878If number of candidates in the set is smaller than this value,
5879we always try to remove unnecessary ivs from the set during its
5880optimization when a new iv is added to the set.
5881
5882@item scev-max-expr-size
5883Bound on size of expressions used in the scalar evolutions analyzer.
5884Large expressions slow the analyzer.
5885
5886@item vect-max-version-checks
5887The maximum number of runtime checks that can be performed when doing
5888loop versioning in the vectorizer.  See option ftree-vect-loop-version
5889for more information.
5890
5891@item max-iterations-to-track
5892
5893The maximum number of iterations of a loop the brute force algorithm
5894for analysis of # of iterations of the loop tries to evaluate.
5895
5896@item hot-bb-count-fraction
5897Select fraction of the maximal count of repetitions of basic block in program
5898given basic block needs to have to be considered hot.
5899
5900@item hot-bb-frequency-fraction
5901Select fraction of the maximal frequency of executions of basic block in
5902function given basic block needs to have to be considered hot
5903
5904@item max-predicted-iterations
5905The maximum number of loop iterations we predict statically.  This is useful
5906in cases where function contain single loop with known bound and other loop
5907with unknown.  We predict the known number of iterations correctly, while
5908the unknown number of iterations average to roughly 10.  This means that the
5909loop without bounds would appear artificially cold relative to the other one.
5910
5911@item tracer-dynamic-coverage
5912@itemx tracer-dynamic-coverage-feedback
5913
5914This value is used to limit superblock formation once the given percentage of
5915executed instructions is covered.  This limits unnecessary code size
5916expansion.
5917
5918The @option{tracer-dynamic-coverage-feedback} is used only when profile
5919feedback is available.  The real profiles (as opposed to statically estimated
5920ones) are much less balanced allowing the threshold to be larger value.
5921
5922@item tracer-max-code-growth
5923Stop tail duplication once code growth has reached given percentage.  This is
5924rather hokey argument, as most of the duplicates will be eliminated later in
5925cross jumping, so it may be set to much higher values than is the desired code
5926growth.
5927
5928@item tracer-min-branch-ratio
5929
5930Stop reverse growth when the reverse probability of best edge is less than this
5931threshold (in percent).
5932
5933@item tracer-min-branch-ratio
5934@itemx tracer-min-branch-ratio-feedback
5935
5936Stop forward growth if the best edge do have probability lower than this
5937threshold.
5938
5939Similarly to @option{tracer-dynamic-coverage} two values are present, one for
5940compilation for profile feedback and one for compilation without.  The value
5941for compilation with profile feedback needs to be more conservative (higher) in
5942order to make tracer effective.
5943
5944@item max-cse-path-length
5945
5946Maximum number of basic blocks on path that cse considers.  The default is 10.
5947
5948@item max-cse-insns
5949The maximum instructions CSE process before flushing. The default is 1000.
5950
5951@item global-var-threshold
5952
5953Counts the number of function calls (@var{n}) and the number of
5954call-clobbered variables (@var{v}).  If @var{n}x@var{v} is larger than this limit, a
5955single artificial variable will be created to represent all the
5956call-clobbered variables at function call sites.  This artificial
5957variable will then be made to alias every call-clobbered variable.
5958(done as @code{int * size_t} on the host machine; beware overflow).
5959
5960@item max-aliased-vops
5961
5962Maximum number of virtual operands allowed to represent aliases
5963before triggering the alias grouping heuristic.  Alias grouping
5964reduces compile times and memory consumption needed for aliasing at
5965the expense of precision loss in alias information.
5966
5967@item ggc-min-expand
5968
5969GCC uses a garbage collector to manage its own memory allocation.  This
5970parameter specifies the minimum percentage by which the garbage
5971collector's heap should be allowed to expand between collections.
5972Tuning this may improve compilation speed; it has no effect on code
5973generation.
5974
5975The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
5976RAM >= 1GB@.  If @code{getrlimit} is available, the notion of "RAM" is
5977the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
5978GCC is not able to calculate RAM on a particular platform, the lower
5979bound of 30% is used.  Setting this parameter and
5980@option{ggc-min-heapsize} to zero causes a full collection to occur at
5981every opportunity.  This is extremely slow, but can be useful for
5982debugging.
5983
5984@item ggc-min-heapsize
5985
5986Minimum size of the garbage collector's heap before it begins bothering
5987to collect garbage.  The first collection occurs after the heap expands
5988by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
5989tuning this may improve compilation speed, and has no effect on code
5990generation.
5991
5992The default is the smaller of RAM/8, RLIMIT_RSS, or a limit which
5993tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
5994with a lower bound of 4096 (four megabytes) and an upper bound of
5995131072 (128 megabytes).  If GCC is not able to calculate RAM on a
5996particular platform, the lower bound is used.  Setting this parameter
5997very large effectively disables garbage collection.  Setting this
5998parameter and @option{ggc-min-expand} to zero causes a full collection
5999to occur at every opportunity.
6000
6001@item max-reload-search-insns
6002The maximum number of instruction reload should look backward for equivalent
6003register.  Increasing values mean more aggressive optimization, making the
6004compile time increase with probably slightly better performance.  The default
6005value is 100.
6006
6007@item max-cselib-memory-locations
6008The maximum number of memory locations cselib should take into account.
6009Increasing values mean more aggressive optimization, making the compile time
6010increase with probably slightly better performance.  The default value is 500.
6011
6012@item max-flow-memory-locations
6013Similar as @option{max-cselib-memory-locations} but for dataflow liveness.
6014The default value is 100.
6015
6016@item reorder-blocks-duplicate
6017@itemx reorder-blocks-duplicate-feedback
6018
6019Used by basic block reordering pass to decide whether to use unconditional
6020branch or duplicate the code on its destination.  Code is duplicated when its
6021estimated size is smaller than this value multiplied by the estimated size of
6022unconditional jump in the hot spots of the program.
6023
6024The @option{reorder-block-duplicate-feedback} is used only when profile
6025feedback is available and may be set to higher values than
6026@option{reorder-block-duplicate} since information about the hot spots is more
6027accurate.
6028
6029@item max-sched-ready-insns
6030The maximum number of instructions ready to be issued the scheduler should
6031consider at any given time during the first scheduling pass.  Increasing
6032values mean more thorough searches, making the compilation time increase
6033with probably little benefit.  The default value is 100.
6034
6035@item max-sched-region-blocks
6036The maximum number of blocks in a region to be considered for
6037interblock scheduling.  The default value is 10.
6038
6039@item max-sched-region-insns
6040The maximum number of insns in a region to be considered for
6041interblock scheduling.  The default value is 100.
6042
6043@item min-spec-prob
6044The minimum probability (in percents) of reaching a source block
6045for interblock speculative scheduling.  The default value is 40.
6046
6047@item max-sched-extend-regions-iters
6048The maximum number of iterations through CFG to extend regions.
60490 - disable region extension,
6050N - do at most N iterations.
6051The default value is 0.
6052
6053@item max-sched-insn-conflict-delay
6054The maximum conflict delay for an insn to be considered for speculative motion.
6055The default value is 3.
6056
6057@item sched-spec-prob-cutoff
6058The minimal probability of speculation success (in percents), so that
6059speculative insn will be scheduled.
6060The default value is 40.
6061
6062@item max-last-value-rtl
6063
6064The maximum size measured as number of RTLs that can be recorded in an expression
6065in combiner for a pseudo register as last known value of that register.  The default
6066is 10000.
6067
6068@item integer-share-limit
6069Small integer constants can use a shared data structure, reducing the
6070compiler's memory usage and increasing its speed.  This sets the maximum
6071value of a shared integer constant's.  The default value is 256.
6072
6073@item min-virtual-mappings
6074Specifies the minimum number of virtual mappings in the incremental
6075SSA updater that should be registered to trigger the virtual mappings
6076heuristic defined by virtual-mappings-ratio.  The default value is
6077100.
6078
6079@item virtual-mappings-ratio
6080If the number of virtual mappings is virtual-mappings-ratio bigger
6081than the number of virtual symbols to be updated, then the incremental
6082SSA updater switches to a full update for those symbols.  The default
6083ratio is 3.
6084
6085@item ssp-buffer-size
6086The minimum size of buffers (i.e. arrays) that will receive stack smashing
6087protection when @option{-fstack-protection} is used.
6088
6089@item max-jump-thread-duplication-stmts
6090Maximum number of statements allowed in a block that needs to be
6091duplicated when threading jumps.
6092
6093@item max-fields-for-field-sensitive
6094Maximum number of fields in a structure we will treat in
6095a field sensitive manner during pointer analysis.
6096
6097@end table
6098@end table
6099
6100@node Preprocessor Options
6101@section Options Controlling the Preprocessor
6102@cindex preprocessor options
6103@cindex options, preprocessor
6104
6105These options control the C preprocessor, which is run on each C source
6106file before actual compilation.
6107
6108If you use the @option{-E} option, nothing is done except preprocessing.
6109Some of these options make sense only together with @option{-E} because
6110they cause the preprocessor output to be unsuitable for actual
6111compilation.
6112
6113@table @gcctabopt
6114@opindex Wp
6115You can use @option{-Wp,@var{option}} to bypass the compiler driver
6116and pass @var{option} directly through to the preprocessor.  If
6117@var{option} contains commas, it is split into multiple options at the
6118commas.  However, many options are modified, translated or interpreted
6119by the compiler driver before being passed to the preprocessor, and
6120@option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
6121interface is undocumented and subject to change, so whenever possible
6122you should avoid using @option{-Wp} and let the driver handle the
6123options instead.
6124
6125@item -Xpreprocessor @var{option}
6126@opindex preprocessor
6127Pass @var{option} as an option to the preprocessor.  You can use this to
6128supply system-specific preprocessor options which GCC does not know how to
6129recognize.
6130
6131If you want to pass an option that takes an argument, you must use
6132@option{-Xpreprocessor} twice, once for the option and once for the argument.
6133@end table
6134
6135@include cppopts.texi
6136
6137@node Assembler Options
6138@section Passing Options to the Assembler
6139
6140@c prevent bad page break with this line
6141You can pass options to the assembler.
6142
6143@table @gcctabopt
6144@item -Wa,@var{option}
6145@opindex Wa
6146Pass @var{option} as an option to the assembler.  If @var{option}
6147contains commas, it is split into multiple options at the commas.
6148
6149@item -Xassembler @var{option}
6150@opindex Xassembler
6151Pass @var{option} as an option to the assembler.  You can use this to
6152supply system-specific assembler options which GCC does not know how to
6153recognize.
6154
6155If you want to pass an option that takes an argument, you must use
6156@option{-Xassembler} twice, once for the option and once for the argument.
6157
6158@end table
6159
6160@node Link Options
6161@section Options for Linking
6162@cindex link options
6163@cindex options, linking
6164
6165These options come into play when the compiler links object files into
6166an executable output file.  They are meaningless if the compiler is
6167not doing a link step.
6168
6169@table @gcctabopt
6170@cindex file names
6171@item @var{object-file-name}
6172A file name that does not end in a special recognized suffix is
6173considered to name an object file or library.  (Object files are
6174distinguished from libraries by the linker according to the file
6175contents.)  If linking is done, these object files are used as input
6176to the linker.
6177
6178@item -c
6179@itemx -S
6180@itemx -E
6181@opindex c
6182@opindex S
6183@opindex E
6184If any of these options is used, then the linker is not run, and
6185object file names should not be used as arguments.  @xref{Overall
6186Options}.
6187
6188@cindex Libraries
6189@item -l@var{library}
6190@itemx -l @var{library}
6191@opindex l
6192Search the library named @var{library} when linking.  (The second
6193alternative with the library as a separate argument is only for
6194POSIX compliance and is not recommended.)
6195
6196It makes a difference where in the command you write this option; the
6197linker searches and processes libraries and object files in the order they
6198are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
6199after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
6200to functions in @samp{z}, those functions may not be loaded.
6201
6202The linker searches a standard list of directories for the library,
6203which is actually a file named @file{lib@var{library}.a}.  The linker
6204then uses this file as if it had been specified precisely by name.
6205
6206The directories searched include several standard system directories
6207plus any that you specify with @option{-L}.
6208
6209Normally the files found this way are library files---archive files
6210whose members are object files.  The linker handles an archive file by
6211scanning through it for members which define symbols that have so far
6212been referenced but not defined.  But if the file that is found is an
6213ordinary object file, it is linked in the usual fashion.  The only
6214difference between using an @option{-l} option and specifying a file name
6215is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
6216and searches several directories.
6217
6218@item -nostartfiles
6219@opindex nostartfiles
6220Do not use the standard system startup files when linking.
6221The standard system libraries are used normally, unless @option{-nostdlib}
6222or @option{-nodefaultlibs} is used.
6223
6224@item -nodefaultlibs
6225@opindex nodefaultlibs
6226Do not use the standard system libraries when linking.
6227Only the libraries you specify will be passed to the linker.
6228The standard startup files are used normally, unless @option{-nostartfiles}
6229is used.  The compiler may generate calls to @code{memcmp},
6230@code{memset}, @code{memcpy} and @code{memmove}.
6231These entries are usually resolved by entries in
6232libc.  These entry points should be supplied through some other
6233mechanism when this option is specified.
6234
6235@item -nostdlib
6236@opindex nostdlib
6237Do not use the standard system startup files or libraries when linking.
6238No startup files and only the libraries you specify will be passed to
6239the linker.  The compiler may generate calls to @code{memcmp}, @code{memset},
6240@code{memcpy} and @code{memmove}.
6241These entries are usually resolved by entries in
6242libc.  These entry points should be supplied through some other
6243mechanism when this option is specified.
6244
6245@cindex @option{-lgcc}, use with @option{-nostdlib}
6246@cindex @option{-nostdlib} and unresolved references
6247@cindex unresolved references and @option{-nostdlib}
6248@cindex @option{-lgcc}, use with @option{-nodefaultlibs}
6249@cindex @option{-nodefaultlibs} and unresolved references
6250@cindex unresolved references and @option{-nodefaultlibs}
6251One of the standard libraries bypassed by @option{-nostdlib} and
6252@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
6253that GCC uses to overcome shortcomings of particular machines, or special
6254needs for some languages.
6255(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
6256Collection (GCC) Internals},
6257for more discussion of @file{libgcc.a}.)
6258In most cases, you need @file{libgcc.a} even when you want to avoid
6259other standard libraries.  In other words, when you specify @option{-nostdlib}
6260or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
6261This ensures that you have no unresolved references to internal GCC
6262library subroutines.  (For example, @samp{__main}, used to ensure C++
6263constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
6264GNU Compiler Collection (GCC) Internals}.)
6265
6266@item -pie
6267@opindex pie
6268Produce a position independent executable on targets which support it.
6269For predictable results, you must also specify the same set of options
6270that were used to generate code (@option{-fpie}, @option{-fPIE},
6271or model suboptions) when you specify this option.
6272
6273@item -rdynamic
6274@opindex rdynamic
6275Pass the flag @option{-export-dynamic} to the ELF linker, on targets
6276that support it. This instructs the linker to add all symbols, not
6277only used ones, to the dynamic symbol table. This option is needed
6278for some uses of @code{dlopen} or to allow obtaining backtraces
6279from within a program.
6280
6281@item -s
6282@opindex s
6283Remove all symbol table and relocation information from the executable.
6284
6285@item -static
6286@opindex static
6287On systems that support dynamic linking, this prevents linking with the shared
6288libraries.  On other systems, this option has no effect.
6289
6290@item -shared
6291@opindex shared
6292Produce a shared object which can then be linked with other objects to
6293form an executable.  Not all systems support this option.  For predictable
6294results, you must also specify the same set of options that were used to
6295generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
6296when you specify this option.@footnote{On some systems, @samp{gcc -shared}
6297needs to build supplementary stub code for constructors to work.  On
6298multi-libbed systems, @samp{gcc -shared} must select the correct support
6299libraries to link against.  Failing to supply the correct flags may lead
6300to subtle defects.  Supplying them in cases where they are not necessary
6301is innocuous.}
6302
6303@item -shared-libgcc
6304@itemx -static-libgcc
6305@opindex shared-libgcc
6306@opindex static-libgcc
6307On systems that provide @file{libgcc} as a shared library, these options
6308force the use of either the shared or static version respectively.
6309If no shared version of @file{libgcc} was built when the compiler was
6310configured, these options have no effect.
6311
6312There are several situations in which an application should use the
6313shared @file{libgcc} instead of the static version.  The most common
6314of these is when the application wishes to throw and catch exceptions
6315across different shared libraries.  In that case, each of the libraries
6316as well as the application itself should use the shared @file{libgcc}.
6317
6318Therefore, the G++ and GCJ drivers automatically add
6319@option{-shared-libgcc} whenever you build a shared library or a main
6320executable, because C++ and Java programs typically use exceptions, so
6321this is the right thing to do.
6322
6323If, instead, you use the GCC driver to create shared libraries, you may
6324find that they will not always be linked with the shared @file{libgcc}.
6325If GCC finds, at its configuration time, that you have a non-GNU linker
6326or a GNU linker that does not support option @option{--eh-frame-hdr},
6327it will link the shared version of @file{libgcc} into shared libraries
6328by default.  Otherwise, it will take advantage of the linker and optimize
6329away the linking with the shared version of @file{libgcc}, linking with
6330the static version of libgcc by default.  This allows exceptions to
6331propagate through such shared libraries, without incurring relocation
6332costs at library load time.
6333
6334However, if a library or main executable is supposed to throw or catch
6335exceptions, you must link it using the G++ or GCJ driver, as appropriate
6336for the languages used in the program, or using the option
6337@option{-shared-libgcc}, such that it is linked with the shared
6338@file{libgcc}.
6339
6340@item -symbolic
6341@opindex symbolic
6342Bind references to global symbols when building a shared object.  Warn
6343about any unresolved references (unless overridden by the link editor
6344option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
6345this option.
6346
6347@item -Xlinker @var{option}
6348@opindex Xlinker
6349Pass @var{option} as an option to the linker.  You can use this to
6350supply system-specific linker options which GCC does not know how to
6351recognize.
6352
6353If you want to pass an option that takes an argument, you must use
6354@option{-Xlinker} twice, once for the option and once for the argument.
6355For example, to pass @option{-assert definitions}, you must write
6356@samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
6357@option{-Xlinker "-assert definitions"}, because this passes the entire
6358string as a single argument, which is not what the linker expects.
6359
6360@item -Wl,@var{option}
6361@opindex Wl
6362Pass @var{option} as an option to the linker.  If @var{option} contains
6363commas, it is split into multiple options at the commas.
6364
6365@item -u @var{symbol}
6366@opindex u
6367Pretend the symbol @var{symbol} is undefined, to force linking of
6368library modules to define it.  You can use @option{-u} multiple times with
6369different symbols to force loading of additional library modules.
6370@end table
6371
6372@node Directory Options
6373@section Options for Directory Search
6374@cindex directory options
6375@cindex options, directory search
6376@cindex search path
6377
6378These options specify directories to search for header files, for
6379libraries and for parts of the compiler:
6380
6381@table @gcctabopt
6382@item -I@var{dir}
6383@opindex I
6384Add the directory @var{dir} to the head of the list of directories to be
6385searched for header files.  This can be used to override a system header
6386file, substituting your own version, since these directories are
6387searched before the system header file directories.  However, you should
6388not use this option to add directories that contain vendor-supplied
6389system header files (use @option{-isystem} for that).  If you use more than
6390one @option{-I} option, the directories are scanned in left-to-right
6391order; the standard system directories come after.
6392
6393If a standard system include directory, or a directory specified with
6394@option{-isystem}, is also specified with @option{-I}, the @option{-I}
6395option will be ignored.  The directory will still be searched but as a
6396system directory at its normal position in the system include chain.
6397This is to ensure that GCC's procedure to fix buggy system headers and
6398the ordering for the include_next directive are not inadvertently changed.
6399If you really need to change the search order for system directories,
6400use the @option{-nostdinc} and/or @option{-isystem} options.
6401
6402@item -iquote@var{dir}
6403@opindex iquote
6404Add the directory @var{dir} to the head of the list of directories to
6405be searched for header files only for the case of @samp{#include
6406"@var{file}"}; they are not searched for @samp{#include <@var{file}>},
6407otherwise just like @option{-I}.
6408
6409@item -L@var{dir}
6410@opindex L
6411Add directory @var{dir} to the list of directories to be searched
6412for @option{-l}.
6413
6414@item -B@var{prefix}
6415@opindex B
6416This option specifies where to find the executables, libraries,
6417include files, and data files of the compiler itself.
6418
6419The compiler driver program runs one or more of the subprograms
6420@file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
6421@var{prefix} as a prefix for each program it tries to run, both with and
6422without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
6423
6424For each subprogram to be run, the compiler driver first tries the
6425@option{-B} prefix, if any.  If that name is not found, or if @option{-B}
6426was not specified, the driver tries two standard prefixes, which are
6427@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
6428those results in a file name that is found, the unmodified program
6429name is searched for using the directories specified in your
6430@env{PATH} environment variable.
6431
6432The compiler will check to see if the path provided by the @option{-B}
6433refers to a directory, and if necessary it will add a directory
6434separator character at the end of the path.
6435
6436@option{-B} prefixes that effectively specify directory names also apply
6437to libraries in the linker, because the compiler translates these
6438options into @option{-L} options for the linker.  They also apply to
6439includes files in the preprocessor, because the compiler translates these
6440options into @option{-isystem} options for the preprocessor.  In this case,
6441the compiler appends @samp{include} to the prefix.
6442
6443The run-time support file @file{libgcc.a} can also be searched for using
6444the @option{-B} prefix, if needed.  If it is not found there, the two
6445standard prefixes above are tried, and that is all.  The file is left
6446out of the link if it is not found by those means.
6447
6448Another way to specify a prefix much like the @option{-B} prefix is to use
6449the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
6450Variables}.
6451
6452As a special kludge, if the path provided by @option{-B} is
6453@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
64549, then it will be replaced by @file{[dir/]include}.  This is to help
6455with boot-strapping the compiler.
6456
6457@item -specs=@var{file}
6458@opindex specs
6459Process @var{file} after the compiler reads in the standard @file{specs}
6460file, in order to override the defaults that the @file{gcc} driver
6461program uses when determining what switches to pass to @file{cc1},
6462@file{cc1plus}, @file{as}, @file{ld}, etc.  More than one
6463@option{-specs=@var{file}} can be specified on the command line, and they
6464are processed in order, from left to right.
6465
6466@item --sysroot=@var{dir}
6467@opindex sysroot
6468Use @var{dir} as the logical root directory for headers and libraries.
6469For example, if the compiler would normally search for headers in
6470@file{/usr/include} and libraries in @file{/usr/lib}, it will instead
6471search @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.  
6472
6473If you use both this option and the @option{-isysroot} option, then
6474the @option{--sysroot} option will apply to libraries, but the
6475@option{-isysroot} option will apply to header files.
6476
6477The GNU linker (beginning with version 2.16) has the necessary support
6478for this option.  If your linker does not support this option, the
6479header file aspect of @option{--sysroot} will still work, but the
6480library aspect will not.
6481
6482@item -I-
6483@opindex I-
6484This option has been deprecated.  Please use @option{-iquote} instead for
6485@option{-I} directories before the @option{-I-} and remove the @option{-I-}.
6486Any directories you specify with @option{-I} options before the @option{-I-}
6487option are searched only for the case of @samp{#include "@var{file}"};
6488they are not searched for @samp{#include <@var{file}>}.
6489
6490If additional directories are specified with @option{-I} options after
6491the @option{-I-}, these directories are searched for all @samp{#include}
6492directives.  (Ordinarily @emph{all} @option{-I} directories are used
6493this way.)
6494
6495In addition, the @option{-I-} option inhibits the use of the current
6496directory (where the current input file came from) as the first search
6497directory for @samp{#include "@var{file}"}.  There is no way to
6498override this effect of @option{-I-}.  With @option{-I.} you can specify
6499searching the directory which was current when the compiler was
6500invoked.  That is not exactly the same as what the preprocessor does
6501by default, but it is often satisfactory.
6502
6503@option{-I-} does not inhibit the use of the standard system directories
6504for header files.  Thus, @option{-I-} and @option{-nostdinc} are
6505independent.
6506@end table
6507
6508@c man end
6509
6510@node Spec Files
6511@section Specifying subprocesses and the switches to pass to them
6512@cindex Spec Files
6513
6514@command{gcc} is a driver program.  It performs its job by invoking a
6515sequence of other programs to do the work of compiling, assembling and
6516linking.  GCC interprets its command-line parameters and uses these to
6517deduce which programs it should invoke, and which command-line options
6518it ought to place on their command lines.  This behavior is controlled
6519by @dfn{spec strings}.  In most cases there is one spec string for each
6520program that GCC can invoke, but a few programs have multiple spec
6521strings to control their behavior.  The spec strings built into GCC can
6522be overridden by using the @option{-specs=} command-line switch to specify
6523a spec file.
6524
6525@dfn{Spec files} are plaintext files that are used to construct spec
6526strings.  They consist of a sequence of directives separated by blank
6527lines.  The type of directive is determined by the first non-whitespace
6528character on the line and it can be one of the following:
6529
6530@table @code
6531@item %@var{command}
6532Issues a @var{command} to the spec file processor.  The commands that can
6533appear here are:
6534
6535@table @code
6536@item %include <@var{file}>
6537@cindex %include
6538Search for @var{file} and insert its text at the current point in the
6539specs file.
6540
6541@item %include_noerr <@var{file}>
6542@cindex %include_noerr
6543Just like @samp{%include}, but do not generate an error message if the include
6544file cannot be found.
6545
6546@item %rename @var{old_name} @var{new_name}
6547@cindex %rename
6548Rename the spec string @var{old_name} to @var{new_name}.
6549
6550@end table
6551
6552@item *[@var{spec_name}]:
6553This tells the compiler to create, override or delete the named spec
6554string.  All lines after this directive up to the next directive or
6555blank line are considered to be the text for the spec string.  If this
6556results in an empty string then the spec will be deleted.  (Or, if the
6557spec did not exist, then nothing will happened.)  Otherwise, if the spec
6558does not currently exist a new spec will be created.  If the spec does
6559exist then its contents will be overridden by the text of this
6560directive, unless the first character of that text is the @samp{+}
6561character, in which case the text will be appended to the spec.
6562
6563@item [@var{suffix}]:
6564Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
6565and up to the next directive or blank line are considered to make up the
6566spec string for the indicated suffix.  When the compiler encounters an
6567input file with the named suffix, it will processes the spec string in
6568order to work out how to compile that file.  For example:
6569
6570@smallexample
6571.ZZ:
6572z-compile -input %i
6573@end smallexample
6574
6575This says that any input file whose name ends in @samp{.ZZ} should be
6576passed to the program @samp{z-compile}, which should be invoked with the
6577command-line switch @option{-input} and with the result of performing the
6578@samp{%i} substitution.  (See below.)
6579
6580As an alternative to providing a spec string, the text that follows a
6581suffix directive can be one of the following:
6582
6583@table @code
6584@item @@@var{language}
6585This says that the suffix is an alias for a known @var{language}.  This is
6586similar to using the @option{-x} command-line switch to GCC to specify a
6587language explicitly.  For example:
6588
6589@smallexample
6590.ZZ:
6591@@c++
6592@end smallexample
6593
6594Says that .ZZ files are, in fact, C++ source files.
6595
6596@item #@var{name}
6597This causes an error messages saying:
6598
6599@smallexample
6600@var{name} compiler not installed on this system.
6601@end smallexample
6602@end table
6603
6604GCC already has an extensive list of suffixes built into it.
6605This directive will add an entry to the end of the list of suffixes, but
6606since the list is searched from the end backwards, it is effectively
6607possible to override earlier entries using this technique.
6608
6609@end table
6610
6611GCC has the following spec strings built into it.  Spec files can
6612override these strings or create their own.  Note that individual
6613targets can also add their own spec strings to this list.
6614
6615@smallexample
6616asm          Options to pass to the assembler
6617asm_final    Options to pass to the assembler post-processor
6618cpp          Options to pass to the C preprocessor
6619cc1          Options to pass to the C compiler
6620cc1plus      Options to pass to the C++ compiler
6621endfile      Object files to include at the end of the link
6622link         Options to pass to the linker
6623lib          Libraries to include on the command line to the linker
6624libgcc       Decides which GCC support library to pass to the linker
6625linker       Sets the name of the linker
6626predefines   Defines to be passed to the C preprocessor
6627signed_char  Defines to pass to CPP to say whether @code{char} is signed
6628             by default
6629startfile    Object files to include at the start of the link
6630@end smallexample
6631
6632Here is a small example of a spec file:
6633
6634@smallexample
6635%rename lib                 old_lib
6636
6637*lib:
6638--start-group -lgcc -lc -leval1 --end-group %(old_lib)
6639@end smallexample
6640
6641This example renames the spec called @samp{lib} to @samp{old_lib} and
6642then overrides the previous definition of @samp{lib} with a new one.
6643The new definition adds in some extra command-line options before
6644including the text of the old definition.
6645
6646@dfn{Spec strings} are a list of command-line options to be passed to their
6647corresponding program.  In addition, the spec strings can contain
6648@samp{%}-prefixed sequences to substitute variable text or to
6649conditionally insert text into the command line.  Using these constructs
6650it is possible to generate quite complex command lines.
6651
6652Here is a table of all defined @samp{%}-sequences for spec
6653strings.  Note that spaces are not generated automatically around the
6654results of expanding these sequences.  Therefore you can concatenate them
6655together or combine them with constant text in a single argument.
6656
6657@table @code
6658@item %%
6659Substitute one @samp{%} into the program name or argument.
6660
6661@item %i
6662Substitute the name of the input file being processed.
6663
6664@item %b
6665Substitute the basename of the input file being processed.
6666This is the substring up to (and not including) the last period
6667and not including the directory.
6668
6669@item %B
6670This is the same as @samp{%b}, but include the file suffix (text after
6671the last period).
6672
6673@item %d
6674Marks the argument containing or following the @samp{%d} as a
6675temporary file name, so that that file will be deleted if GCC exits
6676successfully.  Unlike @samp{%g}, this contributes no text to the
6677argument.
6678
6679@item %g@var{suffix}
6680Substitute a file name that has suffix @var{suffix} and is chosen
6681once per compilation, and mark the argument in the same way as
6682@samp{%d}.  To reduce exposure to denial-of-service attacks, the file
6683name is now chosen in a way that is hard to predict even when previously
6684chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
6685might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
6686the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
6687treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
6688was simply substituted with a file name chosen once per compilation,
6689without regard to any appended suffix (which was therefore treated
6690just like ordinary text), making such attacks more likely to succeed.
6691
6692@item %u@var{suffix}
6693Like @samp{%g}, but generates a new temporary file name even if
6694@samp{%u@var{suffix}} was already seen.
6695
6696@item %U@var{suffix}
6697Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
6698new one if there is no such last file name.  In the absence of any
6699@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
6700the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
6701would involve the generation of two distinct file names, one
6702for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
6703simply substituted with a file name chosen for the previous @samp{%u},
6704without regard to any appended suffix.
6705
6706@item %j@var{suffix}
6707Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
6708writable, and if save-temps is off; otherwise, substitute the name
6709of a temporary file, just like @samp{%u}.  This temporary file is not
6710meant for communication between processes, but rather as a junk
6711disposal mechanism.
6712
6713@item %|@var{suffix}
6714@itemx %m@var{suffix}
6715Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
6716@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
6717all.  These are the two most common ways to instruct a program that it
6718should read from standard input or write to standard output.  If you
6719need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
6720construct: see for example @file{f/lang-specs.h}.
6721
6722@item %.@var{SUFFIX}
6723Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
6724when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
6725terminated by the next space or %.
6726
6727@item %w
6728Marks the argument containing or following the @samp{%w} as the
6729designated output file of this compilation.  This puts the argument
6730into the sequence of arguments that @samp{%o} will substitute later.
6731
6732@item %o
6733Substitutes the names of all the output files, with spaces
6734automatically placed around them.  You should write spaces
6735around the @samp{%o} as well or the results are undefined.
6736@samp{%o} is for use in the specs for running the linker.
6737Input files whose names have no recognized suffix are not compiled
6738at all, but they are included among the output files, so they will
6739be linked.
6740
6741@item %O
6742Substitutes the suffix for object files.  Note that this is
6743handled specially when it immediately follows @samp{%g, %u, or %U},
6744because of the need for those to form complete file names.  The
6745handling is such that @samp{%O} is treated exactly as if it had already
6746been substituted, except that @samp{%g, %u, and %U} do not currently
6747support additional @var{suffix} characters following @samp{%O} as they would
6748following, for example, @samp{.o}.
6749
6750@item %p
6751Substitutes the standard macro predefinitions for the
6752current target machine.  Use this when running @code{cpp}.
6753
6754@item %P
6755Like @samp{%p}, but puts @samp{__} before and after the name of each
6756predefined macro, except for macros that start with @samp{__} or with
6757@samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
6758C@.
6759
6760@item %I
6761Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
6762@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
6763@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
6764and @option{-imultilib} as necessary.
6765
6766@item %s
6767Current argument is the name of a library or startup file of some sort.
6768Search for that file in a standard list of directories and substitute
6769the full name found.
6770
6771@item %e@var{str}
6772Print @var{str} as an error message.  @var{str} is terminated by a newline.
6773Use this when inconsistent options are detected.
6774
6775@item %(@var{name})
6776Substitute the contents of spec string @var{name} at this point.
6777
6778@item %[@var{name}]
6779Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
6780
6781@item %x@{@var{option}@}
6782Accumulate an option for @samp{%X}.
6783
6784@item %X
6785Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
6786spec string.
6787
6788@item %Y
6789Output the accumulated assembler options specified by @option{-Wa}.
6790
6791@item %Z
6792Output the accumulated preprocessor options specified by @option{-Wp}.
6793
6794@item %a
6795Process the @code{asm} spec.  This is used to compute the
6796switches to be passed to the assembler.
6797
6798@item %A
6799Process the @code{asm_final} spec.  This is a spec string for
6800passing switches to an assembler post-processor, if such a program is
6801needed.
6802
6803@item %l
6804Process the @code{link} spec.  This is the spec for computing the
6805command line passed to the linker.  Typically it will make use of the
6806@samp{%L %G %S %D and %E} sequences.
6807
6808@item %D
6809Dump out a @option{-L} option for each directory that GCC believes might
6810contain startup files.  If the target supports multilibs then the
6811current multilib directory will be prepended to each of these paths.
6812
6813@item %L
6814Process the @code{lib} spec.  This is a spec string for deciding which
6815libraries should be included on the command line to the linker.
6816
6817@item %G
6818Process the @code{libgcc} spec.  This is a spec string for deciding
6819which GCC support library should be included on the command line to the linker.
6820
6821@item %S
6822Process the @code{startfile} spec.  This is a spec for deciding which
6823object files should be the first ones passed to the linker.  Typically
6824this might be a file named @file{crt0.o}.
6825
6826@item %E
6827Process the @code{endfile} spec.  This is a spec string that specifies
6828the last object files that will be passed to the linker.
6829
6830@item %C
6831Process the @code{cpp} spec.  This is used to construct the arguments
6832to be passed to the C preprocessor.
6833
6834@item %1
6835Process the @code{cc1} spec.  This is used to construct the options to be
6836passed to the actual C compiler (@samp{cc1}).
6837
6838@item %2
6839Process the @code{cc1plus} spec.  This is used to construct the options to be
6840passed to the actual C++ compiler (@samp{cc1plus}).
6841
6842@item %*
6843Substitute the variable part of a matched option.  See below.
6844Note that each comma in the substituted string is replaced by
6845a single space.
6846
6847@item %<@code{S}
6848Remove all occurrences of @code{-S} from the command line.  Note---this
6849command is position dependent.  @samp{%} commands in the spec string
6850before this one will see @code{-S}, @samp{%} commands in the spec string
6851after this one will not.
6852
6853@item %:@var{function}(@var{args})
6854Call the named function @var{function}, passing it @var{args}.
6855@var{args} is first processed as a nested spec string, then split
6856into an argument vector in the usual fashion.  The function returns
6857a string which is processed as if it had appeared literally as part
6858of the current spec.
6859
6860The following built-in spec functions are provided:
6861
6862@table @code
6863@item @code{if-exists}
6864The @code{if-exists} spec function takes one argument, an absolute
6865pathname to a file.  If the file exists, @code{if-exists} returns the
6866pathname.  Here is a small example of its usage:
6867
6868@smallexample
6869*startfile:
6870crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
6871@end smallexample
6872
6873@item @code{if-exists-else}
6874The @code{if-exists-else} spec function is similar to the @code{if-exists}
6875spec function, except that it takes two arguments.  The first argument is
6876an absolute pathname to a file.  If the file exists, @code{if-exists-else}
6877returns the pathname.  If it does not exist, it returns the second argument.
6878This way, @code{if-exists-else} can be used to select one file or another,
6879based on the existence of the first.  Here is a small example of its usage:
6880
6881@smallexample
6882*startfile:
6883crt0%O%s %:if-exists(crti%O%s) \
6884%:if-exists-else(crtbeginT%O%s crtbegin%O%s)
6885@end smallexample
6886
6887@item @code{replace-outfile}
6888The @code{replace-outfile} spec function takes two arguments.  It looks for the
6889first argument in the outfiles array and replaces it with the second argument.  Here
6890is a small example of its usage:
6891
6892@smallexample
6893%@{static|static-libgcc|static-libstdc++:%:replace-outfile(-lstdc++ \
6894libstdc++.a%s)@}
6895
6896@end smallexample
6897
6898@end table
6899
6900@item %@{@code{S}@}
6901Substitutes the @code{-S} switch, if that switch was given to GCC@.
6902If that switch was not specified, this substitutes nothing.  Note that
6903the leading dash is omitted when specifying this option, and it is
6904automatically inserted if the substitution is performed.  Thus the spec
6905string @samp{%@{foo@}} would match the command-line option @option{-foo}
6906and would output the command line option @option{-foo}.
6907
6908@item %W@{@code{S}@}
6909Like %@{@code{S}@} but mark last argument supplied within as a file to be
6910deleted on failure.
6911
6912@item %@{@code{S}*@}
6913Substitutes all the switches specified to GCC whose names start
6914with @code{-S}, but which also take an argument.  This is used for
6915switches like @option{-o}, @option{-D}, @option{-I}, etc.
6916GCC considers @option{-o foo} as being
6917one switch whose names starts with @samp{o}.  %@{o*@} would substitute this
6918text, including the space.  Thus two arguments would be generated.
6919
6920@item %@{@code{S}*&@code{T}*@}
6921Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
6922(the order of @code{S} and @code{T} in the spec is not significant).
6923There can be any number of ampersand-separated variables; for each the
6924wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
6925
6926@item %@{@code{S}:@code{X}@}
6927Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
6928
6929@item %@{!@code{S}:@code{X}@}
6930Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
6931
6932@item %@{@code{S}*:@code{X}@}
6933Substitutes @code{X} if one or more switches whose names start with
6934@code{-S} are specified to GCC@.  Normally @code{X} is substituted only
6935once, no matter how many such switches appeared.  However, if @code{%*}
6936appears somewhere in @code{X}, then @code{X} will be substituted once
6937for each matching switch, with the @code{%*} replaced by the part of
6938that switch that matched the @code{*}.
6939
6940@item %@{.@code{S}:@code{X}@}
6941Substitutes @code{X}, if processing a file with suffix @code{S}.
6942
6943@item %@{!.@code{S}:@code{X}@}
6944Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
6945
6946@item %@{@code{S}|@code{P}:@code{X}@}
6947Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@.
6948This may be combined with @samp{!}, @samp{.}, and @code{*} sequences as well,
6949although they have a stronger binding than the @samp{|}.  If @code{%*}
6950appears in @code{X}, all of the alternatives must be starred, and only
6951the first matching alternative is substituted.
6952
6953For example, a spec string like this:
6954
6955@smallexample
6956%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
6957@end smallexample
6958
6959will output the following command-line options from the following input
6960command-line options:
6961
6962@smallexample
6963fred.c        -foo -baz
6964jim.d         -bar -boggle
6965-d fred.c     -foo -baz -boggle
6966-d jim.d      -bar -baz -boggle
6967@end smallexample
6968
6969@item %@{S:X; T:Y; :D@}
6970
6971If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
6972given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
6973be as many clauses as you need.  This may be combined with @code{.},
6974@code{!}, @code{|}, and @code{*} as needed.
6975
6976
6977@end table
6978
6979The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
6980construct may contain other nested @samp{%} constructs or spaces, or
6981even newlines.  They are processed as usual, as described above.
6982Trailing white space in @code{X} is ignored.  White space may also
6983appear anywhere on the left side of the colon in these constructs,
6984except between @code{.} or @code{*} and the corresponding word.
6985
6986The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
6987handled specifically in these constructs.  If another value of
6988@option{-O} or the negated form of a @option{-f}, @option{-m}, or
6989@option{-W} switch is found later in the command line, the earlier
6990switch value is ignored, except with @{@code{S}*@} where @code{S} is
6991just one letter, which passes all matching options.
6992
6993The character @samp{|} at the beginning of the predicate text is used to
6994indicate that a command should be piped to the following command, but
6995only if @option{-pipe} is specified.
6996
6997It is built into GCC which switches take arguments and which do not.
6998(You might think it would be useful to generalize this to allow each
6999compiler's spec to say which switches take arguments.  But this cannot
7000be done in a consistent fashion.  GCC cannot even decide which input
7001files have been specified without knowing which switches take arguments,
7002and it must know which input files to compile in order to tell which
7003compilers to run).
7004
7005GCC also knows implicitly that arguments starting in @option{-l} are to be
7006treated as compiler output files, and passed to the linker in their
7007proper position among the other output files.
7008
7009@c man begin OPTIONS
7010
7011@node Target Options
7012@section Specifying Target Machine and Compiler Version
7013@cindex target options
7014@cindex cross compiling
7015@cindex specifying machine version
7016@cindex specifying compiler version and target machine
7017@cindex compiler version, specifying
7018@cindex target machine, specifying
7019
7020The usual way to run GCC is to run the executable called @file{gcc}, or
7021@file{<machine>-gcc} when cross-compiling, or
7022@file{<machine>-gcc-<version>} to run a version other than the one that
7023was installed last.  Sometimes this is inconvenient, so GCC provides
7024options that will switch to another cross-compiler or version.
7025
7026@table @gcctabopt
7027@item -b @var{machine}
7028@opindex b
7029The argument @var{machine} specifies the target machine for compilation.
7030
7031The value to use for @var{machine} is the same as was specified as the
7032machine type when configuring GCC as a cross-compiler.  For
7033example, if a cross-compiler was configured with @samp{configure
7034arm-elf}, meaning to compile for an arm processor with elf binaries,
7035then you would specify @option{-b arm-elf} to run that cross compiler.
7036Because there are other options beginning with @option{-b}, the
7037configuration must contain a hyphen. 
7038
7039@item -V @var{version}
7040@opindex V
7041The argument @var{version} specifies which version of GCC to run.
7042This is useful when multiple versions are installed.  For example,
7043@var{version} might be @samp{4.0}, meaning to run GCC version 4.0.
7044@end table
7045
7046The @option{-V} and @option{-b} options work by running the
7047@file{<machine>-gcc-<version>} executable, so there's no real reason to
7048use them if you can just run that directly.
7049
7050@node Submodel Options
7051@section Hardware Models and Configurations
7052@cindex submodel options
7053@cindex specifying hardware config
7054@cindex hardware models and configurations, specifying
7055@cindex machine dependent options
7056
7057Earlier we discussed the standard option @option{-b} which chooses among
7058different installed compilers for completely different target
7059machines, such as VAX vs.@: 68000 vs.@: 80386.
7060
7061In addition, each of these target machine types can have its own
7062special options, starting with @samp{-m}, to choose among various
7063hardware models or configurations---for example, 68010 vs 68020,
7064floating coprocessor or none.  A single installed version of the
7065compiler can compile for any model or configuration, according to the
7066options specified.
7067
7068Some configurations of the compiler also support additional special
7069options, usually for compatibility with other compilers on the same
7070platform.
7071
7072@c This list is ordered alphanumerically by subsection name.
7073@c It should be the same order and spelling as these options are listed
7074@c in Machine Dependent Options
7075
7076@menu
7077* ARC Options::
7078* ARM Options::
7079* AVR Options::
7080* Blackfin Options::
7081* CRIS Options::
7082* CRX Options::
7083* Darwin Options::
7084* DEC Alpha Options::
7085* DEC Alpha/VMS Options::
7086* FRV Options::
7087* GNU/Linux Options::
7088* H8/300 Options::
7089* HPPA Options::
7090* i386 and x86-64 Options::
7091* IA-64 Options::
7092* M32C Options::
7093* M32R/D Options::
7094* M680x0 Options::
7095* M68hc1x Options::
7096* MCore Options::
7097* MIPS Options::
7098* MMIX Options::
7099* MN10300 Options::
7100* MT Options::
7101* PDP-11 Options::
7102* PowerPC Options::
7103* RS/6000 and PowerPC Options::
7104* S/390 and zSeries Options::
7105* Score Options::
7106* SH Options::
7107* SPARC Options::
7108* System V Options::
7109* TMS320C3x/C4x Options::
7110* V850 Options::
7111* VAX Options::
7112* x86-64 Options::
7113* Xstormy16 Options::
7114* Xtensa Options::
7115* zSeries Options::
7116@end menu
7117
7118@node ARC Options
7119@subsection ARC Options
7120@cindex ARC Options
7121
7122These options are defined for ARC implementations:
7123
7124@table @gcctabopt
7125@item -EL
7126@opindex EL
7127Compile code for little endian mode.  This is the default.
7128
7129@item -EB
7130@opindex EB
7131Compile code for big endian mode.
7132
7133@item -mmangle-cpu
7134@opindex mmangle-cpu
7135Prepend the name of the cpu to all public symbol names.
7136In multiple-processor systems, there are many ARC variants with different
7137instruction and register set characteristics.  This flag prevents code
7138compiled for one cpu to be linked with code compiled for another.
7139No facility exists for handling variants that are ``almost identical''.
7140This is an all or nothing option.
7141
7142@item -mcpu=@var{cpu}
7143@opindex mcpu
7144Compile code for ARC variant @var{cpu}.
7145Which variants are supported depend on the configuration.
7146All variants support @option{-mcpu=base}, this is the default.
7147
7148@item -mtext=@var{text-section}
7149@itemx -mdata=@var{data-section}
7150@itemx -mrodata=@var{readonly-data-section}
7151@opindex mtext
7152@opindex mdata
7153@opindex mrodata
7154Put functions, data, and readonly data in @var{text-section},
7155@var{data-section}, and @var{readonly-data-section} respectively
7156by default.  This can be overridden with the @code{section} attribute.
7157@xref{Variable Attributes}.
7158
7159@end table
7160
7161@node ARM Options
7162@subsection ARM Options
7163@cindex ARM options
7164
7165These @samp{-m} options are defined for Advanced RISC Machines (ARM)
7166architectures:
7167
7168@table @gcctabopt
7169@item -mabi=@var{name}
7170@opindex mabi
7171Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
7172@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
7173
7174@item -mapcs-frame
7175@opindex mapcs-frame
7176Generate a stack frame that is compliant with the ARM Procedure Call
7177Standard for all functions, even if this is not strictly necessary for
7178correct execution of the code.  Specifying @option{-fomit-frame-pointer}
7179with this option will cause the stack frames not to be generated for
7180leaf functions.  The default is @option{-mno-apcs-frame}.
7181
7182@item -mapcs
7183@opindex mapcs
7184This is a synonym for @option{-mapcs-frame}.
7185
7186@ignore
7187@c not currently implemented
7188@item -mapcs-stack-check
7189@opindex mapcs-stack-check
7190Generate code to check the amount of stack space available upon entry to
7191every function (that actually uses some stack space).  If there is
7192insufficient space available then either the function
7193@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
7194called, depending upon the amount of stack space required.  The run time
7195system is required to provide these functions.  The default is
7196@option{-mno-apcs-stack-check}, since this produces smaller code.
7197
7198@c not currently implemented
7199@item -mapcs-float
7200@opindex mapcs-float
7201Pass floating point arguments using the float point registers.  This is
7202one of the variants of the APCS@.  This option is recommended if the
7203target hardware has a floating point unit or if a lot of floating point
7204arithmetic is going to be performed by the code.  The default is
7205@option{-mno-apcs-float}, since integer only code is slightly increased in
7206size if @option{-mapcs-float} is used.
7207
7208@c not currently implemented
7209@item -mapcs-reentrant
7210@opindex mapcs-reentrant
7211Generate reentrant, position independent code.  The default is
7212@option{-mno-apcs-reentrant}.
7213@end ignore
7214
7215@item -mthumb-interwork
7216@opindex mthumb-interwork
7217Generate code which supports calling between the ARM and Thumb
7218instruction sets.  Without this option the two instruction sets cannot
7219be reliably used inside one program.  The default is
7220@option{-mno-thumb-interwork}, since slightly larger code is generated
7221when @option{-mthumb-interwork} is specified.
7222
7223@item -mno-sched-prolog
7224@opindex mno-sched-prolog
7225Prevent the reordering of instructions in the function prolog, or the
7226merging of those instruction with the instructions in the function's
7227body.  This means that all functions will start with a recognizable set
7228of instructions (or in fact one of a choice from a small set of
7229different function prologues), and this information can be used to
7230locate the start if functions inside an executable piece of code.  The
7231default is @option{-msched-prolog}.
7232
7233@item -mhard-float
7234@opindex mhard-float
7235Generate output containing floating point instructions.  This is the
7236default.
7237
7238@item -msoft-float
7239@opindex msoft-float
7240Generate output containing library calls for floating point.
7241@strong{Warning:} the requisite libraries are not available for all ARM
7242targets.  Normally the facilities of the machine's usual C compiler are
7243used, but this cannot be done directly in cross-compilation.  You must make
7244your own arrangements to provide suitable library functions for
7245cross-compilation.
7246
7247@option{-msoft-float} changes the calling convention in the output file;
7248therefore, it is only useful if you compile @emph{all} of a program with
7249this option.  In particular, you need to compile @file{libgcc.a}, the
7250library that comes with GCC, with @option{-msoft-float} in order for
7251this to work.
7252
7253@item -mfloat-abi=@var{name}
7254@opindex mfloat-abi
7255Specifies which ABI to use for floating point values.  Permissible values
7256are: @samp{soft}, @samp{softfp} and @samp{hard}.
7257
7258@samp{soft} and @samp{hard} are equivalent to @option{-msoft-float}
7259and @option{-mhard-float} respectively.  @samp{softfp} allows the generation
7260of floating point instructions, but still uses the soft-float calling
7261conventions.
7262
7263@item -mlittle-endian
7264@opindex mlittle-endian
7265Generate code for a processor running in little-endian mode.  This is
7266the default for all standard configurations.
7267
7268@item -mbig-endian
7269@opindex mbig-endian
7270Generate code for a processor running in big-endian mode; the default is
7271to compile code for a little-endian processor.
7272
7273@item -mwords-little-endian
7274@opindex mwords-little-endian
7275This option only applies when generating code for big-endian processors.
7276Generate code for a little-endian word order but a big-endian byte
7277order.  That is, a byte order of the form @samp{32107654}.  Note: this
7278option should only be used if you require compatibility with code for
7279big-endian ARM processors generated by versions of the compiler prior to
72802.8.
7281
7282@item -mcpu=@var{name}
7283@opindex mcpu
7284This specifies the name of the target ARM processor.  GCC uses this name
7285to determine what kind of instructions it can emit when generating
7286assembly code.  Permissible names are: @samp{arm2}, @samp{arm250},
7287@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
7288@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
7289@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
7290@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
7291@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
7292@samp{arm8}, @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
7293@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
7294@samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
7295@samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
7296@samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
7297@samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
7298@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
7299@samp{arm1176jz-s}, @samp{arm1176jzf-s}, @samp{xscale}, @samp{iwmmxt},
7300@samp{ep9312}.
7301
7302@itemx -mtune=@var{name}
7303@opindex mtune
7304This option is very similar to the @option{-mcpu=} option, except that
7305instead of specifying the actual target processor type, and hence
7306restricting which instructions can be used, it specifies that GCC should
7307tune the performance of the code as if the target were of the type
7308specified in this option, but still choosing the instructions that it
7309will generate based on the cpu specified by a @option{-mcpu=} option.
7310For some ARM implementations better performance can be obtained by using
7311this option.
7312
7313@item -march=@var{name}
7314@opindex march
7315This specifies the name of the target ARM architecture.  GCC uses this
7316name to determine what kind of instructions it can emit when generating
7317assembly code.  This option can be used in conjunction with or instead
7318of the @option{-mcpu=} option.  Permissible names are: @samp{armv2},
7319@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
7320@samp{armv5}, @samp{armv5t}, @samp{armv5te}, @samp{armv6}, @samp{armv6j},
7321@samp{iwmmxt}, @samp{ep9312}.
7322
7323@item -mfpu=@var{name}
7324@itemx -mfpe=@var{number}
7325@itemx -mfp=@var{number}
7326@opindex mfpu
7327@opindex mfpe
7328@opindex mfp
7329This specifies what floating point hardware (or hardware emulation) is
7330available on the target.  Permissible names are: @samp{fpa}, @samp{fpe2},
7331@samp{fpe3}, @samp{maverick}, @samp{vfp}.  @option{-mfp} and @option{-mfpe}
7332are synonyms for @option{-mfpu}=@samp{fpe}@var{number}, for compatibility
7333with older versions of GCC@.
7334
7335If @option{-msoft-float} is specified this specifies the format of
7336floating point values.
7337
7338@item -mstructure-size-boundary=@var{n}
7339@opindex mstructure-size-boundary
7340The size of all structures and unions will be rounded up to a multiple
7341of the number of bits set by this option.  Permissible values are 8, 32
7342and 64.  The default value varies for different toolchains.  For the COFF
7343targeted toolchain the default value is 8.  A value of 64 is only allowed
7344if the underlying ABI supports it.
7345
7346Specifying the larger number can produce faster, more efficient code, but
7347can also increase the size of the program.  Different values are potentially
7348incompatible.  Code compiled with one value cannot necessarily expect to
7349work with code or libraries compiled with another value, if they exchange
7350information using structures or unions.
7351
7352@item -mabort-on-noreturn
7353@opindex mabort-on-noreturn
7354Generate a call to the function @code{abort} at the end of a
7355@code{noreturn} function.  It will be executed if the function tries to
7356return.
7357
7358@item -mlong-calls
7359@itemx -mno-long-calls
7360@opindex mlong-calls
7361@opindex mno-long-calls
7362Tells the compiler to perform function calls by first loading the
7363address of the function into a register and then performing a subroutine
7364call on this register.  This switch is needed if the target function
7365will lie outside of the 64 megabyte addressing range of the offset based
7366version of subroutine call instruction.
7367
7368Even if this switch is enabled, not all function calls will be turned
7369into long calls.  The heuristic is that static functions, functions
7370which have the @samp{short-call} attribute, functions that are inside
7371the scope of a @samp{#pragma no_long_calls} directive and functions whose
7372definitions have already been compiled within the current compilation
7373unit, will not be turned into long calls.  The exception to this rule is
7374that weak function definitions, functions with the @samp{long-call}
7375attribute or the @samp{section} attribute, and functions that are within
7376the scope of a @samp{#pragma long_calls} directive, will always be
7377turned into long calls.
7378
7379This feature is not enabled by default.  Specifying
7380@option{-mno-long-calls} will restore the default behavior, as will
7381placing the function calls within the scope of a @samp{#pragma
7382long_calls_off} directive.  Note these switches have no effect on how
7383the compiler generates code to handle function calls via function
7384pointers.
7385
7386@item -mnop-fun-dllimport
7387@opindex mnop-fun-dllimport
7388Disable support for the @code{dllimport} attribute.
7389
7390@item -msingle-pic-base
7391@opindex msingle-pic-base
7392Treat the register used for PIC addressing as read-only, rather than
7393loading it in the prologue for each function.  The run-time system is
7394responsible for initializing this register with an appropriate value
7395before execution begins.
7396
7397@item -mpic-register=@var{reg}
7398@opindex mpic-register
7399Specify the register to be used for PIC addressing.  The default is R10
7400unless stack-checking is enabled, when R9 is used.
7401
7402@item -mcirrus-fix-invalid-insns
7403@opindex mcirrus-fix-invalid-insns
7404@opindex mno-cirrus-fix-invalid-insns
7405Insert NOPs into the instruction stream to in order to work around
7406problems with invalid Maverick instruction combinations.  This option
7407is only valid if the @option{-mcpu=ep9312} option has been used to
7408enable generation of instructions for the Cirrus Maverick floating
7409point co-processor.  This option is not enabled by default, since the
7410problem is only present in older Maverick implementations.  The default
7411can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
7412switch.
7413
7414@item -mpoke-function-name
7415@opindex mpoke-function-name
7416Write the name of each function into the text section, directly
7417preceding the function prologue.  The generated code is similar to this:
7418
7419@smallexample
7420     t0
7421         .ascii "arm_poke_function_name", 0
7422         .align
7423     t1
7424         .word 0xff000000 + (t1 - t0)
7425     arm_poke_function_name
7426         mov     ip, sp
7427         stmfd   sp!, @{fp, ip, lr, pc@}
7428         sub     fp, ip, #4
7429@end smallexample
7430
7431When performing a stack backtrace, code can inspect the value of
7432@code{pc} stored at @code{fp + 0}.  If the trace function then looks at
7433location @code{pc - 12} and the top 8 bits are set, then we know that
7434there is a function name embedded immediately preceding this location
7435and has length @code{((pc[-3]) & 0xff000000)}.
7436
7437@item -mthumb
7438@opindex mthumb
7439Generate code for the 16-bit Thumb instruction set.  The default is to
7440use the 32-bit ARM instruction set.
7441
7442@item -mtpcs-frame
7443@opindex mtpcs-frame
7444Generate a stack frame that is compliant with the Thumb Procedure Call
7445Standard for all non-leaf functions.  (A leaf function is one that does
7446not call any other functions.)  The default is @option{-mno-tpcs-frame}.
7447
7448@item -mtpcs-leaf-frame
7449@opindex mtpcs-leaf-frame
7450Generate a stack frame that is compliant with the Thumb Procedure Call
7451Standard for all leaf functions.  (A leaf function is one that does
7452not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
7453
7454@item -mcallee-super-interworking
7455@opindex mcallee-super-interworking
7456Gives all externally visible functions in the file being compiled an ARM
7457instruction set header which switches to Thumb mode before executing the
7458rest of the function.  This allows these functions to be called from
7459non-interworking code.
7460
7461@item -mcaller-super-interworking
7462@opindex mcaller-super-interworking
7463Allows calls via function pointers (including virtual functions) to
7464execute correctly regardless of whether the target code has been
7465compiled for interworking or not.  There is a small overhead in the cost
7466of executing a function pointer if this option is enabled.
7467
7468@item -mtp=@var{name}
7469@opindex mtp
7470Specify the access model for the thread local storage pointer.  The valid
7471models are @option{soft}, which generates calls to @code{__aeabi_read_tp},
7472@option{cp15}, which fetches the thread pointer from @code{cp15} directly
7473(supported in the arm6k architecture), and @option{auto}, which uses the
7474best available method for the selected processor.  The default setting is
7475@option{auto}.
7476
7477@end table
7478
7479@node AVR Options
7480@subsection AVR Options
7481@cindex AVR Options
7482
7483These options are defined for AVR implementations:
7484
7485@table @gcctabopt
7486@item -mmcu=@var{mcu}
7487@opindex mmcu
7488Specify ATMEL AVR instruction set or MCU type.
7489
7490Instruction set avr1 is for the minimal AVR core, not supported by the C
7491compiler, only for assembler programs (MCU types: at90s1200, attiny10,
7492attiny11, attiny12, attiny15, attiny28).
7493
7494Instruction set avr2 (default) is for the classic AVR core with up to
74958K program memory space (MCU types: at90s2313, at90s2323, attiny22,
7496at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
7497at90c8534, at90s8535).
7498
7499Instruction set avr3 is for the classic AVR core with up to 128K program
7500memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
7501
7502Instruction set avr4 is for the enhanced AVR core with up to 8K program
7503memory space (MCU types: atmega8, atmega83, atmega85).
7504
7505Instruction set avr5 is for the enhanced AVR core with up to 128K program
7506memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
7507atmega64, atmega128, at43usb355, at94k).
7508
7509@item -msize
7510@opindex msize
7511Output instruction sizes to the asm file.
7512
7513@item -minit-stack=@var{N}
7514@opindex minit-stack
7515Specify the initial stack address, which may be a symbol or numeric value,
7516@samp{__stack} is the default.
7517
7518@item -mno-interrupts
7519@opindex mno-interrupts
7520Generated code is not compatible with hardware interrupts.
7521Code size will be smaller.
7522
7523@item -mcall-prologues
7524@opindex mcall-prologues
7525Functions prologues/epilogues expanded as call to appropriate
7526subroutines.  Code size will be smaller.
7527
7528@item -mno-tablejump
7529@opindex mno-tablejump
7530Do not generate tablejump insns which sometimes increase code size.
7531
7532@item -mtiny-stack
7533@opindex mtiny-stack
7534Change only the low 8 bits of the stack pointer.
7535
7536@item -mint8
7537@opindex mint8
7538Assume int to be 8 bit integer.  This affects the sizes of all types: A
7539char will be 1 byte, an int will be 1 byte, an long will be 2 bytes
7540and long long will be 4 bytes.  Please note that this option does not
7541comply to the C standards, but it will provide you with smaller code
7542size.
7543@end table
7544
7545@node Blackfin Options
7546@subsection Blackfin Options
7547@cindex Blackfin Options
7548
7549@table @gcctabopt
7550@item -momit-leaf-frame-pointer
7551@opindex momit-leaf-frame-pointer
7552Don't keep the frame pointer in a register for leaf functions.  This
7553avoids the instructions to save, set up and restore frame pointers and
7554makes an extra register available in leaf functions.  The option
7555@option{-fomit-frame-pointer} removes the frame pointer for all functions
7556which might make debugging harder.
7557
7558@item -mspecld-anomaly
7559@opindex mspecld-anomaly
7560When enabled, the compiler will ensure that the generated code does not
7561contain speculative loads after jump instructions.  This option is enabled
7562by default.
7563
7564@item -mno-specld-anomaly
7565@opindex mno-specld-anomaly
7566Don't generate extra code to prevent speculative loads from occurring.
7567
7568@item -mcsync-anomaly
7569@opindex mcsync-anomaly
7570When enabled, the compiler will ensure that the generated code does not
7571contain CSYNC or SSYNC instructions too soon after conditional branches.
7572This option is enabled by default.
7573
7574@item -mno-csync-anomaly
7575@opindex mno-csync-anomaly
7576Don't generate extra code to prevent CSYNC or SSYNC instructions from
7577occurring too soon after a conditional branch.
7578
7579@item -mlow-64k
7580@opindex mlow-64k
7581When enabled, the compiler is free to take advantage of the knowledge that
7582the entire program fits into the low 64k of memory.
7583
7584@item -mno-low-64k
7585@opindex mno-low-64k
7586Assume that the program is arbitrarily large.  This is the default.
7587
7588@item -mid-shared-library
7589@opindex mid-shared-library
7590Generate code that supports shared libraries via the library ID method.
7591This allows for execute in place and shared libraries in an environment
7592without virtual memory management.  This option implies @option{-fPIC}.
7593
7594@item -mno-id-shared-library
7595@opindex mno-id-shared-library
7596Generate code that doesn't assume ID based shared libraries are being used.
7597This is the default.
7598
7599@item -mshared-library-id=n
7600@opindex mshared-library-id
7601Specified the identification number of the ID based shared library being
7602compiled.  Specifying a value of 0 will generate more compact code, specifying
7603other values will force the allocation of that number to the current
7604library but is no more space or time efficient than omitting this option.
7605
7606@item -mlong-calls
7607@itemx -mno-long-calls
7608@opindex mlong-calls
7609@opindex mno-long-calls
7610Tells the compiler to perform function calls by first loading the
7611address of the function into a register and then performing a subroutine
7612call on this register.  This switch is needed if the target function
7613will lie outside of the 24 bit addressing range of the offset based
7614version of subroutine call instruction.
7615
7616This feature is not enabled by default.  Specifying
7617@option{-mno-long-calls} will restore the default behavior.  Note these
7618switches have no effect on how the compiler generates code to handle
7619function calls via function pointers.
7620@end table
7621
7622@node CRIS Options
7623@subsection CRIS Options
7624@cindex CRIS Options
7625
7626These options are defined specifically for the CRIS ports.
7627
7628@table @gcctabopt
7629@item -march=@var{architecture-type}
7630@itemx -mcpu=@var{architecture-type}
7631@opindex march
7632@opindex mcpu
7633Generate code for the specified architecture.  The choices for
7634@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
7635respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
7636Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
7637@samp{v10}.
7638
7639@item -mtune=@var{architecture-type}
7640@opindex mtune
7641Tune to @var{architecture-type} everything applicable about the generated
7642code, except for the ABI and the set of available instructions.  The
7643choices for @var{architecture-type} are the same as for
7644@option{-march=@var{architecture-type}}.
7645
7646@item -mmax-stack-frame=@var{n}
7647@opindex mmax-stack-frame
7648Warn when the stack frame of a function exceeds @var{n} bytes.
7649
7650@item -melinux-stacksize=@var{n}
7651@opindex melinux-stacksize
7652Only available with the @samp{cris-axis-aout} target.  Arranges for
7653indications in the program to the kernel loader that the stack of the
7654program should be set to @var{n} bytes.
7655
7656@item -metrax4
7657@itemx -metrax100
7658@opindex metrax4
7659@opindex metrax100
7660The options @option{-metrax4} and @option{-metrax100} are synonyms for
7661@option{-march=v3} and @option{-march=v8} respectively.
7662
7663@item -mmul-bug-workaround
7664@itemx -mno-mul-bug-workaround
7665@opindex mmul-bug-workaround
7666@opindex mno-mul-bug-workaround
7667Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
7668models where it applies.  This option is active by default.
7669
7670@item -mpdebug
7671@opindex mpdebug
7672Enable CRIS-specific verbose debug-related information in the assembly
7673code.  This option also has the effect to turn off the @samp{#NO_APP}
7674formatted-code indicator to the assembler at the beginning of the
7675assembly file.
7676
7677@item -mcc-init
7678@opindex mcc-init
7679Do not use condition-code results from previous instruction; always emit
7680compare and test instructions before use of condition codes.
7681
7682@item -mno-side-effects
7683@opindex mno-side-effects
7684Do not emit instructions with side-effects in addressing modes other than
7685post-increment.
7686
7687@item -mstack-align
7688@itemx -mno-stack-align
7689@itemx -mdata-align
7690@itemx -mno-data-align
7691@itemx -mconst-align
7692@itemx -mno-const-align
7693@opindex mstack-align
7694@opindex mno-stack-align
7695@opindex mdata-align
7696@opindex mno-data-align
7697@opindex mconst-align
7698@opindex mno-const-align
7699These options (no-options) arranges (eliminate arrangements) for the
7700stack-frame, individual data and constants to be aligned for the maximum
7701single data access size for the chosen CPU model.  The default is to
7702arrange for 32-bit alignment.  ABI details such as structure layout are
7703not affected by these options.
7704
7705@item -m32-bit
7706@itemx -m16-bit
7707@itemx -m8-bit
7708@opindex m32-bit
7709@opindex m16-bit
7710@opindex m8-bit
7711Similar to the stack- data- and const-align options above, these options
7712arrange for stack-frame, writable data and constants to all be 32-bit,
771316-bit or 8-bit aligned.  The default is 32-bit alignment.
7714
7715@item -mno-prologue-epilogue
7716@itemx -mprologue-epilogue
7717@opindex mno-prologue-epilogue
7718@opindex mprologue-epilogue
7719With @option{-mno-prologue-epilogue}, the normal function prologue and
7720epilogue that sets up the stack-frame are omitted and no return
7721instructions or return sequences are generated in the code.  Use this
7722option only together with visual inspection of the compiled code: no
7723warnings or errors are generated when call-saved registers must be saved,
7724or storage for local variable needs to be allocated.
7725
7726@item -mno-gotplt
7727@itemx -mgotplt
7728@opindex mno-gotplt
7729@opindex mgotplt
7730With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
7731instruction sequences that load addresses for functions from the PLT part
7732of the GOT rather than (traditional on other architectures) calls to the
7733PLT@.  The default is @option{-mgotplt}.
7734
7735@item -maout
7736@opindex maout
7737Legacy no-op option only recognized with the cris-axis-aout target.
7738
7739@item -melf
7740@opindex melf
7741Legacy no-op option only recognized with the cris-axis-elf and
7742cris-axis-linux-gnu targets.
7743
7744@item -melinux
7745@opindex melinux
7746Only recognized with the cris-axis-aout target, where it selects a
7747GNU/linux-like multilib, include files and instruction set for
7748@option{-march=v8}.
7749
7750@item -mlinux
7751@opindex mlinux
7752Legacy no-op option only recognized with the cris-axis-linux-gnu target.
7753
7754@item -sim
7755@opindex sim
7756This option, recognized for the cris-axis-aout and cris-axis-elf arranges
7757to link with input-output functions from a simulator library.  Code,
7758initialized data and zero-initialized data are allocated consecutively.
7759
7760@item -sim2
7761@opindex sim2
7762Like @option{-sim}, but pass linker options to locate initialized data at
77630x40000000 and zero-initialized data at 0x80000000.
7764@end table
7765
7766@node CRX Options
7767@subsection CRX Options
7768@cindex CRX Options
7769
7770These options are defined specifically for the CRX ports.
7771
7772@table @gcctabopt
7773
7774@item -mmac
7775@opindex mmac
7776Enable the use of multiply-accumulate instructions. Disabled by default.
7777
7778@item -mpush-args
7779@opindex mpush-args
7780Push instructions will be used to pass outgoing arguments when functions
7781are called. Enabled by default.
7782@end table
7783
7784@node Darwin Options
7785@subsection Darwin Options
7786@cindex Darwin options
7787
7788These options are defined for all architectures running the Darwin operating
7789system.
7790
7791FSF GCC on Darwin does not create ``fat'' object files; it will create
7792an object file for the single architecture that it was built to
7793target.  Apple's GCC on Darwin does create ``fat'' files if multiple
7794@option{-arch} options are used; it does so by running the compiler or
7795linker multiple times and joining the results together with
7796@file{lipo}.
7797
7798The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
7799@samp{i686}) is determined by the flags that specify the ISA
7800that GCC is targetting, like @option{-mcpu} or @option{-march}.  The
7801@option{-force_cpusubtype_ALL} option can be used to override this.
7802
7803The Darwin tools vary in their behavior when presented with an ISA
7804mismatch.  The assembler, @file{as}, will only permit instructions to
7805be used that are valid for the subtype of the file it is generating,
7806so you cannot put 64-bit instructions in an @samp{ppc750} object file.
7807The linker for shared libraries, @file{/usr/bin/libtool}, will fail
7808and print an error if asked to create a shared library with a less
7809restrictive subtype than its input files (for instance, trying to put
7810a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
7811for executables, @file{ld}, will quietly give the executable the most
7812restrictive subtype of any of its input files.
7813
7814@table @gcctabopt
7815@item -F@var{dir}
7816@opindex F
7817Add the framework directory @var{dir} to the head of the list of
7818directories to be searched for header files.  These directories are
7819interleaved with those specified by @option{-I} options and are
7820scanned in a left-to-right order.
7821
7822A framework directory is a directory with frameworks in it.  A
7823framework is a directory with a @samp{"Headers"} and/or
7824@samp{"PrivateHeaders"} directory contained directly in it that ends
7825in @samp{".framework"}.  The name of a framework is the name of this
7826directory excluding the @samp{".framework"}.  Headers associated with
7827the framework are found in one of those two directories, with
7828@samp{"Headers"} being searched first.  A subframework is a framework
7829directory that is in a framework's @samp{"Frameworks"} directory.
7830Includes of subframework headers can only appear in a header of a
7831framework that contains the subframework, or in a sibling subframework
7832header.  Two subframeworks are siblings if they occur in the same
7833framework.  A subframework should not have the same name as a
7834framework, a warning will be issued if this is violated.  Currently a
7835subframework cannot have subframeworks, in the future, the mechanism
7836may be extended to support this.  The standard frameworks can be found
7837in @samp{"/System/Library/Frameworks"} and
7838@samp{"/Library/Frameworks"}.  An example include looks like
7839@code{#include <Framework/header.h>}, where @samp{Framework} denotes
7840the name of the framework and header.h is found in the
7841@samp{"PrivateHeaders"} or @samp{"Headers"} directory.
7842
7843@item -gused
7844@opindex gused
7845Emit debugging information for symbols that are used.  For STABS
7846debugging format, this enables @option{-feliminate-unused-debug-symbols}.
7847This is by default ON@.
7848
7849@item -gfull
7850@opindex gfull
7851Emit debugging information for all symbols and types.
7852
7853@item -mmacosx-version-min=@var{version}
7854The earliest version of MacOS X that this executable will run on
7855is @var{version}.  Typical values of @var{version} include @code{10.1},
7856@code{10.2}, and @code{10.3.9}.
7857
7858The default for this option is to make choices that seem to be most
7859useful.  
7860
7861@item -mkernel
7862@opindex mkernel
7863Enable kernel development mode.  The @option{-mkernel} option sets
7864@option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit},
7865@option{-fno-exceptions}, @option{-fno-non-call-exceptions},
7866@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
7867applicable.  This mode also sets @option{-mno-altivec},
7868@option{-msoft-float}, @option{-fno-builtin} and
7869@option{-mlong-branch} for PowerPC targets.
7870
7871@item -mone-byte-bool
7872@opindex mone-byte-bool
7873Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}.
7874By default @samp{sizeof(bool)} is @samp{4} when compiling for
7875Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this
7876option has no effect on x86.
7877
7878@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
7879to generate code that is not binary compatible with code generated
7880without that switch.  Using this switch may require recompiling all
7881other modules in a program, including system libraries.  Use this
7882switch to conform to a non-default data model.
7883
7884@item -mfix-and-continue
7885@itemx -ffix-and-continue
7886@itemx -findirect-data
7887@opindex mfix-and-continue
7888@opindex ffix-and-continue
7889@opindex findirect-data
7890Generate code suitable for fast turn around development.  Needed to
7891enable gdb to dynamically load @code{.o} files into already running
7892programs.  @option{-findirect-data} and @option{-ffix-and-continue}
7893are provided for backwards compatibility.
7894
7895@item -all_load
7896@opindex all_load
7897Loads all members of static archive libraries.
7898See man ld(1) for more information.
7899
7900@item -arch_errors_fatal
7901@opindex arch_errors_fatal
7902Cause the errors having to do with files that have the wrong architecture
7903to be fatal.
7904
7905@item -bind_at_load
7906@opindex bind_at_load
7907Causes the output file to be marked such that the dynamic linker will
7908bind all undefined references when the file is loaded or launched.
7909
7910@item -bundle
7911@opindex bundle
7912Produce a Mach-o bundle format file.
7913See man ld(1) for more information.
7914
7915@item -bundle_loader @var{executable}
7916@opindex bundle_loader
7917This option specifies the @var{executable} that will be loading the build
7918output file being linked.  See man ld(1) for more information.
7919
7920@item -dynamiclib
7921@opindex dynamiclib
7922When passed this option, GCC will produce a dynamic library instead of
7923an executable when linking, using the Darwin @file{libtool} command.
7924
7925@item -force_cpusubtype_ALL
7926@opindex force_cpusubtype_ALL
7927This causes GCC's output file to have the @var{ALL} subtype, instead of
7928one controlled by the @option{-mcpu} or @option{-march} option.
7929
7930@item -allowable_client  @var{client_name}
7931@itemx -client_name
7932@itemx -compatibility_version
7933@itemx -current_version
7934@itemx -dead_strip
7935@itemx -dependency-file
7936@itemx -dylib_file
7937@itemx -dylinker_install_name
7938@itemx -dynamic
7939@itemx -exported_symbols_list
7940@itemx -filelist
7941@itemx -flat_namespace
7942@itemx -force_flat_namespace
7943@itemx -headerpad_max_install_names
7944@itemx -image_base
7945@itemx -init
7946@itemx -install_name
7947@itemx -keep_private_externs
7948@itemx -multi_module
7949@itemx -multiply_defined
7950@itemx -multiply_defined_unused
7951@itemx -noall_load
7952@itemx -no_dead_strip_inits_and_terms
7953@itemx -nofixprebinding
7954@itemx -nomultidefs
7955@itemx -noprebind
7956@itemx -noseglinkedit
7957@itemx -pagezero_size
7958@itemx -prebind
7959@itemx -prebind_all_twolevel_modules
7960@itemx -private_bundle
7961@itemx -read_only_relocs
7962@itemx -sectalign
7963@itemx -sectobjectsymbols
7964@itemx -whyload
7965@itemx -seg1addr
7966@itemx -sectcreate
7967@itemx -sectobjectsymbols
7968@itemx -sectorder
7969@itemx -segaddr
7970@itemx -segs_read_only_addr
7971@itemx -segs_read_write_addr
7972@itemx -seg_addr_table
7973@itemx -seg_addr_table_filename
7974@itemx -seglinkedit
7975@itemx -segprot
7976@itemx -segs_read_only_addr
7977@itemx -segs_read_write_addr
7978@itemx -single_module
7979@itemx -static
7980@itemx -sub_library
7981@itemx -sub_umbrella
7982@itemx -twolevel_namespace
7983@itemx -umbrella
7984@itemx -undefined
7985@itemx -unexported_symbols_list
7986@itemx -weak_reference_mismatches
7987@itemx -whatsloaded
7988
7989@opindex allowable_client
7990@opindex client_name
7991@opindex compatibility_version
7992@opindex current_version
7993@opindex dead_strip
7994@opindex dependency-file
7995@opindex dylib_file
7996@opindex dylinker_install_name
7997@opindex dynamic
7998@opindex exported_symbols_list
7999@opindex filelist
8000@opindex flat_namespace
8001@opindex force_flat_namespace
8002@opindex headerpad_max_install_names
8003@opindex image_base
8004@opindex init
8005@opindex install_name
8006@opindex keep_private_externs
8007@opindex multi_module
8008@opindex multiply_defined
8009@opindex multiply_defined_unused
8010@opindex noall_load
8011@opindex no_dead_strip_inits_and_terms
8012@opindex nofixprebinding
8013@opindex nomultidefs
8014@opindex noprebind
8015@opindex noseglinkedit
8016@opindex pagezero_size
8017@opindex prebind
8018@opindex prebind_all_twolevel_modules
8019@opindex private_bundle
8020@opindex read_only_relocs
8021@opindex sectalign
8022@opindex sectobjectsymbols
8023@opindex whyload
8024@opindex seg1addr
8025@opindex sectcreate
8026@opindex sectobjectsymbols
8027@opindex sectorder
8028@opindex segaddr
8029@opindex segs_read_only_addr
8030@opindex segs_read_write_addr
8031@opindex seg_addr_table
8032@opindex seg_addr_table_filename
8033@opindex seglinkedit
8034@opindex segprot
8035@opindex segs_read_only_addr
8036@opindex segs_read_write_addr
8037@opindex single_module
8038@opindex static
8039@opindex sub_library
8040@opindex sub_umbrella
8041@opindex twolevel_namespace
8042@opindex umbrella
8043@opindex undefined
8044@opindex unexported_symbols_list
8045@opindex weak_reference_mismatches
8046@opindex whatsloaded
8047
8048These options are passed to the Darwin linker.  The Darwin linker man page
8049describes them in detail.
8050@end table
8051
8052@node DEC Alpha Options
8053@subsection DEC Alpha Options
8054
8055These @samp{-m} options are defined for the DEC Alpha implementations:
8056
8057@table @gcctabopt
8058@item -mno-soft-float
8059@itemx -msoft-float
8060@opindex mno-soft-float
8061@opindex msoft-float
8062Use (do not use) the hardware floating-point instructions for
8063floating-point operations.  When @option{-msoft-float} is specified,
8064functions in @file{libgcc.a} will be used to perform floating-point
8065operations.  Unless they are replaced by routines that emulate the
8066floating-point operations, or compiled in such a way as to call such
8067emulations routines, these routines will issue floating-point
8068operations.   If you are compiling for an Alpha without floating-point
8069operations, you must ensure that the library is built so as not to call
8070them.
8071
8072Note that Alpha implementations without floating-point operations are
8073required to have floating-point registers.
8074
8075@item -mfp-reg
8076@itemx -mno-fp-regs
8077@opindex mfp-reg
8078@opindex mno-fp-regs
8079Generate code that uses (does not use) the floating-point register set.
8080@option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
8081register set is not used, floating point operands are passed in integer
8082registers as if they were integers and floating-point results are passed
8083in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
8084so any function with a floating-point argument or return value called by code
8085compiled with @option{-mno-fp-regs} must also be compiled with that
8086option.
8087
8088A typical use of this option is building a kernel that does not use,
8089and hence need not save and restore, any floating-point registers.
8090
8091@item -mieee
8092@opindex mieee
8093The Alpha architecture implements floating-point hardware optimized for
8094maximum performance.  It is mostly compliant with the IEEE floating
8095point standard.  However, for full compliance, software assistance is
8096required.  This option generates code fully IEEE compliant code
8097@emph{except} that the @var{inexact-flag} is not maintained (see below).
8098If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
8099defined during compilation.  The resulting code is less efficient but is
8100able to correctly support denormalized numbers and exceptional IEEE
8101values such as not-a-number and plus/minus infinity.  Other Alpha
8102compilers call this option @option{-ieee_with_no_inexact}.
8103
8104@item -mieee-with-inexact
8105@opindex mieee-with-inexact
8106This is like @option{-mieee} except the generated code also maintains
8107the IEEE @var{inexact-flag}.  Turning on this option causes the
8108generated code to implement fully-compliant IEEE math.  In addition to
8109@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
8110macro.  On some Alpha implementations the resulting code may execute
8111significantly slower than the code generated by default.  Since there is
8112very little code that depends on the @var{inexact-flag}, you should
8113normally not specify this option.  Other Alpha compilers call this
8114option @option{-ieee_with_inexact}.
8115
8116@item -mfp-trap-mode=@var{trap-mode}
8117@opindex mfp-trap-mode
8118This option controls what floating-point related traps are enabled.
8119Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
8120The trap mode can be set to one of four values:
8121
8122@table @samp
8123@item n
8124This is the default (normal) setting.  The only traps that are enabled
8125are the ones that cannot be disabled in software (e.g., division by zero
8126trap).
8127
8128@item u
8129In addition to the traps enabled by @samp{n}, underflow traps are enabled
8130as well.
8131
8132@item su
8133Like @samp{u}, but the instructions are marked to be safe for software
8134completion (see Alpha architecture manual for details).
8135
8136@item sui
8137Like @samp{su}, but inexact traps are enabled as well.
8138@end table
8139
8140@item -mfp-rounding-mode=@var{rounding-mode}
8141@opindex mfp-rounding-mode
8142Selects the IEEE rounding mode.  Other Alpha compilers call this option
8143@option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
8144of:
8145
8146@table @samp
8147@item n
8148Normal IEEE rounding mode.  Floating point numbers are rounded towards
8149the nearest machine number or towards the even machine number in case
8150of a tie.
8151
8152@item m
8153Round towards minus infinity.
8154
8155@item c
8156Chopped rounding mode.  Floating point numbers are rounded towards zero.
8157
8158@item d
8159Dynamic rounding mode.  A field in the floating point control register
8160(@var{fpcr}, see Alpha architecture reference manual) controls the
8161rounding mode in effect.  The C library initializes this register for
8162rounding towards plus infinity.  Thus, unless your program modifies the
8163@var{fpcr}, @samp{d} corresponds to round towards plus infinity.
8164@end table
8165
8166@item -mtrap-precision=@var{trap-precision}
8167@opindex mtrap-precision
8168In the Alpha architecture, floating point traps are imprecise.  This
8169means without software assistance it is impossible to recover from a
8170floating trap and program execution normally needs to be terminated.
8171GCC can generate code that can assist operating system trap handlers
8172in determining the exact location that caused a floating point trap.
8173Depending on the requirements of an application, different levels of
8174precisions can be selected:
8175
8176@table @samp
8177@item p
8178Program precision.  This option is the default and means a trap handler
8179can only identify which program caused a floating point exception.
8180
8181@item f
8182Function precision.  The trap handler can determine the function that
8183caused a floating point exception.
8184
8185@item i
8186Instruction precision.  The trap handler can determine the exact
8187instruction that caused a floating point exception.
8188@end table
8189
8190Other Alpha compilers provide the equivalent options called
8191@option{-scope_safe} and @option{-resumption_safe}.
8192
8193@item -mieee-conformant
8194@opindex mieee-conformant
8195This option marks the generated code as IEEE conformant.  You must not
8196use this option unless you also specify @option{-mtrap-precision=i} and either
8197@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
8198is to emit the line @samp{.eflag 48} in the function prologue of the
8199generated assembly file.  Under DEC Unix, this has the effect that
8200IEEE-conformant math library routines will be linked in.
8201
8202@item -mbuild-constants
8203@opindex mbuild-constants
8204Normally GCC examines a 32- or 64-bit integer constant to
8205see if it can construct it from smaller constants in two or three
8206instructions.  If it cannot, it will output the constant as a literal and
8207generate code to load it from the data segment at runtime.
8208
8209Use this option to require GCC to construct @emph{all} integer constants
8210using code, even if it takes more instructions (the maximum is six).
8211
8212You would typically use this option to build a shared library dynamic
8213loader.  Itself a shared library, it must relocate itself in memory
8214before it can find the variables and constants in its own data segment.
8215
8216@item -malpha-as
8217@itemx -mgas
8218@opindex malpha-as
8219@opindex mgas
8220Select whether to generate code to be assembled by the vendor-supplied
8221assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
8222
8223@item -mbwx
8224@itemx -mno-bwx
8225@itemx -mcix
8226@itemx -mno-cix
8227@itemx -mfix
8228@itemx -mno-fix
8229@itemx -mmax
8230@itemx -mno-max
8231@opindex mbwx
8232@opindex mno-bwx
8233@opindex mcix
8234@opindex mno-cix
8235@opindex mfix
8236@opindex mno-fix
8237@opindex mmax
8238@opindex mno-max
8239Indicate whether GCC should generate code to use the optional BWX,
8240CIX, FIX and MAX instruction sets.  The default is to use the instruction
8241sets supported by the CPU type specified via @option{-mcpu=} option or that
8242of the CPU on which GCC was built if none was specified.
8243
8244@item -mfloat-vax
8245@itemx -mfloat-ieee
8246@opindex mfloat-vax
8247@opindex mfloat-ieee
8248Generate code that uses (does not use) VAX F and G floating point
8249arithmetic instead of IEEE single and double precision.
8250
8251@item -mexplicit-relocs
8252@itemx -mno-explicit-relocs
8253@opindex mexplicit-relocs
8254@opindex mno-explicit-relocs
8255Older Alpha assemblers provided no way to generate symbol relocations
8256except via assembler macros.  Use of these macros does not allow
8257optimal instruction scheduling.  GNU binutils as of version 2.12
8258supports a new syntax that allows the compiler to explicitly mark
8259which relocations should apply to which instructions.  This option
8260is mostly useful for debugging, as GCC detects the capabilities of
8261the assembler when it is built and sets the default accordingly.
8262
8263@item -msmall-data
8264@itemx -mlarge-data
8265@opindex msmall-data
8266@opindex mlarge-data
8267When @option{-mexplicit-relocs} is in effect, static data is
8268accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
8269is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
8270(the @code{.sdata} and @code{.sbss} sections) and are accessed via
827116-bit relocations off of the @code{$gp} register.  This limits the
8272size of the small data area to 64KB, but allows the variables to be
8273directly accessed via a single instruction.
8274
8275The default is @option{-mlarge-data}.  With this option the data area
8276is limited to just below 2GB@.  Programs that require more than 2GB of
8277data must use @code{malloc} or @code{mmap} to allocate the data in the
8278heap instead of in the program's data segment.
8279
8280When generating code for shared libraries, @option{-fpic} implies
8281@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
8282
8283@item -msmall-text
8284@itemx -mlarge-text
8285@opindex msmall-text
8286@opindex mlarge-text
8287When @option{-msmall-text} is used, the compiler assumes that the
8288code of the entire program (or shared library) fits in 4MB, and is
8289thus reachable with a branch instruction.  When @option{-msmall-data}
8290is used, the compiler can assume that all local symbols share the
8291same @code{$gp} value, and thus reduce the number of instructions
8292required for a function call from 4 to 1.
8293
8294The default is @option{-mlarge-text}.
8295
8296@item -mcpu=@var{cpu_type}
8297@opindex mcpu
8298Set the instruction set and instruction scheduling parameters for
8299machine type @var{cpu_type}.  You can specify either the @samp{EV}
8300style name or the corresponding chip number.  GCC supports scheduling
8301parameters for the EV4, EV5 and EV6 family of processors and will
8302choose the default values for the instruction set from the processor
8303you specify.  If you do not specify a processor type, GCC will default
8304to the processor on which the compiler was built.
8305
8306Supported values for @var{cpu_type} are
8307
8308@table @samp
8309@item ev4
8310@itemx ev45
8311@itemx 21064
8312Schedules as an EV4 and has no instruction set extensions.
8313
8314@item ev5
8315@itemx 21164
8316Schedules as an EV5 and has no instruction set extensions.
8317
8318@item ev56
8319@itemx 21164a
8320Schedules as an EV5 and supports the BWX extension.
8321
8322@item pca56
8323@itemx 21164pc
8324@itemx 21164PC
8325Schedules as an EV5 and supports the BWX and MAX extensions.
8326
8327@item ev6
8328@itemx 21264
8329Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
8330
8331@item ev67
8332@itemx 21264a
8333Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
8334@end table
8335
8336@item -mtune=@var{cpu_type}
8337@opindex mtune
8338Set only the instruction scheduling parameters for machine type
8339@var{cpu_type}.  The instruction set is not changed.
8340
8341@item -mmemory-latency=@var{time}
8342@opindex mmemory-latency
8343Sets the latency the scheduler should assume for typical memory
8344references as seen by the application.  This number is highly
8345dependent on the memory access patterns used by the application
8346and the size of the external cache on the machine.
8347
8348Valid options for @var{time} are
8349
8350@table @samp
8351@item @var{number}
8352A decimal number representing clock cycles.
8353
8354@item L1
8355@itemx L2
8356@itemx L3
8357@itemx main
8358The compiler contains estimates of the number of clock cycles for
8359``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
8360(also called Dcache, Scache, and Bcache), as well as to main memory.
8361Note that L3 is only valid for EV5.
8362
8363@end table
8364@end table
8365
8366@node DEC Alpha/VMS Options
8367@subsection DEC Alpha/VMS Options
8368
8369These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
8370
8371@table @gcctabopt
8372@item -mvms-return-codes
8373@opindex mvms-return-codes
8374Return VMS condition codes from main.  The default is to return POSIX
8375style condition (e.g.@ error) codes.
8376@end table
8377
8378@node FRV Options
8379@subsection FRV Options
8380@cindex FRV Options
8381
8382@table @gcctabopt
8383@item -mgpr-32
8384@opindex mgpr-32
8385
8386Only use the first 32 general purpose registers.
8387
8388@item -mgpr-64
8389@opindex mgpr-64
8390
8391Use all 64 general purpose registers.
8392
8393@item -mfpr-32
8394@opindex mfpr-32
8395
8396Use only the first 32 floating point registers.
8397
8398@item -mfpr-64
8399@opindex mfpr-64
8400
8401Use all 64 floating point registers
8402
8403@item -mhard-float
8404@opindex mhard-float
8405
8406Use hardware instructions for floating point operations.
8407
8408@item -msoft-float
8409@opindex msoft-float
8410
8411Use library routines for floating point operations.
8412
8413@item -malloc-cc
8414@opindex malloc-cc
8415
8416Dynamically allocate condition code registers.
8417
8418@item -mfixed-cc
8419@opindex mfixed-cc
8420
8421Do not try to dynamically allocate condition code registers, only
8422use @code{icc0} and @code{fcc0}.
8423
8424@item -mdword
8425@opindex mdword
8426
8427Change ABI to use double word insns.
8428
8429@item -mno-dword
8430@opindex mno-dword
8431
8432Do not use double word instructions.
8433
8434@item -mdouble
8435@opindex mdouble
8436
8437Use floating point double instructions.
8438
8439@item -mno-double
8440@opindex mno-double
8441
8442Do not use floating point double instructions.
8443
8444@item -mmedia
8445@opindex mmedia
8446
8447Use media instructions.
8448
8449@item -mno-media
8450@opindex mno-media
8451
8452Do not use media instructions.
8453
8454@item -mmuladd
8455@opindex mmuladd
8456
8457Use multiply and add/subtract instructions.
8458
8459@item -mno-muladd
8460@opindex mno-muladd
8461
8462Do not use multiply and add/subtract instructions.
8463
8464@item -mfdpic
8465@opindex mfdpic
8466
8467Select the FDPIC ABI, that uses function descriptors to represent
8468pointers to functions.  Without any PIC/PIE-related options, it
8469implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
8470assumes GOT entries and small data are within a 12-bit range from the
8471GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
8472are computed with 32 bits.
8473
8474@item -minline-plt
8475@opindex minline-plt
8476
8477Enable inlining of PLT entries in function calls to functions that are
8478not known to bind locally.  It has no effect without @option{-mfdpic}.
8479It's enabled by default if optimizing for speed and compiling for
8480shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
8481optimization option such as @option{-O3} or above is present in the
8482command line.
8483
8484@item -mTLS
8485@opindex TLS
8486
8487Assume a large TLS segment when generating thread-local code.
8488
8489@item -mtls
8490@opindex tls
8491
8492Do not assume a large TLS segment when generating thread-local code.
8493
8494@item -mgprel-ro
8495@opindex mgprel-ro
8496
8497Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
8498that is known to be in read-only sections.  It's enabled by default,
8499except for @option{-fpic} or @option{-fpie}: even though it may help
8500make the global offset table smaller, it trades 1 instruction for 4.
8501With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
8502one of which may be shared by multiple symbols, and it avoids the need
8503for a GOT entry for the referenced symbol, so it's more likely to be a
8504win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
8505
8506@item -multilib-library-pic
8507@opindex multilib-library-pic
8508
8509Link with the (library, not FD) pic libraries.  It's implied by
8510@option{-mlibrary-pic}, as well as by @option{-fPIC} and
8511@option{-fpic} without @option{-mfdpic}.  You should never have to use
8512it explicitly.
8513
8514@item -mlinked-fp
8515@opindex mlinked-fp
8516
8517Follow the EABI requirement of always creating a frame pointer whenever
8518a stack frame is allocated.  This option is enabled by default and can
8519be disabled with @option{-mno-linked-fp}.
8520
8521@item -mlong-calls
8522@opindex mlong-calls
8523
8524Use indirect addressing to call functions outside the current
8525compilation unit.  This allows the functions to be placed anywhere
8526within the 32-bit address space.
8527
8528@item -malign-labels
8529@opindex malign-labels
8530
8531Try to align labels to an 8-byte boundary by inserting nops into the
8532previous packet.  This option only has an effect when VLIW packing
8533is enabled.  It doesn't create new packets; it merely adds nops to
8534existing ones.
8535
8536@item -mlibrary-pic
8537@opindex mlibrary-pic
8538
8539Generate position-independent EABI code.
8540
8541@item -macc-4
8542@opindex macc-4
8543
8544Use only the first four media accumulator registers.
8545
8546@item -macc-8
8547@opindex macc-8
8548
8549Use all eight media accumulator registers.
8550
8551@item -mpack
8552@opindex mpack
8553
8554Pack VLIW instructions.
8555
8556@item -mno-pack
8557@opindex mno-pack
8558
8559Do not pack VLIW instructions.
8560
8561@item -mno-eflags
8562@opindex mno-eflags
8563
8564Do not mark ABI switches in e_flags.
8565
8566@item -mcond-move
8567@opindex mcond-move
8568
8569Enable the use of conditional-move instructions (default).
8570
8571This switch is mainly for debugging the compiler and will likely be removed
8572in a future version.
8573
8574@item -mno-cond-move
8575@opindex mno-cond-move
8576
8577Disable the use of conditional-move instructions.
8578
8579This switch is mainly for debugging the compiler and will likely be removed
8580in a future version.
8581
8582@item -mscc
8583@opindex mscc
8584
8585Enable the use of conditional set instructions (default).
8586
8587This switch is mainly for debugging the compiler and will likely be removed
8588in a future version.
8589
8590@item -mno-scc
8591@opindex mno-scc
8592
8593Disable the use of conditional set instructions.
8594
8595This switch is mainly for debugging the compiler and will likely be removed
8596in a future version.
8597
8598@item -mcond-exec
8599@opindex mcond-exec
8600
8601Enable the use of conditional execution (default).
8602
8603This switch is mainly for debugging the compiler and will likely be removed
8604in a future version.
8605
8606@item -mno-cond-exec
8607@opindex mno-cond-exec
8608
8609Disable the use of conditional execution.
8610
8611This switch is mainly for debugging the compiler and will likely be removed
8612in a future version.
8613
8614@item -mvliw-branch
8615@opindex mvliw-branch
8616
8617Run a pass to pack branches into VLIW instructions (default).
8618
8619This switch is mainly for debugging the compiler and will likely be removed
8620in a future version.
8621
8622@item -mno-vliw-branch
8623@opindex mno-vliw-branch
8624
8625Do not run a pass to pack branches into VLIW instructions.
8626
8627This switch is mainly for debugging the compiler and will likely be removed
8628in a future version.
8629
8630@item -mmulti-cond-exec
8631@opindex mmulti-cond-exec
8632
8633Enable optimization of @code{&&} and @code{||} in conditional execution
8634(default).
8635
8636This switch is mainly for debugging the compiler and will likely be removed
8637in a future version.
8638
8639@item -mno-multi-cond-exec
8640@opindex mno-multi-cond-exec
8641
8642Disable optimization of @code{&&} and @code{||} in conditional execution.
8643
8644This switch is mainly for debugging the compiler and will likely be removed
8645in a future version.
8646
8647@item -mnested-cond-exec
8648@opindex mnested-cond-exec
8649
8650Enable nested conditional execution optimizations (default).
8651
8652This switch is mainly for debugging the compiler and will likely be removed
8653in a future version.
8654
8655@item -mno-nested-cond-exec
8656@opindex mno-nested-cond-exec
8657
8658Disable nested conditional execution optimizations.
8659
8660This switch is mainly for debugging the compiler and will likely be removed
8661in a future version.
8662
8663@item -moptimize-membar
8664@opindex moptimize-membar
8665
8666This switch removes redundant @code{membar} instructions from the
8667compiler generated code.  It is enabled by default.
8668
8669@item -mno-optimize-membar
8670@opindex mno-optimize-membar
8671
8672This switch disables the automatic removal of redundant @code{membar}
8673instructions from the generated code.
8674
8675@item -mtomcat-stats
8676@opindex mtomcat-stats
8677
8678Cause gas to print out tomcat statistics.
8679
8680@item -mcpu=@var{cpu}
8681@opindex mcpu
8682
8683Select the processor type for which to generate code.  Possible values are
8684@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
8685@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
8686
8687@end table
8688
8689@node GNU/Linux Options
8690@subsection GNU/Linux Options
8691
8692These @samp{-m} options are defined for GNU/Linux targets:
8693
8694@table @gcctabopt
8695@item -mglibc
8696@opindex mglibc
8697Use the GNU C library instead of uClibc.  This is the default except
8698on @samp{*-*-linux-*uclibc*} targets.
8699
8700@item -muclibc
8701@opindex muclibc
8702Use uClibc instead of the GNU C library.  This is the default on
8703@samp{*-*-linux-*uclibc*} targets.
8704@end table
8705
8706@node H8/300 Options
8707@subsection H8/300 Options
8708
8709These @samp{-m} options are defined for the H8/300 implementations:
8710
8711@table @gcctabopt
8712@item -mrelax
8713@opindex mrelax
8714Shorten some address references at link time, when possible; uses the
8715linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
8716ld, Using ld}, for a fuller description.
8717
8718@item -mh
8719@opindex mh
8720Generate code for the H8/300H@.
8721
8722@item -ms
8723@opindex ms
8724Generate code for the H8S@.
8725
8726@item -mn
8727@opindex mn
8728Generate code for the H8S and H8/300H in the normal mode.  This switch
8729must be used either with @option{-mh} or @option{-ms}.
8730
8731@item -ms2600
8732@opindex ms2600
8733Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
8734
8735@item -mint32
8736@opindex mint32
8737Make @code{int} data 32 bits by default.
8738
8739@item -malign-300
8740@opindex malign-300
8741On the H8/300H and H8S, use the same alignment rules as for the H8/300.
8742The default for the H8/300H and H8S is to align longs and floats on 4
8743byte boundaries.
8744@option{-malign-300} causes them to be aligned on 2 byte boundaries.
8745This option has no effect on the H8/300.
8746@end table
8747
8748@node HPPA Options
8749@subsection HPPA Options
8750@cindex HPPA Options
8751
8752These @samp{-m} options are defined for the HPPA family of computers:
8753
8754@table @gcctabopt
8755@item -march=@var{architecture-type}
8756@opindex march
8757Generate code for the specified architecture.  The choices for
8758@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
87591.1, and @samp{2.0} for PA 2.0 processors.  Refer to
8760@file{/usr/lib/sched.models} on an HP-UX system to determine the proper
8761architecture option for your machine.  Code compiled for lower numbered
8762architectures will run on higher numbered architectures, but not the
8763other way around.
8764
8765@item -mpa-risc-1-0
8766@itemx -mpa-risc-1-1
8767@itemx -mpa-risc-2-0
8768@opindex mpa-risc-1-0
8769@opindex mpa-risc-1-1
8770@opindex mpa-risc-2-0
8771Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
8772
8773@item -mbig-switch
8774@opindex mbig-switch
8775Generate code suitable for big switch tables.  Use this option only if
8776the assembler/linker complain about out of range branches within a switch
8777table.
8778
8779@item -mjump-in-delay
8780@opindex mjump-in-delay
8781Fill delay slots of function calls with unconditional jump instructions
8782by modifying the return pointer for the function call to be the target
8783of the conditional jump.
8784
8785@item -mdisable-fpregs
8786@opindex mdisable-fpregs
8787Prevent floating point registers from being used in any manner.  This is
8788necessary for compiling kernels which perform lazy context switching of
8789floating point registers.  If you use this option and attempt to perform
8790floating point operations, the compiler will abort.
8791
8792@item -mdisable-indexing
8793@opindex mdisable-indexing
8794Prevent the compiler from using indexing address modes.  This avoids some
8795rather obscure problems when compiling MIG generated code under MACH@.
8796
8797@item -mno-space-regs
8798@opindex mno-space-regs
8799Generate code that assumes the target has no space registers.  This allows
8800GCC to generate faster indirect calls and use unscaled index address modes.
8801
8802Such code is suitable for level 0 PA systems and kernels.
8803
8804@item -mfast-indirect-calls
8805@opindex mfast-indirect-calls
8806Generate code that assumes calls never cross space boundaries.  This
8807allows GCC to emit code which performs faster indirect calls.
8808
8809This option will not work in the presence of shared libraries or nested
8810functions.
8811
8812@item -mfixed-range=@var{register-range}
8813@opindex mfixed-range
8814Generate code treating the given register range as fixed registers.
8815A fixed register is one that the register allocator can not use.  This is
8816useful when compiling kernel code.  A register range is specified as
8817two registers separated by a dash.  Multiple register ranges can be
8818specified separated by a comma.
8819
8820@item -mlong-load-store
8821@opindex mlong-load-store
8822Generate 3-instruction load and store sequences as sometimes required by
8823the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
8824the HP compilers.
8825
8826@item -mportable-runtime
8827@opindex mportable-runtime
8828Use the portable calling conventions proposed by HP for ELF systems.
8829
8830@item -mgas
8831@opindex mgas
8832Enable the use of assembler directives only GAS understands.
8833
8834@item -mschedule=@var{cpu-type}
8835@opindex mschedule
8836Schedule code according to the constraints for the machine type
8837@var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
8838@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
8839to @file{/usr/lib/sched.models} on an HP-UX system to determine the
8840proper scheduling option for your machine.  The default scheduling is
8841@samp{8000}.
8842
8843@item -mlinker-opt
8844@opindex mlinker-opt
8845Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
8846debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
8847linkers in which they give bogus error messages when linking some programs.
8848
8849@item -msoft-float
8850@opindex msoft-float
8851Generate output containing library calls for floating point.
8852@strong{Warning:} the requisite libraries are not available for all HPPA
8853targets.  Normally the facilities of the machine's usual C compiler are
8854used, but this cannot be done directly in cross-compilation.  You must make
8855your own arrangements to provide suitable library functions for
8856cross-compilation.  The embedded target @samp{hppa1.1-*-pro}
8857does provide software floating point support.
8858
8859@option{-msoft-float} changes the calling convention in the output file;
8860therefore, it is only useful if you compile @emph{all} of a program with
8861this option.  In particular, you need to compile @file{libgcc.a}, the
8862library that comes with GCC, with @option{-msoft-float} in order for
8863this to work.
8864
8865@item -msio
8866@opindex msio
8867Generate the predefine, @code{_SIO}, for server IO@.  The default is
8868@option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
8869@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
8870options are available under HP-UX and HI-UX@.
8871
8872@item -mgnu-ld
8873@opindex gnu-ld
8874Use GNU ld specific options.  This passes @option{-shared} to ld when
8875building a shared library.  It is the default when GCC is configured,
8876explicitly or implicitly, with the GNU linker.  This option does not
8877have any affect on which ld is called, it only changes what parameters
8878are passed to that ld.  The ld that is called is determined by the
8879@option{--with-ld} configure option, GCC's program search path, and
8880finally by the user's @env{PATH}.  The linker used by GCC can be printed
8881using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
8882on the 64 bit HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}.
8883
8884@item -mhp-ld
8885@opindex hp-ld
8886Use HP ld specific options.  This passes @option{-b} to ld when building
8887a shared library and passes @option{+Accept TypeMismatch} to ld on all
8888links.  It is the default when GCC is configured, explicitly or
8889implicitly, with the HP linker.  This option does not have any affect on
8890which ld is called, it only changes what parameters are passed to that
8891ld.  The ld that is called is determined by the @option{--with-ld}
8892configure option, GCC's program search path, and finally by the user's
8893@env{PATH}.  The linker used by GCC can be printed using @samp{which
8894`gcc -print-prog-name=ld`}.  This option is only available on the 64 bit
8895HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}.
8896
8897@item -mlong-calls
8898@opindex mno-long-calls
8899Generate code that uses long call sequences.  This ensures that a call
8900is always able to reach linker generated stubs.  The default is to generate
8901long calls only when the distance from the call site to the beginning
8902of the function or translation unit, as the case may be, exceeds a
8903predefined limit set by the branch type being used.  The limits for
8904normal calls are 7,600,000 and 240,000 bytes, respectively for the
8905PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
8906240,000 bytes.
8907
8908Distances are measured from the beginning of functions when using the
8909@option{-ffunction-sections} option, or when using the @option{-mgas}
8910and @option{-mno-portable-runtime} options together under HP-UX with
8911the SOM linker.
8912
8913It is normally not desirable to use this option as it will degrade
8914performance.  However, it may be useful in large applications,
8915particularly when partial linking is used to build the application.
8916
8917The types of long calls used depends on the capabilities of the
8918assembler and linker, and the type of code being generated.  The
8919impact on systems that support long absolute calls, and long pic
8920symbol-difference or pc-relative calls should be relatively small.
8921However, an indirect call is used on 32-bit ELF systems in pic code
8922and it is quite long.
8923
8924@item -munix=@var{unix-std}
8925@opindex march
8926Generate compiler predefines and select a startfile for the specified
8927UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
8928and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
8929is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
893011.11 and later.  The default values are @samp{93} for HP-UX 10.00,
8931@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
8932and later.
8933
8934@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
8935@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
8936and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
8937@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
8938@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
8939@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
8940
8941It is @emph{important} to note that this option changes the interfaces
8942for various library routines.  It also affects the operational behavior
8943of the C library.  Thus, @emph{extreme} care is needed in using this
8944option.
8945
8946Library code that is intended to operate with more than one UNIX
8947standard must test, set and restore the variable @var{__xpg4_extended_mask}
8948as appropriate.  Most GNU software doesn't provide this capability.
8949
8950@item -nolibdld
8951@opindex nolibdld
8952Suppress the generation of link options to search libdld.sl when the
8953@option{-static} option is specified on HP-UX 10 and later.
8954
8955@item -static
8956@opindex static
8957The HP-UX implementation of setlocale in libc has a dependency on
8958libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
8959when the @option{-static} option is specified, special link options
8960are needed to resolve this dependency.
8961
8962On HP-UX 10 and later, the GCC driver adds the necessary options to
8963link with libdld.sl when the @option{-static} option is specified.
8964This causes the resulting binary to be dynamic.  On the 64-bit port,
8965the linkers generate dynamic binaries by default in any case.  The
8966@option{-nolibdld} option can be used to prevent the GCC driver from
8967adding these link options.
8968
8969@item -threads
8970@opindex threads
8971Add support for multithreading with the @dfn{dce thread} library
8972under HP-UX@.  This option sets flags for both the preprocessor and
8973linker.
8974@end table
8975
8976@node i386 and x86-64 Options
8977@subsection Intel 386 and AMD x86-64 Options
8978@cindex i386 Options
8979@cindex x86-64 Options
8980@cindex Intel 386 Options
8981@cindex AMD x86-64 Options
8982
8983These @samp{-m} options are defined for the i386 and x86-64 family of
8984computers:
8985
8986@table @gcctabopt
8987@item -mtune=@var{cpu-type}
8988@opindex mtune
8989Tune to @var{cpu-type} everything applicable about the generated code, except
8990for the ABI and the set of available instructions.  The choices for
8991@var{cpu-type} are:
8992@table @emph
8993@item generic
8994Produce code optimized for the most common IA32/AMD64/EM64T processors.
8995If you know the CPU on which your code will run, then you should use
8996the corresponding @option{-mtune} option instead of
8997@option{-mtune=generic}.  But, if you do not know exactly what CPU users
8998of your application will have, then you should use this option.
8999
9000As new processors are deployed in the marketplace, the behavior of this
9001option will change.  Therefore, if you upgrade to a newer version of
9002GCC, the code generated option will change to reflect the processors
9003that were most common when that version of GCC was released.
9004
9005There is no @option{-march=generic} option because @option{-march}
9006indicates the instruction set the compiler can use, and there is no
9007generic instruction set applicable to all processors.  In contrast,
9008@option{-mtune} indicates the processor (or, in this case, collection of
9009processors) for which the code is optimized.
9010@item native
9011This selects the CPU to tune for at compilation time by determining
9012the processor type of the compiling machine.  Using @option{-mtune=native}
9013will produce code optimized for the local machine under the constraints
9014of the selected instruction set.  Using @option{-march=native} will
9015enable all instruction subsets supported by the local machine (hence
9016the result might not run on different machines).
9017@item i386
9018Original Intel's i386 CPU@.
9019@item i486
9020Intel's i486 CPU@.  (No scheduling is implemented for this chip.)
9021@item i586, pentium
9022Intel Pentium CPU with no MMX support.
9023@item pentium-mmx
9024Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
9025@item pentiumpro
9026Intel PentiumPro CPU@.
9027@item i686
9028Same as @code{generic}, but when used as @code{march} option, PentiumPro
9029instruction set will be used, so the code will run on all i686 family chips.
9030@item pentium2
9031Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
9032@item pentium3, pentium3m
9033Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
9034support.
9035@item pentium-m
9036Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set
9037support.  Used by Centrino notebooks.
9038@item pentium4, pentium4m
9039Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
9040@item prescott
9041Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction
9042set support.
9043@item nocona
9044Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE,
9045SSE2 and SSE3 instruction set support.
9046@item core2
9047Intel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
9048instruction set support.
9049@item k6
9050AMD K6 CPU with MMX instruction set support.
9051@item k6-2, k6-3
9052Improved versions of AMD K6 CPU with MMX and 3dNOW! instruction set support.
9053@item athlon, athlon-tbird
9054AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE prefetch instructions
9055support.
9056@item athlon-4, athlon-xp, athlon-mp
9057Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and full SSE
9058instruction set support.
9059@item k8, opteron, athlon64, athlon-fx
9060AMD K8 core based CPUs with x86-64 instruction set support.  (This supersets
9061MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.)
9062@item k8-sse3, opteron-sse3, athlon64-sse3
9063Improved versions of k8, opteron and athlon64 with SSE3 instruction set support.
9064@item amdfam10, barcelona
9065AMD Family 10h core based CPUs with x86-64 instruction set support.  (This
9066supersets MMX, SSE, SSE2, SSE3, SSE4A, 3dNOW!, enhanced 3dNOW!, ABM and 64-bit
9067instruction set extensions.)
9068@item winchip-c6
9069IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
9070set support.
9071@item winchip2
9072IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW!
9073instruction set support.
9074@item c3
9075Via C3 CPU with MMX and 3dNOW! instruction set support.  (No scheduling is
9076implemented for this chip.)
9077@item c3-2
9078Via C3-2 CPU with MMX and SSE instruction set support.  (No scheduling is
9079implemented for this chip.)
9080@item geode
9081Embedded AMD CPU with MMX and 3dNOW! instruction set support.
9082@end table
9083
9084While picking a specific @var{cpu-type} will schedule things appropriately
9085for that particular chip, the compiler will not generate any code that
9086does not run on the i386 without the @option{-march=@var{cpu-type}} option
9087being used.
9088
9089@item -march=@var{cpu-type}
9090@opindex march
9091Generate instructions for the machine type @var{cpu-type}.  The choices
9092for @var{cpu-type} are the same as for @option{-mtune}.  Moreover,
9093specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
9094
9095@item -mcpu=@var{cpu-type}
9096@opindex mcpu
9097A deprecated synonym for @option{-mtune}.
9098
9099@item -m386
9100@itemx -m486
9101@itemx -mpentium
9102@itemx -mpentiumpro
9103@opindex m386
9104@opindex m486
9105@opindex mpentium
9106@opindex mpentiumpro
9107These options are synonyms for @option{-mtune=i386}, @option{-mtune=i486},
9108@option{-mtune=pentium}, and @option{-mtune=pentiumpro} respectively.
9109These synonyms are deprecated.
9110
9111@item -mfpmath=@var{unit}
9112@opindex march
9113Generate floating point arithmetics for selected unit @var{unit}.  The choices
9114for @var{unit} are:
9115
9116@table @samp
9117@item 387
9118Use the standard 387 floating point coprocessor present majority of chips and
9119emulated otherwise.  Code compiled with this option will run almost everywhere.
9120The temporary results are computed in 80bit precision instead of precision
9121specified by the type resulting in slightly different results compared to most
9122of other chips.  See @option{-ffloat-store} for more detailed description.
9123
9124This is the default choice for i386 compiler.
9125
9126@item sse
9127Use scalar floating point instructions present in the SSE instruction set.
9128This instruction set is supported by Pentium3 and newer chips, in the AMD line
9129by Athlon-4, Athlon-xp and Athlon-mp chips.  The earlier version of SSE
9130instruction set supports only single precision arithmetics, thus the double and
9131extended precision arithmetics is still done using 387.  Later version, present
9132only in Pentium4 and the future AMD x86-64 chips supports double precision
9133arithmetics too.
9134
9135For the i386 compiler, you need to use @option{-march=@var{cpu-type}}, @option{-msse}
9136or @option{-msse2} switches to enable SSE extensions and make this option
9137effective.  For the x86-64 compiler, these extensions are enabled by default.
9138
9139The resulting code should be considerably faster in the majority of cases and avoid
9140the numerical instability problems of 387 code, but may break some existing
9141code that expects temporaries to be 80bit.
9142
9143This is the default choice for the x86-64 compiler.
9144
9145@item sse,387
9146Attempt to utilize both instruction sets at once.  This effectively double the
9147amount of available registers and on chips with separate execution units for
9148387 and SSE the execution resources too.  Use this option with care, as it is
9149still experimental, because the GCC register allocator does not model separate
9150functional units well resulting in instable performance.
9151@end table
9152
9153@item -masm=@var{dialect}
9154@opindex masm=@var{dialect}
9155Output asm instructions using selected @var{dialect}.  Supported
9156choices are @samp{intel} or @samp{att} (the default one).  Darwin does
9157not support @samp{intel}.
9158
9159@item -mieee-fp
9160@itemx -mno-ieee-fp
9161@opindex mieee-fp
9162@opindex mno-ieee-fp
9163Control whether or not the compiler uses IEEE floating point
9164comparisons.  These handle correctly the case where the result of a
9165comparison is unordered.
9166
9167@item -msoft-float
9168@opindex msoft-float
9169Generate output containing library calls for floating point.
9170@strong{Warning:} the requisite libraries are not part of GCC@.
9171Normally the facilities of the machine's usual C compiler are used, but
9172this can't be done directly in cross-compilation.  You must make your
9173own arrangements to provide suitable library functions for
9174cross-compilation.
9175
9176On machines where a function returns floating point results in the 80387
9177register stack, some floating point opcodes may be emitted even if
9178@option{-msoft-float} is used.
9179
9180@item -mno-fp-ret-in-387
9181@opindex mno-fp-ret-in-387
9182Do not use the FPU registers for return values of functions.
9183
9184The usual calling convention has functions return values of types
9185@code{float} and @code{double} in an FPU register, even if there
9186is no FPU@.  The idea is that the operating system should emulate
9187an FPU@.
9188
9189The option @option{-mno-fp-ret-in-387} causes such values to be returned
9190in ordinary CPU registers instead.
9191
9192@item -mno-fancy-math-387
9193@opindex mno-fancy-math-387
9194Some 387 emulators do not support the @code{sin}, @code{cos} and
9195@code{sqrt} instructions for the 387.  Specify this option to avoid
9196generating those instructions.  This option is the default on
9197OpenBSD and NetBSD@.  This option is overridden when @option{-march}
9198indicates that the target cpu will always have an FPU and so the
9199instruction will not need emulation.  As of revision 2.6.1, these
9200instructions are not generated unless you also use the
9201@option{-funsafe-math-optimizations} switch.
9202
9203@item -malign-double
9204@itemx -mno-align-double
9205@opindex malign-double
9206@opindex mno-align-double
9207Control whether GCC aligns @code{double}, @code{long double}, and
9208@code{long long} variables on a two word boundary or a one word
9209boundary.  Aligning @code{double} variables on a two word boundary will
9210produce code that runs somewhat faster on a @samp{Pentium} at the
9211expense of more memory.
9212
9213On x86-64, @option{-malign-double} is enabled by default.
9214
9215@strong{Warning:} if you use the @option{-malign-double} switch,
9216structures containing the above types will be aligned differently than
9217the published application binary interface specifications for the 386
9218and will not be binary compatible with structures in code compiled
9219without that switch.
9220
9221@item -m96bit-long-double
9222@itemx -m128bit-long-double
9223@opindex m96bit-long-double
9224@opindex m128bit-long-double
9225These switches control the size of @code{long double} type.  The i386
9226application binary interface specifies the size to be 96 bits,
9227so @option{-m96bit-long-double} is the default in 32 bit mode.
9228
9229Modern architectures (Pentium and newer) would prefer @code{long double}
9230to be aligned to an 8 or 16 byte boundary.  In arrays or structures
9231conforming to the ABI, this would not be possible.  So specifying a
9232@option{-m128bit-long-double} will align @code{long double}
9233to a 16 byte boundary by padding the @code{long double} with an additional
923432 bit zero.
9235
9236In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
9237its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
9238
9239Notice that neither of these options enable any extra precision over the x87
9240standard of 80 bits for a @code{long double}.
9241
9242@strong{Warning:} if you override the default value for your target ABI, the
9243structures and arrays containing @code{long double} variables will change
9244their size as well as function calling convention for function taking
9245@code{long double} will be modified.  Hence they will not be binary
9246compatible with arrays or structures in code compiled without that switch.
9247
9248@item -mmlarge-data-threshold=@var{number}
9249@opindex mlarge-data-threshold=@var{number}
9250When @option{-mcmodel=medium} is specified, the data greater than
9251@var{threshold} are placed in large data section.  This value must be the
9252same across all object linked into the binary and defaults to 65535.
9253
9254@item -msvr3-shlib
9255@itemx -mno-svr3-shlib
9256@opindex msvr3-shlib
9257@opindex mno-svr3-shlib
9258Control whether GCC places uninitialized local variables into the
9259@code{bss} or @code{data} segments.  @option{-msvr3-shlib} places them
9260into @code{bss}.  These options are meaningful only on System V Release 3.
9261
9262@item -mrtd
9263@opindex mrtd
9264Use a different function-calling convention, in which functions that
9265take a fixed number of arguments return with the @code{ret} @var{num}
9266instruction, which pops their arguments while returning.  This saves one
9267instruction in the caller since there is no need to pop the arguments
9268there.
9269
9270You can specify that an individual function is called with this calling
9271sequence with the function attribute @samp{stdcall}.  You can also
9272override the @option{-mrtd} option by using the function attribute
9273@samp{cdecl}.  @xref{Function Attributes}.
9274
9275@strong{Warning:} this calling convention is incompatible with the one
9276normally used on Unix, so you cannot use it if you need to call
9277libraries compiled with the Unix compiler.
9278
9279Also, you must provide function prototypes for all functions that
9280take variable numbers of arguments (including @code{printf});
9281otherwise incorrect code will be generated for calls to those
9282functions.
9283
9284In addition, seriously incorrect code will result if you call a
9285function with too many arguments.  (Normally, extra arguments are
9286harmlessly ignored.)
9287
9288@item -mregparm=@var{num}
9289@opindex mregparm
9290Control how many registers are used to pass integer arguments.  By
9291default, no registers are used to pass arguments, and at most 3
9292registers can be used.  You can control this behavior for a specific
9293function by using the function attribute @samp{regparm}.
9294@xref{Function Attributes}.
9295
9296@strong{Warning:} if you use this switch, and
9297@var{num} is nonzero, then you must build all modules with the same
9298value, including any libraries.  This includes the system libraries and
9299startup modules.
9300
9301@item -msseregparm
9302@opindex msseregparm
9303Use SSE register passing conventions for float and double arguments
9304and return values.  You can control this behavior for a specific
9305function by using the function attribute @samp{sseregparm}.
9306@xref{Function Attributes}.
9307
9308@strong{Warning:} if you use this switch then you must build all
9309modules with the same value, including any libraries.  This includes
9310the system libraries and startup modules.
9311
9312@item -mstackrealign
9313@opindex mstackrealign
9314Realign the stack at entry.  On the Intel x86, the
9315@option{-mstackrealign} option will generate an alternate prologue and
9316epilogue that realigns the runtime stack.  This supports mixing legacy
9317codes that keep a 4-byte aligned stack with modern codes that keep a
931816-byte stack for SSE compatibility.  The alternate prologue and
9319epilogue are slower and bigger than the regular ones, and the
9320alternate prologue requires an extra scratch register; this lowers the
9321number of registers available if used in conjunction with the
9322@code{regparm} attribute.  The @option{-mstackrealign} option is
9323incompatible with the nested function prologue; this is considered a
9324hard error.  See also the attribute @code{force_align_arg_pointer},
9325applicable to individual functions.
9326
9327@item -mpreferred-stack-boundary=@var{num}
9328@opindex mpreferred-stack-boundary
9329Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
9330byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
9331the default is 4 (16 bytes or 128 bits).
9332
9333On Pentium and PentiumPro, @code{double} and @code{long double} values
9334should be aligned to an 8 byte boundary (see @option{-malign-double}) or
9335suffer significant run time performance penalties.  On Pentium III, the
9336Streaming SIMD Extension (SSE) data type @code{__m128} may not work
9337properly if it is not 16 byte aligned.
9338
9339To ensure proper alignment of this values on the stack, the stack boundary
9340must be as aligned as that required by any value stored on the stack.
9341Further, every function must be generated such that it keeps the stack
9342aligned.  Thus calling a function compiled with a higher preferred
9343stack boundary from a function compiled with a lower preferred stack
9344boundary will most likely misalign the stack.  It is recommended that
9345libraries that use callbacks always use the default setting.
9346
9347This extra alignment does consume extra stack space, and generally
9348increases code size.  Code that is sensitive to stack space usage, such
9349as embedded systems and operating system kernels, may want to reduce the
9350preferred alignment to @option{-mpreferred-stack-boundary=2}.
9351
9352@item -mmmx
9353@itemx -mno-mmx
9354@item -msse
9355@itemx -mno-sse
9356@item -msse2
9357@itemx -mno-sse2
9358@item -msse3
9359@itemx -mno-sse3
9360@item -mssse3
9361@itemx -mno-ssse3
9362@item -msse4a
9363@item -mno-sse4a
9364@item -m3dnow
9365@itemx -mno-3dnow
9366@item -mpopcnt
9367@itemx -mno-popcnt
9368@item -mabm
9369@itemx -mno-abm
9370@item -maes
9371@itemx -mno-aes
9372@opindex mmmx
9373@opindex mno-mmx
9374@opindex msse
9375@opindex mno-sse
9376@opindex m3dnow
9377@opindex mno-3dnow
9378These switches enable or disable the use of instructions in the MMX,
9379SSE, SSE2, SSE3, SSSE3, SSE4A, ABM, AES or 3DNow! extended
9380instruction sets.  These extensions are also available as built-in
9381functions: see @ref{X86 Built-in Functions}, for details of the functions
9382enabled and disabled by these switches.
9383
9384To have SSE/SSE2 instructions generated automatically from floating-point
9385code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
9386
9387These options will enable GCC to use these extended instructions in
9388generated code, even without @option{-mfpmath=sse}.  Applications which
9389perform runtime CPU detection must compile separate files for each
9390supported architecture, using the appropriate flags.  In particular,
9391the file containing the CPU detection code should be compiled without
9392these options.
9393
9394@item -mpush-args
9395@itemx -mno-push-args
9396@opindex mpush-args
9397@opindex mno-push-args
9398Use PUSH operations to store outgoing parameters.  This method is shorter
9399and usually equally fast as method using SUB/MOV operations and is enabled
9400by default.  In some cases disabling it may improve performance because of
9401improved scheduling and reduced dependencies.
9402
9403@item -maccumulate-outgoing-args
9404@opindex maccumulate-outgoing-args
9405If enabled, the maximum amount of space required for outgoing arguments will be
9406computed in the function prologue.  This is faster on most modern CPUs
9407because of reduced dependencies, improved scheduling and reduced stack usage
9408when preferred stack boundary is not equal to 2.  The drawback is a notable
9409increase in code size.  This switch implies @option{-mno-push-args}.
9410
9411@item -mthreads
9412@opindex mthreads
9413Support thread-safe exception handling on @samp{Mingw32}.  Code that relies
9414on thread-safe exception handling must compile and link all code with the
9415@option{-mthreads} option.  When compiling, @option{-mthreads} defines
9416@option{-D_MT}; when linking, it links in a special thread helper library
9417@option{-lmingwthrd} which cleans up per thread exception handling data.
9418
9419@item -mno-align-stringops
9420@opindex mno-align-stringops
9421Do not align destination of inlined string operations.  This switch reduces
9422code size and improves performance in case the destination is already aligned,
9423but GCC doesn't know about it.
9424
9425@item -minline-all-stringops
9426@opindex minline-all-stringops
9427By default GCC inlines string operations only when destination is known to be
9428aligned at least to 4 byte boundary.  This enables more inlining, increase code
9429size, but may improve performance of code that depends on fast memcpy, strlen
9430and memset for short lengths.
9431
9432@item -momit-leaf-frame-pointer
9433@opindex momit-leaf-frame-pointer
9434Don't keep the frame pointer in a register for leaf functions.  This
9435avoids the instructions to save, set up and restore frame pointers and
9436makes an extra register available in leaf functions.  The option
9437@option{-fomit-frame-pointer} removes the frame pointer for all functions
9438which might make debugging harder.
9439
9440@item -mtls-direct-seg-refs
9441@itemx -mno-tls-direct-seg-refs
9442@opindex mtls-direct-seg-refs
9443Controls whether TLS variables may be accessed with offsets from the
9444TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
9445or whether the thread base pointer must be added.  Whether or not this
9446is legal depends on the operating system, and whether it maps the
9447segment to cover the entire TLS area.
9448
9449For systems that use GNU libc, the default is on.
9450@end table
9451
9452These @samp{-m} switches are supported in addition to the above
9453on AMD x86-64 processors in 64-bit environments.
9454
9455@table @gcctabopt
9456@item -m32
9457@itemx -m64
9458@opindex m32
9459@opindex m64
9460Generate code for a 32-bit or 64-bit environment.
9461The 32-bit environment sets int, long and pointer to 32 bits and
9462generates code that runs on any i386 system.
9463The 64-bit environment sets int to 32 bits and long and pointer
9464to 64 bits and generates code for AMD's x86-64 architecture. For
9465darwin only the -m64 option turns off the @option{-fno-pic} and
9466@option{-mdynamic-no-pic} options.
9467
9468@item -mno-red-zone
9469@opindex no-red-zone
9470Do not use a so called red zone for x86-64 code.  The red zone is mandated
9471by the x86-64 ABI, it is a 128-byte area beyond the location of the
9472stack pointer that will not be modified by signal or interrupt handlers
9473and therefore can be used for temporary data without adjusting the stack
9474pointer.  The flag @option{-mno-red-zone} disables this red zone.
9475
9476@item -mcmodel=small
9477@opindex mcmodel=small
9478Generate code for the small code model: the program and its symbols must
9479be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
9480Programs can be statically or dynamically linked.  This is the default
9481code model.
9482
9483@item -mcmodel=kernel
9484@opindex mcmodel=kernel
9485Generate code for the kernel code model.  The kernel runs in the
9486negative 2 GB of the address space.
9487This model has to be used for Linux kernel code.
9488
9489@item -mcmodel=medium
9490@opindex mcmodel=medium
9491Generate code for the medium model: The program is linked in the lower 2
9492GB of the address space but symbols can be located anywhere in the
9493address space.  Programs can be statically or dynamically linked, but
9494building of shared libraries are not supported with the medium model.
9495
9496@item -mcmodel=large
9497@opindex mcmodel=large
9498Generate code for the large model: This model makes no assumptions
9499about addresses and sizes of sections.  Currently GCC does not implement
9500this model.
9501@end table
9502
9503@node IA-64 Options
9504@subsection IA-64 Options
9505@cindex IA-64 Options
9506
9507These are the @samp{-m} options defined for the Intel IA-64 architecture.
9508
9509@table @gcctabopt
9510@item -mbig-endian
9511@opindex mbig-endian
9512Generate code for a big endian target.  This is the default for HP-UX@.
9513
9514@item -mlittle-endian
9515@opindex mlittle-endian
9516Generate code for a little endian target.  This is the default for AIX5
9517and GNU/Linux.
9518
9519@item -mgnu-as
9520@itemx -mno-gnu-as
9521@opindex mgnu-as
9522@opindex mno-gnu-as
9523Generate (or don't) code for the GNU assembler.  This is the default.
9524@c Also, this is the default if the configure option @option{--with-gnu-as}
9525@c is used.
9526
9527@item -mgnu-ld
9528@itemx -mno-gnu-ld
9529@opindex mgnu-ld
9530@opindex mno-gnu-ld
9531Generate (or don't) code for the GNU linker.  This is the default.
9532@c Also, this is the default if the configure option @option{--with-gnu-ld}
9533@c is used.
9534
9535@item -mno-pic
9536@opindex mno-pic
9537Generate code that does not use a global pointer register.  The result
9538is not position independent code, and violates the IA-64 ABI@.
9539
9540@item -mvolatile-asm-stop
9541@itemx -mno-volatile-asm-stop
9542@opindex mvolatile-asm-stop
9543@opindex mno-volatile-asm-stop
9544Generate (or don't) a stop bit immediately before and after volatile asm
9545statements.
9546
9547@item -mregister-names
9548@itemx -mno-register-names
9549@opindex mregister-names
9550@opindex mno-register-names
9551Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
9552the stacked registers.  This may make assembler output more readable.
9553
9554@item -mno-sdata
9555@itemx -msdata
9556@opindex mno-sdata
9557@opindex msdata
9558Disable (or enable) optimizations that use the small data section.  This may
9559be useful for working around optimizer bugs.
9560
9561@item -mconstant-gp
9562@opindex mconstant-gp
9563Generate code that uses a single constant global pointer value.  This is
9564useful when compiling kernel code.
9565
9566@item -mauto-pic
9567@opindex mauto-pic
9568Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
9569This is useful when compiling firmware code.
9570
9571@item -minline-float-divide-min-latency
9572@opindex minline-float-divide-min-latency
9573Generate code for inline divides of floating point values
9574using the minimum latency algorithm.
9575
9576@item -minline-float-divide-max-throughput
9577@opindex minline-float-divide-max-throughput
9578Generate code for inline divides of floating point values
9579using the maximum throughput algorithm.
9580
9581@item -minline-int-divide-min-latency
9582@opindex minline-int-divide-min-latency
9583Generate code for inline divides of integer values
9584using the minimum latency algorithm.
9585
9586@item -minline-int-divide-max-throughput
9587@opindex minline-int-divide-max-throughput
9588Generate code for inline divides of integer values
9589using the maximum throughput algorithm.
9590
9591@item -minline-sqrt-min-latency
9592@opindex minline-sqrt-min-latency
9593Generate code for inline square roots
9594using the minimum latency algorithm.
9595
9596@item -minline-sqrt-max-throughput
9597@opindex minline-sqrt-max-throughput
9598Generate code for inline square roots
9599using the maximum throughput algorithm.
9600
9601@item -mno-dwarf2-asm
9602@itemx -mdwarf2-asm
9603@opindex mno-dwarf2-asm
9604@opindex mdwarf2-asm
9605Don't (or do) generate assembler code for the DWARF2 line number debugging
9606info.  This may be useful when not using the GNU assembler.
9607
9608@item -mearly-stop-bits
9609@itemx -mno-early-stop-bits
9610@opindex mearly-stop-bits
9611@opindex mno-early-stop-bits
9612Allow stop bits to be placed earlier than immediately preceding the
9613instruction that triggered the stop bit.  This can improve instruction
9614scheduling, but does not always do so.
9615
9616@item -mfixed-range=@var{register-range}
9617@opindex mfixed-range
9618Generate code treating the given register range as fixed registers.
9619A fixed register is one that the register allocator can not use.  This is
9620useful when compiling kernel code.  A register range is specified as
9621two registers separated by a dash.  Multiple register ranges can be
9622specified separated by a comma.
9623
9624@item -mtls-size=@var{tls-size}
9625@opindex mtls-size
9626Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
962764.
9628
9629@item -mtune=@var{cpu-type}
9630@opindex mtune
9631Tune the instruction scheduling for a particular CPU, Valid values are
9632itanium, itanium1, merced, itanium2, and mckinley.
9633
9634@item -mt
9635@itemx -pthread
9636@opindex mt
9637@opindex pthread
9638Add support for multithreading using the POSIX threads library.  This
9639option sets flags for both the preprocessor and linker.  It does
9640not affect the thread safety of object code produced by the compiler or
9641that of libraries supplied with it.  These are HP-UX specific flags.
9642
9643@item -milp32
9644@itemx -mlp64
9645@opindex milp32
9646@opindex mlp64
9647Generate code for a 32-bit or 64-bit environment.
9648The 32-bit environment sets int, long and pointer to 32 bits.
9649The 64-bit environment sets int to 32 bits and long and pointer
9650to 64 bits.  These are HP-UX specific flags.
9651
9652@item -mno-sched-br-data-spec
9653@itemx -msched-br-data-spec
9654@opindex mno-sched-br-data-spec
9655@opindex msched-br-data-spec
9656(Dis/En)able data speculative scheduling before reload.
9657This will result in generation of the ld.a instructions and
9658the corresponding check instructions (ld.c / chk.a).
9659The default is 'disable'.
9660
9661@item -msched-ar-data-spec
9662@itemx -mno-sched-ar-data-spec
9663@opindex msched-ar-data-spec
9664@opindex mno-sched-ar-data-spec
9665(En/Dis)able data speculative scheduling after reload.
9666This will result in generation of the ld.a instructions and
9667the corresponding check instructions (ld.c / chk.a).
9668The default is 'enable'.
9669
9670@item -mno-sched-control-spec
9671@itemx -msched-control-spec
9672@opindex mno-sched-control-spec
9673@opindex msched-control-spec
9674(Dis/En)able control speculative scheduling.  This feature is
9675available only during region scheduling (i.e. before reload).
9676This will result in generation of the ld.s instructions and
9677the corresponding check instructions chk.s .
9678The default is 'disable'.
9679
9680@item -msched-br-in-data-spec
9681@itemx -mno-sched-br-in-data-spec
9682@opindex msched-br-in-data-spec
9683@opindex mno-sched-br-in-data-spec
9684(En/Dis)able speculative scheduling of the instructions that
9685are dependent on the data speculative loads before reload.
9686This is effective only with @option{-msched-br-data-spec} enabled.
9687The default is 'enable'.
9688
9689@item -msched-ar-in-data-spec
9690@itemx -mno-sched-ar-in-data-spec
9691@opindex msched-ar-in-data-spec
9692@opindex mno-sched-ar-in-data-spec
9693(En/Dis)able speculative scheduling of the instructions that
9694are dependent on the data speculative loads after reload.
9695This is effective only with @option{-msched-ar-data-spec} enabled.
9696The default is 'enable'.
9697
9698@item -msched-in-control-spec
9699@itemx -mno-sched-in-control-spec
9700@opindex msched-in-control-spec
9701@opindex mno-sched-in-control-spec
9702(En/Dis)able speculative scheduling of the instructions that
9703are dependent on the control speculative loads.
9704This is effective only with @option{-msched-control-spec} enabled.
9705The default is 'enable'.
9706
9707@item -msched-ldc
9708@itemx -mno-sched-ldc
9709@opindex msched-ldc
9710@opindex mno-sched-ldc
9711(En/Dis)able use of simple data speculation checks ld.c .
9712If disabled, only chk.a instructions will be emitted to check
9713data speculative loads.
9714The default is 'enable'.
9715
9716@item -mno-sched-control-ldc
9717@itemx -msched-control-ldc
9718@opindex mno-sched-control-ldc
9719@opindex msched-control-ldc 
9720(Dis/En)able use of ld.c instructions to check control speculative loads.
9721If enabled, in case of control speculative load with no speculatively
9722scheduled dependent instructions this load will be emitted as ld.sa and
9723ld.c will be used to check it.
9724The default is 'disable'.
9725
9726@item -mno-sched-spec-verbose
9727@itemx -msched-spec-verbose
9728@opindex mno-sched-spec-verbose
9729@opindex msched-spec-verbose
9730(Dis/En)able printing of the information about speculative motions.
9731
9732@item -mno-sched-prefer-non-data-spec-insns
9733@itemx -msched-prefer-non-data-spec-insns
9734@opindex mno-sched-prefer-non-data-spec-insns
9735@opindex msched-prefer-non-data-spec-insns
9736If enabled, data speculative instructions will be chosen for schedule
9737only if there are no other choices at the moment.  This will make
9738the use of the data speculation much more conservative.
9739The default is 'disable'.
9740
9741@item -mno-sched-prefer-non-control-spec-insns
9742@itemx -msched-prefer-non-control-spec-insns
9743@opindex mno-sched-prefer-non-control-spec-insns
9744@opindex msched-prefer-non-control-spec-insns
9745If enabled, control speculative instructions will be chosen for schedule
9746only if there are no other choices at the moment.  This will make
9747the use of the control speculation much more conservative.
9748The default is 'disable'.
9749
9750@item -mno-sched-count-spec-in-critical-path
9751@itemx -msched-count-spec-in-critical-path
9752@opindex mno-sched-count-spec-in-critical-path
9753@opindex msched-count-spec-in-critical-path
9754If enabled, speculative dependencies will be considered during
9755computation of the instructions priorities.  This will make the use of the
9756speculation a bit more conservative.
9757The default is 'disable'.
9758
9759@end table
9760
9761@node M32C Options
9762@subsection M32C Options
9763@cindex M32C options
9764
9765@table @gcctabopt
9766@item -mcpu=@var{name}
9767@opindex mcpu=
9768Select the CPU for which code is generated.  @var{name} may be one of
9769@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
9770/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
9771the M32C/80 series.
9772
9773@item -msim
9774@opindex msim
9775Specifies that the program will be run on the simulator.  This causes
9776an alternate runtime library to be linked in which supports, for
9777example, file I/O.  You must not use this option when generating
9778programs that will run on real hardware; you must provide your own
9779runtime library for whatever I/O functions are needed.
9780
9781@item -memregs=@var{number}
9782@opindex memregs=
9783Specifies the number of memory-based pseudo-registers GCC will use
9784during code generation.  These pseudo-registers will be used like real
9785registers, so there is a tradeoff between GCC's ability to fit the
9786code into available registers, and the performance penalty of using
9787memory instead of registers.  Note that all modules in a program must
9788be compiled with the same value for this option.  Because of that, you
9789must not use this option with the default runtime libraries gcc
9790builds.
9791
9792@end table
9793
9794@node M32R/D Options
9795@subsection M32R/D Options
9796@cindex M32R/D options
9797
9798These @option{-m} options are defined for Renesas M32R/D architectures:
9799
9800@table @gcctabopt
9801@item -m32r2
9802@opindex m32r2
9803Generate code for the M32R/2@.
9804
9805@item -m32rx
9806@opindex m32rx
9807Generate code for the M32R/X@.
9808
9809@item -m32r
9810@opindex m32r
9811Generate code for the M32R@.  This is the default.
9812
9813@item -mmodel=small
9814@opindex mmodel=small
9815Assume all objects live in the lower 16MB of memory (so that their addresses
9816can be loaded with the @code{ld24} instruction), and assume all subroutines
9817are reachable with the @code{bl} instruction.
9818This is the default.
9819
9820The addressability of a particular object can be set with the
9821@code{model} attribute.
9822
9823@item -mmodel=medium
9824@opindex mmodel=medium
9825Assume objects may be anywhere in the 32-bit address space (the compiler
9826will generate @code{seth/add3} instructions to load their addresses), and
9827assume all subroutines are reachable with the @code{bl} instruction.
9828
9829@item -mmodel=large
9830@opindex mmodel=large
9831Assume objects may be anywhere in the 32-bit address space (the compiler
9832will generate @code{seth/add3} instructions to load their addresses), and
9833assume subroutines may not be reachable with the @code{bl} instruction
9834(the compiler will generate the much slower @code{seth/add3/jl}
9835instruction sequence).
9836
9837@item -msdata=none
9838@opindex msdata=none
9839Disable use of the small data area.  Variables will be put into
9840one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
9841@code{section} attribute has been specified).
9842This is the default.
9843
9844The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
9845Objects may be explicitly put in the small data area with the
9846@code{section} attribute using one of these sections.
9847
9848@item -msdata=sdata
9849@opindex msdata=sdata
9850Put small global and static data in the small data area, but do not
9851generate special code to reference them.
9852
9853@item -msdata=use
9854@opindex msdata=use
9855Put small global and static data in the small data area, and generate
9856special instructions to reference them.
9857
9858@item -G @var{num}
9859@opindex G
9860@cindex smaller data references
9861Put global and static objects less than or equal to @var{num} bytes
9862into the small data or bss sections instead of the normal data or bss
9863sections.  The default value of @var{num} is 8.
9864The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
9865for this option to have any effect.
9866
9867All modules should be compiled with the same @option{-G @var{num}} value.
9868Compiling with different values of @var{num} may or may not work; if it
9869doesn't the linker will give an error message---incorrect code will not be
9870generated.
9871
9872@item -mdebug
9873@opindex mdebug
9874Makes the M32R specific code in the compiler display some statistics
9875that might help in debugging programs.
9876
9877@item -malign-loops
9878@opindex malign-loops
9879Align all loops to a 32-byte boundary.
9880
9881@item -mno-align-loops
9882@opindex mno-align-loops
9883Do not enforce a 32-byte alignment for loops.  This is the default.
9884
9885@item -missue-rate=@var{number}
9886@opindex missue-rate=@var{number}
9887Issue @var{number} instructions per cycle.  @var{number} can only be 1
9888or 2.
9889
9890@item -mbranch-cost=@var{number}
9891@opindex mbranch-cost=@var{number}
9892@var{number} can only be 1 or 2.  If it is 1 then branches will be
9893preferred over conditional code, if it is 2, then the opposite will
9894apply.
9895
9896@item -mflush-trap=@var{number}
9897@opindex mflush-trap=@var{number}
9898Specifies the trap number to use to flush the cache.  The default is
989912.  Valid numbers are between 0 and 15 inclusive.
9900
9901@item -mno-flush-trap
9902@opindex mno-flush-trap
9903Specifies that the cache cannot be flushed by using a trap.
9904
9905@item -mflush-func=@var{name}
9906@opindex mflush-func=@var{name}
9907Specifies the name of the operating system function to call to flush
9908the cache.  The default is @emph{_flush_cache}, but a function call
9909will only be used if a trap is not available.
9910
9911@item -mno-flush-func
9912@opindex mno-flush-func
9913Indicates that there is no OS function for flushing the cache.
9914
9915@end table
9916
9917@node M680x0 Options
9918@subsection M680x0 Options
9919@cindex M680x0 options
9920
9921These are the @samp{-m} options defined for the 68000 series.  The default
9922values for these options depends on which style of 68000 was selected when
9923the compiler was configured; the defaults for the most common choices are
9924given below.
9925
9926@table @gcctabopt
9927@item -m68000
9928@itemx -mc68000
9929@opindex m68000
9930@opindex mc68000
9931Generate output for a 68000.  This is the default
9932when the compiler is configured for 68000-based systems.
9933
9934Use this option for microcontrollers with a 68000 or EC000 core,
9935including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
9936
9937@item -m68020
9938@itemx -mc68020
9939@opindex m68020
9940@opindex mc68020
9941Generate output for a 68020.  This is the default
9942when the compiler is configured for 68020-based systems.
9943
9944@item -m68881
9945@opindex m68881
9946Generate output containing 68881 instructions for floating point.
9947This is the default for most 68020 systems unless @option{--nfp} was
9948specified when the compiler was configured.
9949
9950@item -m68030
9951@opindex m68030
9952Generate output for a 68030.  This is the default when the compiler is
9953configured for 68030-based systems.
9954
9955@item -m68040
9956@opindex m68040
9957Generate output for a 68040.  This is the default when the compiler is
9958configured for 68040-based systems.
9959
9960This option inhibits the use of 68881/68882 instructions that have to be
9961emulated by software on the 68040.  Use this option if your 68040 does not
9962have code to emulate those instructions.
9963
9964@item -m68060
9965@opindex m68060
9966Generate output for a 68060.  This is the default when the compiler is
9967configured for 68060-based systems.
9968
9969This option inhibits the use of 68020 and 68881/68882 instructions that
9970have to be emulated by software on the 68060.  Use this option if your 68060
9971does not have code to emulate those instructions.
9972
9973@item -mcpu32
9974@opindex mcpu32
9975Generate output for a CPU32.  This is the default
9976when the compiler is configured for CPU32-based systems.
9977
9978Use this option for microcontrollers with a
9979CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
998068336, 68340, 68341, 68349 and 68360.
9981
9982@item -m5200
9983@opindex m5200
9984Generate output for a 520X ``coldfire'' family cpu.  This is the default
9985when the compiler is configured for 520X-based systems.
9986
9987Use this option for microcontroller with a 5200 core, including
9988the MCF5202, MCF5203, MCF5204 and MCF5202.
9989
9990@item -mcfv4e
9991@opindex mcfv4e
9992Generate output for a ColdFire V4e family cpu (e.g.@: 547x/548x).
9993This includes use of hardware floating point instructions.
9994
9995@item -m68020-40
9996@opindex m68020-40
9997Generate output for a 68040, without using any of the new instructions.
9998This results in code which can run relatively efficiently on either a
999968020/68881 or a 68030 or a 68040.  The generated code does use the
1000068881 instructions that are emulated on the 68040.
10001
10002@item -m68020-60
10003@opindex m68020-60
10004Generate output for a 68060, without using any of the new instructions.
10005This results in code which can run relatively efficiently on either a
1000668020/68881 or a 68030 or a 68040.  The generated code does use the
1000768881 instructions that are emulated on the 68060.
10008
10009@item -msoft-float
10010@opindex msoft-float
10011Generate output containing library calls for floating point.
10012@strong{Warning:} the requisite libraries are not available for all m68k
10013targets.  Normally the facilities of the machine's usual C compiler are
10014used, but this can't be done directly in cross-compilation.  You must
10015make your own arrangements to provide suitable library functions for
10016cross-compilation.  The embedded targets @samp{m68k-*-aout} and
10017@samp{m68k-*-coff} do provide software floating point support.
10018
10019@item -mshort
10020@opindex mshort
10021Consider type @code{int} to be 16 bits wide, like @code{short int}.
10022Additionally, parameters passed on the stack are also aligned to a
1002316-bit boundary even on targets whose API mandates promotion to 32-bit.
10024
10025@item -mnobitfield
10026@opindex mnobitfield
10027Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
10028and @option{-m5200} options imply @w{@option{-mnobitfield}}.
10029
10030@item -mbitfield
10031@opindex mbitfield
10032Do use the bit-field instructions.  The @option{-m68020} option implies
10033@option{-mbitfield}.  This is the default if you use a configuration
10034designed for a 68020.
10035
10036@item -mrtd
10037@opindex mrtd
10038Use a different function-calling convention, in which functions
10039that take a fixed number of arguments return with the @code{rtd}
10040instruction, which pops their arguments while returning.  This
10041saves one instruction in the caller since there is no need to pop
10042the arguments there.
10043
10044This calling convention is incompatible with the one normally
10045used on Unix, so you cannot use it if you need to call libraries
10046compiled with the Unix compiler.
10047
10048Also, you must provide function prototypes for all functions that
10049take variable numbers of arguments (including @code{printf});
10050otherwise incorrect code will be generated for calls to those
10051functions.
10052
10053In addition, seriously incorrect code will result if you call a
10054function with too many arguments.  (Normally, extra arguments are
10055harmlessly ignored.)
10056
10057The @code{rtd} instruction is supported by the 68010, 68020, 68030,
1005868040, 68060 and CPU32 processors, but not by the 68000 or 5200.
10059
10060@item -malign-int
10061@itemx -mno-align-int
10062@opindex malign-int
10063@opindex mno-align-int
10064Control whether GCC aligns @code{int}, @code{long}, @code{long long},
10065@code{float}, @code{double}, and @code{long double} variables on a 32-bit
10066boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
10067Aligning variables on 32-bit boundaries produces code that runs somewhat
10068faster on processors with 32-bit busses at the expense of more memory.
10069
10070@strong{Warning:} if you use the @option{-malign-int} switch, GCC will
10071align structures containing the above types  differently than
10072most published application binary interface specifications for the m68k.
10073
10074@item -mpcrel
10075@opindex mpcrel
10076Use the pc-relative addressing mode of the 68000 directly, instead of
10077using a global offset table.  At present, this option implies @option{-fpic},
10078allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
10079not presently supported with @option{-mpcrel}, though this could be supported for
1008068020 and higher processors.
10081
10082@item -mno-strict-align
10083@itemx -mstrict-align
10084@opindex mno-strict-align
10085@opindex mstrict-align
10086Do not (do) assume that unaligned memory references will be handled by
10087the system.
10088
10089@item -msep-data
10090Generate code that allows the data segment to be located in a different
10091area of memory from the text segment.  This allows for execute in place in
10092an environment without virtual memory management.  This option implies
10093@option{-fPIC}.
10094
10095@item -mno-sep-data
10096Generate code that assumes that the data segment follows the text segment.
10097This is the default.
10098
10099@item -mid-shared-library
10100Generate code that supports shared libraries via the library ID method.
10101This allows for execute in place and shared libraries in an environment
10102without virtual memory management.  This option implies @option{-fPIC}.
10103
10104@item -mno-id-shared-library
10105Generate code that doesn't assume ID based shared libraries are being used.
10106This is the default.
10107
10108@item -mshared-library-id=n
10109Specified the identification number of the ID based shared library being
10110compiled.  Specifying a value of 0 will generate more compact code, specifying
10111other values will force the allocation of that number to the current
10112library but is no more space or time efficient than omitting this option.
10113
10114@end table
10115
10116@node M68hc1x Options
10117@subsection M68hc1x Options
10118@cindex M68hc1x options
10119
10120These are the @samp{-m} options defined for the 68hc11 and 68hc12
10121microcontrollers.  The default values for these options depends on
10122which style of microcontroller was selected when the compiler was configured;
10123the defaults for the most common choices are given below.
10124
10125@table @gcctabopt
10126@item -m6811
10127@itemx -m68hc11
10128@opindex m6811
10129@opindex m68hc11
10130Generate output for a 68HC11.  This is the default
10131when the compiler is configured for 68HC11-based systems.
10132
10133@item -m6812
10134@itemx -m68hc12
10135@opindex m6812
10136@opindex m68hc12
10137Generate output for a 68HC12.  This is the default
10138when the compiler is configured for 68HC12-based systems.
10139
10140@item -m68S12
10141@itemx -m68hcs12
10142@opindex m68S12
10143@opindex m68hcs12
10144Generate output for a 68HCS12.
10145
10146@item -mauto-incdec
10147@opindex mauto-incdec
10148Enable the use of 68HC12 pre and post auto-increment and auto-decrement
10149addressing modes.
10150
10151@item -minmax
10152@itemx -nominmax
10153@opindex minmax
10154@opindex mnominmax
10155Enable the use of 68HC12 min and max instructions.
10156
10157@item -mlong-calls
10158@itemx -mno-long-calls
10159@opindex mlong-calls
10160@opindex mno-long-calls
10161Treat all calls as being far away (near).  If calls are assumed to be
10162far away, the compiler will use the @code{call} instruction to
10163call a function and the @code{rtc} instruction for returning.
10164
10165@item -mshort
10166@opindex mshort
10167Consider type @code{int} to be 16 bits wide, like @code{short int}.
10168
10169@item -msoft-reg-count=@var{count}
10170@opindex msoft-reg-count
10171Specify the number of pseudo-soft registers which are used for the
10172code generation.  The maximum number is 32.  Using more pseudo-soft
10173register may or may not result in better code depending on the program.
10174The default is 4 for 68HC11 and 2 for 68HC12.
10175
10176@end table
10177
10178@node MCore Options
10179@subsection MCore Options
10180@cindex MCore options
10181
10182These are the @samp{-m} options defined for the Motorola M*Core
10183processors.
10184
10185@table @gcctabopt
10186
10187@item -mhardlit
10188@itemx -mno-hardlit
10189@opindex mhardlit
10190@opindex mno-hardlit
10191Inline constants into the code stream if it can be done in two
10192instructions or less.
10193
10194@item -mdiv
10195@itemx -mno-div
10196@opindex mdiv
10197@opindex mno-div
10198Use the divide instruction.  (Enabled by default).
10199
10200@item -mrelax-immediate
10201@itemx -mno-relax-immediate
10202@opindex mrelax-immediate
10203@opindex mno-relax-immediate
10204Allow arbitrary sized immediates in bit operations.
10205
10206@item -mwide-bitfields
10207@itemx -mno-wide-bitfields
10208@opindex mwide-bitfields
10209@opindex mno-wide-bitfields
10210Always treat bit-fields as int-sized.
10211
10212@item -m4byte-functions
10213@itemx -mno-4byte-functions
10214@opindex m4byte-functions
10215@opindex mno-4byte-functions
10216Force all functions to be aligned to a four byte boundary.
10217
10218@item -mcallgraph-data
10219@itemx -mno-callgraph-data
10220@opindex mcallgraph-data
10221@opindex mno-callgraph-data
10222Emit callgraph information.
10223
10224@item -mslow-bytes
10225@itemx -mno-slow-bytes
10226@opindex mslow-bytes
10227@opindex mno-slow-bytes
10228Prefer word access when reading byte quantities.
10229
10230@item -mlittle-endian
10231@itemx -mbig-endian
10232@opindex mlittle-endian
10233@opindex mbig-endian
10234Generate code for a little endian target.
10235
10236@item -m210
10237@itemx -m340
10238@opindex m210
10239@opindex m340
10240Generate code for the 210 processor.
10241@end table
10242
10243@node MIPS Options
10244@subsection MIPS Options
10245@cindex MIPS options
10246
10247@table @gcctabopt
10248
10249@item -EB
10250@opindex EB
10251Generate big-endian code.
10252
10253@item -EL
10254@opindex EL
10255Generate little-endian code.  This is the default for @samp{mips*el-*-*}
10256configurations.
10257
10258@item -march=@var{arch}
10259@opindex march
10260Generate code that will run on @var{arch}, which can be the name of a
10261generic MIPS ISA, or the name of a particular processor.
10262The ISA names are:
10263@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
10264@samp{mips32}, @samp{mips32r2}, and @samp{mips64}.
10265The processor names are:
10266@samp{4kc}, @samp{4km}, @samp{4kp},
10267@samp{5kc}, @samp{5kf},
10268@samp{20kc},
10269@samp{24k}, @samp{24kc}, @samp{24kf}, @samp{24kx},
10270@samp{m4k},
10271@samp{orion},
10272@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
10273@samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000},
10274@samp{rm7000}, @samp{rm9000},
10275@samp{sb1},
10276@samp{sr71000},
10277@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
10278@samp{vr5000}, @samp{vr5400} and @samp{vr5500}.
10279The special value @samp{from-abi} selects the
10280most compatible architecture for the selected ABI (that is,
10281@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
10282
10283In processor names, a final @samp{000} can be abbreviated as @samp{k}
10284(for example, @samp{-march=r2k}).  Prefixes are optional, and
10285@samp{vr} may be written @samp{r}.
10286
10287GCC defines two macros based on the value of this option.  The first
10288is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
10289a string.  The second has the form @samp{_MIPS_ARCH_@var{foo}},
10290where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
10291For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
10292to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
10293
10294Note that the @samp{_MIPS_ARCH} macro uses the processor names given
10295above.  In other words, it will have the full prefix and will not
10296abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
10297the macro names the resolved architecture (either @samp{"mips1"} or
10298@samp{"mips3"}).  It names the default architecture when no
10299@option{-march} option is given.
10300
10301@item -mtune=@var{arch}
10302@opindex mtune
10303Optimize for @var{arch}.  Among other things, this option controls
10304the way instructions are scheduled, and the perceived cost of arithmetic
10305operations.  The list of @var{arch} values is the same as for
10306@option{-march}.
10307
10308When this option is not used, GCC will optimize for the processor
10309specified by @option{-march}.  By using @option{-march} and
10310@option{-mtune} together, it is possible to generate code that will
10311run on a family of processors, but optimize the code for one
10312particular member of that family.
10313
10314@samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
10315@samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
10316@samp{-march} ones described above.
10317
10318@item -mips1
10319@opindex mips1
10320Equivalent to @samp{-march=mips1}.
10321
10322@item -mips2
10323@opindex mips2
10324Equivalent to @samp{-march=mips2}.
10325
10326@item -mips3
10327@opindex mips3
10328Equivalent to @samp{-march=mips3}.
10329
10330@item -mips4
10331@opindex mips4
10332Equivalent to @samp{-march=mips4}.
10333
10334@item -mips32
10335@opindex mips32
10336Equivalent to @samp{-march=mips32}.
10337
10338@item -mips32r2
10339@opindex mips32r2
10340Equivalent to @samp{-march=mips32r2}.
10341
10342@item -mips64
10343@opindex mips64
10344Equivalent to @samp{-march=mips64}.
10345
10346@item -mips16
10347@itemx -mno-mips16
10348@opindex mips16
10349@opindex mno-mips16
10350Generate (do not generate) MIPS16 code.  If GCC is targetting a
10351MIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE@.
10352
10353@item -mabi=32
10354@itemx -mabi=o64
10355@itemx -mabi=n32
10356@itemx -mabi=64
10357@itemx -mabi=eabi
10358@opindex mabi=32
10359@opindex mabi=o64
10360@opindex mabi=n32
10361@opindex mabi=64
10362@opindex mabi=eabi
10363Generate code for the given ABI@.
10364
10365Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
10366generates 64-bit code when you select a 64-bit architecture, but you
10367can use @option{-mgp32} to get 32-bit code instead.
10368
10369For information about the O64 ABI, see
10370@w{@uref{http://gcc.gnu.org/projects/mipso64-abi.html}}.
10371
10372@item -mabicalls
10373@itemx -mno-abicalls
10374@opindex mabicalls
10375@opindex mno-abicalls
10376Generate (do not generate) code that is suitable for SVR4-style
10377dynamic objects.  @option{-mabicalls} is the default for SVR4-based
10378systems.
10379
10380@item -mshared
10381@itemx -mno-shared
10382Generate (do not generate) code that is fully position-independent,
10383and that can therefore be linked into shared libraries.  This option
10384only affects @option{-mabicalls}.
10385
10386All @option{-mabicalls} code has traditionally been position-independent,
10387regardless of options like @option{-fPIC} and @option{-fpic}.  However,
10388as an extension, the GNU toolchain allows executables to use absolute
10389accesses for locally-binding symbols.  It can also use shorter GP
10390initialization sequences and generate direct calls to locally-defined
10391functions.  This mode is selected by @option{-mno-shared}.
10392
10393@option{-mno-shared} depends on binutils 2.16 or higher and generates
10394objects that can only be linked by the GNU linker.  However, the option
10395does not affect the ABI of the final executable; it only affects the ABI
10396of relocatable objects.  Using @option{-mno-shared} will generally make
10397executables both smaller and quicker.
10398
10399@option{-mshared} is the default.
10400
10401@item -mxgot
10402@itemx -mno-xgot
10403@opindex mxgot
10404@opindex mno-xgot
10405Lift (do not lift) the usual restrictions on the size of the global
10406offset table.
10407
10408GCC normally uses a single instruction to load values from the GOT@.
10409While this is relatively efficient, it will only work if the GOT
10410is smaller than about 64k.  Anything larger will cause the linker
10411to report an error such as:
10412
10413@cindex relocation truncated to fit (MIPS)
10414@smallexample
10415relocation truncated to fit: R_MIPS_GOT16 foobar
10416@end smallexample
10417
10418If this happens, you should recompile your code with @option{-mxgot}.
10419It should then work with very large GOTs, although it will also be
10420less efficient, since it will take three instructions to fetch the
10421value of a global symbol.
10422
10423Note that some linkers can create multiple GOTs.  If you have such a
10424linker, you should only need to use @option{-mxgot} when a single object
10425file accesses more than 64k's worth of GOT entries.  Very few do.
10426
10427These options have no effect unless GCC is generating position
10428independent code.
10429
10430@item -mgp32
10431@opindex mgp32
10432Assume that general-purpose registers are 32 bits wide.
10433
10434@item -mgp64
10435@opindex mgp64
10436Assume that general-purpose registers are 64 bits wide.
10437
10438@item -mfp32
10439@opindex mfp32
10440Assume that floating-point registers are 32 bits wide.
10441
10442@item -mfp64
10443@opindex mfp64
10444Assume that floating-point registers are 64 bits wide.
10445
10446@item -mhard-float
10447@opindex mhard-float
10448Use floating-point coprocessor instructions.
10449
10450@item -msoft-float
10451@opindex msoft-float
10452Do not use floating-point coprocessor instructions.  Implement
10453floating-point calculations using library calls instead.
10454
10455@item -msingle-float
10456@opindex msingle-float
10457Assume that the floating-point coprocessor only supports single-precision
10458operations.
10459
10460@itemx -mdouble-float
10461@opindex mdouble-float
10462Assume that the floating-point coprocessor supports double-precision
10463operations.  This is the default.
10464
10465@itemx -mdsp
10466@itemx -mno-dsp
10467@opindex mdsp
10468@opindex mno-dsp
10469Use (do not use) the MIPS DSP ASE.  @xref{MIPS DSP Built-in Functions}.
10470
10471@itemx -mpaired-single
10472@itemx -mno-paired-single
10473@opindex mpaired-single
10474@opindex mno-paired-single
10475Use (do not use) paired-single floating-point instructions.
10476@xref{MIPS Paired-Single Support}.  This option can only be used
10477when generating 64-bit code and requires hardware floating-point
10478support to be enabled.
10479
10480@itemx -mips3d
10481@itemx -mno-mips3d
10482@opindex mips3d
10483@opindex mno-mips3d
10484Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
10485The option @option{-mips3d} implies @option{-mpaired-single}.
10486
10487@item -mlong64
10488@opindex mlong64
10489Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
10490an explanation of the default and the way that the pointer size is
10491determined.
10492
10493@item -mlong32
10494@opindex mlong32
10495Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
10496
10497The default size of @code{int}s, @code{long}s and pointers depends on
10498the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
10499uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
1050032-bit @code{long}s.  Pointers are the same size as @code{long}s,
10501or the same size as integer registers, whichever is smaller.
10502
10503@item -msym32
10504@itemx -mno-sym32
10505@opindex msym32
10506@opindex mno-sym32
10507Assume (do not assume) that all symbols have 32-bit values, regardless
10508of the selected ABI@.  This option is useful in combination with
10509@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
10510to generate shorter and faster references to symbolic addresses.
10511
10512@item -G @var{num}
10513@opindex G
10514@cindex smaller data references (MIPS)
10515@cindex gp-relative references (MIPS)
10516Put global and static items less than or equal to @var{num} bytes into
10517the small data or bss section instead of the normal data or bss section.
10518This allows the data to be accessed using a single instruction.
10519
10520All modules should be compiled with the same @option{-G @var{num}}
10521value.
10522
10523@item -membedded-data
10524@itemx -mno-embedded-data
10525@opindex membedded-data
10526@opindex mno-embedded-data
10527Allocate variables to the read-only data section first if possible, then
10528next in the small data section if possible, otherwise in data.  This gives
10529slightly slower code than the default, but reduces the amount of RAM required
10530when executing, and thus may be preferred for some embedded systems.
10531
10532@item -muninit-const-in-rodata
10533@itemx -mno-uninit-const-in-rodata
10534@opindex muninit-const-in-rodata
10535@opindex mno-uninit-const-in-rodata
10536Put uninitialized @code{const} variables in the read-only data section.
10537This option is only meaningful in conjunction with @option{-membedded-data}.
10538
10539@item -msplit-addresses
10540@itemx -mno-split-addresses
10541@opindex msplit-addresses
10542@opindex mno-split-addresses
10543Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
10544relocation operators.  This option has been superseded by
10545@option{-mexplicit-relocs} but is retained for backwards compatibility.
10546
10547@item -mexplicit-relocs
10548@itemx -mno-explicit-relocs
10549@opindex mexplicit-relocs
10550@opindex mno-explicit-relocs
10551Use (do not use) assembler relocation operators when dealing with symbolic
10552addresses.  The alternative, selected by @option{-mno-explicit-relocs},
10553is to use assembler macros instead.
10554
10555@option{-mexplicit-relocs} is the default if GCC was configured
10556to use an assembler that supports relocation operators.
10557
10558@item -mcheck-zero-division
10559@itemx -mno-check-zero-division
10560@opindex mcheck-zero-division
10561@opindex mno-check-zero-division
10562Trap (do not trap) on integer division by zero.  The default is
10563@option{-mcheck-zero-division}.
10564
10565@item -mdivide-traps
10566@itemx -mdivide-breaks
10567@opindex mdivide-traps
10568@opindex mdivide-breaks
10569MIPS systems check for division by zero by generating either a
10570conditional trap or a break instruction.  Using traps results in
10571smaller code, but is only supported on MIPS II and later.  Also, some
10572versions of the Linux kernel have a bug that prevents trap from
10573generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
10574allow conditional traps on architectures that support them and
10575@option{-mdivide-breaks} to force the use of breaks.
10576
10577The default is usually @option{-mdivide-traps}, but this can be
10578overridden at configure time using @option{--with-divide=breaks}.
10579Divide-by-zero checks can be completely disabled using
10580@option{-mno-check-zero-division}.
10581
10582@item -mmemcpy
10583@itemx -mno-memcpy
10584@opindex mmemcpy
10585@opindex mno-memcpy
10586Force (do not force) the use of @code{memcpy()} for non-trivial block
10587moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
10588most constant-sized copies.
10589
10590@item -mlong-calls
10591@itemx -mno-long-calls
10592@opindex mlong-calls
10593@opindex mno-long-calls
10594Disable (do not disable) use of the @code{jal} instruction.  Calling
10595functions using @code{jal} is more efficient but requires the caller
10596and callee to be in the same 256 megabyte segment.
10597
10598This option has no effect on abicalls code.  The default is
10599@option{-mno-long-calls}.
10600
10601@item -mmad
10602@itemx -mno-mad
10603@opindex mmad
10604@opindex mno-mad
10605Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
10606instructions, as provided by the R4650 ISA@.
10607
10608@item -mfused-madd
10609@itemx -mno-fused-madd
10610@opindex mfused-madd
10611@opindex mno-fused-madd
10612Enable (disable) use of the floating point multiply-accumulate
10613instructions, when they are available.  The default is
10614@option{-mfused-madd}.
10615
10616When multiply-accumulate instructions are used, the intermediate
10617product is calculated to infinite precision and is not subject to
10618the FCSR Flush to Zero bit.  This may be undesirable in some
10619circumstances.
10620
10621@item -nocpp
10622@opindex nocpp
10623Tell the MIPS assembler to not run its preprocessor over user
10624assembler files (with a @samp{.s} suffix) when assembling them.
10625
10626@item -mfix-r4000
10627@itemx -mno-fix-r4000
10628@opindex mfix-r4000
10629@opindex mno-fix-r4000
10630Work around certain R4000 CPU errata:
10631@itemize @minus
10632@item
10633A double-word or a variable shift may give an incorrect result if executed
10634immediately after starting an integer division.
10635@item
10636A double-word or a variable shift may give an incorrect result if executed
10637while an integer multiplication is in progress.
10638@item
10639An integer division may give an incorrect result if started in a delay slot
10640of a taken branch or a jump.
10641@end itemize
10642
10643@item -mfix-r4400
10644@itemx -mno-fix-r4400
10645@opindex mfix-r4400
10646@opindex mno-fix-r4400
10647Work around certain R4400 CPU errata:
10648@itemize @minus
10649@item
10650A double-word or a variable shift may give an incorrect result if executed
10651immediately after starting an integer division.
10652@end itemize
10653
10654@item -mfix-vr4120
10655@itemx -mno-fix-vr4120
10656@opindex mfix-vr4120
10657Work around certain VR4120 errata:
10658@itemize @minus
10659@item
10660@code{dmultu} does not always produce the correct result.
10661@item
10662@code{div} and @code{ddiv} do not always produce the correct result if one
10663of the operands is negative.
10664@end itemize
10665The workarounds for the division errata rely on special functions in
10666@file{libgcc.a}.  At present, these functions are only provided by
10667the @code{mips64vr*-elf} configurations.
10668
10669Other VR4120 errata require a nop to be inserted between certain pairs of
10670instructions.  These errata are handled by the assembler, not by GCC itself.
10671
10672@item -mfix-vr4130
10673@opindex mfix-vr4130
10674Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
10675workarounds are implemented by the assembler rather than by GCC,
10676although GCC will avoid using @code{mflo} and @code{mfhi} if the
10677VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
10678instructions are available instead.
10679
10680@item -mfix-sb1
10681@itemx -mno-fix-sb1
10682@opindex mfix-sb1
10683Work around certain SB-1 CPU core errata.
10684(This flag currently works around the SB-1 revision 2
10685``F1'' and ``F2'' floating point errata.)
10686
10687@item -mflush-func=@var{func}
10688@itemx -mno-flush-func
10689@opindex mflush-func
10690Specifies the function to call to flush the I and D caches, or to not
10691call any such function.  If called, the function must take the same
10692arguments as the common @code{_flush_func()}, that is, the address of the
10693memory range for which the cache is being flushed, the size of the
10694memory range, and the number 3 (to flush both caches).  The default
10695depends on the target GCC was configured for, but commonly is either
10696@samp{_flush_func} or @samp{__cpu_flush}.
10697
10698@item -mbranch-likely
10699@itemx -mno-branch-likely
10700@opindex mbranch-likely
10701@opindex mno-branch-likely
10702Enable or disable use of Branch Likely instructions, regardless of the
10703default for the selected architecture.  By default, Branch Likely
10704instructions may be generated if they are supported by the selected
10705architecture.  An exception is for the MIPS32 and MIPS64 architectures
10706and processors which implement those architectures; for those, Branch
10707Likely instructions will not be generated by default because the MIPS32
10708and MIPS64 architectures specifically deprecate their use.
10709
10710@item -mfp-exceptions
10711@itemx -mno-fp-exceptions
10712@opindex mfp-exceptions
10713Specifies whether FP exceptions are enabled.  This affects how we schedule
10714FP instructions for some processors.  The default is that FP exceptions are
10715enabled.
10716
10717For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
1071864-bit code, then we can use both FP pipes.  Otherwise, we can only use one
10719FP pipe.
10720
10721@item -mvr4130-align
10722@itemx -mno-vr4130-align
10723@opindex mvr4130-align
10724The VR4130 pipeline is two-way superscalar, but can only issue two
10725instructions together if the first one is 8-byte aligned.  When this
10726option is enabled, GCC will align pairs of instructions that it
10727thinks should execute in parallel.
10728
10729This option only has an effect when optimizing for the VR4130.
10730It normally makes code faster, but at the expense of making it bigger.
10731It is enabled by default at optimization level @option{-O3}.
10732@end table
10733
10734@node MMIX Options
10735@subsection MMIX Options
10736@cindex MMIX Options
10737
10738These options are defined for the MMIX:
10739
10740@table @gcctabopt
10741@item -mlibfuncs
10742@itemx -mno-libfuncs
10743@opindex mlibfuncs
10744@opindex mno-libfuncs
10745Specify that intrinsic library functions are being compiled, passing all
10746values in registers, no matter the size.
10747
10748@item -mepsilon
10749@itemx -mno-epsilon
10750@opindex mepsilon
10751@opindex mno-epsilon
10752Generate floating-point comparison instructions that compare with respect
10753to the @code{rE} epsilon register.
10754
10755@item -mabi=mmixware
10756@itemx -mabi=gnu
10757@opindex mabi-mmixware
10758@opindex mabi=gnu
10759Generate code that passes function parameters and return values that (in
10760the called function) are seen as registers @code{$0} and up, as opposed to
10761the GNU ABI which uses global registers @code{$231} and up.
10762
10763@item -mzero-extend
10764@itemx -mno-zero-extend
10765@opindex mzero-extend
10766@opindex mno-zero-extend
10767When reading data from memory in sizes shorter than 64 bits, use (do not
10768use) zero-extending load instructions by default, rather than
10769sign-extending ones.
10770
10771@item -mknuthdiv
10772@itemx -mno-knuthdiv
10773@opindex mknuthdiv
10774@opindex mno-knuthdiv
10775Make the result of a division yielding a remainder have the same sign as
10776the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
10777remainder follows the sign of the dividend.  Both methods are
10778arithmetically valid, the latter being almost exclusively used.
10779
10780@item -mtoplevel-symbols
10781@itemx -mno-toplevel-symbols
10782@opindex mtoplevel-symbols
10783@opindex mno-toplevel-symbols
10784Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
10785code can be used with the @code{PREFIX} assembly directive.
10786
10787@item -melf
10788@opindex melf
10789Generate an executable in the ELF format, rather than the default
10790@samp{mmo} format used by the @command{mmix} simulator.
10791
10792@item -mbranch-predict
10793@itemx -mno-branch-predict
10794@opindex mbranch-predict
10795@opindex mno-branch-predict
10796Use (do not use) the probable-branch instructions, when static branch
10797prediction indicates a probable branch.
10798
10799@item -mbase-addresses
10800@itemx -mno-base-addresses
10801@opindex mbase-addresses
10802@opindex mno-base-addresses
10803Generate (do not generate) code that uses @emph{base addresses}.  Using a
10804base address automatically generates a request (handled by the assembler
10805and the linker) for a constant to be set up in a global register.  The
10806register is used for one or more base address requests within the range 0
10807to 255 from the value held in the register.  The generally leads to short
10808and fast code, but the number of different data items that can be
10809addressed is limited.  This means that a program that uses lots of static
10810data may require @option{-mno-base-addresses}.
10811
10812@item -msingle-exit
10813@itemx -mno-single-exit
10814@opindex msingle-exit
10815@opindex mno-single-exit
10816Force (do not force) generated code to have a single exit point in each
10817function.
10818@end table
10819
10820@node MN10300 Options
10821@subsection MN10300 Options
10822@cindex MN10300 options
10823
10824These @option{-m} options are defined for Matsushita MN10300 architectures:
10825
10826@table @gcctabopt
10827@item -mmult-bug
10828@opindex mmult-bug
10829Generate code to avoid bugs in the multiply instructions for the MN10300
10830processors.  This is the default.
10831
10832@item -mno-mult-bug
10833@opindex mno-mult-bug
10834Do not generate code to avoid bugs in the multiply instructions for the
10835MN10300 processors.
10836
10837@item -mam33
10838@opindex mam33
10839Generate code which uses features specific to the AM33 processor.
10840
10841@item -mno-am33
10842@opindex mno-am33
10843Do not generate code which uses features specific to the AM33 processor.  This
10844is the default.
10845
10846@item -mreturn-pointer-on-d0
10847@opindex mreturn-pointer-on-d0
10848When generating a function which returns a pointer, return the pointer
10849in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
10850only in a0, and attempts to call such functions without a prototype
10851would result in errors.  Note that this option is on by default; use
10852@option{-mno-return-pointer-on-d0} to disable it.
10853
10854@item -mno-crt0
10855@opindex mno-crt0
10856Do not link in the C run-time initialization object file.
10857
10858@item -mrelax
10859@opindex mrelax
10860Indicate to the linker that it should perform a relaxation optimization pass
10861to shorten branches, calls and absolute memory addresses.  This option only
10862has an effect when used on the command line for the final link step.
10863
10864This option makes symbolic debugging impossible.
10865@end table
10866
10867@node MT Options
10868@subsection MT Options
10869@cindex MT options
10870
10871These @option{-m} options are defined for Morpho MT architectures:
10872
10873@table @gcctabopt
10874
10875@item -march=@var{cpu-type}
10876@opindex march
10877Generate code that will run on @var{cpu-type}, which is the name of a system
10878representing a certain processor type.  Possible values for
10879@var{cpu-type} are @samp{ms1-64-001}, @samp{ms1-16-002},
10880@samp{ms1-16-003} and @samp{ms2}.
10881
10882When this option is not used, the default is @option{-march=ms1-16-002}.
10883
10884@item -mbacc
10885@opindex mbacc
10886Use byte loads and stores when generating code.
10887
10888@item -mno-bacc
10889@opindex mno-bacc
10890Do not use byte loads and stores when generating code.
10891
10892@item -msim
10893@opindex msim
10894Use simulator runtime
10895
10896@item -mno-crt0
10897@opindex mno-crt0
10898Do not link in the C run-time initialization object file
10899@file{crti.o}.  Other run-time initialization and termination files
10900such as @file{startup.o} and @file{exit.o} are still included on the
10901linker command line.
10902
10903@end table
10904
10905@node PDP-11 Options
10906@subsection PDP-11 Options
10907@cindex PDP-11 Options
10908
10909These options are defined for the PDP-11:
10910
10911@table @gcctabopt
10912@item -mfpu
10913@opindex mfpu
10914Use hardware FPP floating point.  This is the default.  (FIS floating
10915point on the PDP-11/40 is not supported.)
10916
10917@item -msoft-float
10918@opindex msoft-float
10919Do not use hardware floating point.
10920
10921@item -mac0
10922@opindex mac0
10923Return floating-point results in ac0 (fr0 in Unix assembler syntax).
10924
10925@item -mno-ac0
10926@opindex mno-ac0
10927Return floating-point results in memory.  This is the default.
10928
10929@item -m40
10930@opindex m40
10931Generate code for a PDP-11/40.
10932
10933@item -m45
10934@opindex m45
10935Generate code for a PDP-11/45.  This is the default.
10936
10937@item -m10
10938@opindex m10
10939Generate code for a PDP-11/10.
10940
10941@item -mbcopy-builtin
10942@opindex bcopy-builtin
10943Use inline @code{movmemhi} patterns for copying memory.  This is the
10944default.
10945
10946@item -mbcopy
10947@opindex mbcopy
10948Do not use inline @code{movmemhi} patterns for copying memory.
10949
10950@item -mint16
10951@itemx -mno-int32
10952@opindex mint16
10953@opindex mno-int32
10954Use 16-bit @code{int}.  This is the default.
10955
10956@item -mint32
10957@itemx -mno-int16
10958@opindex mint32
10959@opindex mno-int16
10960Use 32-bit @code{int}.
10961
10962@item -mfloat64
10963@itemx -mno-float32
10964@opindex mfloat64
10965@opindex mno-float32
10966Use 64-bit @code{float}.  This is the default.
10967
10968@item -mfloat32
10969@itemx -mno-float64
10970@opindex mfloat32
10971@opindex mno-float64
10972Use 32-bit @code{float}.
10973
10974@item -mabshi
10975@opindex mabshi
10976Use @code{abshi2} pattern.  This is the default.
10977
10978@item -mno-abshi
10979@opindex mno-abshi
10980Do not use @code{abshi2} pattern.
10981
10982@item -mbranch-expensive
10983@opindex mbranch-expensive
10984Pretend that branches are expensive.  This is for experimenting with
10985code generation only.
10986
10987@item -mbranch-cheap
10988@opindex mbranch-cheap
10989Do not pretend that branches are expensive.  This is the default.
10990
10991@item -msplit
10992@opindex msplit
10993Generate code for a system with split I&D@.
10994
10995@item -mno-split
10996@opindex mno-split
10997Generate code for a system without split I&D@.  This is the default.
10998
10999@item -munix-asm
11000@opindex munix-asm
11001Use Unix assembler syntax.  This is the default when configured for
11002@samp{pdp11-*-bsd}.
11003
11004@item -mdec-asm
11005@opindex mdec-asm
11006Use DEC assembler syntax.  This is the default when configured for any
11007PDP-11 target other than @samp{pdp11-*-bsd}.
11008@end table
11009
11010@node PowerPC Options
11011@subsection PowerPC Options
11012@cindex PowerPC options
11013
11014These are listed under @xref{RS/6000 and PowerPC Options}.
11015
11016@node RS/6000 and PowerPC Options
11017@subsection IBM RS/6000 and PowerPC Options
11018@cindex RS/6000 and PowerPC Options
11019@cindex IBM RS/6000 and PowerPC Options
11020
11021These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
11022@table @gcctabopt
11023@item -mpower
11024@itemx -mno-power
11025@itemx -mpower2
11026@itemx -mno-power2
11027@itemx -mpowerpc
11028@itemx -mno-powerpc
11029@itemx -mpowerpc-gpopt
11030@itemx -mno-powerpc-gpopt
11031@itemx -mpowerpc-gfxopt
11032@itemx -mno-powerpc-gfxopt
11033@itemx -mpowerpc64
11034@itemx -mno-powerpc64
11035@itemx -mmfcrf
11036@itemx -mno-mfcrf
11037@itemx -mpopcntb
11038@itemx -mno-popcntb
11039@itemx -mfprnd
11040@itemx -mno-fprnd
11041@opindex mpower
11042@opindex mno-power
11043@opindex mpower2
11044@opindex mno-power2
11045@opindex mpowerpc
11046@opindex mno-powerpc
11047@opindex mpowerpc-gpopt
11048@opindex mno-powerpc-gpopt
11049@opindex mpowerpc-gfxopt
11050@opindex mno-powerpc-gfxopt
11051@opindex mpowerpc64
11052@opindex mno-powerpc64
11053@opindex mmfcrf
11054@opindex mno-mfcrf
11055@opindex mpopcntb
11056@opindex mno-popcntb
11057@opindex mfprnd
11058@opindex mno-fprnd
11059GCC supports two related instruction set architectures for the
11060RS/6000 and PowerPC@.  The @dfn{POWER} instruction set are those
11061instructions supported by the @samp{rios} chip set used in the original
11062RS/6000 systems and the @dfn{PowerPC} instruction set is the
11063architecture of the Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and
11064the IBM 4xx, 6xx, and follow-on microprocessors.
11065
11066Neither architecture is a subset of the other.  However there is a
11067large common subset of instructions supported by both.  An MQ
11068register is included in processors supporting the POWER architecture.
11069
11070You use these options to specify which instructions are available on the
11071processor you are using.  The default value of these options is
11072determined when configuring GCC@.  Specifying the
11073@option{-mcpu=@var{cpu_type}} overrides the specification of these
11074options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
11075rather than the options listed above.
11076
11077The @option{-mpower} option allows GCC to generate instructions that
11078are found only in the POWER architecture and to use the MQ register.
11079Specifying @option{-mpower2} implies @option{-power} and also allows GCC
11080to generate instructions that are present in the POWER2 architecture but
11081not the original POWER architecture.
11082
11083The @option{-mpowerpc} option allows GCC to generate instructions that
11084are found only in the 32-bit subset of the PowerPC architecture.
11085Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
11086GCC to use the optional PowerPC architecture instructions in the
11087General Purpose group, including floating-point square root.  Specifying
11088@option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
11089use the optional PowerPC architecture instructions in the Graphics
11090group, including floating-point select.
11091
11092The @option{-mmfcrf} option allows GCC to generate the move from
11093condition register field instruction implemented on the POWER4
11094processor and other processors that support the PowerPC V2.01
11095architecture.
11096The @option{-mpopcntb} option allows GCC to generate the popcount and
11097double precision FP reciprocal estimate instruction implemented on the
11098POWER5 processor and other processors that support the PowerPC V2.02
11099architecture.
11100The @option{-mfprnd} option allows GCC to generate the FP round to
11101integer instructions implemented on the POWER5+ processor and other
11102processors that support the PowerPC V2.03 architecture.
11103
11104The @option{-mpowerpc64} option allows GCC to generate the additional
1110564-bit instructions that are found in the full PowerPC64 architecture
11106and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
11107@option{-mno-powerpc64}.
11108
11109If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
11110will use only the instructions in the common subset of both
11111architectures plus some special AIX common-mode calls, and will not use
11112the MQ register.  Specifying both @option{-mpower} and @option{-mpowerpc}
11113permits GCC to use any instruction from either architecture and to
11114allow use of the MQ register; specify this for the Motorola MPC601.
11115
11116@item -mnew-mnemonics
11117@itemx -mold-mnemonics
11118@opindex mnew-mnemonics
11119@opindex mold-mnemonics
11120Select which mnemonics to use in the generated assembler code.  With
11121@option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
11122the PowerPC architecture.  With @option{-mold-mnemonics} it uses the
11123assembler mnemonics defined for the POWER architecture.  Instructions
11124defined in only one architecture have only one mnemonic; GCC uses that
11125mnemonic irrespective of which of these options is specified.
11126
11127GCC defaults to the mnemonics appropriate for the architecture in
11128use.  Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
11129value of these option.  Unless you are building a cross-compiler, you
11130should normally not specify either @option{-mnew-mnemonics} or
11131@option{-mold-mnemonics}, but should instead accept the default.
11132
11133@item -mcpu=@var{cpu_type}
11134@opindex mcpu
11135Set architecture type, register usage, choice of mnemonics, and
11136instruction scheduling parameters for machine type @var{cpu_type}.
11137Supported values for @var{cpu_type} are @samp{401}, @samp{403},
11138@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{505},
11139@samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604},
11140@samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400},
11141@samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
11142@samp{860}, @samp{970}, @samp{8540}, @samp{ec603e}, @samp{G3},
11143@samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3},
11144@samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6},
11145@samp{common}, @samp{powerpc}, @samp{powerpc64},
11146@samp{rios}, @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}.
11147
11148@option{-mcpu=common} selects a completely generic processor.  Code
11149generated under this option will run on any POWER or PowerPC processor.
11150GCC will use only the instructions in the common subset of both
11151architectures, and will not use the MQ register.  GCC assumes a generic
11152processor model for scheduling purposes.
11153
11154@option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
11155@option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
11156PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
11157types, with an appropriate, generic processor model assumed for
11158scheduling purposes.
11159
11160The other options specify a specific processor.  Code generated under
11161those options will run best on that processor, and may not run at all on
11162others.
11163
11164The @option{-mcpu} options automatically enable or disable the
11165following options: @option{-maltivec}, @option{-mfprnd},
11166@option{-mhard-float}, @option{-mmfcrf}, @option{-mmultiple},
11167@option{-mnew-mnemonics}, @option{-mpopcntb}, @option{-mpower},
11168@option{-mpower2}, @option{-mpowerpc64}, @option{-mpowerpc-gpopt},
11169@option{-mpowerpc-gfxopt}, @option{-mstring}, @option{-mmulhw}, @option{-mdlmzb}.
11170The particular options
11171set for any particular CPU will vary between compiler versions,
11172depending on what setting seems to produce optimal code for that CPU;
11173it doesn't necessarily reflect the actual hardware's capabilities.  If
11174you wish to set an individual option to a particular value, you may
11175specify it after the @option{-mcpu} option, like @samp{-mcpu=970
11176-mno-altivec}.
11177
11178On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
11179not enabled or disabled by the @option{-mcpu} option at present because
11180AIX does not have full support for these options.  You may still
11181enable or disable them individually if you're sure it'll work in your
11182environment.
11183
11184@item -mtune=@var{cpu_type}
11185@opindex mtune
11186Set the instruction scheduling parameters for machine type
11187@var{cpu_type}, but do not set the architecture type, register usage, or
11188choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would.  The same
11189values for @var{cpu_type} are used for @option{-mtune} as for
11190@option{-mcpu}.  If both are specified, the code generated will use the
11191architecture, registers, and mnemonics set by @option{-mcpu}, but the
11192scheduling parameters set by @option{-mtune}.
11193
11194@item -mswdiv
11195@itemx -mno-swdiv
11196@opindex mswdiv
11197@opindex mno-swdiv
11198Generate code to compute division as reciprocal estimate and iterative
11199refinement, creating opportunities for increased throughput.  This
11200feature requires: optional PowerPC Graphics instruction set for single
11201precision and FRE instruction for double precision, assuming divides
11202cannot generate user-visible traps, and the domain values not include
11203Infinities, denormals or zero denominator.
11204
11205@item -maltivec
11206@itemx -mno-altivec
11207@opindex maltivec
11208@opindex mno-altivec
11209Generate code that uses (does not use) AltiVec instructions, and also
11210enable the use of built-in functions that allow more direct access to
11211the AltiVec instruction set.  You may also need to set
11212@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
11213enhancements.
11214
11215@item -mvrsave
11216@item -mno-vrsave
11217@opindex mvrsave
11218@opindex mno-vrsave
11219Generate VRSAVE instructions when generating AltiVec code.
11220
11221@item -msecure-plt
11222@opindex msecure-plt
11223Generate code that allows ld and ld.so to build executables and shared
11224libraries with non-exec .plt and .got sections.  This is a PowerPC
1122532-bit SYSV ABI option.
11226
11227@item -mbss-plt
11228@opindex mbss-plt
11229Generate code that uses a BSS .plt section that ld.so fills in, and
11230requires .plt and .got sections that are both writable and executable.
11231This is a PowerPC 32-bit SYSV ABI option.
11232
11233@item -misel
11234@itemx -mno-isel
11235@opindex misel
11236@opindex mno-isel
11237This switch enables or disables the generation of ISEL instructions.
11238
11239@item -misel=@var{yes/no}
11240This switch has been deprecated.  Use @option{-misel} and
11241@option{-mno-isel} instead.
11242
11243@item -mspe
11244@itemx -mno-spe
11245@opindex mspe
11246@opindex mno-spe
11247This switch enables or disables the generation of SPE simd
11248instructions.
11249
11250@item -mspe=@var{yes/no}
11251This option has been deprecated.  Use @option{-mspe} and
11252@option{-mno-spe} instead.
11253
11254@item -mfloat-gprs=@var{yes/single/double/no}
11255@itemx -mfloat-gprs
11256@opindex mfloat-gprs
11257This switch enables or disables the generation of floating point
11258operations on the general purpose registers for architectures that
11259support it.
11260
11261The argument @var{yes} or @var{single} enables the use of
11262single-precision floating point operations.
11263
11264The argument @var{double} enables the use of single and
11265double-precision floating point operations.
11266
11267The argument @var{no} disables floating point operations on the
11268general purpose registers.
11269
11270This option is currently only available on the MPC854x.
11271
11272@item -m32
11273@itemx -m64
11274@opindex m32
11275@opindex m64
11276Generate code for 32-bit or 64-bit environments of Darwin and SVR4
11277targets (including GNU/Linux).  The 32-bit environment sets int, long
11278and pointer to 32 bits and generates code that runs on any PowerPC
11279variant.  The 64-bit environment sets int to 32 bits and long and
11280pointer to 64 bits, and generates code for PowerPC64, as for
11281@option{-mpowerpc64}.
11282
11283@item -mfull-toc
11284@itemx -mno-fp-in-toc
11285@itemx -mno-sum-in-toc
11286@itemx -mminimal-toc
11287@opindex mfull-toc
11288@opindex mno-fp-in-toc
11289@opindex mno-sum-in-toc
11290@opindex mminimal-toc
11291Modify generation of the TOC (Table Of Contents), which is created for
11292every executable file.  The @option{-mfull-toc} option is selected by
11293default.  In that case, GCC will allocate at least one TOC entry for
11294each unique non-automatic variable reference in your program.  GCC
11295will also place floating-point constants in the TOC@.  However, only
1129616,384 entries are available in the TOC@.
11297
11298If you receive a linker error message that saying you have overflowed
11299the available TOC space, you can reduce the amount of TOC space used
11300with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
11301@option{-mno-fp-in-toc} prevents GCC from putting floating-point
11302constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
11303generate code to calculate the sum of an address and a constant at
11304run-time instead of putting that sum into the TOC@.  You may specify one
11305or both of these options.  Each causes GCC to produce very slightly
11306slower and larger code at the expense of conserving TOC space.
11307
11308If you still run out of space in the TOC even when you specify both of
11309these options, specify @option{-mminimal-toc} instead.  This option causes
11310GCC to make only one TOC entry for every file.  When you specify this
11311option, GCC will produce code that is slower and larger but which
11312uses extremely little TOC space.  You may wish to use this option
11313only on files that contain less frequently executed code.
11314
11315@item -maix64
11316@itemx -maix32
11317@opindex maix64
11318@opindex maix32
11319Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
11320@code{long} type, and the infrastructure needed to support them.
11321Specifying @option{-maix64} implies @option{-mpowerpc64} and
11322@option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
11323implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
11324
11325@item -mxl-compat
11326@itemx -mno-xl-compat
11327@opindex mxl-compat
11328@opindex mno-xl-compat
11329Produce code that conforms more closely to IBM XL compiler semantics
11330when using AIX-compatible ABI.  Pass floating-point arguments to
11331prototyped functions beyond the register save area (RSA) on the stack
11332in addition to argument FPRs.  Do not assume that most significant
11333double in 128-bit long double value is properly rounded when comparing
11334values and converting to double.  Use XL symbol names for long double
11335support routines.
11336
11337The AIX calling convention was extended but not initially documented to
11338handle an obscure K&R C case of calling a function that takes the
11339address of its arguments with fewer arguments than declared.  IBM XL
11340compilers access floating point arguments which do not fit in the
11341RSA from the stack when a subroutine is compiled without
11342optimization.  Because always storing floating-point arguments on the
11343stack is inefficient and rarely needed, this option is not enabled by
11344default and only is necessary when calling subroutines compiled by IBM
11345XL compilers without optimization.
11346
11347@item -mpe
11348@opindex mpe
11349Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
11350application written to use message passing with special startup code to
11351enable the application to run.  The system must have PE installed in the
11352standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
11353must be overridden with the @option{-specs=} option to specify the
11354appropriate directory location.  The Parallel Environment does not
11355support threads, so the @option{-mpe} option and the @option{-pthread}
11356option are incompatible.
11357
11358@item -malign-natural
11359@itemx -malign-power
11360@opindex malign-natural
11361@opindex malign-power
11362On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
11363@option{-malign-natural} overrides the ABI-defined alignment of larger
11364types, such as floating-point doubles, on their natural size-based boundary.
11365The option @option{-malign-power} instructs GCC to follow the ABI-specified
11366alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
11367
11368On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
11369is not supported.
11370
11371@item -msoft-float
11372@itemx -mhard-float
11373@opindex msoft-float
11374@opindex mhard-float
11375Generate code that does not use (uses) the floating-point register set.
11376Software floating point emulation is provided if you use the
11377@option{-msoft-float} option, and pass the option to GCC when linking.
11378
11379@item -mmultiple
11380@itemx -mno-multiple
11381@opindex mmultiple
11382@opindex mno-multiple
11383Generate code that uses (does not use) the load multiple word
11384instructions and the store multiple word instructions.  These
11385instructions are generated by default on POWER systems, and not
11386generated on PowerPC systems.  Do not use @option{-mmultiple} on little
11387endian PowerPC systems, since those instructions do not work when the
11388processor is in little endian mode.  The exceptions are PPC740 and
11389PPC750 which permit the instructions usage in little endian mode.
11390
11391@item -mstring
11392@itemx -mno-string
11393@opindex mstring
11394@opindex mno-string
11395Generate code that uses (does not use) the load string instructions
11396and the store string word instructions to save multiple registers and
11397do small block moves.  These instructions are generated by default on
11398POWER systems, and not generated on PowerPC systems.  Do not use
11399@option{-mstring} on little endian PowerPC systems, since those
11400instructions do not work when the processor is in little endian mode.
11401The exceptions are PPC740 and PPC750 which permit the instructions
11402usage in little endian mode.
11403
11404@item -mupdate
11405@itemx -mno-update
11406@opindex mupdate
11407@opindex mno-update
11408Generate code that uses (does not use) the load or store instructions
11409that update the base register to the address of the calculated memory
11410location.  These instructions are generated by default.  If you use
11411@option{-mno-update}, there is a small window between the time that the
11412stack pointer is updated and the address of the previous frame is
11413stored, which means code that walks the stack frame across interrupts or
11414signals may get corrupted data.
11415
11416@item -mfused-madd
11417@itemx -mno-fused-madd
11418@opindex mfused-madd
11419@opindex mno-fused-madd
11420Generate code that uses (does not use) the floating point multiply and
11421accumulate instructions.  These instructions are generated by default if
11422hardware floating is used.
11423
11424@item -mmulhw
11425@itemx -mno-mulhw
11426@opindex mmulhw
11427@opindex mno-mulhw
11428Generate code that uses (does not use) the half-word multiply and
11429multiply-accumulate instructions on the IBM 405 and 440 processors.
11430These instructions are generated by default when targetting those
11431processors.
11432
11433@item -mdlmzb
11434@itemx -mno-dlmzb
11435@opindex mdlmzb
11436@opindex mno-dlmzb
11437Generate code that uses (does not use) the string-search @samp{dlmzb}
11438instruction on the IBM 405 and 440 processors.  This instruction is
11439generated by default when targetting those processors.
11440
11441@item -mno-bit-align
11442@itemx -mbit-align
11443@opindex mno-bit-align
11444@opindex mbit-align
11445On System V.4 and embedded PowerPC systems do not (do) force structures
11446and unions that contain bit-fields to be aligned to the base type of the
11447bit-field.
11448
11449For example, by default a structure containing nothing but 8
11450@code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
11451boundary and have a size of 4 bytes.  By using @option{-mno-bit-align},
11452the structure would be aligned to a 1 byte boundary and be one byte in
11453size.
11454
11455@item -mno-strict-align
11456@itemx -mstrict-align
11457@opindex mno-strict-align
11458@opindex mstrict-align
11459On System V.4 and embedded PowerPC systems do not (do) assume that
11460unaligned memory references will be handled by the system.
11461
11462@item -mrelocatable
11463@itemx -mno-relocatable
11464@opindex mrelocatable
11465@opindex mno-relocatable
11466On embedded PowerPC systems generate code that allows (does not allow)
11467the program to be relocated to a different address at runtime.  If you
11468use @option{-mrelocatable} on any module, all objects linked together must
11469be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
11470
11471@item -mrelocatable-lib
11472@itemx -mno-relocatable-lib
11473@opindex mrelocatable-lib
11474@opindex mno-relocatable-lib
11475On embedded PowerPC systems generate code that allows (does not allow)
11476the program to be relocated to a different address at runtime.  Modules
11477compiled with @option{-mrelocatable-lib} can be linked with either modules
11478compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
11479with modules compiled with the @option{-mrelocatable} options.
11480
11481@item -mno-toc
11482@itemx -mtoc
11483@opindex mno-toc
11484@opindex mtoc
11485On System V.4 and embedded PowerPC systems do not (do) assume that
11486register 2 contains a pointer to a global area pointing to the addresses
11487used in the program.
11488
11489@item -mlittle
11490@itemx -mlittle-endian
11491@opindex mlittle
11492@opindex mlittle-endian
11493On System V.4 and embedded PowerPC systems compile code for the
11494processor in little endian mode.  The @option{-mlittle-endian} option is
11495the same as @option{-mlittle}.
11496
11497@item -mbig
11498@itemx -mbig-endian
11499@opindex mbig
11500@opindex mbig-endian
11501On System V.4 and embedded PowerPC systems compile code for the
11502processor in big endian mode.  The @option{-mbig-endian} option is
11503the same as @option{-mbig}.
11504
11505@item -mdynamic-no-pic
11506@opindex mdynamic-no-pic
11507On Darwin and Mac OS X systems, compile code so that it is not
11508relocatable, but that its external references are relocatable.  The
11509resulting code is suitable for applications, but not shared
11510libraries.
11511
11512@item -mprioritize-restricted-insns=@var{priority}
11513@opindex mprioritize-restricted-insns
11514This option controls the priority that is assigned to
11515dispatch-slot restricted instructions during the second scheduling
11516pass.  The argument @var{priority} takes the value @var{0/1/2} to assign
11517@var{no/highest/second-highest} priority to dispatch slot restricted
11518instructions.
11519
11520@item -msched-costly-dep=@var{dependence_type}
11521@opindex msched-costly-dep
11522This option controls which dependences are considered costly
11523by the target during instruction scheduling.  The argument
11524@var{dependence_type} takes one of the following values:
11525@var{no}: no dependence is costly,
11526@var{all}: all dependences are costly,
11527@var{true_store_to_load}: a true dependence from store to load is costly,
11528@var{store_to_load}: any dependence from store to load is costly,
11529@var{number}: any dependence which latency >= @var{number} is costly.
11530
11531@item -minsert-sched-nops=@var{scheme}
11532@opindex minsert-sched-nops
11533This option controls which nop insertion scheme will be used during
11534the second scheduling pass.  The argument @var{scheme} takes one of the
11535following values:
11536@var{no}: Don't insert nops.
11537@var{pad}: Pad with nops any dispatch group which has vacant issue slots,
11538according to the scheduler's grouping.
11539@var{regroup_exact}: Insert nops to force costly dependent insns into
11540separate groups.  Insert exactly as many nops as needed to force an insn
11541to a new group, according to the estimated processor grouping.
11542@var{number}: Insert nops to force costly dependent insns into
11543separate groups.  Insert @var{number} nops to force an insn to a new group.
11544
11545@item -mcall-sysv
11546@opindex mcall-sysv
11547On System V.4 and embedded PowerPC systems compile code using calling
11548conventions that adheres to the March 1995 draft of the System V
11549Application Binary Interface, PowerPC processor supplement.  This is the
11550default unless you configured GCC using @samp{powerpc-*-eabiaix}.
11551
11552@item -mcall-sysv-eabi
11553@opindex mcall-sysv-eabi
11554Specify both @option{-mcall-sysv} and @option{-meabi} options.
11555
11556@item -mcall-sysv-noeabi
11557@opindex mcall-sysv-noeabi
11558Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
11559
11560@item -mcall-solaris
11561@opindex mcall-solaris
11562On System V.4 and embedded PowerPC systems compile code for the Solaris
11563operating system.
11564
11565@item -mcall-linux
11566@opindex mcall-linux
11567On System V.4 and embedded PowerPC systems compile code for the
11568Linux-based GNU system.
11569
11570@item -mcall-gnu
11571@opindex mcall-gnu
11572On System V.4 and embedded PowerPC systems compile code for the
11573Hurd-based GNU system.
11574
11575@item -mcall-netbsd
11576@opindex mcall-netbsd
11577On System V.4 and embedded PowerPC systems compile code for the
11578NetBSD operating system.
11579
11580@item -maix-struct-return
11581@opindex maix-struct-return
11582Return all structures in memory (as specified by the AIX ABI)@.
11583
11584@item -msvr4-struct-return
11585@opindex msvr4-struct-return
11586Return structures smaller than 8 bytes in registers (as specified by the
11587SVR4 ABI)@.
11588
11589@item -mabi=@var{abi-type}
11590@opindex mabi
11591Extend the current ABI with a particular extension, or remove such extension.
11592Valid values are @var{altivec}, @var{no-altivec}, @var{spe},
11593@var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@.
11594
11595@item -mabi=spe
11596@opindex mabi=spe
11597Extend the current ABI with SPE ABI extensions.  This does not change
11598the default ABI, instead it adds the SPE ABI extensions to the current
11599ABI@.
11600
11601@item -mabi=no-spe
11602@opindex mabi=no-spe
11603Disable Booke SPE ABI extensions for the current ABI@.
11604
11605@item -mabi=ibmlongdouble
11606@opindex mabi=ibmlongdouble
11607Change the current ABI to use IBM extended precision long double.
11608This is a PowerPC 32-bit SYSV ABI option.
11609
11610@item -mabi=ieeelongdouble
11611@opindex mabi=ieeelongdouble
11612Change the current ABI to use IEEE extended precision long double.
11613This is a PowerPC 32-bit Linux ABI option.
11614
11615@item -mprototype
11616@itemx -mno-prototype
11617@opindex mprototype
11618@opindex mno-prototype
11619On System V.4 and embedded PowerPC systems assume that all calls to
11620variable argument functions are properly prototyped.  Otherwise, the
11621compiler must insert an instruction before every non prototyped call to
11622set or clear bit 6 of the condition code register (@var{CR}) to
11623indicate whether floating point values were passed in the floating point
11624registers in case the function takes a variable arguments.  With
11625@option{-mprototype}, only calls to prototyped variable argument functions
11626will set or clear the bit.
11627
11628@item -msim
11629@opindex msim
11630On embedded PowerPC systems, assume that the startup module is called
11631@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
11632@file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}.
11633configurations.
11634
11635@item -mmvme
11636@opindex mmvme
11637On embedded PowerPC systems, assume that the startup module is called
11638@file{crt0.o} and the standard C libraries are @file{libmvme.a} and
11639@file{libc.a}.
11640
11641@item -mads
11642@opindex mads
11643On embedded PowerPC systems, assume that the startup module is called
11644@file{crt0.o} and the standard C libraries are @file{libads.a} and
11645@file{libc.a}.
11646
11647@item -myellowknife
11648@opindex myellowknife
11649On embedded PowerPC systems, assume that the startup module is called
11650@file{crt0.o} and the standard C libraries are @file{libyk.a} and
11651@file{libc.a}.
11652
11653@item -mvxworks
11654@opindex mvxworks
11655On System V.4 and embedded PowerPC systems, specify that you are
11656compiling for a VxWorks system.
11657
11658@item -mwindiss
11659@opindex mwindiss
11660Specify that you are compiling for the WindISS simulation environment.
11661
11662@item -memb
11663@opindex memb
11664On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
11665header to indicate that @samp{eabi} extended relocations are used.
11666
11667@item -meabi
11668@itemx -mno-eabi
11669@opindex meabi
11670@opindex mno-eabi
11671On System V.4 and embedded PowerPC systems do (do not) adhere to the
11672Embedded Applications Binary Interface (eabi) which is a set of
11673modifications to the System V.4 specifications.  Selecting @option{-meabi}
11674means that the stack is aligned to an 8 byte boundary, a function
11675@code{__eabi} is called to from @code{main} to set up the eabi
11676environment, and the @option{-msdata} option can use both @code{r2} and
11677@code{r13} to point to two separate small data areas.  Selecting
11678@option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
11679do not call an initialization function from @code{main}, and the
11680@option{-msdata} option will only use @code{r13} to point to a single
11681small data area.  The @option{-meabi} option is on by default if you
11682configured GCC using one of the @samp{powerpc*-*-eabi*} options.
11683
11684@item -msdata=eabi
11685@opindex msdata=eabi
11686On System V.4 and embedded PowerPC systems, put small initialized
11687@code{const} global and static data in the @samp{.sdata2} section, which
11688is pointed to by register @code{r2}.  Put small initialized
11689non-@code{const} global and static data in the @samp{.sdata} section,
11690which is pointed to by register @code{r13}.  Put small uninitialized
11691global and static data in the @samp{.sbss} section, which is adjacent to
11692the @samp{.sdata} section.  The @option{-msdata=eabi} option is
11693incompatible with the @option{-mrelocatable} option.  The
11694@option{-msdata=eabi} option also sets the @option{-memb} option.
11695
11696@item -msdata=sysv
11697@opindex msdata=sysv
11698On System V.4 and embedded PowerPC systems, put small global and static
11699data in the @samp{.sdata} section, which is pointed to by register
11700@code{r13}.  Put small uninitialized global and static data in the
11701@samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
11702The @option{-msdata=sysv} option is incompatible with the
11703@option{-mrelocatable} option.
11704
11705@item -msdata=default
11706@itemx -msdata
11707@opindex msdata=default
11708@opindex msdata
11709On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
11710compile code the same as @option{-msdata=eabi}, otherwise compile code the
11711same as @option{-msdata=sysv}.
11712
11713@item -msdata-data
11714@opindex msdata-data
11715On System V.4 and embedded PowerPC systems, put small global
11716data in the @samp{.sdata} section.  Put small uninitialized global
11717data in the @samp{.sbss} section.  Do not use register @code{r13}
11718to address small data however.  This is the default behavior unless
11719other @option{-msdata} options are used.
11720
11721@item -msdata=none
11722@itemx -mno-sdata
11723@opindex msdata=none
11724@opindex mno-sdata
11725On embedded PowerPC systems, put all initialized global and static data
11726in the @samp{.data} section, and all uninitialized data in the
11727@samp{.bss} section.
11728
11729@item -G @var{num}
11730@opindex G
11731@cindex smaller data references (PowerPC)
11732@cindex .sdata/.sdata2 references (PowerPC)
11733On embedded PowerPC systems, put global and static items less than or
11734equal to @var{num} bytes into the small data or bss sections instead of
11735the normal data or bss section.  By default, @var{num} is 8.  The
11736@option{-G @var{num}} switch is also passed to the linker.
11737All modules should be compiled with the same @option{-G @var{num}} value.
11738
11739@item -mregnames
11740@itemx -mno-regnames
11741@opindex mregnames
11742@opindex mno-regnames
11743On System V.4 and embedded PowerPC systems do (do not) emit register
11744names in the assembly language output using symbolic forms.
11745
11746@item -mlongcall
11747@itemx -mno-longcall
11748@opindex mlongcall
11749@opindex mno-longcall
11750By default assume that all calls are far away so that a longer more
11751expensive calling sequence is required.  This is required for calls
11752further than 32 megabytes (33,554,432 bytes) from the current location.
11753A short call will be generated if the compiler knows
11754the call cannot be that far away.  This setting can be overridden by
11755the @code{shortcall} function attribute, or by @code{#pragma
11756longcall(0)}.
11757
11758Some linkers are capable of detecting out-of-range calls and generating
11759glue code on the fly.  On these systems, long calls are unnecessary and
11760generate slower code.  As of this writing, the AIX linker can do this,
11761as can the GNU linker for PowerPC/64.  It is planned to add this feature
11762to the GNU linker for 32-bit PowerPC systems as well.
11763
11764On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr
11765callee, L42'', plus a ``branch island'' (glue code).  The two target
11766addresses represent the callee and the ``branch island''.  The
11767Darwin/PPC linker will prefer the first address and generate a ``bl
11768callee'' if the PPC ``bl'' instruction will reach the callee directly;
11769otherwise, the linker will generate ``bl L42'' to call the ``branch
11770island''.  The ``branch island'' is appended to the body of the
11771calling function; it computes the full 32-bit address of the callee
11772and jumps to it.
11773
11774On Mach-O (Darwin) systems, this option directs the compiler emit to
11775the glue for every direct call, and the Darwin linker decides whether
11776to use or discard it.
11777
11778In the future, we may cause GCC to ignore all longcall specifications
11779when the linker is known to generate glue.
11780
11781@item -pthread
11782@opindex pthread
11783Adds support for multithreading with the @dfn{pthreads} library.
11784This option sets flags for both the preprocessor and linker.
11785
11786@end table
11787
11788@node S/390 and zSeries Options
11789@subsection S/390 and zSeries Options
11790@cindex S/390 and zSeries Options
11791
11792These are the @samp{-m} options defined for the S/390 and zSeries architecture.
11793
11794@table @gcctabopt
11795@item -mhard-float
11796@itemx -msoft-float
11797@opindex mhard-float
11798@opindex msoft-float
11799Use (do not use) the hardware floating-point instructions and registers
11800for floating-point operations.  When @option{-msoft-float} is specified,
11801functions in @file{libgcc.a} will be used to perform floating-point
11802operations.  When @option{-mhard-float} is specified, the compiler
11803generates IEEE floating-point instructions.  This is the default.
11804
11805@item -mlong-double-64
11806@itemx -mlong-double-128
11807@opindex mlong-double-64
11808@opindex mlong-double-128
11809These switches control the size of @code{long double} type. A size
11810of 64bit makes the @code{long double} type equivalent to the @code{double}
11811type. This is the default.
11812
11813@item -mbackchain
11814@itemx -mno-backchain
11815@opindex mbackchain
11816@opindex mno-backchain
11817Store (do not store) the address of the caller's frame as backchain pointer
11818into the callee's stack frame.
11819A backchain may be needed to allow debugging using tools that do not understand
11820DWARF-2 call frame information.
11821When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
11822at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
11823the backchain is placed into the topmost word of the 96/160 byte register
11824save area.
11825
11826In general, code compiled with @option{-mbackchain} is call-compatible with
11827code compiled with @option{-mmo-backchain}; however, use of the backchain
11828for debugging purposes usually requires that the whole binary is built with
11829@option{-mbackchain}.  Note that the combination of @option{-mbackchain},
11830@option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
11831to build a linux kernel use @option{-msoft-float}.
11832
11833The default is to not maintain the backchain.
11834
11835@item -mpacked-stack
11836@item -mno-packed-stack
11837@opindex mpacked-stack
11838@opindex mno-packed-stack
11839Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
11840specified, the compiler uses the all fields of the 96/160 byte register save
11841area only for their default purpose; unused fields still take up stack space.
11842When @option{-mpacked-stack} is specified, register save slots are densely
11843packed at the top of the register save area; unused space is reused for other
11844purposes, allowing for more efficient use of the available stack space.
11845However, when @option{-mbackchain} is also in effect, the topmost word of
11846the save area is always used to store the backchain, and the return address
11847register is always saved two words below the backchain.
11848
11849As long as the stack frame backchain is not used, code generated with
11850@option{-mpacked-stack} is call-compatible with code generated with
11851@option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
11852S/390 or zSeries generated code that uses the stack frame backchain at run
11853time, not just for debugging purposes.  Such code is not call-compatible
11854with code compiled with @option{-mpacked-stack}.  Also, note that the
11855combination of @option{-mbackchain},
11856@option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
11857to build a linux kernel use @option{-msoft-float}.
11858
11859The default is to not use the packed stack layout.
11860
11861@item -msmall-exec
11862@itemx -mno-small-exec
11863@opindex msmall-exec
11864@opindex mno-small-exec
11865Generate (or do not generate) code using the @code{bras} instruction
11866to do subroutine calls.
11867This only works reliably if the total executable size does not
11868exceed 64k.  The default is to use the @code{basr} instruction instead,
11869which does not have this limitation.
11870
11871@item -m64
11872@itemx -m31
11873@opindex m64
11874@opindex m31
11875When @option{-m31} is specified, generate code compliant to the
11876GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
11877code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
11878particular to generate 64-bit instructions.  For the @samp{s390}
11879targets, the default is @option{-m31}, while the @samp{s390x}
11880targets default to @option{-m64}.
11881
11882@item -mzarch
11883@itemx -mesa
11884@opindex mzarch
11885@opindex mesa
11886When @option{-mzarch} is specified, generate code using the
11887instructions available on z/Architecture.
11888When @option{-mesa} is specified, generate code using the
11889instructions available on ESA/390.  Note that @option{-mesa} is
11890not possible with @option{-m64}.
11891When generating code compliant to the GNU/Linux for S/390 ABI,
11892the default is @option{-mesa}.  When generating code compliant
11893to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
11894
11895@item -mmvcle
11896@itemx -mno-mvcle
11897@opindex mmvcle
11898@opindex mno-mvcle
11899Generate (or do not generate) code using the @code{mvcle} instruction
11900to perform block moves.  When @option{-mno-mvcle} is specified,
11901use a @code{mvc} loop instead.  This is the default unless optimizing for
11902size.
11903
11904@item -mdebug
11905@itemx -mno-debug
11906@opindex mdebug
11907@opindex mno-debug
11908Print (or do not print) additional debug information when compiling.
11909The default is to not print debug information.
11910
11911@item -march=@var{cpu-type}
11912@opindex march
11913Generate code that will run on @var{cpu-type}, which is the name of a system
11914representing a certain processor type.  Possible values for
11915@var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}.
11916When generating code using the instructions available on z/Architecture,
11917the default is @option{-march=z900}.  Otherwise, the default is
11918@option{-march=g5}.
11919
11920@item -mtune=@var{cpu-type}
11921@opindex mtune
11922Tune to @var{cpu-type} everything applicable about the generated code,
11923except for the ABI and the set of available instructions.
11924The list of @var{cpu-type} values is the same as for @option{-march}.
11925The default is the value used for @option{-march}.
11926
11927@item -mtpf-trace
11928@itemx -mno-tpf-trace
11929@opindex mtpf-trace
11930@opindex mno-tpf-trace
11931Generate code that adds (does not add) in TPF OS specific branches to trace
11932routines in the operating system.  This option is off by default, even
11933when compiling for the TPF OS@.
11934
11935@item -mfused-madd
11936@itemx -mno-fused-madd
11937@opindex mfused-madd
11938@opindex mno-fused-madd
11939Generate code that uses (does not use) the floating point multiply and
11940accumulate instructions.  These instructions are generated by default if
11941hardware floating point is used.
11942
11943@item -mwarn-framesize=@var{framesize}
11944@opindex mwarn-framesize
11945Emit a warning if the current function exceeds the given frame size.  Because
11946this is a compile time check it doesn't need to be a real problem when the program
11947runs.  It is intended to identify functions which most probably cause
11948a stack overflow.  It is useful to be used in an environment with limited stack
11949size e.g.@: the linux kernel.
11950
11951@item -mwarn-dynamicstack
11952@opindex mwarn-dynamicstack
11953Emit a warning if the function calls alloca or uses dynamically
11954sized arrays.  This is generally a bad idea with a limited stack size.
11955
11956@item -mstack-guard=@var{stack-guard}
11957@item -mstack-size=@var{stack-size}
11958@opindex mstack-guard
11959@opindex mstack-size
11960These arguments always have to be used in conjunction.  If they are present the s390
11961back end emits additional instructions in the function prologue which trigger a trap
11962if the stack size is @var{stack-guard} bytes above the @var{stack-size}
11963(remember that the stack on s390 grows downward).  These options are intended to
11964be used to help debugging stack overflow problems.  The additionally emitted code
11965causes only little overhead and hence can also be used in production like systems
11966without greater performance degradation.  The given values have to be exact
11967powers of 2 and @var{stack-size} has to be greater than @var{stack-guard} without
11968exceeding 64k.
11969In order to be efficient the extra code makes the assumption that the stack starts
11970at an address aligned to the value given by @var{stack-size}.
11971@end table
11972
11973@node Score Options
11974@subsection Score Options
11975@cindex Score Options
11976
11977These options are defined for Score implementations:
11978
11979@table @gcctabopt
11980@item -meb
11981@opindex meb
11982Compile code for big endian mode.  This is the default.
11983
11984@item -mel
11985@opindex mel
11986Compile code for little endian mode. 
11987
11988@item -mnhwloop
11989@opindex mnhwloop
11990Disable generate bcnz instruction.
11991
11992@item -muls
11993@opindex muls
11994Enable generate unaligned load and store instruction.
11995
11996@item -mmac
11997@opindex mmac
11998Enable the use of multiply-accumulate instructions. Disabled by default. 
11999
12000@item -mscore5
12001@opindex mscore5
12002Specify the SCORE5 as the target architecture.
12003
12004@item -mscore5u
12005@opindex mscore5u
12006Specify the SCORE5U of the target architecture.
12007
12008@item -mscore7
12009@opindex mscore7
12010Specify the SCORE7 as the target architecture. This is the default.
12011
12012@item -mscore7d
12013@opindex mscore7d
12014Specify the SCORE7D as the target architecture.
12015@end table
12016
12017@node SH Options
12018@subsection SH Options
12019
12020These @samp{-m} options are defined for the SH implementations:
12021
12022@table @gcctabopt
12023@item -m1
12024@opindex m1
12025Generate code for the SH1.
12026
12027@item -m2
12028@opindex m2
12029Generate code for the SH2.
12030
12031@item -m2e
12032Generate code for the SH2e.
12033
12034@item -m3
12035@opindex m3
12036Generate code for the SH3.
12037
12038@item -m3e
12039@opindex m3e
12040Generate code for the SH3e.
12041
12042@item -m4-nofpu
12043@opindex m4-nofpu
12044Generate code for the SH4 without a floating-point unit.
12045
12046@item -m4-single-only
12047@opindex m4-single-only
12048Generate code for the SH4 with a floating-point unit that only
12049supports single-precision arithmetic.
12050
12051@item -m4-single
12052@opindex m4-single
12053Generate code for the SH4 assuming the floating-point unit is in
12054single-precision mode by default.
12055
12056@item -m4
12057@opindex m4
12058Generate code for the SH4.
12059
12060@item -m4a-nofpu
12061@opindex m4a-nofpu
12062Generate code for the SH4al-dsp, or for a SH4a in such a way that the
12063floating-point unit is not used.
12064
12065@item -m4a-single-only
12066@opindex m4a-single-only
12067Generate code for the SH4a, in such a way that no double-precision
12068floating point operations are used.
12069
12070@item -m4a-single
12071@opindex m4a-single
12072Generate code for the SH4a assuming the floating-point unit is in
12073single-precision mode by default.
12074
12075@item -m4a
12076@opindex m4a
12077Generate code for the SH4a.
12078
12079@item -m4al
12080@opindex m4al
12081Same as @option{-m4a-nofpu}, except that it implicitly passes
12082@option{-dsp} to the assembler.  GCC doesn't generate any DSP
12083instructions at the moment.
12084
12085@item -mb
12086@opindex mb
12087Compile code for the processor in big endian mode.
12088
12089@item -ml
12090@opindex ml
12091Compile code for the processor in little endian mode.
12092
12093@item -mdalign
12094@opindex mdalign
12095Align doubles at 64-bit boundaries.  Note that this changes the calling
12096conventions, and thus some functions from the standard C library will
12097not work unless you recompile it first with @option{-mdalign}.
12098
12099@item -mrelax
12100@opindex mrelax
12101Shorten some address references at link time, when possible; uses the
12102linker option @option{-relax}.
12103
12104@item -mbigtable
12105@opindex mbigtable
12106Use 32-bit offsets in @code{switch} tables.  The default is to use
1210716-bit offsets.
12108
12109@item -mfmovd
12110@opindex mfmovd
12111Enable the use of the instruction @code{fmovd}.
12112
12113@item -mhitachi
12114@opindex mhitachi
12115Comply with the calling conventions defined by Renesas.
12116
12117@item -mrenesas
12118@opindex mhitachi
12119Comply with the calling conventions defined by Renesas.
12120
12121@item -mno-renesas
12122@opindex mhitachi
12123Comply with the calling conventions defined for GCC before the Renesas
12124conventions were available.  This option is the default for all
12125targets of the SH toolchain except for @samp{sh-symbianelf}.
12126
12127@item -mnomacsave
12128@opindex mnomacsave
12129Mark the @code{MAC} register as call-clobbered, even if
12130@option{-mhitachi} is given.
12131
12132@item -mieee
12133@opindex mieee
12134Increase IEEE-compliance of floating-point code.
12135At the moment, this is equivalent to @option{-fno-finite-math-only}.
12136When generating 16 bit SH opcodes, getting IEEE-conforming results for
12137comparisons of NANs / infinities incurs extra overhead in every
12138floating point comparison, therefore the default is set to
12139@option{-ffinite-math-only}.
12140
12141@item -misize
12142@opindex misize
12143Dump instruction size and location in the assembly code.
12144
12145@item -mpadstruct
12146@opindex mpadstruct
12147This option is deprecated.  It pads structures to multiple of 4 bytes,
12148which is incompatible with the SH ABI@.
12149
12150@item -mspace
12151@opindex mspace
12152Optimize for space instead of speed.  Implied by @option{-Os}.
12153
12154@item -mprefergot
12155@opindex mprefergot
12156When generating position-independent code, emit function calls using
12157the Global Offset Table instead of the Procedure Linkage Table.
12158
12159@item -musermode
12160@opindex musermode
12161Generate a library function call to invalidate instruction cache
12162entries, after fixing up a trampoline.  This library function call
12163doesn't assume it can write to the whole memory address space.  This
12164is the default when the target is @code{sh-*-linux*}.
12165
12166@item -multcost=@var{number}
12167@opindex multcost=@var{number}
12168Set the cost to assume for a multiply insn.
12169
12170@item -mdiv=@var{strategy}
12171@opindex mdiv=@var{strategy}
12172Set the division strategy to use for SHmedia code.  @var{strategy} must be
12173one of: call, call2, fp, inv, inv:minlat, inv20u, inv20l, inv:call,
12174inv:call2, inv:fp .
12175"fp" performs the operation in floating point.  This has a very high latency,
12176but needs only a few instructions, so it might be a good choice if
12177your code has enough easily exploitable ILP to allow the compiler to
12178schedule the floating point instructions together with other instructions.
12179Division by zero causes a floating point exception.
12180"inv" uses integer operations to calculate the inverse of the divisor,
12181and then multiplies the dividend with the inverse.  This strategy allows
12182cse and hoisting of the inverse calculation.  Division by zero calculates
12183an unspecified result, but does not trap.
12184"inv:minlat" is a variant of "inv" where if no cse / hoisting opportunities
12185have been found, or if the entire operation has been hoisted to the same
12186place, the last stages of the inverse calculation are intertwined with the
12187final multiply to reduce the overall latency, at the expense of using a few
12188more instructions, and thus offering fewer scheduling opportunities with
12189other code.
12190"call" calls a library function that usually implements the inv:minlat
12191strategy.
12192This gives high code density for m5-*media-nofpu compilations.
12193"call2" uses a different entry point of the same library function, where it
12194assumes that a pointer to a lookup table has already been set up, which
12195exposes the pointer load to cse / code hoisting optimizations.
12196"inv:call", "inv:call2" and "inv:fp" all use the "inv" algorithm for initial
12197code generation, but if the code stays unoptimized, revert to the "call",
12198"call2", or "fp" strategies, respectively.  Note that the
12199potentially-trapping side effect of division by zero is carried by a
12200separate instruction, so it is possible that all the integer instructions
12201are hoisted out, but the marker for the side effect stays where it is.
12202A recombination to fp operations or a call is not possible in that case.
12203"inv20u" and "inv20l" are variants of the "inv:minlat" strategy.  In the case
12204that the inverse calculation was nor separated from the multiply, they speed
12205up division where the dividend fits into 20 bits (plus sign where applicable),
12206by inserting a test to skip a number of operations in this case; this test
12207slows down the case of larger dividends.  inv20u assumes the case of a such
12208a small dividend to be unlikely, and inv20l assumes it to be likely.
12209
12210@item -mdivsi3_libfunc=@var{name}
12211@opindex mdivsi3_libfunc=@var{name}
12212Set the name of the library function used for 32 bit signed division to
12213@var{name}.  This only affect the name used in the call and inv:call
12214division strategies, and the compiler will still expect the same
12215sets of input/output/clobbered registers as if this option was not present.
12216
12217@item -madjust-unroll
12218@opindex madjust-unroll
12219Throttle unrolling to avoid thrashing target registers.
12220This option only has an effect if the gcc code base supports the
12221TARGET_ADJUST_UNROLL_MAX target hook.
12222
12223@item -mindexed-addressing
12224@opindex mindexed-addressing
12225Enable the use of the indexed addressing mode for SHmedia32/SHcompact.
12226This is only safe if the hardware and/or OS implement 32 bit wrap-around
12227semantics for the indexed addressing mode.  The architecture allows the
12228implementation of processors with 64 bit MMU, which the OS could use to
12229get 32 bit addressing, but since no current hardware implementation supports
12230this or any other way to make the indexed addressing mode safe to use in
12231the 32 bit ABI, the default is -mno-indexed-addressing.
12232
12233@item -mgettrcost=@var{number}
12234@opindex mgettrcost=@var{number}
12235Set the cost assumed for the gettr instruction to @var{number}.
12236The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise.
12237
12238@item -mpt-fixed
12239@opindex mpt-fixed
12240Assume pt* instructions won't trap.  This will generally generate better
12241scheduled code, but is unsafe on current hardware.  The current architecture
12242definition says that ptabs and ptrel trap when the target anded with 3 is 3.
12243This has the unintentional effect of making it unsafe to schedule ptabs /
12244ptrel before a branch, or hoist it out of a loop.  For example,
12245__do_global_ctors, a part of libgcc that runs constructors at program
12246startup, calls functions in a list which is delimited by -1.  With the
12247-mpt-fixed option, the ptabs will be done before testing against -1.
12248That means that all the constructors will be run a bit quicker, but when
12249the loop comes to the end of the list, the program crashes because ptabs
12250loads -1 into a target register.  Since this option is unsafe for any
12251hardware implementing the current architecture specification, the default
12252is -mno-pt-fixed.  Unless the user specifies a specific cost with
12253@option{-mgettrcost}, -mno-pt-fixed also implies @option{-mgettrcost=100};
12254this deters register allocation using target registers for storing
12255ordinary integers.
12256
12257@item -minvalid-symbols
12258@opindex minvalid-symbols
12259Assume symbols might be invalid.  Ordinary function symbols generated by
12260the compiler will always be valid to load with movi/shori/ptabs or
12261movi/shori/ptrel, but with assembler and/or linker tricks it is possible
12262to generate symbols that will cause ptabs / ptrel to trap.
12263This option is only meaningful when @option{-mno-pt-fixed} is in effect.
12264It will then prevent cross-basic-block cse, hoisting and most scheduling
12265of symbol loads.  The default is @option{-mno-invalid-symbols}.
12266@end table
12267
12268@node SPARC Options
12269@subsection SPARC Options
12270@cindex SPARC options
12271
12272These @samp{-m} options are supported on the SPARC:
12273
12274@table @gcctabopt
12275@item -mno-app-regs
12276@itemx -mapp-regs
12277@opindex mno-app-regs
12278@opindex mapp-regs
12279Specify @option{-mapp-regs} to generate output using the global registers
122802 through 4, which the SPARC SVR4 ABI reserves for applications.  This
12281is the default.
12282
12283To be fully SVR4 ABI compliant at the cost of some performance loss,
12284specify @option{-mno-app-regs}.  You should compile libraries and system
12285software with this option.
12286
12287@item -mfpu
12288@itemx -mhard-float
12289@opindex mfpu
12290@opindex mhard-float
12291Generate output containing floating point instructions.  This is the
12292default.
12293
12294@item -mno-fpu
12295@itemx -msoft-float
12296@opindex mno-fpu
12297@opindex msoft-float
12298Generate output containing library calls for floating point.
12299@strong{Warning:} the requisite libraries are not available for all SPARC
12300targets.  Normally the facilities of the machine's usual C compiler are
12301used, but this cannot be done directly in cross-compilation.  You must make
12302your own arrangements to provide suitable library functions for
12303cross-compilation.  The embedded targets @samp{sparc-*-aout} and
12304@samp{sparclite-*-*} do provide software floating point support.
12305
12306@option{-msoft-float} changes the calling convention in the output file;
12307therefore, it is only useful if you compile @emph{all} of a program with
12308this option.  In particular, you need to compile @file{libgcc.a}, the
12309library that comes with GCC, with @option{-msoft-float} in order for
12310this to work.
12311
12312@item -mhard-quad-float
12313@opindex mhard-quad-float
12314Generate output containing quad-word (long double) floating point
12315instructions.
12316
12317@item -msoft-quad-float
12318@opindex msoft-quad-float
12319Generate output containing library calls for quad-word (long double)
12320floating point instructions.  The functions called are those specified
12321in the SPARC ABI@.  This is the default.
12322
12323As of this writing, there are no SPARC implementations that have hardware
12324support for the quad-word floating point instructions.  They all invoke
12325a trap handler for one of these instructions, and then the trap handler
12326emulates the effect of the instruction.  Because of the trap handler overhead,
12327this is much slower than calling the ABI library routines.  Thus the
12328@option{-msoft-quad-float} option is the default.
12329
12330@item -mno-unaligned-doubles
12331@itemx -munaligned-doubles
12332@opindex mno-unaligned-doubles
12333@opindex munaligned-doubles
12334Assume that doubles have 8 byte alignment.  This is the default.
12335
12336With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
12337alignment only if they are contained in another type, or if they have an
12338absolute address.  Otherwise, it assumes they have 4 byte alignment.
12339Specifying this option avoids some rare compatibility problems with code
12340generated by other compilers.  It is not the default because it results
12341in a performance loss, especially for floating point code.
12342
12343@item -mno-faster-structs
12344@itemx -mfaster-structs
12345@opindex mno-faster-structs
12346@opindex mfaster-structs
12347With @option{-mfaster-structs}, the compiler assumes that structures
12348should have 8 byte alignment.  This enables the use of pairs of
12349@code{ldd} and @code{std} instructions for copies in structure
12350assignment, in place of twice as many @code{ld} and @code{st} pairs.
12351However, the use of this changed alignment directly violates the SPARC
12352ABI@.  Thus, it's intended only for use on targets where the developer
12353acknowledges that their resulting code will not be directly in line with
12354the rules of the ABI@.
12355
12356@item -mimpure-text
12357@opindex mimpure-text
12358@option{-mimpure-text}, used in addition to @option{-shared}, tells
12359the compiler to not pass @option{-z text} to the linker when linking a
12360shared object.  Using this option, you can link position-dependent
12361code into a shared object.
12362
12363@option{-mimpure-text} suppresses the ``relocations remain against
12364allocatable but non-writable sections'' linker error message.
12365However, the necessary relocations will trigger copy-on-write, and the
12366shared object is not actually shared across processes.  Instead of
12367using @option{-mimpure-text}, you should compile all source code with
12368@option{-fpic} or @option{-fPIC}.
12369
12370This option is only available on SunOS and Solaris.
12371
12372@item -mcpu=@var{cpu_type}
12373@opindex mcpu
12374Set the instruction set, register set, and instruction scheduling parameters
12375for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
12376@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
12377@samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x},
12378@samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc},
12379@samp{ultrasparc3}, and @samp{niagara}.
12380
12381Default instruction scheduling parameters are used for values that select
12382an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
12383@samp{sparclite}, @samp{sparclet}, @samp{v9}.
12384
12385Here is a list of each supported architecture and their supported
12386implementations.
12387
12388@smallexample
12389    v7:             cypress
12390    v8:             supersparc, hypersparc
12391    sparclite:      f930, f934, sparclite86x
12392    sparclet:       tsc701
12393    v9:             ultrasparc, ultrasparc3, niagara
12394@end smallexample
12395
12396By default (unless configured otherwise), GCC generates code for the V7
12397variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
12398additionally optimizes it for the Cypress CY7C602 chip, as used in the
12399SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
12400SPARCStation 1, 2, IPX etc.
12401
12402With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
12403architecture.  The only difference from V7 code is that the compiler emits
12404the integer multiply and integer divide instructions which exist in SPARC-V8
12405but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
12406optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
124072000 series.
12408
12409With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
12410the SPARC architecture.  This adds the integer multiply, integer divide step
12411and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
12412With @option{-mcpu=f930}, the compiler additionally optimizes it for the
12413Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
12414@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
12415MB86934 chip, which is the more recent SPARClite with FPU@.
12416
12417With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
12418the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
12419integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
12420but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
12421optimizes it for the TEMIC SPARClet chip.
12422
12423With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
12424architecture.  This adds 64-bit integer and floating-point move instructions,
124253 additional floating-point condition code registers and conditional move
12426instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
12427optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
12428@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
12429Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
12430@option{-mcpu=niagara}, the compiler additionally optimizes it for
12431Sun UltraSPARC T1 chips.
12432
12433@item -mtune=@var{cpu_type}
12434@opindex mtune
12435Set the instruction scheduling parameters for machine type
12436@var{cpu_type}, but do not set the instruction set or register set that the
12437option @option{-mcpu=@var{cpu_type}} would.
12438
12439The same values for @option{-mcpu=@var{cpu_type}} can be used for
12440@option{-mtune=@var{cpu_type}}, but the only useful values are those
12441that select a particular cpu implementation.  Those are @samp{cypress},
12442@samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
12443@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
12444@samp{ultrasparc3}, and @samp{niagara}.
12445
12446@item -mv8plus
12447@itemx -mno-v8plus
12448@opindex mv8plus
12449@opindex mno-v8plus
12450With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
12451difference from the V8 ABI is that the global and out registers are
12452considered 64-bit wide.  This is enabled by default on Solaris in 32-bit
12453mode for all SPARC-V9 processors.
12454
12455@item -mvis
12456@itemx -mno-vis
12457@opindex mvis
12458@opindex mno-vis
12459With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
12460Visual Instruction Set extensions.  The default is @option{-mno-vis}.
12461@end table
12462
12463These @samp{-m} options are supported in addition to the above
12464on SPARC-V9 processors in 64-bit environments:
12465
12466@table @gcctabopt
12467@item -mlittle-endian
12468@opindex mlittle-endian
12469Generate code for a processor running in little-endian mode.  It is only
12470available for a few configurations and most notably not on Solaris and Linux.
12471
12472@item -m32
12473@itemx -m64
12474@opindex m32
12475@opindex m64
12476Generate code for a 32-bit or 64-bit environment.
12477The 32-bit environment sets int, long and pointer to 32 bits.
12478The 64-bit environment sets int to 32 bits and long and pointer
12479to 64 bits.
12480
12481@item -mcmodel=medlow
12482@opindex mcmodel=medlow
12483Generate code for the Medium/Low code model: 64-bit addresses, programs
12484must be linked in the low 32 bits of memory.  Programs can be statically
12485or dynamically linked.
12486
12487@item -mcmodel=medmid
12488@opindex mcmodel=medmid
12489Generate code for the Medium/Middle code model: 64-bit addresses, programs
12490must be linked in the low 44 bits of memory, the text and data segments must
12491be less than 2GB in size and the data segment must be located within 2GB of
12492the text segment.
12493
12494@item -mcmodel=medany
12495@opindex mcmodel=medany
12496Generate code for the Medium/Anywhere code model: 64-bit addresses, programs
12497may be linked anywhere in memory, the text and data segments must be less
12498than 2GB in size and the data segment must be located within 2GB of the
12499text segment.
12500
12501@item -mcmodel=embmedany
12502@opindex mcmodel=embmedany
12503Generate code for the Medium/Anywhere code model for embedded systems:
1250464-bit addresses, the text and data segments must be less than 2GB in
12505size, both starting anywhere in memory (determined at link time).  The
12506global register %g4 points to the base of the data segment.  Programs
12507are statically linked and PIC is not supported.
12508
12509@item -mstack-bias
12510@itemx -mno-stack-bias
12511@opindex mstack-bias
12512@opindex mno-stack-bias
12513With @option{-mstack-bias}, GCC assumes that the stack pointer, and
12514frame pointer if present, are offset by @minus{}2047 which must be added back
12515when making stack frame references.  This is the default in 64-bit mode.
12516Otherwise, assume no such offset is present.
12517@end table
12518
12519These switches are supported in addition to the above on Solaris:
12520
12521@table @gcctabopt
12522@item -threads
12523@opindex threads
12524Add support for multithreading using the Solaris threads library.  This
12525option sets flags for both the preprocessor and linker.  This option does
12526not affect the thread safety of object code produced by the compiler or
12527that of libraries supplied with it.
12528
12529@item -pthreads
12530@opindex pthreads
12531Add support for multithreading using the POSIX threads library.  This
12532option sets flags for both the preprocessor and linker.  This option does
12533not affect the thread safety of object code produced  by the compiler or
12534that of libraries supplied with it.
12535
12536@item -pthread
12537@opindex pthread
12538This is a synonym for @option{-pthreads}.
12539@end table
12540
12541@node System V Options
12542@subsection Options for System V
12543
12544These additional options are available on System V Release 4 for
12545compatibility with other compilers on those systems:
12546
12547@table @gcctabopt
12548@item -G
12549@opindex G
12550Create a shared object.
12551It is recommended that @option{-symbolic} or @option{-shared} be used instead.
12552
12553@item -Qy
12554@opindex Qy
12555Identify the versions of each tool used by the compiler, in a
12556@code{.ident} assembler directive in the output.
12557
12558@item -Qn
12559@opindex Qn
12560Refrain from adding @code{.ident} directives to the output file (this is
12561the default).
12562
12563@item -YP,@var{dirs}
12564@opindex YP
12565Search the directories @var{dirs}, and no others, for libraries
12566specified with @option{-l}.
12567
12568@item -Ym,@var{dir}
12569@opindex Ym
12570Look in the directory @var{dir} to find the M4 preprocessor.
12571The assembler uses this option.
12572@c This is supposed to go with a -Yd for predefined M4 macro files, but
12573@c the generic assembler that comes with Solaris takes just -Ym.
12574@end table
12575
12576@node TMS320C3x/C4x Options
12577@subsection TMS320C3x/C4x Options
12578@cindex TMS320C3x/C4x Options
12579
12580These @samp{-m} options are defined for TMS320C3x/C4x implementations:
12581
12582@table @gcctabopt
12583
12584@item -mcpu=@var{cpu_type}
12585@opindex mcpu
12586Set the instruction set, register set, and instruction scheduling
12587parameters for machine type @var{cpu_type}.  Supported values for
12588@var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
12589@samp{c44}.  The default is @samp{c40} to generate code for the
12590TMS320C40.
12591
12592@item -mbig-memory
12593@itemx -mbig
12594@itemx -msmall-memory
12595@itemx -msmall
12596@opindex mbig-memory
12597@opindex mbig
12598@opindex msmall-memory
12599@opindex msmall
12600Generates code for the big or small memory model.  The small memory
12601model assumed that all data fits into one 64K word page.  At run-time
12602the data page (DP) register must be set to point to the 64K page
12603containing the .bss and .data program sections.  The big memory model is
12604the default and requires reloading of the DP register for every direct
12605memory access.
12606
12607@item -mbk
12608@itemx -mno-bk
12609@opindex mbk
12610@opindex mno-bk
12611Allow (disallow) allocation of general integer operands into the block
12612count register BK@.
12613
12614@item -mdb
12615@itemx -mno-db
12616@opindex mdb
12617@opindex mno-db
12618Enable (disable) generation of code using decrement and branch,
12619DBcond(D), instructions.  This is enabled by default for the C4x.  To be
12620on the safe side, this is disabled for the C3x, since the maximum
12621iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than
12622@math{2^{23}} times on the C3x?).  Note that GCC will try to reverse a loop so
12623that it can utilize the decrement and branch instruction, but will give
12624up if there is more than one memory reference in the loop.  Thus a loop
12625where the loop counter is decremented can generate slightly more
12626efficient code, in cases where the RPTB instruction cannot be utilized.
12627
12628@item -mdp-isr-reload
12629@itemx -mparanoid
12630@opindex mdp-isr-reload
12631@opindex mparanoid
12632Force the DP register to be saved on entry to an interrupt service
12633routine (ISR), reloaded to point to the data section, and restored on
12634exit from the ISR@.  This should not be required unless someone has
12635violated the small memory model by modifying the DP register, say within
12636an object library.
12637
12638@item -mmpyi
12639@itemx -mno-mpyi
12640@opindex mmpyi
12641@opindex mno-mpyi
12642For the C3x use the 24-bit MPYI instruction for integer multiplies
12643instead of a library call to guarantee 32-bit results.  Note that if one
12644of the operands is a constant, then the multiplication will be performed
12645using shifts and adds.  If the @option{-mmpyi} option is not specified for the C3x,
12646then squaring operations are performed inline instead of a library call.
12647
12648@item -mfast-fix
12649@itemx -mno-fast-fix
12650@opindex mfast-fix
12651@opindex mno-fast-fix
12652The C3x/C4x FIX instruction to convert a floating point value to an
12653integer value chooses the nearest integer less than or equal to the
12654floating point value rather than to the nearest integer.  Thus if the
12655floating point number is negative, the result will be incorrectly
12656truncated an additional code is necessary to detect and correct this
12657case.  This option can be used to disable generation of the additional
12658code required to correct the result.
12659
12660@item -mrptb
12661@itemx -mno-rptb
12662@opindex mrptb
12663@opindex mno-rptb
12664Enable (disable) generation of repeat block sequences using the RPTB
12665instruction for zero overhead looping.  The RPTB construct is only used
12666for innermost loops that do not call functions or jump across the loop
12667boundaries.  There is no advantage having nested RPTB loops due to the
12668overhead required to save and restore the RC, RS, and RE registers.
12669This is enabled by default with @option{-O2}.
12670
12671@item -mrpts=@var{count}
12672@itemx -mno-rpts
12673@opindex mrpts
12674@opindex mno-rpts
12675Enable (disable) the use of the single instruction repeat instruction
12676RPTS@.  If a repeat block contains a single instruction, and the loop
12677count can be guaranteed to be less than the value @var{count}, GCC will
12678emit a RPTS instruction instead of a RPTB@.  If no value is specified,
12679then a RPTS will be emitted even if the loop count cannot be determined
12680at compile time.  Note that the repeated instruction following RPTS does
12681not have to be reloaded from memory each iteration, thus freeing up the
12682CPU buses for operands.  However, since interrupts are blocked by this
12683instruction, it is disabled by default.
12684
12685@item -mloop-unsigned
12686@itemx -mno-loop-unsigned
12687@opindex mloop-unsigned
12688@opindex mno-loop-unsigned
12689The maximum iteration count when using RPTS and RPTB (and DB on the C40)
12690is @math{2^{31} + 1} since these instructions test if the iteration count is
12691negative to terminate the loop.  If the iteration count is unsigned
12692there is a possibility than the @math{2^{31} + 1} maximum iteration count may be
12693exceeded.  This switch allows an unsigned iteration count.
12694
12695@item -mti
12696@opindex mti
12697Try to emit an assembler syntax that the TI assembler (asm30) is happy
12698with.  This also enforces compatibility with the API employed by the TI
12699C3x C compiler.  For example, long doubles are passed as structures
12700rather than in floating point registers.
12701
12702@item -mregparm
12703@itemx -mmemparm
12704@opindex mregparm
12705@opindex mmemparm
12706Generate code that uses registers (stack) for passing arguments to functions.
12707By default, arguments are passed in registers where possible rather
12708than by pushing arguments on to the stack.
12709
12710@item -mparallel-insns
12711@itemx -mno-parallel-insns
12712@opindex mparallel-insns
12713@opindex mno-parallel-insns
12714Allow the generation of parallel instructions.  This is enabled by
12715default with @option{-O2}.
12716
12717@item -mparallel-mpy
12718@itemx -mno-parallel-mpy
12719@opindex mparallel-mpy
12720@opindex mno-parallel-mpy
12721Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
12722provided @option{-mparallel-insns} is also specified.  These instructions have
12723tight register constraints which can pessimize the code generation
12724of large functions.
12725
12726@end table
12727
12728@node V850 Options
12729@subsection V850 Options
12730@cindex V850 Options
12731
12732These @samp{-m} options are defined for V850 implementations:
12733
12734@table @gcctabopt
12735@item -mlong-calls
12736@itemx -mno-long-calls
12737@opindex mlong-calls
12738@opindex mno-long-calls
12739Treat all calls as being far away (near).  If calls are assumed to be
12740far away, the compiler will always load the functions address up into a
12741register, and call indirect through the pointer.
12742
12743@item -mno-ep
12744@itemx -mep
12745@opindex mno-ep
12746@opindex mep
12747Do not optimize (do optimize) basic blocks that use the same index
12748pointer 4 or more times to copy pointer into the @code{ep} register, and
12749use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
12750option is on by default if you optimize.
12751
12752@item -mno-prolog-function
12753@itemx -mprolog-function
12754@opindex mno-prolog-function
12755@opindex mprolog-function
12756Do not use (do use) external functions to save and restore registers
12757at the prologue and epilogue of a function.  The external functions
12758are slower, but use less code space if more than one function saves
12759the same number of registers.  The @option{-mprolog-function} option
12760is on by default if you optimize.
12761
12762@item -mspace
12763@opindex mspace
12764Try to make the code as small as possible.  At present, this just turns
12765on the @option{-mep} and @option{-mprolog-function} options.
12766
12767@item -mtda=@var{n}
12768@opindex mtda
12769Put static or global variables whose size is @var{n} bytes or less into
12770the tiny data area that register @code{ep} points to.  The tiny data
12771area can hold up to 256 bytes in total (128 bytes for byte references).
12772
12773@item -msda=@var{n}
12774@opindex msda
12775Put static or global variables whose size is @var{n} bytes or less into
12776the small data area that register @code{gp} points to.  The small data
12777area can hold up to 64 kilobytes.
12778
12779@item -mzda=@var{n}
12780@opindex mzda
12781Put static or global variables whose size is @var{n} bytes or less into
12782the first 32 kilobytes of memory.
12783
12784@item -mv850
12785@opindex mv850
12786Specify that the target processor is the V850.
12787
12788@item -mbig-switch
12789@opindex mbig-switch
12790Generate code suitable for big switch tables.  Use this option only if
12791the assembler/linker complain about out of range branches within a switch
12792table.
12793
12794@item -mapp-regs
12795@opindex mapp-regs
12796This option will cause r2 and r5 to be used in the code generated by
12797the compiler.  This setting is the default.
12798
12799@item -mno-app-regs
12800@opindex mno-app-regs
12801This option will cause r2 and r5 to be treated as fixed registers.
12802
12803@item -mv850e1
12804@opindex mv850e1
12805Specify that the target processor is the V850E1.  The preprocessor
12806constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
12807this option is used.
12808
12809@item -mv850e
12810@opindex mv850e
12811Specify that the target processor is the V850E@.  The preprocessor
12812constant @samp{__v850e__} will be defined if this option is used.
12813
12814If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
12815are defined then a default target processor will be chosen and the
12816relevant @samp{__v850*__} preprocessor constant will be defined.
12817
12818The preprocessor constants @samp{__v850} and @samp{__v851__} are always
12819defined, regardless of which processor variant is the target.
12820
12821@item -mdisable-callt
12822@opindex mdisable-callt
12823This option will suppress generation of the CALLT instruction for the
12824v850e and v850e1 flavors of the v850 architecture.  The default is
12825@option{-mno-disable-callt} which allows the CALLT instruction to be used.
12826
12827@end table
12828
12829@node VAX Options
12830@subsection VAX Options
12831@cindex VAX options
12832
12833These @samp{-m} options are defined for the VAX:
12834
12835@table @gcctabopt
12836@item -munix
12837@opindex munix
12838Do not output certain jump instructions (@code{aobleq} and so on)
12839that the Unix assembler for the VAX cannot handle across long
12840ranges.
12841
12842@item -mgnu
12843@opindex mgnu
12844Do output those jump instructions, on the assumption that you
12845will assemble with the GNU assembler.
12846
12847@item -mg
12848@opindex mg
12849Output code for g-format floating point numbers instead of d-format.
12850@end table
12851
12852@node x86-64 Options
12853@subsection x86-64 Options
12854@cindex x86-64 options
12855
12856These are listed under @xref{i386 and x86-64 Options}.
12857
12858@node Xstormy16 Options
12859@subsection Xstormy16 Options
12860@cindex Xstormy16 Options
12861
12862These options are defined for Xstormy16:
12863
12864@table @gcctabopt
12865@item -msim
12866@opindex msim
12867Choose startup files and linker script suitable for the simulator.
12868@end table
12869
12870@node Xtensa Options
12871@subsection Xtensa Options
12872@cindex Xtensa Options
12873
12874These options are supported for Xtensa targets:
12875
12876@table @gcctabopt
12877@item -mconst16
12878@itemx -mno-const16
12879@opindex mconst16
12880@opindex mno-const16
12881Enable or disable use of @code{CONST16} instructions for loading
12882constant values.  The @code{CONST16} instruction is currently not a
12883standard option from Tensilica.  When enabled, @code{CONST16}
12884instructions are always used in place of the standard @code{L32R}
12885instructions.  The use of @code{CONST16} is enabled by default only if
12886the @code{L32R} instruction is not available.
12887
12888@item -mfused-madd
12889@itemx -mno-fused-madd
12890@opindex mfused-madd
12891@opindex mno-fused-madd
12892Enable or disable use of fused multiply/add and multiply/subtract
12893instructions in the floating-point option.  This has no effect if the
12894floating-point option is not also enabled.  Disabling fused multiply/add
12895and multiply/subtract instructions forces the compiler to use separate
12896instructions for the multiply and add/subtract operations.  This may be
12897desirable in some cases where strict IEEE 754-compliant results are
12898required: the fused multiply add/subtract instructions do not round the
12899intermediate result, thereby producing results with @emph{more} bits of
12900precision than specified by the IEEE standard.  Disabling fused multiply
12901add/subtract instructions also ensures that the program output is not
12902sensitive to the compiler's ability to combine multiply and add/subtract
12903operations.
12904
12905@item -mtext-section-literals
12906@itemx -mno-text-section-literals
12907@opindex mtext-section-literals
12908@opindex mno-text-section-literals
12909Control the treatment of literal pools.  The default is
12910@option{-mno-text-section-literals}, which places literals in a separate
12911section in the output file.  This allows the literal pool to be placed
12912in a data RAM/ROM, and it also allows the linker to combine literal
12913pools from separate object files to remove redundant literals and
12914improve code size.  With @option{-mtext-section-literals}, the literals
12915are interspersed in the text section in order to keep them as close as
12916possible to their references.  This may be necessary for large assembly
12917files.
12918
12919@item -mtarget-align
12920@itemx -mno-target-align
12921@opindex mtarget-align
12922@opindex mno-target-align
12923When this option is enabled, GCC instructs the assembler to
12924automatically align instructions to reduce branch penalties at the
12925expense of some code density.  The assembler attempts to widen density
12926instructions to align branch targets and the instructions following call
12927instructions.  If there are not enough preceding safe density
12928instructions to align a target, no widening will be performed.  The
12929default is @option{-mtarget-align}.  These options do not affect the
12930treatment of auto-aligned instructions like @code{LOOP}, which the
12931assembler will always align, either by widening density instructions or
12932by inserting no-op instructions.
12933
12934@item -mlongcalls
12935@itemx -mno-longcalls
12936@opindex mlongcalls
12937@opindex mno-longcalls
12938When this option is enabled, GCC instructs the assembler to translate
12939direct calls to indirect calls unless it can determine that the target
12940of a direct call is in the range allowed by the call instruction.  This
12941translation typically occurs for calls to functions in other source
12942files.  Specifically, the assembler translates a direct @code{CALL}
12943instruction into an @code{L32R} followed by a @code{CALLX} instruction.
12944The default is @option{-mno-longcalls}.  This option should be used in
12945programs where the call target can potentially be out of range.  This
12946option is implemented in the assembler, not the compiler, so the
12947assembly code generated by GCC will still show direct call
12948instructions---look at the disassembled object code to see the actual
12949instructions.  Note that the assembler will use an indirect call for
12950every cross-file call, not just those that really will be out of range.
12951@end table
12952
12953@node zSeries Options
12954@subsection zSeries Options
12955@cindex zSeries options
12956
12957These are listed under @xref{S/390 and zSeries Options}.
12958
12959@node Code Gen Options
12960@section Options for Code Generation Conventions
12961@cindex code generation conventions
12962@cindex options, code generation
12963@cindex run-time options
12964
12965These machine-independent options control the interface conventions
12966used in code generation.
12967
12968Most of them have both positive and negative forms; the negative form
12969of @option{-ffoo} would be @option{-fno-foo}.  In the table below, only
12970one of the forms is listed---the one which is not the default.  You
12971can figure out the other form by either removing @samp{no-} or adding
12972it.
12973
12974@table @gcctabopt
12975@item -fbounds-check
12976@opindex fbounds-check
12977For front-ends that support it, generate additional code to check that
12978indices used to access arrays are within the declared range.  This is
12979currently only supported by the Java and Fortran front-ends, where
12980this option defaults to true and false respectively.
12981
12982@item -ftrapv
12983@opindex ftrapv
12984This option generates traps for signed overflow on addition, subtraction,
12985multiplication operations.
12986
12987@item -fwrapv
12988@opindex fwrapv
12989This option instructs the compiler to assume that signed arithmetic
12990overflow of addition, subtraction and multiplication wraps around
12991using twos-complement representation.  This flag enables some optimizations
12992and disables others.  This option is enabled by default for the Java
12993front-end, as required by the Java language specification.
12994
12995@item -fexceptions
12996@opindex fexceptions
12997Enable exception handling.  Generates extra code needed to propagate
12998exceptions.  For some targets, this implies GCC will generate frame
12999unwind information for all functions, which can produce significant data
13000size overhead, although it does not affect execution.  If you do not
13001specify this option, GCC will enable it by default for languages like
13002C++ which normally require exception handling, and disable it for
13003languages like C that do not normally require it.  However, you may need
13004to enable this option when compiling C code that needs to interoperate
13005properly with exception handlers written in C++.  You may also wish to
13006disable this option if you are compiling older C++ programs that don't
13007use exception handling.
13008
13009@item -fnon-call-exceptions
13010@opindex fnon-call-exceptions
13011Generate code that allows trapping instructions to throw exceptions.
13012Note that this requires platform-specific runtime support that does
13013not exist everywhere.  Moreover, it only allows @emph{trapping}
13014instructions to throw exceptions, i.e.@: memory references or floating
13015point instructions.  It does not allow exceptions to be thrown from
13016arbitrary signal handlers such as @code{SIGALRM}.
13017
13018@item -funwind-tables
13019@opindex funwind-tables
13020Similar to @option{-fexceptions}, except that it will just generate any needed
13021static data, but will not affect the generated code in any other way.
13022You will normally not enable this option; instead, a language processor
13023that needs this handling would enable it on your behalf.
13024
13025@item -fasynchronous-unwind-tables
13026@opindex fasynchronous-unwind-tables
13027Generate unwind table in dwarf2 format, if supported by target machine.  The
13028table is exact at each instruction boundary, so it can be used for stack
13029unwinding from asynchronous events (such as debugger or garbage collector).
13030
13031@item -fpcc-struct-return
13032@opindex fpcc-struct-return
13033Return ``short'' @code{struct} and @code{union} values in memory like
13034longer ones, rather than in registers.  This convention is less
13035efficient, but it has the advantage of allowing intercallability between
13036GCC-compiled files and files compiled with other compilers, particularly
13037the Portable C Compiler (pcc).
13038
13039The precise convention for returning structures in memory depends
13040on the target configuration macros.
13041
13042Short structures and unions are those whose size and alignment match
13043that of some integer type.
13044
13045@strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13046switch is not binary compatible with code compiled with the
13047@option{-freg-struct-return} switch.
13048Use it to conform to a non-default application binary interface.
13049
13050@item -freg-struct-return
13051@opindex freg-struct-return
13052Return @code{struct} and @code{union} values in registers when possible.
13053This is more efficient for small structures than
13054@option{-fpcc-struct-return}.
13055
13056If you specify neither @option{-fpcc-struct-return} nor
13057@option{-freg-struct-return}, GCC defaults to whichever convention is
13058standard for the target.  If there is no standard convention, GCC
13059defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13060the principal compiler.  In those cases, we can choose the standard, and
13061we chose the more efficient register return alternative.
13062
13063@strong{Warning:} code compiled with the @option{-freg-struct-return}
13064switch is not binary compatible with code compiled with the
13065@option{-fpcc-struct-return} switch.
13066Use it to conform to a non-default application binary interface.
13067
13068@item -fshort-enums
13069@opindex fshort-enums
13070Allocate to an @code{enum} type only as many bytes as it needs for the
13071declared range of possible values.  Specifically, the @code{enum} type
13072will be equivalent to the smallest integer type which has enough room.
13073
13074@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13075code that is not binary compatible with code generated without that switch.
13076Use it to conform to a non-default application binary interface.
13077
13078@item -fshort-double
13079@opindex fshort-double
13080Use the same size for @code{double} as for @code{float}.
13081
13082@strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
13083code that is not binary compatible with code generated without that switch.
13084Use it to conform to a non-default application binary interface.
13085
13086@item -fshort-wchar
13087@opindex fshort-wchar
13088Override the underlying type for @samp{wchar_t} to be @samp{short
13089unsigned int} instead of the default for the target.  This option is
13090useful for building programs to run under WINE@.
13091
13092@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13093code that is not binary compatible with code generated without that switch.
13094Use it to conform to a non-default application binary interface.
13095
13096@item -fno-common
13097@opindex fno-common
13098In C, allocate even uninitialized global variables in the data section of the
13099object file, rather than generating them as common blocks.  This has the
13100effect that if the same variable is declared (without @code{extern}) in
13101two different compilations, you will get an error when you link them.
13102The only reason this might be useful is if you wish to verify that the
13103program will work on other systems which always work this way.
13104
13105@item -fno-ident
13106@opindex fno-ident
13107Ignore the @samp{#ident} directive.
13108
13109@item -finhibit-size-directive
13110@opindex finhibit-size-directive
13111Don't output a @code{.size} assembler directive, or anything else that
13112would cause trouble if the function is split in the middle, and the
13113two halves are placed at locations far apart in memory.  This option is
13114used when compiling @file{crtstuff.c}; you should not need to use it
13115for anything else.
13116
13117@item -fverbose-asm
13118@opindex fverbose-asm
13119Put extra commentary information in the generated assembly code to
13120make it more readable.  This option is generally only of use to those
13121who actually need to read the generated assembly code (perhaps while
13122debugging the compiler itself).
13123
13124@option{-fno-verbose-asm}, the default, causes the
13125extra information to be omitted and is useful when comparing two assembler
13126files.
13127
13128@item -fpic
13129@opindex fpic
13130@cindex global offset table
13131@cindex PIC
13132Generate position-independent code (PIC) suitable for use in a shared
13133library, if supported for the target machine.  Such code accesses all
13134constant addresses through a global offset table (GOT)@.  The dynamic
13135loader resolves the GOT entries when the program starts (the dynamic
13136loader is not part of GCC; it is part of the operating system).  If
13137the GOT size for the linked executable exceeds a machine-specific
13138maximum size, you get an error message from the linker indicating that
13139@option{-fpic} does not work; in that case, recompile with @option{-fPIC}
13140instead.  (These maximums are 8k on the SPARC and 32k
13141on the m68k and RS/6000.  The 386 has no such limit.)
13142
13143Position-independent code requires special support, and therefore works
13144only on certain machines.  For the 386, GCC supports PIC for System V
13145but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
13146position-independent.
13147
13148When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13149are defined to 1.
13150
13151@item -fPIC
13152@opindex fPIC
13153If supported for the target machine, emit position-independent code,
13154suitable for dynamic linking and avoiding any limit on the size of the
13155global offset table.  This option makes a difference on the m68k,
13156PowerPC and SPARC@.
13157
13158Position-independent code requires special support, and therefore works
13159only on certain machines.
13160
13161When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13162are defined to 2.
13163
13164@item -fpie
13165@itemx -fPIE
13166@opindex fpie
13167@opindex fPIE
13168These options are similar to @option{-fpic} and @option{-fPIC}, but
13169generated position independent code can be only linked into executables.
13170Usually these options are used when @option{-pie} GCC option will be
13171used during linking.
13172
13173@item -fno-jump-tables
13174@opindex fno-jump-tables
13175Do not use jump tables for switch statements even where it would be
13176more efficient than other code generation strategies.  This option is
13177of use in conjunction with @option{-fpic} or @option{-fPIC} for
13178building code which forms part of a dynamic linker and cannot
13179reference the address of a jump table.  On some targets, jump tables
13180do not require a GOT and this option is not needed.
13181
13182@item -ffixed-@var{reg}
13183@opindex ffixed
13184Treat the register named @var{reg} as a fixed register; generated code
13185should never refer to it (except perhaps as a stack pointer, frame
13186pointer or in some other fixed role).
13187
13188@var{reg} must be the name of a register.  The register names accepted
13189are machine-specific and are defined in the @code{REGISTER_NAMES}
13190macro in the machine description macro file.
13191
13192This flag does not have a negative form, because it specifies a
13193three-way choice.
13194
13195@item -fcall-used-@var{reg}
13196@opindex fcall-used
13197Treat the register named @var{reg} as an allocable register that is
13198clobbered by function calls.  It may be allocated for temporaries or
13199variables that do not live across a call.  Functions compiled this way
13200will not save and restore the register @var{reg}.
13201
13202It is an error to used this flag with the frame pointer or stack pointer.
13203Use of this flag for other registers that have fixed pervasive roles in
13204the machine's execution model will produce disastrous results.
13205
13206This flag does not have a negative form, because it specifies a
13207three-way choice.
13208
13209@item -fcall-saved-@var{reg}
13210@opindex fcall-saved
13211Treat the register named @var{reg} as an allocable register saved by
13212functions.  It may be allocated even for temporaries or variables that
13213live across a call.  Functions compiled this way will save and restore
13214the register @var{reg} if they use it.
13215
13216It is an error to used this flag with the frame pointer or stack pointer.
13217Use of this flag for other registers that have fixed pervasive roles in
13218the machine's execution model will produce disastrous results.
13219
13220A different sort of disaster will result from the use of this flag for
13221a register in which function values may be returned.
13222
13223This flag does not have a negative form, because it specifies a
13224three-way choice.
13225
13226@item -fpack-struct[=@var{n}]
13227@opindex fpack-struct
13228Without a value specified, pack all structure members together without
13229holes.  When a value is specified (which must be a small power of two), pack
13230structure members according to this value, representing the maximum
13231alignment (that is, objects with default alignment requirements larger than
13232this will be output potentially unaligned at the next fitting location.
13233
13234@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
13235code that is not binary compatible with code generated without that switch.
13236Additionally, it makes the code suboptimal.
13237Use it to conform to a non-default application binary interface.
13238
13239@item -finstrument-functions
13240@opindex finstrument-functions
13241Generate instrumentation calls for entry and exit to functions.  Just
13242after function entry and just before function exit, the following
13243profiling functions will be called with the address of the current
13244function and its call site.  (On some platforms,
13245@code{__builtin_return_address} does not work beyond the current
13246function, so the call site information may not be available to the
13247profiling functions otherwise.)
13248
13249@smallexample
13250void __cyg_profile_func_enter (void *this_fn,
13251                               void *call_site);
13252void __cyg_profile_func_exit  (void *this_fn,
13253                               void *call_site);
13254@end smallexample
13255
13256The first argument is the address of the start of the current function,
13257which may be looked up exactly in the symbol table.
13258
13259This instrumentation is also done for functions expanded inline in other
13260functions.  The profiling calls will indicate where, conceptually, the
13261inline function is entered and exited.  This means that addressable
13262versions of such functions must be available.  If all your uses of a
13263function are expanded inline, this may mean an additional expansion of
13264code size.  If you use @samp{extern inline} in your C code, an
13265addressable version of such functions must be provided.  (This is
13266normally the case anyways, but if you get lucky and the optimizer always
13267expands the functions inline, you might have gotten away without
13268providing static copies.)
13269
13270A function may be given the attribute @code{no_instrument_function}, in
13271which case this instrumentation will not be done.  This can be used, for
13272example, for the profiling functions listed above, high-priority
13273interrupt routines, and any functions from which the profiling functions
13274cannot safely be called (perhaps signal handlers, if the profiling
13275routines generate output or allocate memory).
13276
13277@item -fstack-check
13278@opindex fstack-check
13279Generate code to verify that you do not go beyond the boundary of the
13280stack.  You should specify this flag if you are running in an
13281environment with multiple threads, but only rarely need to specify it in
13282a single-threaded environment since stack overflow is automatically
13283detected on nearly all systems if there is only one stack.
13284
13285Note that this switch does not actually cause checking to be done; the
13286operating system must do that.  The switch causes generation of code
13287to ensure that the operating system sees the stack being extended.
13288
13289@item -fstack-limit-register=@var{reg}
13290@itemx -fstack-limit-symbol=@var{sym}
13291@itemx -fno-stack-limit
13292@opindex fstack-limit-register
13293@opindex fstack-limit-symbol
13294@opindex fno-stack-limit
13295Generate code to ensure that the stack does not grow beyond a certain value,
13296either the value of a register or the address of a symbol.  If the stack
13297would grow beyond the value, a signal is raised.  For most targets,
13298the signal is raised before the stack overruns the boundary, so
13299it is possible to catch the signal without taking special precautions.
13300
13301For instance, if the stack starts at absolute address @samp{0x80000000}
13302and grows downwards, you can use the flags
13303@option{-fstack-limit-symbol=__stack_limit} and
13304@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
13305of 128KB@.  Note that this may only work with the GNU linker.
13306
13307@cindex aliasing of parameters
13308@cindex parameters, aliased
13309@item -fargument-alias
13310@itemx -fargument-noalias
13311@itemx -fargument-noalias-global
13312@itemx -fargument-noalias-anything
13313@opindex fargument-alias
13314@opindex fargument-noalias
13315@opindex fargument-noalias-global
13316@opindex fargument-noalias-anything
13317Specify the possible relationships among parameters and between
13318parameters and global data.
13319
13320@option{-fargument-alias} specifies that arguments (parameters) may
13321alias each other and may alias global storage.@*
13322@option{-fargument-noalias} specifies that arguments do not alias
13323each other, but may alias global storage.@*
13324@option{-fargument-noalias-global} specifies that arguments do not
13325alias each other and do not alias global storage.
13326@option{-fargument-noalias-anything} specifies that arguments do not
13327alias any other storage.
13328
13329Each language will automatically use whatever option is required by
13330the language standard.  You should not need to use these options yourself.
13331
13332@item -fleading-underscore
13333@opindex fleading-underscore
13334This option and its counterpart, @option{-fno-leading-underscore}, forcibly
13335change the way C symbols are represented in the object file.  One use
13336is to help link with legacy assembly code.
13337
13338@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
13339generate code that is not binary compatible with code generated without that
13340switch.  Use it to conform to a non-default application binary interface.
13341Not all targets provide complete support for this switch.
13342
13343@item -ftls-model=@var{model}
13344Alter the thread-local storage model to be used (@pxref{Thread-Local}).
13345The @var{model} argument should be one of @code{global-dynamic},
13346@code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
13347
13348The default without @option{-fpic} is @code{initial-exec}; with
13349@option{-fpic} the default is @code{global-dynamic}.
13350
13351@item -fvisibility=@var{default|internal|hidden|protected}
13352@opindex fvisibility
13353Set the default ELF image symbol visibility to the specified option---all
13354symbols will be marked with this unless overridden within the code.
13355Using this feature can very substantially improve linking and
13356load times of shared object libraries, produce more optimized
13357code, provide near-perfect API export and prevent symbol clashes.
13358It is @strong{strongly} recommended that you use this in any shared objects
13359you distribute.
13360
13361Despite the nomenclature, @code{default} always means public ie;
13362available to be linked against from outside the shared object.
13363@code{protected} and @code{internal} are pretty useless in real-world
13364usage so the only other commonly used option will be @code{hidden}.
13365The default if @option{-fvisibility} isn't specified is
13366@code{default}, i.e., make every
13367symbol public---this causes the same behavior as previous versions of
13368GCC@.
13369
13370A good explanation of the benefits offered by ensuring ELF
13371symbols have the correct visibility is given by ``How To Write
13372Shared Libraries'' by Ulrich Drepper (which can be found at
13373@w{@uref{http://people.redhat.com/~drepper/}})---however a superior
13374solution made possible by this option to marking things hidden when
13375the default is public is to make the default hidden and mark things
13376public.  This is the norm with DLL's on Windows and with @option{-fvisibility=hidden}
13377and @code{__attribute__ ((visibility("default")))} instead of
13378@code{__declspec(dllexport)} you get almost identical semantics with
13379identical syntax.  This is a great boon to those working with
13380cross-platform projects.
13381
13382For those adding visibility support to existing code, you may find
13383@samp{#pragma GCC visibility} of use.  This works by you enclosing
13384the declarations you wish to set visibility for with (for example)
13385@samp{#pragma GCC visibility push(hidden)} and
13386@samp{#pragma GCC visibility pop}.
13387Bear in mind that symbol visibility should be viewed @strong{as
13388part of the API interface contract} and thus all new code should
13389always specify visibility when it is not the default ie; declarations
13390only for use within the local DSO should @strong{always} be marked explicitly
13391as hidden as so to avoid PLT indirection overheads---making this
13392abundantly clear also aids readability and self-documentation of the code.
13393Note that due to ISO C++ specification requirements, operator new and
13394operator delete must always be of default visibility.
13395
13396Be aware that headers from outside your project, in particular system
13397headers and headers from any other library you use, may not be
13398expecting to be compiled with visibility other than the default.  You
13399may need to explicitly say @samp{#pragma GCC visibility push(default)}
13400before including any such headers.
13401
13402@samp{extern} declarations are not affected by @samp{-fvisibility}, so
13403a lot of code can be recompiled with @samp{-fvisibility=hidden} with
13404no modifications.  However, this means that calls to @samp{extern}
13405functions with no explicit visibility will use the PLT, so it is more
13406effective to use @samp{__attribute ((visibility))} and/or
13407@samp{#pragma GCC visibility} to tell the compiler which @samp{extern}
13408declarations should be treated as hidden.
13409
13410Note that @samp{-fvisibility} does affect C++ vague linkage
13411entities. This means that, for instance, an exception class that will
13412be thrown between DSOs must be explicitly marked with default
13413visibility so that the @samp{type_info} nodes will be unified between
13414the DSOs.
13415
13416An overview of these techniques, their benefits and how to use them
13417is at @w{@uref{http://gcc.gnu.org/wiki/Visibility}}.
13418
13419@end table
13420
13421@c man end
13422
13423@node Environment Variables
13424@section Environment Variables Affecting GCC
13425@cindex environment variables
13426
13427@c man begin ENVIRONMENT
13428This section describes several environment variables that affect how GCC
13429operates.  Some of them work by specifying directories or prefixes to use
13430when searching for various kinds of files.  Some are used to specify other
13431aspects of the compilation environment.
13432
13433Note that you can also specify places to search using options such as
13434@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
13435take precedence over places specified using environment variables, which
13436in turn take precedence over those specified by the configuration of GCC@.
13437@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
13438GNU Compiler Collection (GCC) Internals}.
13439
13440@table @env
13441@item LANG
13442@itemx LC_CTYPE
13443@c @itemx LC_COLLATE
13444@itemx LC_MESSAGES
13445@c @itemx LC_MONETARY
13446@c @itemx LC_NUMERIC
13447@c @itemx LC_TIME
13448@itemx LC_ALL
13449@findex LANG
13450@findex LC_CTYPE
13451@c @findex LC_COLLATE
13452@findex LC_MESSAGES
13453@c @findex LC_MONETARY
13454@c @findex LC_NUMERIC
13455@c @findex LC_TIME
13456@findex LC_ALL
13457@cindex locale
13458These environment variables control the way that GCC uses
13459localization information that allow GCC to work with different
13460national conventions.  GCC inspects the locale categories
13461@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
13462so.  These locale categories can be set to any value supported by your
13463installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
13464Kingdom encoded in UTF-8.
13465
13466The @env{LC_CTYPE} environment variable specifies character
13467classification.  GCC uses it to determine the character boundaries in
13468a string; this is needed for some multibyte encodings that contain quote
13469and escape characters that would otherwise be interpreted as a string
13470end or escape.
13471
13472The @env{LC_MESSAGES} environment variable specifies the language to
13473use in diagnostic messages.
13474
13475If the @env{LC_ALL} environment variable is set, it overrides the value
13476of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
13477and @env{LC_MESSAGES} default to the value of the @env{LANG}
13478environment variable.  If none of these variables are set, GCC
13479defaults to traditional C English behavior.
13480
13481@item TMPDIR
13482@findex TMPDIR
13483If @env{TMPDIR} is set, it specifies the directory to use for temporary
13484files.  GCC uses temporary files to hold the output of one stage of
13485compilation which is to be used as input to the next stage: for example,
13486the output of the preprocessor, which is the input to the compiler
13487proper.
13488
13489@item GCC_EXEC_PREFIX
13490@findex GCC_EXEC_PREFIX
13491If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
13492names of the subprograms executed by the compiler.  No slash is added
13493when this prefix is combined with the name of a subprogram, but you can
13494specify a prefix that ends with a slash if you wish.
13495
13496If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
13497an appropriate prefix to use based on the pathname it was invoked with.
13498
13499If GCC cannot find the subprogram using the specified prefix, it
13500tries looking in the usual places for the subprogram.
13501
13502The default value of @env{GCC_EXEC_PREFIX} is
13503@file{@var{prefix}/lib/gcc/} where @var{prefix} is the value
13504of @code{prefix} when you ran the @file{configure} script.
13505
13506Other prefixes specified with @option{-B} take precedence over this prefix.
13507
13508This prefix is also used for finding files such as @file{crt0.o} that are
13509used for linking.
13510
13511In addition, the prefix is used in an unusual way in finding the
13512directories to search for header files.  For each of the standard
13513directories whose name normally begins with @samp{/usr/local/lib/gcc}
13514(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
13515replacing that beginning with the specified prefix to produce an
13516alternate directory name.  Thus, with @option{-Bfoo/}, GCC will search
13517@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
13518These alternate directories are searched first; the standard directories
13519come next.
13520
13521@item COMPILER_PATH
13522@findex COMPILER_PATH
13523The value of @env{COMPILER_PATH} is a colon-separated list of
13524directories, much like @env{PATH}.  GCC tries the directories thus
13525specified when searching for subprograms, if it can't find the
13526subprograms using @env{GCC_EXEC_PREFIX}.
13527
13528@item LIBRARY_PATH
13529@findex LIBRARY_PATH
13530The value of @env{LIBRARY_PATH} is a colon-separated list of
13531directories, much like @env{PATH}.  When configured as a native compiler,
13532GCC tries the directories thus specified when searching for special
13533linker files, if it can't find them using @env{GCC_EXEC_PREFIX}.  Linking
13534using GCC also uses these directories when searching for ordinary
13535libraries for the @option{-l} option (but directories specified with
13536@option{-L} come first).
13537
13538@item LANG
13539@findex LANG
13540@cindex locale definition
13541This variable is used to pass locale information to the compiler.  One way in
13542which this information is used is to determine the character set to be used
13543when character literals, string literals and comments are parsed in C and C++.
13544When the compiler is configured to allow multibyte characters,
13545the following values for @env{LANG} are recognized:
13546
13547@table @samp
13548@item C-JIS
13549Recognize JIS characters.
13550@item C-SJIS
13551Recognize SJIS characters.
13552@item C-EUCJP
13553Recognize EUCJP characters.
13554@end table
13555
13556If @env{LANG} is not defined, or if it has some other value, then the
13557compiler will use mblen and mbtowc as defined by the default locale to
13558recognize and translate multibyte characters.
13559@end table
13560
13561@noindent
13562Some additional environments variables affect the behavior of the
13563preprocessor.
13564
13565@include cppenv.texi
13566
13567@c man end
13568
13569@node Precompiled Headers
13570@section Using Precompiled Headers
13571@cindex precompiled headers
13572@cindex speed of compilation
13573
13574Often large projects have many header files that are included in every
13575source file.  The time the compiler takes to process these header files
13576over and over again can account for nearly all of the time required to
13577build the project.  To make builds faster, GCC allows users to
13578`precompile' a header file; then, if builds can use the precompiled
13579header file they will be much faster.
13580
13581To create a precompiled header file, simply compile it as you would any
13582other file, if necessary using the @option{-x} option to make the driver
13583treat it as a C or C++ header file.  You will probably want to use a
13584tool like @command{make} to keep the precompiled header up-to-date when
13585the headers it contains change.
13586
13587A precompiled header file will be searched for when @code{#include} is
13588seen in the compilation.  As it searches for the included file
13589(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
13590compiler looks for a precompiled header in each directory just before it
13591looks for the include file in that directory.  The name searched for is
13592the name specified in the @code{#include} with @samp{.gch} appended.  If
13593the precompiled header file can't be used, it is ignored.
13594
13595For instance, if you have @code{#include "all.h"}, and you have
13596@file{all.h.gch} in the same directory as @file{all.h}, then the
13597precompiled header file will be used if possible, and the original
13598header will be used otherwise.
13599
13600Alternatively, you might decide to put the precompiled header file in a
13601directory and use @option{-I} to ensure that directory is searched
13602before (or instead of) the directory containing the original header.
13603Then, if you want to check that the precompiled header file is always
13604used, you can put a file of the same name as the original header in this
13605directory containing an @code{#error} command.
13606
13607This also works with @option{-include}.  So yet another way to use
13608precompiled headers, good for projects not designed with precompiled
13609header files in mind, is to simply take most of the header files used by
13610a project, include them from another header file, precompile that header
13611file, and @option{-include} the precompiled header.  If the header files
13612have guards against multiple inclusion, they will be skipped because
13613they've already been included (in the precompiled header).
13614
13615If you need to precompile the same header file for different
13616languages, targets, or compiler options, you can instead make a
13617@emph{directory} named like @file{all.h.gch}, and put each precompiled
13618header in the directory, perhaps using @option{-o}.  It doesn't matter
13619what you call the files in the directory, every precompiled header in
13620the directory will be considered.  The first precompiled header
13621encountered in the directory that is valid for this compilation will
13622be used; they're searched in no particular order.
13623
13624There are many other possibilities, limited only by your imagination,
13625good sense, and the constraints of your build system.
13626
13627A precompiled header file can be used only when these conditions apply:
13628
13629@itemize
13630@item
13631Only one precompiled header can be used in a particular compilation.
13632
13633@item
13634A precompiled header can't be used once the first C token is seen.  You
13635can have preprocessor directives before a precompiled header; you can
13636even include a precompiled header from inside another header, so long as
13637there are no C tokens before the @code{#include}.
13638
13639@item
13640The precompiled header file must be produced for the same language as
13641the current compilation.  You can't use a C precompiled header for a C++
13642compilation.
13643
13644@item
13645The precompiled header file must have been produced by the same compiler
13646binary as the current compilation is using.
13647
13648@item
13649Any macros defined before the precompiled header is included must
13650either be defined in the same way as when the precompiled header was
13651generated, or must not affect the precompiled header, which usually
13652means that they don't appear in the precompiled header at all.
13653
13654The @option{-D} option is one way to define a macro before a
13655precompiled header is included; using a @code{#define} can also do it.
13656There are also some options that define macros implicitly, like
13657@option{-O} and @option{-Wdeprecated}; the same rule applies to macros
13658defined this way.
13659
13660@item If debugging information is output when using the precompiled
13661header, using @option{-g} or similar, the same kind of debugging information
13662must have been output when building the precompiled header.  However,
13663a precompiled header built using @option{-g} can be used in a compilation
13664when no debugging information is being output.
13665
13666@item The same @option{-m} options must generally be used when building
13667and using the precompiled header.  @xref{Submodel Options},
13668for any cases where this rule is relaxed.
13669
13670@item Each of the following options must be the same when building and using
13671the precompiled header:
13672
13673@gccoptlist{-fexceptions -funit-at-a-time}
13674
13675@item
13676Some other command-line options starting with @option{-f},
13677@option{-p}, or @option{-O} must be defined in the same way as when
13678the precompiled header was generated.  At present, it's not clear
13679which options are safe to change and which are not; the safest choice
13680is to use exactly the same options when generating and using the
13681precompiled header.  The following are known to be safe:
13682
13683@gccoptlist{-fmessage-length= -fpreprocessed
13684-fsched-interblock -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous
13685-fsched-verbose=<number> -fschedule-insns -fvisibility=
13686-pedantic-errors}
13687
13688@end itemize
13689
13690For all of these except the last, the compiler will automatically
13691ignore the precompiled header if the conditions aren't met.  If you
13692find an option combination that doesn't work and doesn't cause the
13693precompiled header to be ignored, please consider filing a bug report,
13694see @ref{Bugs}.
13695
13696If you do use differing options when generating and using the
13697precompiled header, the actual behavior will be a mixture of the
13698behavior for the options.  For instance, if you use @option{-g} to
13699generate the precompiled header but not when using it, you may or may
13700not get debugging information for routines in the precompiled header.
13701
13702@node Running Protoize
13703@section Running Protoize
13704
13705The program @code{protoize} is an optional part of GCC@.  You can use
13706it to add prototypes to a program, thus converting the program to ISO
13707C in one respect.  The companion program @code{unprotoize} does the
13708reverse: it removes argument types from any prototypes that are found.
13709
13710When you run these programs, you must specify a set of source files as
13711command line arguments.  The conversion programs start out by compiling
13712these files to see what functions they define.  The information gathered
13713about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
13714
13715After scanning comes actual conversion.  The specified files are all
13716eligible to be converted; any files they include (whether sources or
13717just headers) are eligible as well.
13718
13719But not all the eligible files are converted.  By default,
13720@code{protoize} and @code{unprotoize} convert only source and header
13721files in the current directory.  You can specify additional directories
13722whose files should be converted with the @option{-d @var{directory}}
13723option.  You can also specify particular files to exclude with the
13724@option{-x @var{file}} option.  A file is converted if it is eligible, its
13725directory name matches one of the specified directory names, and its
13726name within the directory has not been excluded.
13727
13728Basic conversion with @code{protoize} consists of rewriting most
13729function definitions and function declarations to specify the types of
13730the arguments.  The only ones not rewritten are those for varargs
13731functions.
13732
13733@code{protoize} optionally inserts prototype declarations at the
13734beginning of the source file, to make them available for any calls that
13735precede the function's definition.  Or it can insert prototype
13736declarations with block scope in the blocks where undeclared functions
13737are called.
13738
13739Basic conversion with @code{unprotoize} consists of rewriting most
13740function declarations to remove any argument types, and rewriting
13741function definitions to the old-style pre-ISO form.
13742
13743Both conversion programs print a warning for any function declaration or
13744definition that they can't convert.  You can suppress these warnings
13745with @option{-q}.
13746
13747The output from @code{protoize} or @code{unprotoize} replaces the
13748original source file.  The original file is renamed to a name ending
13749with @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
13750without the original @samp{.c} suffix).  If the @samp{.save} (@samp{.sav}
13751for DOS) file already exists, then the source file is simply discarded.
13752
13753@code{protoize} and @code{unprotoize} both depend on GCC itself to
13754scan the program and collect information about the functions it uses.
13755So neither of these programs will work until GCC is installed.
13756
13757Here is a table of the options you can use with @code{protoize} and
13758@code{unprotoize}.  Each option works with both programs unless
13759otherwise stated.
13760
13761@table @code
13762@item -B @var{directory}
13763Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
13764usual directory (normally @file{/usr/local/lib}).  This file contains
13765prototype information about standard system functions.  This option
13766applies only to @code{protoize}.
13767
13768@item -c @var{compilation-options}
13769Use @var{compilation-options} as the options when running @command{gcc} to
13770produce the @samp{.X} files.  The special option @option{-aux-info} is
13771always passed in addition, to tell @command{gcc} to write a @samp{.X} file.
13772
13773Note that the compilation options must be given as a single argument to
13774@code{protoize} or @code{unprotoize}.  If you want to specify several
13775@command{gcc} options, you must quote the entire set of compilation options
13776to make them a single word in the shell.
13777
13778There are certain @command{gcc} arguments that you cannot use, because they
13779would produce the wrong kind of output.  These include @option{-g},
13780@option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
13781the @var{compilation-options}, they are ignored.
13782
13783@item -C
13784Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file
13785systems) instead of @samp{.c}.  This is convenient if you are converting
13786a C program to C++.  This option applies only to @code{protoize}.
13787
13788@item -g
13789Add explicit global declarations.  This means inserting explicit
13790declarations at the beginning of each source file for each function
13791that is called in the file and was not declared.  These declarations
13792precede the first function definition that contains a call to an
13793undeclared function.  This option applies only to @code{protoize}.
13794
13795@item -i @var{string}
13796Indent old-style parameter declarations with the string @var{string}.
13797This option applies only to @code{protoize}.
13798
13799@code{unprotoize} converts prototyped function definitions to old-style
13800function definitions, where the arguments are declared between the
13801argument list and the initial @samp{@{}.  By default, @code{unprotoize}
13802uses five spaces as the indentation.  If you want to indent with just
13803one space instead, use @option{-i " "}.
13804
13805@item -k
13806Keep the @samp{.X} files.  Normally, they are deleted after conversion
13807is finished.
13808
13809@item -l
13810Add explicit local declarations.  @code{protoize} with @option{-l} inserts
13811a prototype declaration for each function in each block which calls the
13812function without any declaration.  This option applies only to
13813@code{protoize}.
13814
13815@item -n
13816Make no real changes.  This mode just prints information about the conversions
13817that would have been done without @option{-n}.
13818
13819@item -N
13820Make no @samp{.save} files.  The original files are simply deleted.
13821Use this option with caution.
13822
13823@item -p @var{program}
13824Use the program @var{program} as the compiler.  Normally, the name
13825@file{gcc} is used.
13826
13827@item -q
13828Work quietly.  Most warnings are suppressed.
13829
13830@item -v
13831Print the version number, just like @option{-v} for @command{gcc}.
13832@end table
13833
13834If you need special compiler options to compile one of your program's
13835source files, then you should generate that file's @samp{.X} file
13836specially, by running @command{gcc} on that source file with the
13837appropriate options and the option @option{-aux-info}.  Then run
13838@code{protoize} on the entire set of files.  @code{protoize} will use
13839the existing @samp{.X} file because it is newer than the source file.
13840For example:
13841
13842@smallexample
13843gcc -Dfoo=bar file1.c -aux-info file1.X
13844protoize *.c
13845@end smallexample
13846
13847@noindent
13848You need to include the special files along with the rest in the
13849@code{protoize} command, even though their @samp{.X} files already
13850exist, because otherwise they won't get converted.
13851
13852@xref{Protoize Caveats}, for more information on how to use
13853@code{protoize} successfully.
13854