190075Sobrien@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2169689Skan@c 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
390075Sobrien@c This is part of the GCC manual.
490075Sobrien@c For copying conditions, see the file gcc.texi.
590075Sobrien
690075Sobrien@ignore
7169689Skan@c man begin INCLUDE
8169689Skan@include gcc-vers.texi
9169689Skan@c man end
10169689Skan
1190075Sobrien@c man begin COPYRIGHT
12169689SkanCopyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
13169689Skan1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
1490075Sobrien
1590075SobrienPermission is granted to copy, distribute and/or modify this document
16117395Skanunder the terms of the GNU Free Documentation License, Version 1.2 or
1790075Sobrienany later version published by the Free Software Foundation; with the
1890075SobrienInvariant Sections being ``GNU General Public License'' and ``Funding
1990075SobrienFree Software'', the Front-Cover texts being (a) (see below), and with
2090075Sobrienthe Back-Cover Texts being (b) (see below).  A copy of the license is
2190075Sobrienincluded in the gfdl(7) man page.
2290075Sobrien
2390075Sobrien(a) The FSF's Front-Cover Text is:
2490075Sobrien
2590075Sobrien     A GNU Manual
2690075Sobrien
2790075Sobrien(b) The FSF's Back-Cover Text is:
2890075Sobrien
2990075Sobrien     You have freedom to copy and modify this GNU Manual, like GNU
3090075Sobrien     software.  Copies published by the Free Software Foundation raise
3190075Sobrien     funds for GNU development.
3290075Sobrien@c man end
3390075Sobrien@c Set file name and title for the man page.
3490075Sobrien@setfilename gcc
3590075Sobrien@settitle GNU project C and C++ compiler
3690075Sobrien@c man begin SYNOPSIS
3790075Sobriengcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
3890075Sobrien    [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
3990075Sobrien    [@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
4090075Sobrien    [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
4190075Sobrien    [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
4290075Sobrien    [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
43169689Skan    [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
4490075Sobrien
4590075SobrienOnly the most useful options are listed here; see below for the
4690075Sobrienremainder.  @samp{g++} accepts mostly the same options as @samp{gcc}.
4790075Sobrien@c man end
4890075Sobrien@c man begin SEEALSO
4990075Sobriengpl(7), gfdl(7), fsf-funding(7),
50169689Skancpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
51169689Skanand the Info entries for @file{gcc}, @file{cpp}, @file{as},
5290075Sobrien@file{ld}, @file{binutils} and @file{gdb}.
5390075Sobrien@c man end
5490075Sobrien@c man begin BUGS
5590075SobrienFor instructions on reporting bugs, see
56169689Skan@w{@uref{http://gcc.gnu.org/bugs.html}}.
5790075Sobrien@c man end
5890075Sobrien@c man begin AUTHOR
5990075SobrienSee the Info entry for @command{gcc}, or
6090075Sobrien@w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
6190075Sobrienfor contributors to GCC@.
6290075Sobrien@c man end
6390075Sobrien@end ignore
6490075Sobrien
6590075Sobrien@node Invoking GCC
6690075Sobrien@chapter GCC Command Options
6790075Sobrien@cindex GCC command options
6890075Sobrien@cindex command options
6990075Sobrien@cindex options, GCC command
7090075Sobrien
7190075Sobrien@c man begin DESCRIPTION
7290075SobrienWhen you invoke GCC, it normally does preprocessing, compilation,
7390075Sobrienassembly and linking.  The ``overall options'' allow you to stop this
7490075Sobrienprocess at an intermediate stage.  For example, the @option{-c} option
7590075Sobriensays not to run the linker.  Then the output consists of object files
7690075Sobrienoutput by the assembler.
7790075Sobrien
7890075SobrienOther options are passed on to one stage of processing.  Some options
7990075Sobriencontrol the preprocessor and others the compiler itself.  Yet other
8090075Sobrienoptions control the assembler and linker; most of these are not
8190075Sobriendocumented here, since you rarely need to use any of them.
8290075Sobrien
8390075Sobrien@cindex C compilation options
8490075SobrienMost of the command line options that you can use with GCC are useful
8590075Sobrienfor C programs; when an option is only useful with another language
8690075Sobrien(usually C++), the explanation says so explicitly.  If the description
8790075Sobrienfor a particular option does not mention a source language, you can use
8890075Sobrienthat option with all supported languages.
8990075Sobrien
9090075Sobrien@cindex C++ compilation options
9190075Sobrien@xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
9290075Sobrienoptions for compiling C++ programs.
9390075Sobrien
9490075Sobrien@cindex grouping options
9590075Sobrien@cindex options, grouping
9690075SobrienThe @command{gcc} program accepts options and file names as operands.  Many
9790075Sobrienoptions have multi-letter names; therefore multiple single-letter options
9890075Sobrienmay @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d
9990075Sobrien-r}}.
10090075Sobrien
10190075Sobrien@cindex order of options
10290075Sobrien@cindex options, order
10390075SobrienYou can mix options and other arguments.  For the most part, the order
10490075Sobrienyou use doesn't matter.  Order does matter when you use several options
10590075Sobrienof the same kind; for example, if you specify @option{-L} more than once,
10690075Sobrienthe directories are searched in the order specified.
10790075Sobrien
10890075SobrienMany options have long names starting with @samp{-f} or with
109169689Skan@samp{-W}---for example, 
110169689Skan@option{-fmove-loop-invariants}, @option{-Wformat} and so on.  Most of
11190075Sobrienthese have both positive and negative forms; the negative form of
11290075Sobrien@option{-ffoo} would be @option{-fno-foo}.  This manual documents
11390075Sobrienonly one of these two forms, whichever one is not the default.
11490075Sobrien
11590075Sobrien@c man end
11690075Sobrien
11790075Sobrien@xref{Option Index}, for an index to GCC's options.
11890075Sobrien
11990075Sobrien@menu
12090075Sobrien* Option Summary::	Brief list of all options, without explanations.
12190075Sobrien* Overall Options::     Controlling the kind of output:
12290075Sobrien                        an executable, object files, assembler files,
12390075Sobrien                        or preprocessed source.
12490075Sobrien* Invoking G++::	Compiling C++ programs.
12590075Sobrien* C Dialect Options::   Controlling the variant of C language compiled.
12690075Sobrien* C++ Dialect Options:: Variations on C++.
12790075Sobrien* Language Independent Options:: Controlling how diagnostics should be
12890075Sobrien                        formatted.
12990075Sobrien* Warning Options::     How picky should the compiler be?
13090075Sobrien* Debugging Options::   Symbol tables, measurements, and debugging dumps.
13190075Sobrien* Optimize Options::    How much optimization?
13290075Sobrien* Preprocessor Options:: Controlling header files and macro definitions.
13390075Sobrien                         Also, getting dependency information for Make.
13490075Sobrien* Assembler Options::   Passing options to the assembler.
13590075Sobrien* Link Options::        Specifying libraries and so on.
13690075Sobrien* Directory Options::   Where to find header files and libraries.
13790075Sobrien                        Where to find the compiler executable files.
13890075Sobrien* Spec Files::          How to pass switches to sub-processes.
13990075Sobrien* Target Options::      Running a cross-compiler, or an old version of GCC.
14090075Sobrien* Submodel Options::    Specifying minor hardware or convention variations,
14190075Sobrien                        such as 68010 vs 68020.
14290075Sobrien* Code Gen Options::    Specifying conventions for function calls, data layout
14390075Sobrien                        and register usage.
14490075Sobrien* Environment Variables:: Env vars that affect GCC.
145132718Skan* Precompiled Headers:: Compiling a header once, and using it many times.
14690075Sobrien* Running Protoize::    Automatically adding or removing function prototypes.
14790075Sobrien@end menu
14890075Sobrien
14990075Sobrien@c man begin OPTIONS
15090075Sobrien
15190075Sobrien@node Option Summary
15290075Sobrien@section Option Summary
15390075Sobrien
15490075SobrienHere is a summary of all the options, grouped by type.  Explanations are
15590075Sobrienin the following sections.
15690075Sobrien
15790075Sobrien@table @emph
15890075Sobrien@item Overall Options
15990075Sobrien@xref{Overall Options,,Options Controlling the Kind of Output}.
160169689Skan@gccoptlist{-c  -S  -E  -o @var{file}  -combine -pipe  -pass-exit-codes  @gol
161169689Skan-x @var{language}  -v  -###  --help  --target-help  --version @@@var{file}}
16290075Sobrien
16390075Sobrien@item C Language Options
16490075Sobrien@xref{C Dialect Options,,Options Controlling C Dialect}.
165169689Skan@gccoptlist{-ansi  -std=@var{standard}  -fgnu89-inline @gol
166169689Skan-aux-info @var{filename} @gol
167117395Skan-fno-asm  -fno-builtin  -fno-builtin-@var{function} @gol
168169689Skan-fhosted  -ffreestanding -fopenmp -fms-extensions @gol
16996263Sobrien-trigraphs  -no-integrated-cpp  -traditional  -traditional-cpp @gol
17090075Sobrien-fallow-single-precision  -fcond-mismatch @gol
17190075Sobrien-fsigned-bitfields  -fsigned-char @gol
172169689Skan-funsigned-bitfields  -funsigned-char}
17390075Sobrien
17490075Sobrien@item C++ Language Options
17590075Sobrien@xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
176117395Skan@gccoptlist{-fabi-version=@var{n}  -fno-access-control  -fcheck-new @gol
177169689Skan-fconserve-space  -ffriend-injection @gol
17890075Sobrien-fno-elide-constructors @gol
179132718Skan-fno-enforce-eh-specs @gol
18090075Sobrien-ffor-scope  -fno-for-scope  -fno-gnu-keywords @gol
18190075Sobrien-fno-implicit-templates @gol
18290075Sobrien-fno-implicit-inline-templates @gol
18390075Sobrien-fno-implement-inlines  -fms-extensions @gol
18490075Sobrien-fno-nonansi-builtins  -fno-operator-names @gol
18590075Sobrien-fno-optional-diags  -fpermissive @gol
18690075Sobrien-frepo  -fno-rtti  -fstats  -ftemplate-depth-@var{n} @gol
187169689Skan-fno-threadsafe-statics -fuse-cxa-atexit  -fno-weak  -nostdinc++ @gol
188169689Skan-fno-default-inline  -fvisibility-inlines-hidden @gol
189169689Skan-Wabi  -Wctor-dtor-privacy @gol
19090075Sobrien-Wnon-virtual-dtor  -Wreorder @gol
191169689Skan-Weffc++  -Wno-deprecated  -Wstrict-null-sentinel @gol
19290075Sobrien-Wno-non-template-friend  -Wold-style-cast @gol
19390075Sobrien-Woverloaded-virtual  -Wno-pmf-conversions @gol
194146895Skan-Wsign-promo}
19590075Sobrien
19690075Sobrien@item Language Independent Options
19790075Sobrien@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
198132718Skan@gccoptlist{-fmessage-length=@var{n}  @gol
199169689Skan-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}  @gol
200169689Skan-fdiagnostics-show-option}
20190075Sobrien
20290075Sobrien@item Warning Options
20390075Sobrien@xref{Warning Options,,Options to Request or Suppress Warnings}.
204117395Skan@gccoptlist{-fsyntax-only  -pedantic  -pedantic-errors @gol
205169689Skan-w  -Wextra  -Wall  -Waddress  -Waggregate-return -Wno-attributes @gol
206169689Skan-Wc++-compat -Wcast-align  -Wcast-qual  -Wchar-subscripts  -Wcomment @gol
20790075Sobrien-Wconversion  -Wno-deprecated-declarations @gol
208169689Skan-Wdisabled-optimization  -Wno-div-by-zero  -Wno-endif-labels @gol
209169689Skan-Werror  -Werror=* -Werror-implicit-function-declaration @gol
210169689Skan-Wfatal-errors  -Wfloat-equal  -Wformat  -Wformat=2 @gol
211132718Skan-Wno-format-extra-args -Wformat-nonliteral @gol
212132718Skan-Wformat-security  -Wformat-y2k @gol
213132718Skan-Wimplicit  -Wimplicit-function-declaration  -Wimplicit-int @gol
214132718Skan-Wimport  -Wno-import  -Winit-self  -Winline @gol
215169689Skan-Wno-int-to-pointer-cast @gol
216132718Skan-Wno-invalid-offsetof  -Winvalid-pch @gol
217169689Skan-Wlarger-than-@var{len}  -Wunsafe-loop-optimizations  -Wlong-long @gol
218169689Skan-Wmain  -Wmissing-braces  -Wmissing-field-initializers @gol
219169689Skan-Wmissing-format-attribute  -Wmissing-include-dirs @gol
220169689Skan-Wmissing-noreturn @gol
221169689Skan-Wno-multichar  -Wnonnull  -Wno-overflow @gol
222169689Skan-Woverlength-strings  -Wpacked  -Wpadded @gol
223169689Skan-Wparentheses  -Wpointer-arith  -Wno-pointer-to-int-cast @gol
224169689Skan-Wredundant-decls @gol
22590075Sobrien-Wreturn-type  -Wsequence-point  -Wshadow @gol
226169689Skan-Wsign-compare  -Wstack-protector @gol
227169689Skan-Wstrict-aliasing -Wstrict-aliasing=2 @gol
228169689Skan-Wstrict-overflow -Wstrict-overflow=@var{n} @gol
229117395Skan-Wswitch  -Wswitch-default  -Wswitch-enum @gol
230117395Skan-Wsystem-headers  -Wtrigraphs  -Wundef  -Wuninitialized @gol
231169689Skan-Wunknown-pragmas  -Wno-pragmas -Wunreachable-code @gol
23290075Sobrien-Wunused  -Wunused-function  -Wunused-label  -Wunused-parameter @gol
233169689Skan-Wunused-value  -Wunused-variable  -Wvariadic-macros @gol
234169689Skan-Wvolatile-register-var  -Wwrite-strings}
23590075Sobrien
23690075Sobrien@item C-only Warning Options
237117395Skan@gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
238132718Skan-Wmissing-prototypes  -Wnested-externs  -Wold-style-definition @gol
239132718Skan-Wstrict-prototypes  -Wtraditional @gol
240169689Skan-Wdeclaration-after-statement -Wpointer-sign}
24190075Sobrien
24290075Sobrien@item Debugging Options
24390075Sobrien@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
244117395Skan@gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
245169689Skan-fdump-noaddr -fdump-unnumbered  -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
24690075Sobrien-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
247169689Skan-fdump-ipa-all -fdump-ipa-cgraph @gol
248169689Skan-fdump-tree-all @gol
249117395Skan-fdump-tree-original@r{[}-@var{n}@r{]}  @gol
250117395Skan-fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
25190075Sobrien-fdump-tree-inlined@r{[}-@var{n}@r{]} @gol
252169689Skan-fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol
253169689Skan-fdump-tree-ch @gol
254169689Skan-fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
255169689Skan-fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
256169689Skan-fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
257169689Skan-fdump-tree-dom@r{[}-@var{n}@r{]} @gol
258169689Skan-fdump-tree-dse@r{[}-@var{n}@r{]} @gol
259169689Skan-fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
260169689Skan-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
261169689Skan-fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
262169689Skan-fdump-tree-nrv -fdump-tree-vect @gol
263169689Skan-fdump-tree-sink @gol
264169689Skan-fdump-tree-sra@r{[}-@var{n}@r{]} @gol
265169689Skan-fdump-tree-salias @gol
266169689Skan-fdump-tree-fre@r{[}-@var{n}@r{]} @gol
267169689Skan-fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
268169689Skan-ftree-vectorizer-verbose=@var{n} @gol
269169689Skan-fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
270132718Skan-feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
271169689Skan-feliminate-unused-debug-symbols -femit-class-debug-always @gol
272169689Skan-fmem-report -fprofile-arcs @gol
273132718Skan-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
274169689Skan-ftest-coverage  -ftime-report -fvar-tracking @gol
275132718Skan-g  -g@var{level}  -gcoff -gdwarf-2 @gol
27690075Sobrien-ggdb  -gstabs  -gstabs+  -gvms  -gxcoff  -gxcoff+ @gol
27790075Sobrien-p  -pg  -print-file-name=@var{library}  -print-libgcc-file-name @gol
27890075Sobrien-print-multi-directory  -print-multi-lib @gol
27990075Sobrien-print-prog-name=@var{program}  -print-search-dirs  -Q @gol
28090075Sobrien-save-temps  -time}
28190075Sobrien
28290075Sobrien@item Optimization Options
28390075Sobrien@xref{Optimize Options,,Options that Control Optimization}.
284117395Skan@gccoptlist{-falign-functions=@var{n}  -falign-jumps=@var{n} @gol
28590075Sobrien-falign-labels=@var{n}  -falign-loops=@var{n}  @gol
286169689Skan-fbounds-check -fmudflap -fmudflapth -fmudflapir @gol
287132718Skan-fbranch-probabilities -fprofile-values -fvpt -fbranch-target-load-optimize @gol
288169689Skan-fbranch-target-load-optimize2 -fbtr-bb-exclusive @gol
289169689Skan-fcaller-saves  -fcprop-registers  -fcse-follow-jumps @gol
290169689Skan-fcse-skip-blocks  -fcx-limited-range  -fdata-sections @gol
291169689Skan-fdelayed-branch  -fdelete-null-pointer-checks -fearly-inlining @gol
29290075Sobrien-fexpensive-optimizations  -ffast-math  -ffloat-store @gol
293169689Skan-fforce-addr  -ffunction-sections @gol
294169689Skan-fgcse  -fgcse-lm  -fgcse-sm  -fgcse-las  -fgcse-after-reload @gol
295132718Skan-fcrossjumping  -fif-conversion  -fif-conversion2 @gol
296169689Skan-finline-functions  -finline-functions-called-once @gol
297169689Skan-finline-limit=@var{n}  -fkeep-inline-functions @gol
29890075Sobrien-fkeep-static-consts  -fmerge-constants  -fmerge-all-constants @gol
299169689Skan-fmodulo-sched -fno-branch-count-reg @gol
300169689Skan-fno-default-inline  -fno-defer-pop -fmove-loop-invariants @gol
30190075Sobrien-fno-function-cse  -fno-guess-branch-probability @gol
30290075Sobrien-fno-inline  -fno-math-errno  -fno-peephole  -fno-peephole2 @gol
303169689Skan-funsafe-math-optimizations  -funsafe-loop-optimizations  -ffinite-math-only @gol
304169689Skan-fno-toplevel-reorder -fno-trapping-math  -fno-zero-initialized-in-bss @gol
30590075Sobrien-fomit-frame-pointer  -foptimize-register-move @gol
30690075Sobrien-foptimize-sibling-calls  -fprefetch-loop-arrays @gol
307132718Skan-fprofile-generate -fprofile-use @gol
308169689Skan-fregmove  -frename-registers @gol
309169689Skan-freorder-blocks  -freorder-blocks-and-partition -freorder-functions @gol
310169689Skan-frerun-cse-after-loop @gol
311169689Skan-frounding-math -frtl-abstract-sequences @gol
312169689Skan-fschedule-insns  -fschedule-insns2 @gol
313117395Skan-fno-sched-interblock  -fno-sched-spec  -fsched-spec-load @gol
314132718Skan-fsched-spec-load-dangerous  @gol
315169689Skan-fsched-stalled-insns=@var{n} -fsched-stalled-insns-dep=@var{n} @gol
316132718Skan-fsched2-use-superblocks @gol
317169689Skan-fsched2-use-traces -fsee -freschedule-modulo-scheduled-loops @gol
318169689Skan-fsection-anchors  -fsignaling-nans  -fsingle-precision-constant @gol
319169689Skan-fstack-protector  -fstack-protector-all @gol
320169689Skan-fstrict-aliasing  -fstrict-overflow  -ftracer  -fthread-jumps @gol
321132718Skan-funroll-all-loops  -funroll-loops  -fpeel-loops @gol
322169689Skan-fsplit-ivs-in-unroller -funswitch-loops @gol
323169689Skan-fvariable-expansion-in-unroller @gol
324169689Skan-ftree-pre  -ftree-ccp  -ftree-dce -ftree-loop-optimize @gol
325169689Skan-ftree-loop-linear -ftree-loop-im -ftree-loop-ivcanon -fivopts @gol
326169689Skan-ftree-dominator-opts -ftree-dse -ftree-copyrename -ftree-sink @gol
327169689Skan-ftree-ch -ftree-sra -ftree-ter -ftree-lrs -ftree-fre -ftree-vectorize @gol
328169689Skan-ftree-vect-loop-version -ftree-salias -fipa-pta -fweb @gol
329169689Skan-ftree-copy-prop -ftree-store-ccp -ftree-store-copy-prop -fwhole-program @gol
330132718Skan--param @var{name}=@var{value}
33190075Sobrien-O  -O0  -O1  -O2  -O3  -Os}
33290075Sobrien
33390075Sobrien@item Preprocessor Options
33490075Sobrien@xref{Preprocessor Options,,Options Controlling the Preprocessor}.
335132718Skan@gccoptlist{-A@var{question}=@var{answer} @gol
336117395Skan-A-@var{question}@r{[}=@var{answer}@r{]} @gol
33790075Sobrien-C  -dD  -dI  -dM  -dN @gol
33890075Sobrien-D@var{macro}@r{[}=@var{defn}@r{]}  -E  -H @gol
33990075Sobrien-idirafter @var{dir} @gol
34090075Sobrien-include @var{file}  -imacros @var{file} @gol
34190075Sobrien-iprefix @var{file}  -iwithprefix @var{dir} @gol
34290075Sobrien-iwithprefixbefore @var{dir}  -isystem @var{dir} @gol
343169689Skan-imultilib @var{dir} -isysroot @var{dir} @gol
344132718Skan-M  -MM  -MF  -MG  -MP  -MQ  -MT  -nostdinc  @gol
345132718Skan-P  -fworking-directory  -remap @gol
346132718Skan-trigraphs  -undef  -U@var{macro}  -Wp,@var{option} @gol
347132718Skan-Xpreprocessor @var{option}}
34890075Sobrien
34990075Sobrien@item Assembler Option
35090075Sobrien@xref{Assembler Options,,Passing Options to the Assembler}.
351132718Skan@gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
35290075Sobrien
35390075Sobrien@item Linker Options
35490075Sobrien@xref{Link Options,,Options for Linking}.
355117395Skan@gccoptlist{@var{object-file-name}  -l@var{library} @gol
356169689Skan-nostartfiles  -nodefaultlibs  -nostdlib -pie -rdynamic @gol
35790075Sobrien-s  -static  -static-libgcc  -shared  -shared-libgcc  -symbolic @gol
35890075Sobrien-Wl,@var{option}  -Xlinker @var{option} @gol
35990075Sobrien-u @var{symbol}}
36090075Sobrien
36190075Sobrien@item Directory Options
36290075Sobrien@xref{Directory Options,,Options for Directory Search}.
363169689Skan@gccoptlist{-B@var{prefix}  -I@var{dir}  -iquote@var{dir}  -L@var{dir}
364169689Skan-specs=@var{file}  -I- --sysroot=@var{dir}}
36590075Sobrien
36690075Sobrien@item Target Options
36790075Sobrien@c I wrote this xref this way to avoid overfull hbox. -- rms
36890075Sobrien@xref{Target Options}.
369117395Skan@gccoptlist{-V @var{version}  -b @var{machine}}
37090075Sobrien
37190075Sobrien@item Machine Dependent Options
37290075Sobrien@xref{Submodel Options,,Hardware Models and Configurations}.
373169689Skan@c This list is ordered alphanumerically by subsection name.
374169689Skan@c Try and put the significant identifier (CPU or system) first,
375169689Skan@c so users have a clue at guessing where the ones they want will be.
37690075Sobrien
377169689Skan@emph{ARC Options}
378169689Skan@gccoptlist{-EB  -EL @gol
379169689Skan-mmangle-cpu  -mcpu=@var{cpu}  -mtext=@var{text-section} @gol
380169689Skan-mdata=@var{data-section}  -mrodata=@var{readonly-data-section}}
38190075Sobrien
38290075Sobrien@emph{ARM Options}
383117395Skan@gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
384169689Skan-mabi=@var{name} @gol
38590075Sobrien-mapcs-stack-check  -mno-apcs-stack-check @gol
38690075Sobrien-mapcs-float  -mno-apcs-float @gol
38790075Sobrien-mapcs-reentrant  -mno-apcs-reentrant @gol
38890075Sobrien-msched-prolog  -mno-sched-prolog @gol
38990075Sobrien-mlittle-endian  -mbig-endian  -mwords-little-endian @gol
390169689Skan-mfloat-abi=@var{name}  -msoft-float  -mhard-float  -mfpe @gol
39190075Sobrien-mthumb-interwork  -mno-thumb-interwork @gol
392169689Skan-mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
39390075Sobrien-mstructure-size-boundary=@var{n} @gol
39490075Sobrien-mabort-on-noreturn @gol
39590075Sobrien-mlong-calls  -mno-long-calls @gol
39690075Sobrien-msingle-pic-base  -mno-single-pic-base @gol
39790075Sobrien-mpic-register=@var{reg} @gol
39890075Sobrien-mnop-fun-dllimport @gol
399132718Skan-mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
40090075Sobrien-mpoke-function-name @gol
40190075Sobrien-mthumb  -marm @gol
40290075Sobrien-mtpcs-frame  -mtpcs-leaf-frame @gol
403169689Skan-mcaller-super-interworking  -mcallee-super-interworking @gol
404169689Skan-mtp=@var{name}}
40590075Sobrien
406169689Skan@emph{AVR Options}
407169689Skan@gccoptlist{-mmcu=@var{mcu}  -msize  -minit-stack=@var{n}  -mno-interrupts @gol
408169689Skan-mcall-prologues  -mno-tablejump  -mtiny-stack  -mint8}
40990075Sobrien
410169689Skan@emph{Blackfin Options}
411169689Skan@gccoptlist{-momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
412169689Skan-mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
413169689Skan-mlow-64k -mno-low64k -mid-shared-library @gol
414169689Skan-mno-id-shared-library -mshared-library-id=@var{n} @gol
415169689Skan-mlong-calls  -mno-long-calls}
416169689Skan
417169689Skan@emph{CRIS Options}
418169689Skan@gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}  -mtune=@var{cpu} @gol
419169689Skan-mmax-stack-frame=@var{n}  -melinux-stacksize=@var{n} @gol
420169689Skan-metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
421169689Skan-mstack-align  -mdata-align  -mconst-align @gol
422169689Skan-m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue  -mno-gotplt @gol
423169689Skan-melf  -maout  -melinux  -mlinux  -sim  -sim2 @gol
424169689Skan-mmul-bug-workaround  -mno-mul-bug-workaround}
425169689Skan
426169689Skan@emph{CRX Options}
427169689Skan@gccoptlist{-mmac -mpush-args}
428169689Skan
429169689Skan@emph{Darwin Options}
430169689Skan@gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal @gol
431169689Skan-arch_only  -bind_at_load  -bundle  -bundle_loader @gol
432169689Skan-client_name  -compatibility_version  -current_version @gol
433169689Skan-dead_strip @gol
434169689Skan-dependency-file  -dylib_file  -dylinker_install_name @gol
435169689Skan-dynamic  -dynamiclib  -exported_symbols_list @gol
436169689Skan-filelist  -flat_namespace  -force_cpusubtype_ALL @gol
437169689Skan-force_flat_namespace  -headerpad_max_install_names @gol
438169689Skan-image_base  -init  -install_name  -keep_private_externs @gol
439169689Skan-multi_module  -multiply_defined  -multiply_defined_unused @gol
440169689Skan-noall_load   -no_dead_strip_inits_and_terms @gol
441169689Skan-nofixprebinding -nomultidefs  -noprebind  -noseglinkedit @gol
442169689Skan-pagezero_size  -prebind  -prebind_all_twolevel_modules @gol
443169689Skan-private_bundle  -read_only_relocs  -sectalign @gol
444169689Skan-sectobjectsymbols  -whyload  -seg1addr @gol
445169689Skan-sectcreate  -sectobjectsymbols  -sectorder @gol
446169689Skan-segaddr -segs_read_only_addr -segs_read_write_addr @gol
447169689Skan-seg_addr_table  -seg_addr_table_filename  -seglinkedit @gol
448169689Skan-segprot  -segs_read_only_addr  -segs_read_write_addr @gol
449169689Skan-single_module  -static  -sub_library  -sub_umbrella @gol
450169689Skan-twolevel_namespace  -umbrella  -undefined @gol
451169689Skan-unexported_symbols_list  -weak_reference_mismatches @gol
452169689Skan-whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
453169689Skan-mkernel -mone-byte-bool}
454169689Skan
455169689Skan@emph{DEC Alpha Options}
456169689Skan@gccoptlist{-mno-fp-regs  -msoft-float  -malpha-as  -mgas @gol
457169689Skan-mieee  -mieee-with-inexact  -mieee-conformant @gol
458169689Skan-mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
459169689Skan-mtrap-precision=@var{mode}  -mbuild-constants @gol
460169689Skan-mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
461169689Skan-mbwx  -mmax  -mfix  -mcix @gol
462169689Skan-mfloat-vax  -mfloat-ieee @gol
463169689Skan-mexplicit-relocs  -msmall-data  -mlarge-data @gol
464169689Skan-msmall-text  -mlarge-text @gol
465169689Skan-mmemory-latency=@var{time}}
466169689Skan
467169689Skan@emph{DEC Alpha/VMS Options}
468169689Skan@gccoptlist{-mvms-return-codes}
469169689Skan
470169689Skan@emph{FRV Options}
471169689Skan@gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
472169689Skan-mhard-float  -msoft-float @gol
473169689Skan-malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
474169689Skan-mdouble  -mno-double @gol
475169689Skan-mmedia  -mno-media  -mmuladd  -mno-muladd @gol
476169689Skan-mfdpic  -minline-plt -mgprel-ro  -multilib-library-pic @gol
477169689Skan-mlinked-fp  -mlong-calls  -malign-labels @gol
478169689Skan-mlibrary-pic  -macc-4  -macc-8 @gol
479169689Skan-mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
480169689Skan-moptimize-membar -mno-optimize-membar @gol
481169689Skan-mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
482169689Skan-mvliw-branch  -mno-vliw-branch @gol
483169689Skan-mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
484169689Skan-mno-nested-cond-exec  -mtomcat-stats @gol
485169689Skan-mTLS -mtls @gol
486169689Skan-mcpu=@var{cpu}}
487169689Skan
488169689Skan@emph{GNU/Linux Options}
489169689Skan@gccoptlist{-muclibc}
490169689Skan
491169689Skan@emph{H8/300 Options}
492169689Skan@gccoptlist{-mrelax  -mh  -ms  -mn  -mint32  -malign-300}
493169689Skan
494169689Skan@emph{HPPA Options}
495169689Skan@gccoptlist{-march=@var{architecture-type} @gol
496169689Skan-mbig-switch  -mdisable-fpregs  -mdisable-indexing @gol
497169689Skan-mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
498169689Skan-mfixed-range=@var{register-range} @gol
499169689Skan-mjump-in-delay -mlinker-opt -mlong-calls @gol
500169689Skan-mlong-load-store  -mno-big-switch  -mno-disable-fpregs @gol
501169689Skan-mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
502169689Skan-mno-jump-in-delay  -mno-long-load-store @gol
503169689Skan-mno-portable-runtime  -mno-soft-float @gol
504169689Skan-mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
505169689Skan-mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
506169689Skan-mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
507169689Skan-munix=@var{unix-std}  -nolibdld  -static  -threads}
508169689Skan
509169689Skan@emph{i386 and x86-64 Options}
510169689Skan@gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
511169689Skan-mfpmath=@var{unit} @gol
512169689Skan-masm=@var{dialect}  -mno-fancy-math-387 @gol
513169689Skan-mno-fp-ret-in-387  -msoft-float  -msvr3-shlib @gol
514169689Skan-mno-wide-multiply  -mrtd  -malign-double @gol
515169689Skan-mpreferred-stack-boundary=@var{num} @gol
516255185Sjmg-mmmx  -msse  -msse2 -msse3 -mssse3 -msse4a -m3dnow -mpopcnt -mabm -maes @gol
517169689Skan-mthreads  -mno-align-stringops  -minline-all-stringops @gol
518169689Skan-mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
519169689Skan-m96bit-long-double  -mregparm=@var{num}  -msseregparm @gol
520169689Skan-mstackrealign @gol
521169689Skan-momit-leaf-frame-pointer  -mno-red-zone -mno-tls-direct-seg-refs @gol
522169689Skan-mcmodel=@var{code-model} @gol
523169689Skan-m32  -m64 -mlarge-data-threshold=@var{num}}
524169689Skan
525169689Skan@emph{IA-64 Options}
526169689Skan@gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
527169689Skan-mvolatile-asm-stop  -mregister-names  -mno-sdata @gol
528169689Skan-mconstant-gp  -mauto-pic  -minline-float-divide-min-latency @gol
529169689Skan-minline-float-divide-max-throughput @gol
530169689Skan-minline-int-divide-min-latency @gol
531169689Skan-minline-int-divide-max-throughput  @gol
532169689Skan-minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
533169689Skan-mno-dwarf2-asm -mearly-stop-bits @gol
534169689Skan-mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
535169689Skan-mtune=@var{cpu-type} -mt -pthread -milp32 -mlp64 @gol
536169689Skan-mno-sched-br-data-spec -msched-ar-data-spec -mno-sched-control-spec @gol
537169689Skan-msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
538169689Skan-msched-ldc -mno-sched-control-ldc -mno-sched-spec-verbose @gol
539169689Skan-mno-sched-prefer-non-data-spec-insns @gol
540169689Skan-mno-sched-prefer-non-control-spec-insns @gol
541169689Skan-mno-sched-count-spec-in-critical-path}
542169689Skan
54390075Sobrien@emph{M32R/D Options}
544132718Skan@gccoptlist{-m32r2 -m32rx -m32r @gol
545132718Skan-mdebug @gol
546132718Skan-malign-loops -mno-align-loops @gol
547132718Skan-missue-rate=@var{number} @gol
548132718Skan-mbranch-cost=@var{number} @gol
549132718Skan-mmodel=@var{code-size-model-type} @gol
550132718Skan-msdata=@var{sdata-type} @gol
551132718Skan-mno-flush-func -mflush-func=@var{name} @gol
552132718Skan-mno-flush-trap -mflush-trap=@var{number} @gol
553132718Skan-G @var{num}}
55490075Sobrien
555169689Skan@emph{M32C Options}
556169689Skan@gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
557169689Skan
558169689Skan@emph{M680x0 Options}
559169689Skan@gccoptlist{-m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
560169689Skan-m68060  -mcpu32  -m5200  -mcfv4e -m68881  -mbitfield  @gol
561169689Skan-mc68000  -mc68020   @gol
562169689Skan-mnobitfield  -mrtd  -mshort  -msoft-float  -mpcrel @gol
563169689Skan-malign-int  -mstrict-align  -msep-data  -mno-sep-data @gol
564169689Skan-mshared-library-id=n  -mid-shared-library  -mno-id-shared-library}
565169689Skan
566169689Skan@emph{M68hc1x Options}
567169689Skan@gccoptlist{-m6811  -m6812  -m68hc11  -m68hc12   -m68hcs12 @gol
568169689Skan-mauto-incdec  -minmax  -mlong-calls  -mshort @gol
569169689Skan-msoft-reg-count=@var{count}}
570169689Skan
571169689Skan@emph{MCore Options}
572169689Skan@gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
573169689Skan-mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
574169689Skan-m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
575169689Skan-mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
576169689Skan-mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
577169689Skan
578169689Skan@emph{MIPS Options}
579169689Skan@gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
580169689Skan-mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips64 @gol
581169689Skan-mips16  -mno-mips16  -mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
582169689Skan-mshared  -mno-shared  -mxgot  -mno-xgot  -mgp32  -mgp64  @gol
583169689Skan-mfp32  -mfp64  -mhard-float  -msoft-float  @gol
584169689Skan-msingle-float  -mdouble-float  -mdsp  -mpaired-single  -mips3d @gol
585169689Skan-mlong64  -mlong32  -msym32  -mno-sym32 @gol
586169689Skan-G@var{num}  -membedded-data  -mno-embedded-data @gol
587169689Skan-muninit-const-in-rodata  -mno-uninit-const-in-rodata @gol
588169689Skan-msplit-addresses  -mno-split-addresses  @gol
589169689Skan-mexplicit-relocs  -mno-explicit-relocs  @gol
590169689Skan-mcheck-zero-division  -mno-check-zero-division @gol
591169689Skan-mdivide-traps  -mdivide-breaks @gol
592169689Skan-mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls @gol
593169689Skan-mmad  -mno-mad  -mfused-madd  -mno-fused-madd  -nocpp @gol
594169689Skan-mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400 @gol
595169689Skan-mfix-vr4120  -mno-fix-vr4120  -mfix-vr4130 @gol
596169689Skan-mfix-sb1  -mno-fix-sb1 @gol
597169689Skan-mflush-func=@var{func}  -mno-flush-func @gol
598169689Skan-mbranch-likely  -mno-branch-likely @gol
599169689Skan-mfp-exceptions -mno-fp-exceptions @gol
600169689Skan-mvr4130-align -mno-vr4130-align}
601169689Skan
602169689Skan@emph{MMIX Options}
603169689Skan@gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
604169689Skan-mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
605169689Skan-melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
606169689Skan-mno-base-addresses  -msingle-exit  -mno-single-exit}
607169689Skan
608169689Skan@emph{MN10300 Options}
609169689Skan@gccoptlist{-mmult-bug  -mno-mult-bug @gol
610169689Skan-mam33  -mno-am33 @gol
611169689Skan-mam33-2  -mno-am33-2 @gol
612169689Skan-mreturn-pointer-on-d0 @gol
613169689Skan-mno-crt0  -mrelax}
614169689Skan
615169689Skan@emph{MT Options}
616169689Skan@gccoptlist{-mno-crt0 -mbacc -msim @gol
617169689Skan-march=@var{cpu-type} }
618169689Skan
619169689Skan@emph{PDP-11 Options}
620169689Skan@gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
621169689Skan-mbcopy  -mbcopy-builtin  -mint32  -mno-int16 @gol
622169689Skan-mint16  -mno-int32  -mfloat32  -mno-float64 @gol
623169689Skan-mfloat64  -mno-float32  -mabshi  -mno-abshi @gol
624169689Skan-mbranch-expensive  -mbranch-cheap @gol
625169689Skan-msplit  -mno-split  -munix-asm  -mdec-asm}
626169689Skan
627169689Skan@emph{PowerPC Options}
628169689SkanSee RS/6000 and PowerPC Options.
629169689Skan
63090075Sobrien@emph{RS/6000 and PowerPC Options}
631117395Skan@gccoptlist{-mcpu=@var{cpu-type} @gol
63290075Sobrien-mtune=@var{cpu-type} @gol
63390075Sobrien-mpower  -mno-power  -mpower2  -mno-power2 @gol
63490075Sobrien-mpowerpc  -mpowerpc64  -mno-powerpc @gol
635117395Skan-maltivec  -mno-altivec @gol
63690075Sobrien-mpowerpc-gpopt  -mno-powerpc-gpopt @gol
63790075Sobrien-mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
638169689Skan-mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb  -mfprnd  -mno-fprnd @gol
63990075Sobrien-mnew-mnemonics  -mold-mnemonics @gol
64096263Sobrien-mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
641146895Skan-m64  -m32  -mxl-compat  -mno-xl-compat  -mpe @gol
642132718Skan-malign-power  -malign-natural @gol
64390075Sobrien-msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
64490075Sobrien-mstring  -mno-string  -mupdate  -mno-update @gol
64590075Sobrien-mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
64690075Sobrien-mstrict-align  -mno-strict-align  -mrelocatable @gol
64790075Sobrien-mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
648117395Skan-mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
649169689Skan-mdynamic-no-pic  -maltivec  -mswdiv @gol
650132718Skan-mprioritize-restricted-insns=@var{priority} @gol
651132718Skan-msched-costly-dep=@var{dependence_type} @gol
652132718Skan-minsert-sched-nops=@var{scheme} @gol
653132718Skan-mcall-sysv  -mcall-netbsd @gol
654117395Skan-maix-struct-return  -msvr4-struct-return @gol
655169689Skan-mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
656169689Skan-misel -mno-isel @gol
657117395Skan-misel=yes  -misel=no @gol
658169689Skan-mspe -mno-spe @gol
659132718Skan-mspe=yes  -mspe=no @gol
660169689Skan-mvrsave -mno-vrsave @gol
661169689Skan-mmulhw -mno-mulhw @gol
662169689Skan-mdlmzb -mno-dlmzb @gol
663169689Skan-mfloat-gprs=yes  -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
66490075Sobrien-mprototype  -mno-prototype @gol
665117395Skan-msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
666117395Skan-msdata=@var{opt}  -mvxworks  -mwindiss  -G @var{num}  -pthread}
66790075Sobrien
668169689Skan@emph{S/390 and zSeries Options}
669132718Skan@gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
670169689Skan-mhard-float  -msoft-float -mlong-double-64 -mlong-double-128 @gol
671169689Skan-mbackchain  -mno-backchain -mpacked-stack  -mno-packed-stack @gol
672169689Skan-msmall-exec  -mno-small-exec  -mmvcle -mno-mvcle @gol
673169689Skan-m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch @gol
674169689Skan-mtpf-trace -mno-tpf-trace  -mfused-madd  -mno-fused-madd @gol
675169689Skan-mwarn-framesize  -mwarn-dynamicstack  -mstack-size -mstack-guard}
67690075Sobrien
677169689Skan@emph{Score Options}
678169689Skan@gccoptlist{-meb -mel @gol
679169689Skan-mnhwloop @gol
680169689Skan-muls @gol
681169689Skan-mmac @gol
682169689Skan-mscore5 -mscore5u -mscore7 -mscore7d}
683169689Skan 
68490075Sobrien@emph{SH Options}
685132718Skan@gccoptlist{-m1  -m2  -m2e  -m3  -m3e @gol
68690075Sobrien-m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
687169689Skan-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
688117395Skan-m5-64media  -m5-64media-nofpu @gol
689117395Skan-m5-32media  -m5-32media-nofpu @gol
690117395Skan-m5-compact  -m5-compact-nofpu @gol
69190075Sobrien-mb  -ml  -mdalign  -mrelax @gol
692169689Skan-mbigtable  -mfmovd  -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
69390075Sobrien-mieee  -misize  -mpadstruct  -mspace @gol
694169689Skan-mprefergot  -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
695169689Skan-mdivsi3_libfunc=@var{name}  @gol
696169689Skan-madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
697169689Skan -minvalid-symbols}
69890075Sobrien
699169689Skan@emph{SPARC Options}
700169689Skan@gccoptlist{-mcpu=@var{cpu-type} @gol
701169689Skan-mtune=@var{cpu-type} @gol
702169689Skan-mcmodel=@var{code-model} @gol
703169689Skan-m32  -m64  -mapp-regs  -mno-app-regs @gol
704169689Skan-mfaster-structs  -mno-faster-structs @gol
705169689Skan-mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
706169689Skan-mhard-quad-float  -msoft-quad-float @gol
707169689Skan-mimpure-text  -mno-impure-text  -mlittle-endian @gol
708169689Skan-mstack-bias  -mno-stack-bias @gol
709169689Skan-munaligned-doubles  -mno-unaligned-doubles @gol
710169689Skan-mv8plus  -mno-v8plus  -mvis  -mno-vis
711169689Skan-threads -pthreads -pthread}
712169689Skan
71390075Sobrien@emph{System V Options}
714117395Skan@gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
71590075Sobrien
71690075Sobrien@emph{TMS320C3x/C4x Options}
717117395Skan@gccoptlist{-mcpu=@var{cpu}  -mbig  -msmall  -mregparm  -mmemparm @gol
71890075Sobrien-mfast-fix  -mmpyi  -mbk  -mti  -mdp-isr-reload @gol
71990075Sobrien-mrpts=@var{count}  -mrptb  -mdb  -mloop-unsigned @gol
72090075Sobrien-mparallel-insns  -mparallel-mpy  -mpreserve-float}
72190075Sobrien
72290075Sobrien@emph{V850 Options}
723117395Skan@gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
72490075Sobrien-mprolog-function  -mno-prolog-function  -mspace @gol
72590075Sobrien-mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
726117395Skan-mapp-regs  -mno-app-regs @gol
727117395Skan-mdisable-callt  -mno-disable-callt @gol
728132718Skan-mv850e1 @gol
729117395Skan-mv850e @gol
73090075Sobrien-mv850  -mbig-switch}
73190075Sobrien
732169689Skan@emph{VAX Options}
733169689Skan@gccoptlist{-mg  -mgnu  -munix}
73490075Sobrien
735169689Skan@emph{x86-64 Options}
736169689SkanSee i386 and x86-64 Options.
73790075Sobrien
73890075Sobrien@emph{Xstormy16 Options}
739117395Skan@gccoptlist{-msim}
74090075Sobrien
74190075Sobrien@emph{Xtensa Options}
742132718Skan@gccoptlist{-mconst16 -mno-const16 @gol
743117395Skan-mfused-madd  -mno-fused-madd @gol
744117395Skan-mtext-section-literals  -mno-text-section-literals @gol
745117395Skan-mtarget-align  -mno-target-align @gol
746117395Skan-mlongcalls  -mno-longcalls}
74790075Sobrien
748169689Skan@emph{zSeries Options}
749169689SkanSee S/390 and zSeries Options.
750117395Skan
75190075Sobrien@item Code Generation Options
75290075Sobrien@xref{Code Gen Options,,Options for Code Generation Conventions}.
753117395Skan@gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
754117395Skan-ffixed-@var{reg}  -fexceptions @gol
75590075Sobrien-fnon-call-exceptions  -funwind-tables @gol
75690075Sobrien-fasynchronous-unwind-tables @gol
75790075Sobrien-finhibit-size-directive  -finstrument-functions @gol
758132718Skan-fno-common  -fno-ident @gol
759132718Skan-fpcc-struct-return  -fpic  -fPIC -fpie -fPIE @gol
760169689Skan-fno-jump-tables @gol
761169689Skan-freg-struct-return  -fshort-enums @gol
762132718Skan-fshort-double  -fshort-wchar @gol
763169689Skan-fverbose-asm  -fpack-struct[=@var{n}]  -fstack-check @gol
76490075Sobrien-fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
76590075Sobrien-fargument-alias  -fargument-noalias @gol
766169689Skan-fargument-noalias-global  -fargument-noalias-anything
767169689Skan-fleading-underscore  -ftls-model=@var{model} @gol
768169689Skan-ftrapv  -fwrapv  -fbounds-check @gol
769169689Skan-fvisibility}
77090075Sobrien@end table
77190075Sobrien
77290075Sobrien@menu
77390075Sobrien* Overall Options::     Controlling the kind of output:
77490075Sobrien                        an executable, object files, assembler files,
77590075Sobrien                        or preprocessed source.
77690075Sobrien* C Dialect Options::   Controlling the variant of C language compiled.
77790075Sobrien* C++ Dialect Options:: Variations on C++.
77890075Sobrien* Language Independent Options:: Controlling how diagnostics should be
77990075Sobrien                        formatted.
78090075Sobrien* Warning Options::     How picky should the compiler be?
78190075Sobrien* Debugging Options::   Symbol tables, measurements, and debugging dumps.
78290075Sobrien* Optimize Options::    How much optimization?
78390075Sobrien* Preprocessor Options:: Controlling header files and macro definitions.
78490075Sobrien                         Also, getting dependency information for Make.
78590075Sobrien* Assembler Options::   Passing options to the assembler.
78690075Sobrien* Link Options::        Specifying libraries and so on.
78790075Sobrien* Directory Options::   Where to find header files and libraries.
78890075Sobrien                        Where to find the compiler executable files.
78990075Sobrien* Spec Files::          How to pass switches to sub-processes.
79090075Sobrien* Target Options::      Running a cross-compiler, or an old version of GCC.
79190075Sobrien@end menu
79290075Sobrien
79390075Sobrien@node Overall Options
79490075Sobrien@section Options Controlling the Kind of Output
79590075Sobrien
79690075SobrienCompilation can involve up to four stages: preprocessing, compilation
797132718Skanproper, assembly and linking, always in that order.  GCC is capable of
798132718Skanpreprocessing and compiling several files either into several
799132718Skanassembler input files, or into one assembler input file; then each
800132718Skanassembler input file produces an object file, and linking combines all
801132718Skanthe object files (those newly compiled, and those specified as input)
802132718Skaninto an executable file.
80390075Sobrien
80490075Sobrien@cindex file name suffix
80590075SobrienFor any given input file, the file name suffix determines what kind of
80690075Sobriencompilation is done:
80790075Sobrien
80890075Sobrien@table @gcctabopt
80990075Sobrien@item @var{file}.c
81090075SobrienC source code which must be preprocessed.
81190075Sobrien
81290075Sobrien@item @var{file}.i
81390075SobrienC source code which should not be preprocessed.
81490075Sobrien
81590075Sobrien@item @var{file}.ii
81690075SobrienC++ source code which should not be preprocessed.
81790075Sobrien
81890075Sobrien@item @var{file}.h
819220755SdimC, or C++ header file to be turned into a precompiled header.
82090075Sobrien
82190075Sobrien@item @var{file}.cc
82290075Sobrien@itemx @var{file}.cp
82390075Sobrien@itemx @var{file}.cxx
82490075Sobrien@itemx @var{file}.cpp
825132718Skan@itemx @var{file}.CPP
82690075Sobrien@itemx @var{file}.c++
82790075Sobrien@itemx @var{file}.C
82890075SobrienC++ source code which must be preprocessed.  Note that in @samp{.cxx},
82990075Sobrienthe last two letters must both be literally @samp{x}.  Likewise,
83090075Sobrien@samp{.C} refers to a literal capital C@.
83190075Sobrien
832132718Skan@item @var{file}.hh
833132718Skan@itemx @var{file}.H
834132718SkanC++ header file to be turned into a precompiled header.
835132718Skan
83690075Sobrien@item @var{file}.f
83790075Sobrien@itemx @var{file}.for
83890075Sobrien@itemx @var{file}.FOR
839169689SkanFixed form Fortran source code which should not be preprocessed.
84090075Sobrien
84190075Sobrien@item @var{file}.F
84290075Sobrien@itemx @var{file}.fpp
84390075Sobrien@itemx @var{file}.FPP
844169689SkanFixed form Fortran source code which must be preprocessed (with the traditional
84590075Sobrienpreprocessor).
84690075Sobrien
847169689Skan@item @var{file}.f90
848169689Skan@itemx @var{file}.f95
849169689SkanFree form Fortran source code which should not be preprocessed.
85090075Sobrien
851169689Skan@item @var{file}.F90
852169689Skan@itemx @var{file}.F95
853169689SkanFree form Fortran source code which must be preprocessed (with the
854169689Skantraditional preprocessor).
85590075Sobrien
85690075Sobrien@c FIXME: Descriptions of Java file types.
85790075Sobrien@c @var{file}.java
85890075Sobrien@c @var{file}.class
85990075Sobrien@c @var{file}.zip
86090075Sobrien@c @var{file}.jar
86190075Sobrien
86290075Sobrien@item @var{file}.ads
86390075SobrienAda source code file which contains a library unit declaration (a
86490075Sobriendeclaration of a package, subprogram, or generic, or a generic
86590075Sobrieninstantiation), or a library unit renaming declaration (a package,
86690075Sobriengeneric, or subprogram renaming declaration).  Such files are also
86790075Sobriencalled @dfn{specs}.
86890075Sobrien
86990075Sobrien@itemx @var{file}.adb
87090075SobrienAda source code file containing a library unit body (a subprogram or
87190075Sobrienpackage body).  Such files are also called @dfn{bodies}.
87290075Sobrien
87390075Sobrien@c GCC also knows about some suffixes for languages not yet included:
87490075Sobrien@c Pascal:
87590075Sobrien@c @var{file}.p
87690075Sobrien@c @var{file}.pas
877169689Skan@c Ratfor:
878169689Skan@c @var{file}.r
87990075Sobrien
88090075Sobrien@item @var{file}.s
88190075SobrienAssembler code.
88290075Sobrien
88390075Sobrien@item @var{file}.S
88490075SobrienAssembler code which must be preprocessed.
88590075Sobrien
88690075Sobrien@item @var{other}
88790075SobrienAn object file to be fed straight into linking.
88890075SobrienAny file name with no recognized suffix is treated this way.
88990075Sobrien@end table
89090075Sobrien
89190075Sobrien@opindex x
89290075SobrienYou can specify the input language explicitly with the @option{-x} option:
89390075Sobrien
89490075Sobrien@table @gcctabopt
89590075Sobrien@item -x @var{language}
89690075SobrienSpecify explicitly the @var{language} for the following input files
89790075Sobrien(rather than letting the compiler choose a default based on the file
89890075Sobrienname suffix).  This option applies to all following input files until
89990075Sobrienthe next @option{-x} option.  Possible values for @var{language} are:
900132718Skan@smallexample
901169689Skanc  c-header  c-cpp-output
902132718Skanc++  c++-header  c++-cpp-output
90390075Sobrienassembler  assembler-with-cpp
90490075Sobrienada
905169689Skanf95  f95-cpp-input
90690075Sobrienjava
907117395Skantreelang
908132718Skan@end smallexample
90990075Sobrien
91090075Sobrien@item -x none
91190075SobrienTurn off any specification of a language, so that subsequent files are
91290075Sobrienhandled according to their file name suffixes (as they are if @option{-x}
91390075Sobrienhas not been used at all).
91490075Sobrien
91590075Sobrien@item -pass-exit-codes
91690075Sobrien@opindex pass-exit-codes
91790075SobrienNormally the @command{gcc} program will exit with the code of 1 if any
91890075Sobrienphase of the compiler returns a non-success return code.  If you specify
91990075Sobrien@option{-pass-exit-codes}, the @command{gcc} program will instead return with
92090075Sobriennumerically highest error produced by any phase that returned an error
921169689Skanindication.  The C, C++, and Fortran frontends return 4, if an internal
922169689Skancompiler error is encountered.
92390075Sobrien@end table
92490075Sobrien
92590075SobrienIf you only want some of the stages of compilation, you can use
92690075Sobrien@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
92790075Sobrienone of the options @option{-c}, @option{-S}, or @option{-E} to say where
92890075Sobrien@command{gcc} is to stop.  Note that some combinations (for example,
92990075Sobrien@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
93090075Sobrien
93190075Sobrien@table @gcctabopt
93290075Sobrien@item -c
93390075Sobrien@opindex c
93490075SobrienCompile or assemble the source files, but do not link.  The linking
93590075Sobrienstage simply is not done.  The ultimate output is in the form of an
93690075Sobrienobject file for each source file.
93790075Sobrien
93890075SobrienBy default, the object file name for a source file is made by replacing
93990075Sobrienthe suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
94090075Sobrien
94190075SobrienUnrecognized input files, not requiring compilation or assembly, are
94290075Sobrienignored.
94390075Sobrien
94490075Sobrien@item -S
94590075Sobrien@opindex S
94690075SobrienStop after the stage of compilation proper; do not assemble.  The output
94790075Sobrienis in the form of an assembler code file for each non-assembler input
94890075Sobrienfile specified.
94990075Sobrien
95090075SobrienBy default, the assembler file name for a source file is made by
95190075Sobrienreplacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
95290075Sobrien
95390075SobrienInput files that don't require compilation are ignored.
95490075Sobrien
95590075Sobrien@item -E
95690075Sobrien@opindex E
95790075SobrienStop after the preprocessing stage; do not run the compiler proper.  The
95890075Sobrienoutput is in the form of preprocessed source code, which is sent to the
95990075Sobrienstandard output.
96090075Sobrien
96190075SobrienInput files which don't require preprocessing are ignored.
96290075Sobrien
96390075Sobrien@cindex output file option
96490075Sobrien@item -o @var{file}
96590075Sobrien@opindex o
96690075SobrienPlace output in file @var{file}.  This applies regardless to whatever
96790075Sobriensort of output is being produced, whether it be an executable file,
96890075Sobrienan object file, an assembler file or preprocessed C code.
96990075Sobrien
970169689SkanIf @option{-o} is not specified, the default is to put an executable
971169689Skanfile in @file{a.out}, the object file for
972169689Skan@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
973169689Skanassembler file in @file{@var{source}.s}, a precompiled header file in
974169689Skan@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
975169689Skanstandard output.
97690075Sobrien
97790075Sobrien@item -v
97890075Sobrien@opindex v
97990075SobrienPrint (on standard error output) the commands executed to run the stages
98090075Sobrienof compilation.  Also print the version number of the compiler driver
98190075Sobrienprogram and of the preprocessor and the compiler proper.
98290075Sobrien
98396263Sobrien@item -###
98496263Sobrien@opindex ###
98596263SobrienLike @option{-v} except the commands are not executed and all command
98696263Sobrienarguments are quoted.  This is useful for shell scripts to capture the
98796263Sobriendriver-generated command lines.
98896263Sobrien
98990075Sobrien@item -pipe
99090075Sobrien@opindex pipe
99190075SobrienUse pipes rather than temporary files for communication between the
99290075Sobrienvarious stages of compilation.  This fails to work on some systems where
99390075Sobrienthe assembler is unable to read from a pipe; but the GNU assembler has
99490075Sobrienno trouble.
99590075Sobrien
996169689Skan@item -combine
997169689Skan@opindex combine
998169689SkanIf you are compiling multiple source files, this option tells the driver
999169689Skanto pass all the source files to the compiler at once (for those
1000169689Skanlanguages for which the compiler can handle this).  This will allow
1001169689Skanintermodule analysis (IMA) to be performed by the compiler.  Currently the only
1002169689Skanlanguage for which this is supported is C@.  If you pass source files for
1003169689Skanmultiple languages to the driver, using this option, the driver will invoke
1004169689Skanthe compiler(s) that support IMA once each, passing each compiler all the
1005169689Skansource files appropriate for it.  For those languages that do not support
1006169689SkanIMA this option will be ignored, and the compiler will be invoked once for
1007169689Skaneach source file in that language.  If you use this option in conjunction
1008169689Skanwith @option{-save-temps}, the compiler will generate multiple
1009169689Skanpre-processed files
1010169689Skan(one for each source file), but only one (combined) @file{.o} or
1011169689Skan@file{.s} file.
1012169689Skan
101390075Sobrien@item --help
101490075Sobrien@opindex help
101590075SobrienPrint (on the standard output) a description of the command line options
101690075Sobrienunderstood by @command{gcc}.  If the @option{-v} option is also specified
101790075Sobrienthen @option{--help} will also be passed on to the various processes
101890075Sobrieninvoked by @command{gcc}, so that they can display the command line options
1019132718Skanthey accept.  If the @option{-Wextra} option is also specified then command
102090075Sobrienline options which have no documentation associated with them will also
102190075Sobrienbe displayed.
102290075Sobrien
102390075Sobrien@item --target-help
102490075Sobrien@opindex target-help
102590075SobrienPrint (on the standard output) a description of target specific command
102690075Sobrienline options for each tool.
1027107590Sobrien
1028107590Sobrien@item --version
1029107590Sobrien@opindex version
1030169689SkanDisplay the version number and copyrights of the invoked GCC@.
1031169689Skan
1032169689Skan@include @value{srcdir}/../libiberty/at-file.texi
103390075Sobrien@end table
103490075Sobrien
103590075Sobrien@node Invoking G++
103690075Sobrien@section Compiling C++ Programs
103790075Sobrien
103890075Sobrien@cindex suffixes for C++ source
103990075Sobrien@cindex C++ source file suffixes
104090075SobrienC++ source files conventionally use one of the suffixes @samp{.C},
1041132718Skan@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1042132718Skan@samp{.cxx}; C++ header files often use @samp{.hh} or @samp{.H}; and
104390075Sobrienpreprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
104490075Sobrienfiles with these names and compiles them as C++ programs even if you
1045132718Skancall the compiler the same way as for compiling C programs (usually
1046132718Skanwith the name @command{gcc}).
104790075Sobrien
104890075Sobrien@findex g++
104990075Sobrien@findex c++
1050169689SkanHowever, the use of @command{gcc} does not add the C++ library.
1051169689Skan@command{g++} is a program that calls GCC and treats @samp{.c},
1052169689Skan@samp{.h} and @samp{.i} files as C++ source files instead of C source
1053169689Skanfiles unless @option{-x} is used, and automatically specifies linking
1054169689Skanagainst the C++ library.  This program is also useful when
1055169689Skanprecompiling a C header file with a @samp{.h} extension for use in C++
1056169689Skancompilations.  On many systems, @command{g++} is also installed with
1057169689Skanthe name @command{c++}.
105890075Sobrien
105990075Sobrien@cindex invoking @command{g++}
106090075SobrienWhen you compile C++ programs, you may specify many of the same
106190075Sobriencommand-line options that you use for compiling programs in any
106290075Sobrienlanguage; or command-line options meaningful for C and related
106390075Sobrienlanguages; or options that are meaningful only for C++ programs.
106490075Sobrien@xref{C Dialect Options,,Options Controlling C Dialect}, for
106590075Sobrienexplanations of options for languages related to C@.
106690075Sobrien@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
106790075Sobrienexplanations of options that are meaningful only for C++ programs.
106890075Sobrien
106990075Sobrien@node C Dialect Options
107090075Sobrien@section Options Controlling C Dialect
107190075Sobrien@cindex dialect options
107290075Sobrien@cindex language dialect options
107390075Sobrien@cindex options, dialect
107490075Sobrien
107590075SobrienThe following options control the dialect of C (or languages derived
1076220755Sdimfrom C, such as C++) that the compiler accepts:
107790075Sobrien
107890075Sobrien@table @gcctabopt
107990075Sobrien@cindex ANSI support
108090075Sobrien@cindex ISO support
108190075Sobrien@item -ansi
108290075Sobrien@opindex ansi
1083117395SkanIn C mode, support all ISO C90 programs.  In C++ mode,
108490075Sobrienremove GNU extensions that conflict with ISO C++.
108590075Sobrien
108690075SobrienThis turns off certain features of GCC that are incompatible with ISO
1087117395SkanC90 (when compiling C code), or of standard C++ (when compiling C++ code),
108890075Sobriensuch as the @code{asm} and @code{typeof} keywords, and
108990075Sobrienpredefined macros such as @code{unix} and @code{vax} that identify the
109090075Sobrientype of system you are using.  It also enables the undesirable and
109190075Sobrienrarely used ISO trigraph feature.  For the C compiler,
109290075Sobrienit disables recognition of C++ style @samp{//} comments as well as
109390075Sobrienthe @code{inline} keyword.
109490075Sobrien
109590075SobrienThe alternate keywords @code{__asm__}, @code{__extension__},
109690075Sobrien@code{__inline__} and @code{__typeof__} continue to work despite
109790075Sobrien@option{-ansi}.  You would not want to use them in an ISO C program, of
109890075Sobriencourse, but it is useful to put them in header files that might be included
109990075Sobrienin compilations done with @option{-ansi}.  Alternate predefined macros
110090075Sobriensuch as @code{__unix__} and @code{__vax__} are also available, with or
110190075Sobrienwithout @option{-ansi}.
110290075Sobrien
110390075SobrienThe @option{-ansi} option does not cause non-ISO programs to be
110490075Sobrienrejected gratuitously.  For that, @option{-pedantic} is required in
110590075Sobrienaddition to @option{-ansi}.  @xref{Warning Options}.
110690075Sobrien
110790075SobrienThe macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
110890075Sobrienoption is used.  Some header files may notice this macro and refrain
110990075Sobrienfrom declaring certain functions or defining certain macros that the
111090075SobrienISO standard doesn't call for; this is to avoid interfering with any
111190075Sobrienprograms that might use these names for other things.
111290075Sobrien
111390075SobrienFunctions which would normally be built in but do not have semantics
111490075Sobriendefined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
111590075Sobrienfunctions with @option{-ansi} is used.  @xref{Other Builtins,,Other
111690075Sobrienbuilt-in functions provided by GCC}, for details of the functions
111790075Sobrienaffected.
111890075Sobrien
111990075Sobrien@item -std=
112090075Sobrien@opindex std
112190075SobrienDetermine the language standard.  This option is currently only
1122117395Skansupported when compiling C or C++.  A value for this option must be
1123117395Skanprovided; possible values are
112490075Sobrien
112590075Sobrien@table @samp
112690075Sobrien@item c89
112790075Sobrien@itemx iso9899:1990
1128117395SkanISO C90 (same as @option{-ansi}).
112990075Sobrien
113090075Sobrien@item iso9899:199409
1131117395SkanISO C90 as modified in amendment 1.
113290075Sobrien
113390075Sobrien@item c99
113490075Sobrien@itemx c9x
113590075Sobrien@itemx iso9899:1999
113690075Sobrien@itemx iso9899:199x
113790075SobrienISO C99.  Note that this standard is not yet fully supported; see
1138169689Skan@w{@uref{http://gcc.gnu.org/gcc-4.2/c99status.html}} for more information.  The
113990075Sobriennames @samp{c9x} and @samp{iso9899:199x} are deprecated.
114090075Sobrien
114190075Sobrien@item gnu89
1142117395SkanDefault, ISO C90 plus GNU extensions (including some C99 features).
114390075Sobrien
114490075Sobrien@item gnu99
1145132718Skan@itemx gnu9x
114690075SobrienISO C99 plus GNU extensions.  When ISO C99 is fully implemented in GCC,
114790075Sobrienthis will become the default.  The name @samp{gnu9x} is deprecated.
114890075Sobrien
1149117395Skan@item c++98
1150117395SkanThe 1998 ISO C++ standard plus amendments.
1151117395Skan
1152117395Skan@item gnu++98
1153117395SkanThe same as @option{-std=c++98} plus GNU extensions.  This is the
1154117395Skandefault for C++ code.
115590075Sobrien@end table
115690075Sobrien
115790075SobrienEven when this option is not specified, you can still use some of the
115890075Sobrienfeatures of newer standards in so far as they do not conflict with
115990075Sobrienprevious C standards.  For example, you may use @code{__restrict__} even
116090075Sobrienwhen @option{-std=c99} is not specified.
116190075Sobrien
116290075SobrienThe @option{-std} options specifying some version of ISO C have the same
1163117395Skaneffects as @option{-ansi}, except that features that were not in ISO C90
116490075Sobrienbut are in the specified version (for example, @samp{//} comments and
116590075Sobrienthe @code{inline} keyword in ISO C99) are not disabled.
116690075Sobrien
116790075Sobrien@xref{Standards,,Language Standards Supported by GCC}, for details of
116890075Sobrienthese standard versions.
116990075Sobrien
1170169689Skan@item -fgnu89-inline
1171169689Skan@opindex fgnu89-inline
1172169689SkanThe option @option{-fgnu89-inline} tells GCC to use the traditional
1173169689SkanGNU semantics for @code{inline} functions when in C99 mode.
1174169689Skan@xref{Inline,,An Inline Function is As Fast As a Macro}.  Using this
1175169689Skanoption is roughly equivalent to adding the @code{gnu_inline} function
1176169689Skanattribute to all inline functions (@pxref{Function Attributes}).
1177169689Skan
1178169689SkanThis option is accepted by GCC versions 4.1.3 and up.  In GCC versions
1179169689Skanprior to 4.3, C99 inline semantics are not supported, and thus this
1180169689Skanoption is effectively assumed to be present regardless of whether or not
1181169689Skanit is specified; the only effect of specifying it explicitly is to
1182169689Skandisable warnings about using inline functions in C99 mode.  Likewise,
1183169689Skanthe option @option{-fno-gnu89-inline} is not supported in versions of
1184169689SkanGCC before 4.3.  It will be supported only in C99 or gnu99 mode, not in
1185169689SkanC89 or gnu89 mode.
1186169689Skan
1187169689SkanThe preprocesor macros @code{__GNUC_GNU_INLINE__} and
1188169689Skan@code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1189169689Skanin effect for @code{inline} functions.  @xref{Common Predefined
1190169689SkanMacros,,,cpp,The C Preprocessor}.
1191169689Skan
119290075Sobrien@item -aux-info @var{filename}
119390075Sobrien@opindex aux-info
119490075SobrienOutput to the given filename prototyped declarations for all functions
119590075Sobriendeclared and/or defined in a translation unit, including those in header
119690075Sobrienfiles.  This option is silently ignored in any language other than C@.
119790075Sobrien
119890075SobrienBesides declarations, the file indicates, in comments, the origin of
119990075Sobrieneach declaration (source file and line), whether the declaration was
120090075Sobrienimplicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
120190075Sobrien@samp{O} for old, respectively, in the first character after the line
120290075Sobriennumber and the colon), and whether it came from a declaration or a
120390075Sobriendefinition (@samp{C} or @samp{F}, respectively, in the following
120490075Sobriencharacter).  In the case of function definitions, a K&R-style list of
120590075Sobrienarguments followed by their declarations is also provided, inside
120690075Sobriencomments, after the declaration.
120790075Sobrien
120890075Sobrien@item -fno-asm
120990075Sobrien@opindex fno-asm
121090075SobrienDo not recognize @code{asm}, @code{inline} or @code{typeof} as a
121190075Sobrienkeyword, so that code can use these words as identifiers.  You can use
121290075Sobrienthe keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
121390075Sobrieninstead.  @option{-ansi} implies @option{-fno-asm}.
121490075Sobrien
121590075SobrienIn C++, this switch only affects the @code{typeof} keyword, since
121690075Sobrien@code{asm} and @code{inline} are standard keywords.  You may want to
121790075Sobrienuse the @option{-fno-gnu-keywords} flag instead, which has the same
121890075Sobrieneffect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
121990075Sobrienswitch only affects the @code{asm} and @code{typeof} keywords, since
122090075Sobrien@code{inline} is a standard keyword in ISO C99.
122190075Sobrien
122290075Sobrien@item -fno-builtin
1223117395Skan@itemx -fno-builtin-@var{function}
122490075Sobrien@opindex fno-builtin
122590075Sobrien@cindex built-in functions
122690075SobrienDon't recognize built-in functions that do not begin with
122790075Sobrien@samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
122890075Sobrienfunctions provided by GCC}, for details of the functions affected,
122990075Sobrienincluding those which are not built-in functions when @option{-ansi} or
123090075Sobrien@option{-std} options for strict ISO C conformance are used because they
123190075Sobriendo not have an ISO standard meaning.
123290075Sobrien
123390075SobrienGCC normally generates special code to handle certain built-in functions
123490075Sobrienmore efficiently; for instance, calls to @code{alloca} may become single
123590075Sobrieninstructions that adjust the stack directly, and calls to @code{memcpy}
123690075Sobrienmay become inline copy loops.  The resulting code is often both smaller
123790075Sobrienand faster, but since the function calls no longer appear as such, you
123890075Sobriencannot set a breakpoint on those calls, nor can you change the behavior
1239169689Skanof the functions by linking with a different library.  In addition,
1240169689Skanwhen a function is recognized as a built-in function, GCC may use
1241169689Skaninformation about that function to warn about problems with calls to
1242169689Skanthat function, or to generate more efficient code, even if the
1243169689Skanresulting code still contains calls to that function.  For example,
1244169689Skanwarnings are given with @option{-Wformat} for bad calls to
1245169689Skan@code{printf}, when @code{printf} is built in, and @code{strlen} is
1246169689Skanknown not to modify global memory.
124790075Sobrien
1248117395SkanWith the @option{-fno-builtin-@var{function}} option
1249117395Skanonly the built-in function @var{function} is
125090075Sobriendisabled.  @var{function} must not begin with @samp{__builtin_}.  If a
125190075Sobrienfunction is named this is not built-in in this version of GCC, this
125290075Sobrienoption is ignored.  There is no corresponding
125390075Sobrien@option{-fbuiltin-@var{function}} option; if you wish to enable
125490075Sobrienbuilt-in functions selectively when using @option{-fno-builtin} or
125590075Sobrien@option{-ffreestanding}, you may define macros such as:
125690075Sobrien
125790075Sobrien@smallexample
125890075Sobrien#define abs(n)          __builtin_abs ((n))
125990075Sobrien#define strcpy(d, s)    __builtin_strcpy ((d), (s))
126090075Sobrien@end smallexample
126190075Sobrien
126290075Sobrien@item -fhosted
126390075Sobrien@opindex fhosted
126490075Sobrien@cindex hosted environment
126590075Sobrien
126690075SobrienAssert that compilation takes place in a hosted environment.  This implies
126790075Sobrien@option{-fbuiltin}.  A hosted environment is one in which the
126890075Sobrienentire standard library is available, and in which @code{main} has a return
126990075Sobrientype of @code{int}.  Examples are nearly everything except a kernel.
127090075SobrienThis is equivalent to @option{-fno-freestanding}.
127190075Sobrien
127290075Sobrien@item -ffreestanding
127390075Sobrien@opindex ffreestanding
127490075Sobrien@cindex hosted environment
127590075Sobrien
127690075SobrienAssert that compilation takes place in a freestanding environment.  This
127790075Sobrienimplies @option{-fno-builtin}.  A freestanding environment
127890075Sobrienis one in which the standard library may not exist, and program startup may
127990075Sobriennot necessarily be at @code{main}.  The most obvious example is an OS kernel.
128090075SobrienThis is equivalent to @option{-fno-hosted}.
128190075Sobrien
128290075Sobrien@xref{Standards,,Language Standards Supported by GCC}, for details of
128390075Sobrienfreestanding and hosted environments.
128490075Sobrien
1285169689Skan@item -fopenmp
1286169689Skan@opindex fopenmp
1287169689Skan@cindex openmp parallel
1288169689SkanEnable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1289169689Skan@code{!$omp} in Fortran.  When @option{-fopenmp} is specified, the
1290169689Skancompiler generates parallel code according to the OpenMP Application
1291169689SkanProgram Interface v2.5 @w{@uref{http://www.openmp.org/}}.
1292169689Skan
1293117395Skan@item -fms-extensions
1294117395Skan@opindex fms-extensions
1295117395SkanAccept some non-standard constructs used in Microsoft header files.
1296117395Skan
1297169689SkanSome cases of unnamed fields in structures and unions are only
1298169689Skanaccepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
1299169689Skanfields within structs/unions}, for details.
1300169689Skan
130190075Sobrien@item -trigraphs
130290075Sobrien@opindex trigraphs
130390075SobrienSupport ISO C trigraphs.  The @option{-ansi} option (and @option{-std}
130490075Sobrienoptions for strict ISO C conformance) implies @option{-trigraphs}.
130590075Sobrien
130696263Sobrien@item -no-integrated-cpp
130796263Sobrien@opindex no-integrated-cpp
1308117395SkanPerforms a compilation in two passes: preprocessing and compiling.  This
1309117395Skanoption allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1310169689Skan@option{-B} option.  The user supplied compilation step can then add in
1311117395Skanan additional preprocessing step after normal preprocessing but before
1312169689Skancompiling.  The default is to use the integrated cpp (internal cpp)
131396263Sobrien
1314117395SkanThe semantics of this option will change if "cc1", "cc1plus", and
1315117395Skan"cc1obj" are merged.
131696263Sobrien
131790075Sobrien@cindex traditional C language
131890075Sobrien@cindex C language, traditional
131990075Sobrien@item -traditional
1320117395Skan@itemx -traditional-cpp
1321117395Skan@opindex traditional-cpp
132290075Sobrien@opindex traditional
1323117395SkanFormerly, these options caused GCC to attempt to emulate a pre-standard
1324117395SkanC compiler.  They are now only supported with the @option{-E} switch.
1325117395SkanThe preprocessor continues to support a pre-standard mode.  See the GNU
1326117395SkanCPP manual for details.
132790075Sobrien
132890075Sobrien@item -fcond-mismatch
132990075Sobrien@opindex fcond-mismatch
133090075SobrienAllow conditional expressions with mismatched types in the second and
133190075Sobrienthird arguments.  The value of such an expression is void.  This option
133290075Sobrienis not supported for C++.
133390075Sobrien
133490075Sobrien@item -funsigned-char
133590075Sobrien@opindex funsigned-char
133690075SobrienLet the type @code{char} be unsigned, like @code{unsigned char}.
133790075Sobrien
133890075SobrienEach kind of machine has a default for what @code{char} should
133990075Sobrienbe.  It is either like @code{unsigned char} by default or like
134090075Sobrien@code{signed char} by default.
134190075Sobrien
134290075SobrienIdeally, a portable program should always use @code{signed char} or
134390075Sobrien@code{unsigned char} when it depends on the signedness of an object.
134490075SobrienBut many programs have been written to use plain @code{char} and
134590075Sobrienexpect it to be signed, or expect it to be unsigned, depending on the
134690075Sobrienmachines they were written for.  This option, and its inverse, let you
134790075Sobrienmake such a program work with the opposite default.
134890075Sobrien
134990075SobrienThe type @code{char} is always a distinct type from each of
135090075Sobrien@code{signed char} or @code{unsigned char}, even though its behavior
135190075Sobrienis always just like one of those two.
135290075Sobrien
135390075Sobrien@item -fsigned-char
135490075Sobrien@opindex fsigned-char
135590075SobrienLet the type @code{char} be signed, like @code{signed char}.
135690075Sobrien
135790075SobrienNote that this is equivalent to @option{-fno-unsigned-char}, which is
135890075Sobrienthe negative form of @option{-funsigned-char}.  Likewise, the option
135990075Sobrien@option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
136090075Sobrien
136190075Sobrien@item -fsigned-bitfields
136290075Sobrien@itemx -funsigned-bitfields
136390075Sobrien@itemx -fno-signed-bitfields
136490075Sobrien@itemx -fno-unsigned-bitfields
136590075Sobrien@opindex fsigned-bitfields
136690075Sobrien@opindex funsigned-bitfields
136790075Sobrien@opindex fno-signed-bitfields
136890075Sobrien@opindex fno-unsigned-bitfields
136990075SobrienThese options control whether a bit-field is signed or unsigned, when the
137090075Sobriendeclaration does not use either @code{signed} or @code{unsigned}.  By
137190075Sobriendefault, such a bit-field is signed, because this is consistent: the
137290075Sobrienbasic integer types such as @code{int} are signed types.
137390075Sobrien@end table
137490075Sobrien
137590075Sobrien@node C++ Dialect Options
137690075Sobrien@section Options Controlling C++ Dialect
137790075Sobrien
137890075Sobrien@cindex compiler options, C++
137990075Sobrien@cindex C++ options, command line
138090075Sobrien@cindex options, C++
138190075SobrienThis section describes the command-line options that are only meaningful
138290075Sobrienfor C++ programs; but you can also use most of the GNU compiler options
138390075Sobrienregardless of what language your program is in.  For example, you
138490075Sobrienmight compile a file @code{firstClass.C} like this:
138590075Sobrien
1386132718Skan@smallexample
138790075Sobrieng++ -g -frepo -O -c firstClass.C
1388132718Skan@end smallexample
138990075Sobrien
139090075Sobrien@noindent
139190075SobrienIn this example, only @option{-frepo} is an option meant
139290075Sobrienonly for C++ programs; you can use the other options with any
139390075Sobrienlanguage supported by GCC@.
139490075Sobrien
139590075SobrienHere is a list of options that are @emph{only} for compiling C++ programs:
139690075Sobrien
139790075Sobrien@table @gcctabopt
1398117395Skan
1399117395Skan@item -fabi-version=@var{n}
1400117395Skan@opindex fabi-version
1401169689SkanUse version @var{n} of the C++ ABI@.  Version 2 is the version of the
1402132718SkanC++ ABI that first appeared in G++ 3.4.  Version 1 is the version of
1403132718Skanthe C++ ABI that first appeared in G++ 3.2.  Version 0 will always be
1404132718Skanthe version that conforms most closely to the C++ ABI specification.
1405132718SkanTherefore, the ABI obtained using version 0 will change as ABI bugs
1406132718Skanare fixed.
1407117395Skan
1408132718SkanThe default is version 2.
1409117395Skan
141090075Sobrien@item -fno-access-control
141190075Sobrien@opindex fno-access-control
141290075SobrienTurn off all access checking.  This switch is mainly useful for working
141390075Sobrienaround bugs in the access control code.
141490075Sobrien
141590075Sobrien@item -fcheck-new
141690075Sobrien@opindex fcheck-new
141790075SobrienCheck that the pointer returned by @code{operator new} is non-null
1418117395Skanbefore attempting to modify the storage allocated.  This check is
1419117395Skannormally unnecessary because the C++ standard specifies that
1420117395Skan@code{operator new} will only return @code{0} if it is declared
1421117395Skan@samp{throw()}, in which case the compiler will always check the
1422117395Skanreturn value even without this option.  In all other cases, when
1423117395Skan@code{operator new} has a non-empty exception specification, memory
1424117395Skanexhaustion is signalled by throwing @code{std::bad_alloc}.  See also
1425117395Skan@samp{new (nothrow)}.
142690075Sobrien
142790075Sobrien@item -fconserve-space
142890075Sobrien@opindex fconserve-space
142990075SobrienPut uninitialized or runtime-initialized global variables into the
143090075Sobriencommon segment, as C does.  This saves space in the executable at the
143190075Sobriencost of not diagnosing duplicate definitions.  If you compile with this
143290075Sobrienflag and your program mysteriously crashes after @code{main()} has
143390075Sobriencompleted, you may have an object that is being destroyed twice because
143490075Sobrientwo definitions were merged.
143590075Sobrien
143690075SobrienThis option is no longer useful on most targets, now that support has
143790075Sobrienbeen added for putting variables into BSS without making them common.
143890075Sobrien
1439169689Skan@item -ffriend-injection
1440169689Skan@opindex ffriend-injection
1441169689SkanInject friend functions into the enclosing namespace, so that they are
1442169689Skanvisible outside the scope of the class in which they are declared.
1443169689SkanFriend functions were documented to work this way in the old Annotated
1444169689SkanC++ Reference Manual, and versions of G++ before 4.1 always worked
1445169689Skanthat way.  However, in ISO C++ a friend function which is not declared
1446169689Skanin an enclosing scope can only be found using argument dependent
1447169689Skanlookup.  This option causes friends to be injected as they were in
1448169689Skanearlier releases.
144990075Sobrien
1450169689SkanThis option is for compatibility, and may be removed in a future
1451169689Skanrelease of G++.
145290075Sobrien
145390075Sobrien@item -fno-elide-constructors
145490075Sobrien@opindex fno-elide-constructors
145590075SobrienThe C++ standard allows an implementation to omit creating a temporary
145690075Sobrienwhich is only used to initialize another object of the same type.
145790075SobrienSpecifying this option disables that optimization, and forces G++ to
145890075Sobriencall the copy constructor in all cases.
145990075Sobrien
146090075Sobrien@item -fno-enforce-eh-specs
146190075Sobrien@opindex fno-enforce-eh-specs
1462169689SkanDon't generate code to check for violation of exception specifications
1463169689Skanat runtime.  This option violates the C++ standard, but may be useful
1464169689Skanfor reducing code size in production builds, much like defining
1465169689Skan@samp{NDEBUG}.  This does not give user code permission to throw
1466169689Skanexceptions in violation of the exception specifications; the compiler
1467169689Skanwill still optimize based on the specifications, so throwing an
1468169689Skanunexpected exception will result in undefined behavior.
146990075Sobrien
147090075Sobrien@item -ffor-scope
147190075Sobrien@itemx -fno-for-scope
147290075Sobrien@opindex ffor-scope
147390075Sobrien@opindex fno-for-scope
147490075SobrienIf @option{-ffor-scope} is specified, the scope of variables declared in
147590075Sobriena @i{for-init-statement} is limited to the @samp{for} loop itself,
147690075Sobrienas specified by the C++ standard.
147790075SobrienIf @option{-fno-for-scope} is specified, the scope of variables declared in
147890075Sobriena @i{for-init-statement} extends to the end of the enclosing scope,
147990075Sobrienas was the case in old versions of G++, and other (traditional)
148090075Sobrienimplementations of C++.
148190075Sobrien
148290075SobrienThe default if neither flag is given to follow the standard,
148390075Sobrienbut to allow and give a warning for old-style code that would
148490075Sobrienotherwise be invalid, or have different behavior.
148590075Sobrien
148690075Sobrien@item -fno-gnu-keywords
148790075Sobrien@opindex fno-gnu-keywords
148890075SobrienDo not recognize @code{typeof} as a keyword, so that code can use this
148990075Sobrienword as an identifier.  You can use the keyword @code{__typeof__} instead.
149090075Sobrien@option{-ansi} implies @option{-fno-gnu-keywords}.
149190075Sobrien
149290075Sobrien@item -fno-implicit-templates
149390075Sobrien@opindex fno-implicit-templates
149490075SobrienNever emit code for non-inline templates which are instantiated
149590075Sobrienimplicitly (i.e.@: by use); only emit code for explicit instantiations.
149690075Sobrien@xref{Template Instantiation}, for more information.
149790075Sobrien
149890075Sobrien@item -fno-implicit-inline-templates
149990075Sobrien@opindex fno-implicit-inline-templates
150090075SobrienDon't emit code for implicit instantiations of inline templates, either.
150190075SobrienThe default is to handle inlines differently so that compiles with and
150290075Sobrienwithout optimization will need the same set of explicit instantiations.
150390075Sobrien
150490075Sobrien@item -fno-implement-inlines
150590075Sobrien@opindex fno-implement-inlines
150690075SobrienTo save space, do not emit out-of-line copies of inline functions
150790075Sobriencontrolled by @samp{#pragma implementation}.  This will cause linker
150890075Sobrienerrors if these functions are not inlined everywhere they are called.
150990075Sobrien
151090075Sobrien@item -fms-extensions
151190075Sobrien@opindex fms-extensions
151290075SobrienDisable pedantic warnings about constructs used in MFC, such as implicit
151390075Sobrienint and getting a pointer to member function via non-standard syntax.
151490075Sobrien
151590075Sobrien@item -fno-nonansi-builtins
151690075Sobrien@opindex fno-nonansi-builtins
151790075SobrienDisable built-in declarations of functions that are not mandated by
151890075SobrienANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
151990075Sobrien@code{index}, @code{bzero}, @code{conjf}, and other related functions.
152090075Sobrien
152190075Sobrien@item -fno-operator-names
152290075Sobrien@opindex fno-operator-names
152390075SobrienDo not treat the operator name keywords @code{and}, @code{bitand},
152490075Sobrien@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
152590075Sobriensynonyms as keywords.
152690075Sobrien
152790075Sobrien@item -fno-optional-diags
152890075Sobrien@opindex fno-optional-diags
152990075SobrienDisable diagnostics that the standard says a compiler does not need to
153090075Sobrienissue.  Currently, the only such diagnostic issued by G++ is the one for
153190075Sobriena name having multiple meanings within a class.
153290075Sobrien
153390075Sobrien@item -fpermissive
153490075Sobrien@opindex fpermissive
1535117395SkanDowngrade some diagnostics about nonconformant code from errors to
1536117395Skanwarnings.  Thus, using @option{-fpermissive} will allow some
1537117395Skannonconforming code to compile.
153890075Sobrien
153990075Sobrien@item -frepo
154090075Sobrien@opindex frepo
154190075SobrienEnable automatic template instantiation at link time.  This option also
154290075Sobrienimplies @option{-fno-implicit-templates}.  @xref{Template
154390075SobrienInstantiation}, for more information.
154490075Sobrien
154590075Sobrien@item -fno-rtti
154690075Sobrien@opindex fno-rtti
154790075SobrienDisable generation of information about every class with virtual
154890075Sobrienfunctions for use by the C++ runtime type identification features
154990075Sobrien(@samp{dynamic_cast} and @samp{typeid}).  If you don't use those parts
155090075Sobrienof the language, you can save some space by using this flag.  Note that
155190075Sobrienexception handling uses the same information, but it will generate it as
1552169689Skanneeded. The @samp{dynamic_cast} operator can still be used for casts that
1553169689Skando not require runtime type information, i.e. casts to @code{void *} or to
1554169689Skanunambiguous base classes.
155590075Sobrien
155690075Sobrien@item -fstats
155790075Sobrien@opindex fstats
155890075SobrienEmit statistics about front-end processing at the end of the compilation.
155990075SobrienThis information is generally only useful to the G++ development team.
156090075Sobrien
156190075Sobrien@item -ftemplate-depth-@var{n}
156290075Sobrien@opindex ftemplate-depth
156390075SobrienSet the maximum instantiation depth for template classes to @var{n}.
156490075SobrienA limit on the template instantiation depth is needed to detect
156590075Sobrienendless recursions during template class instantiation.  ANSI/ISO C++
156690075Sobrienconforming programs must not rely on a maximum depth greater than 17.
156790075Sobrien
1568169689Skan@item -fno-threadsafe-statics
1569169689Skan@opindex fno-threadsafe-statics
1570169689SkanDo not emit the extra code to use the routines specified in the C++
1571169689SkanABI for thread-safe initialization of local statics.  You can use this
1572169689Skanoption to reduce code size slightly in code that doesn't need to be
1573169689Skanthread-safe.
1574169689Skan
157590075Sobrien@item -fuse-cxa-atexit
157690075Sobrien@opindex fuse-cxa-atexit
157790075SobrienRegister destructors for objects with static storage duration with the
157890075Sobrien@code{__cxa_atexit} function rather than the @code{atexit} function.
157990075SobrienThis option is required for fully standards-compliant handling of static
158090075Sobriendestructors, but will only work if your C library supports
158190075Sobrien@code{__cxa_atexit}.
158290075Sobrien
1583169689Skan@item -fno-use-cxa-get-exception-ptr
1584169689Skan@opindex fno-use-cxa-get-exception-ptr
1585169689SkanDon't use the @code{__cxa_get_exception_ptr} runtime routine.  This
1586169689Skanwill cause @code{std::uncaught_exception} to be incorrect, but is necessary
1587169689Skanif the runtime routine is not available.
1588169689Skan
1589169689Skan@item -fvisibility-inlines-hidden
1590169689Skan@opindex fvisibility-inlines-hidden
1591169689SkanThis switch declares that the user does not attempt to compare
1592169689Skanpointers to inline methods where the addresses of the two functions
1593169689Skanwere taken in different shared objects.
1594169689Skan
1595169689SkanThe effect of this is that GCC may, effectively, mark inline methods with
1596169689Skan@code{__attribute__ ((visibility ("hidden")))} so that they do not
1597169689Skanappear in the export table of a DSO and do not require a PLT indirection
1598169689Skanwhen used within the DSO@.  Enabling this option can have a dramatic effect
1599169689Skanon load and link times of a DSO as it massively reduces the size of the
1600169689Skandynamic export table when the library makes heavy use of templates.
1601169689Skan
1602169689SkanThe behaviour of this switch is not quite the same as marking the
1603169689Skanmethods as hidden directly, because it does not affect static variables
1604169689Skanlocal to the function or cause the compiler to deduce that
1605169689Skanthe function is defined in only one shared object.
1606169689Skan
1607169689SkanYou may mark a method as having a visibility explicitly to negate the
1608169689Skaneffect of the switch for that method.  For example, if you do want to
1609169689Skancompare pointers to a particular inline method, you might mark it as
1610169689Skanhaving default visibility.  Marking the enclosing class with explicit
1611169689Skanvisibility will have no effect.
1612169689Skan
1613169689SkanExplicitly instantiated inline methods are unaffected by this option
1614169689Skanas their linkage might otherwise cross a shared library boundary.
1615169689Skan@xref{Template Instantiation}.
1616169689Skan
161790075Sobrien@item -fno-weak
161890075Sobrien@opindex fno-weak
161990075SobrienDo not use weak symbol support, even if it is provided by the linker.
162090075SobrienBy default, G++ will use weak symbols if they are available.  This
162190075Sobrienoption exists only for testing, and should not be used by end-users;
162290075Sobrienit will result in inferior code and has no benefits.  This option may
162390075Sobrienbe removed in a future release of G++.
162490075Sobrien
162590075Sobrien@item -nostdinc++
162690075Sobrien@opindex nostdinc++
162790075SobrienDo not search for header files in the standard directories specific to
162890075SobrienC++, but do still search the other standard directories.  (This option
162990075Sobrienis used when building the C++ library.)
163090075Sobrien@end table
163190075Sobrien
163290075SobrienIn addition, these optimization, warning, and code generation options
163390075Sobrienhave meanings only for C++ programs:
163490075Sobrien
163590075Sobrien@table @gcctabopt
163690075Sobrien@item -fno-default-inline
163790075Sobrien@opindex fno-default-inline
163890075SobrienDo not assume @samp{inline} for functions defined inside a class scope.
163990075Sobrien@xref{Optimize Options,,Options That Control Optimization}.  Note that these
164090075Sobrienfunctions will have linkage like inline functions; they just won't be
164190075Sobrieninlined by default.
164290075Sobrien
1643102780Skan@item -Wabi @r{(C++ only)}
1644102780Skan@opindex Wabi
1645102780SkanWarn when G++ generates code that is probably not compatible with the
1646169689Skanvendor-neutral C++ ABI@.  Although an effort has been made to warn about
1647132718Skanall such cases, there are probably some cases that are not warned about,
1648102780Skaneven though G++ is generating incompatible code.  There may also be
1649102780Skancases where warnings are emitted even though the code that is generated
1650102780Skanwill be compatible.
1651102780Skan
1652102780SkanYou should rewrite your code to avoid these warnings if you are
1653102780Skanconcerned about the fact that code generated by G++ may not be binary
1654102780Skancompatible with code generated by other compilers.
1655102780Skan
1656117395SkanThe known incompatibilities at this point include:
1657102780Skan
1658102780Skan@itemize @bullet
1659102780Skan
1660102780Skan@item
1661102780SkanIncorrect handling of tail-padding for bit-fields.  G++ may attempt to
1662102780Skanpack data into the same byte as a base class.  For example:
1663102780Skan
1664102780Skan@smallexample
1665102780Skanstruct A @{ virtual void f(); int f1 : 1; @};
1666102780Skanstruct B : public A @{ int f2 : 1; @};
1667102780Skan@end smallexample
1668102780Skan
1669102780Skan@noindent
1670102780SkanIn this case, G++ will place @code{B::f2} into the same byte
1671132718Skanas@code{A::f1}; other compilers will not.  You can avoid this problem
1672102780Skanby explicitly padding @code{A} so that its size is a multiple of the
1673102780Skanbyte size on your platform; that will cause G++ and other compilers to
1674102780Skanlayout @code{B} identically.
1675102780Skan
1676102780Skan@item
1677102780SkanIncorrect handling of tail-padding for virtual bases.  G++ does not use
1678102780Skantail padding when laying out virtual bases.  For example:
1679102780Skan
1680102780Skan@smallexample
1681102780Skanstruct A @{ virtual void f(); char c1; @};
1682102780Skanstruct B @{ B(); char c2; @};
1683102780Skanstruct C : public A, public virtual B @{@};
1684102780Skan@end smallexample
1685102780Skan
1686102780Skan@noindent
1687102780SkanIn this case, G++ will not place @code{B} into the tail-padding for
1688102780Skan@code{A}; other compilers will.  You can avoid this problem by
1689102780Skanexplicitly padding @code{A} so that its size is a multiple of its
1690102780Skanalignment (ignoring virtual base classes); that will cause G++ and other
1691102780Skancompilers to layout @code{C} identically.
1692102780Skan
1693117395Skan@item
1694117395SkanIncorrect handling of bit-fields with declared widths greater than that
1695117395Skanof their underlying types, when the bit-fields appear in a union.  For
1696117395Skanexample:
1697117395Skan
1698117395Skan@smallexample
1699117395Skanunion U @{ int i : 4096; @};
1700117395Skan@end smallexample
1701117395Skan
1702117395Skan@noindent
1703117395SkanAssuming that an @code{int} does not have 4096 bits, G++ will make the
1704117395Skanunion too small by the number of bits in an @code{int}.
1705117395Skan
1706117395Skan@item
1707117395SkanEmpty classes can be placed at incorrect offsets.  For example:
1708132718Skan
1709117395Skan@smallexample
1710117395Skanstruct A @{@};
1711117395Skan
1712117395Skanstruct B @{
1713117395Skan  A a;
1714117395Skan  virtual void f ();
1715117395Skan@};
1716117395Skan
1717117395Skanstruct C : public B, public A @{@};
1718117395Skan@end smallexample
1719117395Skan
1720117395Skan@noindent
1721117395SkanG++ will place the @code{A} base class of @code{C} at a nonzero offset;
1722117395Skanit should be placed at offset zero.  G++ mistakenly believes that the
1723117395Skan@code{A} data member of @code{B} is already at offset zero.
1724117395Skan
1725117395Skan@item
1726117395SkanNames of template functions whose types involve @code{typename} or
1727117395Skantemplate template parameters can be mangled incorrectly.
1728117395Skan
1729117395Skan@smallexample
1730117395Skantemplate <typename Q>
1731117395Skanvoid f(typename Q::X) @{@}
1732117395Skan
1733117395Skantemplate <template <typename> class Q>
1734117395Skanvoid f(typename Q<int>::X) @{@}
1735117395Skan@end smallexample
1736117395Skan
1737117395Skan@noindent
1738117395SkanInstantiations of these templates may be mangled incorrectly.
1739117395Skan
1740102780Skan@end itemize
1741102780Skan
174290075Sobrien@item -Wctor-dtor-privacy @r{(C++ only)}
174390075Sobrien@opindex Wctor-dtor-privacy
1744119256SkanWarn when a class seems unusable because all the constructors or
1745119256Skandestructors in that class are private, and it has neither friends nor
1746132718Skanpublic static member functions.
174790075Sobrien
174890075Sobrien@item -Wnon-virtual-dtor @r{(C++ only)}
174990075Sobrien@opindex Wnon-virtual-dtor
1750119256SkanWarn when a class appears to be polymorphic, thereby requiring a virtual
1751169689Skandestructor, yet it declares a non-virtual one.  This warning is also
1752169689Skanenabled if -Weffc++ is specified.
175390075Sobrien
175490075Sobrien@item -Wreorder @r{(C++ only)}
175590075Sobrien@opindex Wreorder
175690075Sobrien@cindex reordering, warning
175790075Sobrien@cindex warning for reordering of member initializers
175890075SobrienWarn when the order of member initializers given in the code does not
175990075Sobrienmatch the order in which they must be executed.  For instance:
176090075Sobrien
176190075Sobrien@smallexample
176290075Sobrienstruct A @{
176390075Sobrien  int i;
176490075Sobrien  int j;
176590075Sobrien  A(): j (0), i (1) @{ @}
176690075Sobrien@};
176790075Sobrien@end smallexample
176890075Sobrien
1769119256SkanThe compiler will rearrange the member initializers for @samp{i}
1770119256Skanand @samp{j} to match the declaration order of the members, emitting
1771119256Skana warning to that effect.  This warning is enabled by @option{-Wall}.
177290075Sobrien@end table
177390075Sobrien
177490075SobrienThe following @option{-W@dots{}} options are not affected by @option{-Wall}.
177590075Sobrien
177690075Sobrien@table @gcctabopt
177790075Sobrien@item -Weffc++ @r{(C++ only)}
177890075Sobrien@opindex Weffc++
177996263SobrienWarn about violations of the following style guidelines from Scott Meyers'
178096263Sobrien@cite{Effective C++} book:
178190075Sobrien
178296263Sobrien@itemize @bullet
178396263Sobrien@item
178496263SobrienItem 11:  Define a copy constructor and an assignment operator for classes
178596263Sobrienwith dynamically allocated memory.
178696263Sobrien
178796263Sobrien@item
178896263SobrienItem 12:  Prefer initialization to assignment in constructors.
178996263Sobrien
179096263Sobrien@item
179196263SobrienItem 14:  Make destructors virtual in base classes.
179296263Sobrien
179396263Sobrien@item
179496263SobrienItem 15:  Have @code{operator=} return a reference to @code{*this}.
179596263Sobrien
179696263Sobrien@item
179796263SobrienItem 23:  Don't try to return a reference when you must return an object.
179896263Sobrien
179996263Sobrien@end itemize
180096263Sobrien
1801132718SkanAlso warn about violations of the following style guidelines from
1802119256SkanScott Meyers' @cite{More Effective C++} book:
180396263Sobrien
180496263Sobrien@itemize @bullet
180596263Sobrien@item
180696263SobrienItem 6:  Distinguish between prefix and postfix forms of increment and
180796263Sobriendecrement operators.
180896263Sobrien
180996263Sobrien@item
181096263SobrienItem 7:  Never overload @code{&&}, @code{||}, or @code{,}.
181196263Sobrien
181296263Sobrien@end itemize
181396263Sobrien
1814119256SkanWhen selecting this option, be aware that the standard library
1815119256Skanheaders do not obey all of these guidelines; use @samp{grep -v}
181696263Sobriento filter out those warnings.
181796263Sobrien
181890075Sobrien@item -Wno-deprecated @r{(C++ only)}
181990075Sobrien@opindex Wno-deprecated
182090075SobrienDo not warn about usage of deprecated features.  @xref{Deprecated Features}.
182190075Sobrien
1822169689Skan@item -Wstrict-null-sentinel @r{(C++ only)}
1823169689Skan@opindex Wstrict-null-sentinel
1824169689SkanWarn also about the use of an uncasted @code{NULL} as sentinel.  When
1825169689Skancompiling only with GCC this is a valid sentinel, as @code{NULL} is defined
1826169689Skanto @code{__null}.  Although it is a null pointer constant not a null pointer,
1827169689Skanit is guaranteed to of the same size as a pointer.  But this use is
1828169689Skannot portable across different compilers.
1829169689Skan
183090075Sobrien@item -Wno-non-template-friend @r{(C++ only)}
183190075Sobrien@opindex Wno-non-template-friend
183290075SobrienDisable warnings when non-templatized friend functions are declared
1833119256Skanwithin a template.  Since the advent of explicit template specification
183490075Sobriensupport in G++, if the name of the friend is an unqualified-id (i.e.,
183590075Sobrien@samp{friend foo(int)}), the C++ language specification demands that the
183690075Sobrienfriend declare or define an ordinary, nontemplate function.  (Section
183790075Sobrien14.5.3).  Before G++ implemented explicit specification, unqualified-ids
183890075Sobriencould be interpreted as a particular specialization of a templatized
183990075Sobrienfunction.  Because this non-conforming behavior is no longer the default
184090075Sobrienbehavior for G++, @option{-Wnon-template-friend} allows the compiler to
1841119256Skancheck existing code for potential trouble spots and is on by default.
184290075SobrienThis new compiler behavior can be turned off with
184390075Sobrien@option{-Wno-non-template-friend} which keeps the conformant compiler code
184490075Sobrienbut disables the helpful warning.
184590075Sobrien
184690075Sobrien@item -Wold-style-cast @r{(C++ only)}
184790075Sobrien@opindex Wold-style-cast
184890075SobrienWarn if an old-style (C-style) cast to a non-void type is used within
1849169689Skana C++ program.  The new-style casts (@samp{dynamic_cast},
1850169689Skan@samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are
1851169689Skanless vulnerable to unintended effects and much easier to search for.
185290075Sobrien
185390075Sobrien@item -Woverloaded-virtual @r{(C++ only)}
185490075Sobrien@opindex Woverloaded-virtual
185590075Sobrien@cindex overloaded virtual fn, warning
185690075Sobrien@cindex warning for overloaded virtual fn
185790075SobrienWarn when a function declaration hides virtual functions from a
185890075Sobrienbase class.  For example, in:
185990075Sobrien
186090075Sobrien@smallexample
186190075Sobrienstruct A @{
186290075Sobrien  virtual void f();
186390075Sobrien@};
186490075Sobrien
186590075Sobrienstruct B: public A @{
186690075Sobrien  void f(int);
186790075Sobrien@};
186890075Sobrien@end smallexample
186990075Sobrien
187090075Sobrienthe @code{A} class version of @code{f} is hidden in @code{B}, and code
1871119256Skanlike:
187290075Sobrien
187390075Sobrien@smallexample
187490075SobrienB* b;
187590075Sobrienb->f();
187690075Sobrien@end smallexample
187790075Sobrien
187890075Sobrienwill fail to compile.
187990075Sobrien
188090075Sobrien@item -Wno-pmf-conversions @r{(C++ only)}
188190075Sobrien@opindex Wno-pmf-conversions
188290075SobrienDisable the diagnostic for converting a bound pointer to member function
188390075Sobriento a plain pointer.
188490075Sobrien
188590075Sobrien@item -Wsign-promo @r{(C++ only)}
188690075Sobrien@opindex Wsign-promo
188790075SobrienWarn when overload resolution chooses a promotion from unsigned or
1888132718Skanenumerated type to a signed type, over a conversion to an unsigned type of
188990075Sobrienthe same size.  Previous versions of G++ would try to preserve
189090075Sobrienunsignedness, but the standard mandates the current behavior.
189190075Sobrien
189290075Sobrien@smallexample
189390075Sobrienstruct A @{
189490075Sobrien  operator int ();
189590075Sobrien  A& operator = (int);
189690075Sobrien@};
189790075Sobrien
189890075Sobrienmain ()
189990075Sobrien@{
190090075Sobrien  A a,b;
190190075Sobrien  a = b;
190290075Sobrien@}
190390075Sobrien@end smallexample
190490075Sobrien
190590075SobrienIn this example, G++ will synthesize a default @samp{A& operator =
190690075Sobrien(const A&);}, while cfront will use the user-defined @samp{operator =}.
190790075Sobrien@end table
190890075Sobrien
190990075Sobrien@node Language Independent Options
191090075Sobrien@section Options to Control Diagnostic Messages Formatting
191190075Sobrien@cindex options to control diagnostics formatting
191290075Sobrien@cindex diagnostic messages
191390075Sobrien@cindex message formatting
191490075Sobrien
191590075SobrienTraditionally, diagnostic messages have been formatted irrespective of
191690075Sobrienthe output device's aspect (e.g.@: its width, @dots{}).  The options described
191790075Sobrienbelow can be used to control the diagnostic messages formatting
191890075Sobrienalgorithm, e.g.@: how many characters per line, how often source location
191990075Sobrieninformation should be reported.  Right now, only the C++ front end can
192090075Sobrienhonor these options.  However it is expected, in the near future, that
192190075Sobrienthe remaining front ends would be able to digest them correctly.
192290075Sobrien
192390075Sobrien@table @gcctabopt
192490075Sobrien@item -fmessage-length=@var{n}
192590075Sobrien@opindex fmessage-length
192690075SobrienTry to format error messages so that they fit on lines of about @var{n}
192790075Sobriencharacters.  The default is 72 characters for @command{g++} and 0 for the rest of
192890075Sobrienthe front ends supported by GCC@.  If @var{n} is zero, then no
192990075Sobrienline-wrapping will be done; each error message will appear on a single
193090075Sobrienline.
193190075Sobrien
193290075Sobrien@opindex fdiagnostics-show-location
193390075Sobrien@item -fdiagnostics-show-location=once
193490075SobrienOnly meaningful in line-wrapping mode.  Instructs the diagnostic messages
193590075Sobrienreporter to emit @emph{once} source location information; that is, in
193690075Sobriencase the message is too long to fit on a single physical line and has to
193790075Sobrienbe wrapped, the source location won't be emitted (as prefix) again,
193890075Sobrienover and over, in subsequent continuation lines.  This is the default
193990075Sobrienbehavior.
194090075Sobrien
194190075Sobrien@item -fdiagnostics-show-location=every-line
194290075SobrienOnly meaningful in line-wrapping mode.  Instructs the diagnostic
194390075Sobrienmessages reporter to emit the same source location information (as
194490075Sobrienprefix) for physical lines that result from the process of breaking
194590075Sobriena message which is too long to fit on a single line.
194690075Sobrien
1947169689Skan@item -fdiagnostics-show-option
1948169689Skan@opindex fdiagnostics-show-option
1949169689SkanThis option instructs the diagnostic machinery to add text to each
1950169689Skandiagnostic emitted, which indicates which command line option directly
1951169689Skancontrols that diagnostic, when such an option is known to the
1952169689Skandiagnostic machinery.
1953169689Skan
195490075Sobrien@end table
195590075Sobrien
195690075Sobrien@node Warning Options
195790075Sobrien@section Options to Request or Suppress Warnings
195890075Sobrien@cindex options to control warnings
195990075Sobrien@cindex warning messages
196090075Sobrien@cindex messages, warning
196190075Sobrien@cindex suppressing warnings
196290075Sobrien
196390075SobrienWarnings are diagnostic messages that report constructions which
196490075Sobrienare not inherently erroneous but which are risky or suggest there
196590075Sobrienmay have been an error.
196690075Sobrien
196790075SobrienYou can request many specific warnings with options beginning @samp{-W},
196890075Sobrienfor example @option{-Wimplicit} to request warnings on implicit
196990075Sobriendeclarations.  Each of these specific warning options also has a
197090075Sobriennegative form beginning @samp{-Wno-} to turn off warnings;
197190075Sobrienfor example, @option{-Wno-implicit}.  This manual lists only one of the
197290075Sobrientwo forms, whichever is not the default.
197390075Sobrien
197496263SobrienThe following options control the amount and kinds of warnings produced
197596263Sobrienby GCC; for further, language-specific options also refer to
1976220755Sdim@ref{C++ Dialect Options}.
197790075Sobrien
197890075Sobrien@table @gcctabopt
197990075Sobrien@cindex syntax checking
198090075Sobrien@item -fsyntax-only
198190075Sobrien@opindex fsyntax-only
198290075SobrienCheck the code for syntax errors, but don't do anything beyond that.
198390075Sobrien
198490075Sobrien@item -pedantic
198590075Sobrien@opindex pedantic
198690075SobrienIssue all the warnings demanded by strict ISO C and ISO C++;
198790075Sobrienreject all programs that use forbidden extensions, and some other
198890075Sobrienprograms that do not follow ISO C and ISO C++.  For ISO C, follows the
198990075Sobrienversion of the ISO C standard specified by any @option{-std} option used.
199090075Sobrien
199190075SobrienValid ISO C and ISO C++ programs should compile properly with or without
199290075Sobrienthis option (though a rare few will require @option{-ansi} or a
199390075Sobrien@option{-std} option specifying the required version of ISO C)@.  However,
199490075Sobrienwithout this option, certain GNU extensions and traditional C and C++
199590075Sobrienfeatures are supported as well.  With this option, they are rejected.
199690075Sobrien
199790075Sobrien@option{-pedantic} does not cause warning messages for use of the
199890075Sobrienalternate keywords whose names begin and end with @samp{__}.  Pedantic
199990075Sobrienwarnings are also disabled in the expression that follows
200090075Sobrien@code{__extension__}.  However, only system header files should use
200190075Sobrienthese escape routes; application programs should avoid them.
200290075Sobrien@xref{Alternate Keywords}.
200390075Sobrien
200490075SobrienSome users try to use @option{-pedantic} to check programs for strict ISO
200590075SobrienC conformance.  They soon find that it does not do quite what they want:
200690075Sobrienit finds some non-ISO practices, but not all---only those for which
200790075SobrienISO C @emph{requires} a diagnostic, and some others for which
200890075Sobriendiagnostics have been added.
200990075Sobrien
201090075SobrienA feature to report any failure to conform to ISO C might be useful in
201190075Sobriensome instances, but would require considerable additional work and would
201290075Sobrienbe quite different from @option{-pedantic}.  We don't have plans to
201390075Sobriensupport such a feature in the near future.
201490075Sobrien
201590075SobrienWhere the standard specified with @option{-std} represents a GNU
201690075Sobrienextended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
201790075Sobriencorresponding @dfn{base standard}, the version of ISO C on which the GNU
201890075Sobrienextended dialect is based.  Warnings from @option{-pedantic} are given
201990075Sobrienwhere they are required by the base standard.  (It would not make sense
202090075Sobrienfor such warnings to be given only for features not in the specified GNU
202190075SobrienC dialect, since by definition the GNU dialects of C include all
202290075Sobrienfeatures the compiler supports with the given option, and there would be
202390075Sobriennothing to warn about.)
202490075Sobrien
202590075Sobrien@item -pedantic-errors
202690075Sobrien@opindex pedantic-errors
202790075SobrienLike @option{-pedantic}, except that errors are produced rather than
202890075Sobrienwarnings.
202990075Sobrien
203090075Sobrien@item -w
203190075Sobrien@opindex w
203290075SobrienInhibit all warning messages.
203390075Sobrien
203490075Sobrien@item -Wno-import
203590075Sobrien@opindex Wno-import
203690075SobrienInhibit warning messages about the use of @samp{#import}.
203790075Sobrien
203890075Sobrien@item -Wchar-subscripts
203990075Sobrien@opindex Wchar-subscripts
204090075SobrienWarn if an array subscript has type @code{char}.  This is a common cause
204190075Sobrienof error, as programmers often forget that this type is signed on some
204290075Sobrienmachines.
2043169689SkanThis warning is enabled by @option{-Wall}.
204490075Sobrien
204590075Sobrien@item -Wcomment
204690075Sobrien@opindex Wcomment
204790075SobrienWarn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
204890075Sobriencomment, or whenever a Backslash-Newline appears in a @samp{//} comment.
2049169689SkanThis warning is enabled by @option{-Wall}.
205090075Sobrien
2051169689Skan@item -Wfatal-errors
2052169689Skan@opindex Wfatal-errors
2053169689SkanThis option causes the compiler to abort compilation on the first error
2054169689Skanoccurred rather than trying to keep going and printing further error
2055169689Skanmessages.
2056169689Skan
205790075Sobrien@item -Wformat
205890075Sobrien@opindex Wformat
2059169689Skan@opindex ffreestanding
2060169689Skan@opindex fno-builtin
206190075SobrienCheck calls to @code{printf} and @code{scanf}, etc., to make sure that
206290075Sobrienthe arguments supplied have types appropriate to the format string
206390075Sobrienspecified, and that the conversions specified in the format string make
206490075Sobriensense.  This includes standard functions, and others specified by format
206590075Sobrienattributes (@pxref{Function Attributes}), in the @code{printf},
206690075Sobrien@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
2067169689Skannot in the C standard) families (or other target-specific families).
2068169689SkanWhich functions are checked without format attributes having been
2069169689Skanspecified depends on the standard version selected, and such checks of
2070169689Skanfunctions without the attribute specified are disabled by
2071169689Skan@option{-ffreestanding} or @option{-fno-builtin}.
207290075Sobrien
207390075SobrienThe formats are checked against the format features supported by GNU
2074117395Skanlibc version 2.2.  These include all ISO C90 and C99 features, as well
207590075Sobrienas features from the Single Unix Specification and some BSD and GNU
207690075Sobrienextensions.  Other library implementations may not support all these
207790075Sobrienfeatures; GCC does not support warning about features that go beyond a
207890075Sobrienparticular library's limitations.  However, if @option{-pedantic} is used
207990075Sobrienwith @option{-Wformat}, warnings will be given about format features not
208090075Sobrienin the selected standard version (but not for @code{strfmon} formats,
208190075Sobriensince those are not in any version of the C standard).  @xref{C Dialect
208290075SobrienOptions,,Options Controlling C Dialect}.
208390075Sobrien
2084117395SkanSince @option{-Wformat} also checks for null format arguments for
2085117395Skanseveral functions, @option{-Wformat} also implies @option{-Wnonnull}.
2086117395Skan
208790075Sobrien@option{-Wformat} is included in @option{-Wall}.  For more control over some
2088132718Skanaspects of format checking, the options @option{-Wformat-y2k},
2089117395Skan@option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
2090117395Skan@option{-Wformat-nonliteral}, @option{-Wformat-security}, and
2091117395Skan@option{-Wformat=2} are available, but are not included in @option{-Wall}.
209290075Sobrien
2093132718Skan@item -Wformat-y2k
2094132718Skan@opindex Wformat-y2k
2095132718SkanIf @option{-Wformat} is specified, also warn about @code{strftime}
209690075Sobrienformats which may yield only a two-digit year.
209790075Sobrien
209890075Sobrien@item -Wno-format-extra-args
209990075Sobrien@opindex Wno-format-extra-args
210090075SobrienIf @option{-Wformat} is specified, do not warn about excess arguments to a
210190075Sobrien@code{printf} or @code{scanf} format function.  The C standard specifies
210290075Sobrienthat such arguments are ignored.
210390075Sobrien
210490075SobrienWhere the unused arguments lie between used arguments that are
210590075Sobrienspecified with @samp{$} operand number specifications, normally
210690075Sobrienwarnings are still given, since the implementation could not know what
210790075Sobrientype to pass to @code{va_arg} to skip the unused arguments.  However,
210890075Sobrienin the case of @code{scanf} formats, this option will suppress the
210990075Sobrienwarning if the unused arguments are all pointers, since the Single
211090075SobrienUnix Specification says that such unused arguments are allowed.
211190075Sobrien
2112117395Skan@item -Wno-format-zero-length
2113117395Skan@opindex Wno-format-zero-length
2114117395SkanIf @option{-Wformat} is specified, do not warn about zero-length formats.
2115117395SkanThe C standard specifies that zero-length formats are allowed.
2116117395Skan
211790075Sobrien@item -Wformat-nonliteral
211890075Sobrien@opindex Wformat-nonliteral
211990075SobrienIf @option{-Wformat} is specified, also warn if the format string is not a
212090075Sobrienstring literal and so cannot be checked, unless the format function
212190075Sobrientakes its format arguments as a @code{va_list}.
212290075Sobrien
212390075Sobrien@item -Wformat-security
212490075Sobrien@opindex Wformat-security
212590075SobrienIf @option{-Wformat} is specified, also warn about uses of format
212690075Sobrienfunctions that represent possible security problems.  At present, this
212790075Sobrienwarns about calls to @code{printf} and @code{scanf} functions where the
212890075Sobrienformat string is not a string literal and there are no format arguments,
212990075Sobrienas in @code{printf (foo);}.  This may be a security hole if the format
213090075Sobrienstring came from untrusted input and contains @samp{%n}.  (This is
213190075Sobriencurrently a subset of what @option{-Wformat-nonliteral} warns about, but
213290075Sobrienin future warnings may be added to @option{-Wformat-security} that are not
213390075Sobrienincluded in @option{-Wformat-nonliteral}.)
213490075Sobrien
213590075Sobrien@item -Wformat=2
213690075Sobrien@opindex Wformat=2
213790075SobrienEnable @option{-Wformat} plus format checks not included in
213890075Sobrien@option{-Wformat}.  Currently equivalent to @samp{-Wformat
2139132718Skan-Wformat-nonliteral -Wformat-security -Wformat-y2k}.
214090075Sobrien
2141117395Skan@item -Wnonnull
2142117395Skan@opindex Wnonnull
2143132718SkanWarn about passing a null pointer for arguments marked as
2144117395Skanrequiring a non-null value by the @code{nonnull} function attribute.
2145117395Skan
2146117395Skan@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
2147117395Skancan be disabled with the @option{-Wno-nonnull} option.
2148117395Skan
2149220755Sdim@item -Winit-self @r{(C and C++ only)}
2150132718Skan@opindex Winit-self
2151132718SkanWarn about uninitialized variables which are initialized with themselves.
2152132718SkanNote this option can only be used with the @option{-Wuninitialized} option,
2153132718Skanwhich in turn only works with @option{-O1} and above.
2154132718Skan
2155132718SkanFor example, GCC will warn about @code{i} being uninitialized in the
2156132718Skanfollowing snippet only when @option{-Winit-self} has been specified:
2157132718Skan@smallexample
2158132718Skan@group
2159132718Skanint f()
2160132718Skan@{
2161132718Skan  int i = i;
2162132718Skan  return i;
2163132718Skan@}
2164132718Skan@end group
2165132718Skan@end smallexample
2166132718Skan
216790075Sobrien@item -Wimplicit-int
216890075Sobrien@opindex Wimplicit-int
216990075SobrienWarn when a declaration does not specify a type.
2170169689SkanThis warning is enabled by @option{-Wall}.
217190075Sobrien
217290075Sobrien@item -Wimplicit-function-declaration
217390075Sobrien@itemx -Werror-implicit-function-declaration
217490075Sobrien@opindex Wimplicit-function-declaration
217590075Sobrien@opindex Werror-implicit-function-declaration
217690075SobrienGive a warning (or error) whenever a function is used before being
2177169689Skandeclared.  The form @option{-Wno-error-implicit-function-declaration}
2178169689Skanis not supported.
2179169689SkanThis warning is enabled by @option{-Wall} (as a warning, not an error).
218090075Sobrien
218190075Sobrien@item -Wimplicit
218290075Sobrien@opindex Wimplicit
218390075SobrienSame as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
2184169689SkanThis warning is enabled by @option{-Wall}.
218590075Sobrien
218690075Sobrien@item -Wmain
218790075Sobrien@opindex Wmain
218890075SobrienWarn if the type of @samp{main} is suspicious.  @samp{main} should be a
218990075Sobrienfunction with external linkage, returning int, taking either zero
219090075Sobrienarguments, two, or three arguments of appropriate types.
2191169689SkanThis warning is enabled by @option{-Wall}.
219290075Sobrien
219390075Sobrien@item -Wmissing-braces
219490075Sobrien@opindex Wmissing-braces
219590075SobrienWarn if an aggregate or union initializer is not fully bracketed.  In
219690075Sobrienthe following example, the initializer for @samp{a} is not fully
219790075Sobrienbracketed, but that for @samp{b} is fully bracketed.
219890075Sobrien
219990075Sobrien@smallexample
220090075Sobrienint a[2][2] = @{ 0, 1, 2, 3 @};
220190075Sobrienint b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
220290075Sobrien@end smallexample
220390075Sobrien
2204169689SkanThis warning is enabled by @option{-Wall}.
2205169689Skan
2206220755Sdim@item -Wmissing-include-dirs @r{(C and C++ only)}
2207169689Skan@opindex Wmissing-include-dirs
2208169689SkanWarn if a user-supplied include directory does not exist.
2209169689Skan
221090075Sobrien@item -Wparentheses
221190075Sobrien@opindex Wparentheses
221290075SobrienWarn if parentheses are omitted in certain contexts, such
221390075Sobrienas when there is an assignment in a context where a truth value
221490075Sobrienis expected, or when operators are nested whose precedence people
2215169689Skanoften get confused about.  Only the warning for an assignment used as
2216169689Skana truth value is supported when compiling C++; the other warnings are
2217169689Skanonly supported when compiling C@.
221890075Sobrien
2219169689SkanAlso warn if a comparison like @samp{x<=y<=z} appears; this is
2220169689Skanequivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
2221169689Skaninterpretation from that of ordinary mathematical notation.
2222169689Skan
222390075SobrienAlso warn about constructions where there may be confusion to which
222490075Sobrien@code{if} statement an @code{else} branch belongs.  Here is an example of
222590075Sobriensuch a case:
222690075Sobrien
222790075Sobrien@smallexample
222890075Sobrien@group
222990075Sobrien@{
223090075Sobrien  if (a)
223190075Sobrien    if (b)
223290075Sobrien      foo ();
223390075Sobrien  else
223490075Sobrien    bar ();
223590075Sobrien@}
223690075Sobrien@end group
223790075Sobrien@end smallexample
223890075Sobrien
223990075SobrienIn C, every @code{else} branch belongs to the innermost possible @code{if}
224090075Sobrienstatement, which in this example is @code{if (b)}.  This is often not
224190075Sobrienwhat the programmer expected, as illustrated in the above example by
224290075Sobrienindentation the programmer chose.  When there is the potential for this
224390075Sobrienconfusion, GCC will issue a warning when this flag is specified.
224490075SobrienTo eliminate the warning, add explicit braces around the innermost
224590075Sobrien@code{if} statement so there is no way the @code{else} could belong to
224690075Sobrienthe enclosing @code{if}.  The resulting code would look like this:
224790075Sobrien
224890075Sobrien@smallexample
224990075Sobrien@group
225090075Sobrien@{
225190075Sobrien  if (a)
225290075Sobrien    @{
225390075Sobrien      if (b)
225490075Sobrien        foo ();
225590075Sobrien      else
225690075Sobrien        bar ();
225790075Sobrien    @}
225890075Sobrien@}
225990075Sobrien@end group
226090075Sobrien@end smallexample
226190075Sobrien
2262169689SkanThis warning is enabled by @option{-Wall}.
2263169689Skan
226490075Sobrien@item -Wsequence-point
226590075Sobrien@opindex Wsequence-point
226690075SobrienWarn about code that may have undefined semantics because of violations
2267169689Skanof sequence point rules in the C and C++ standards.
226890075Sobrien
2269169689SkanThe C and C++ standards defines the order in which expressions in a C/C++
2270169689Skanprogram are evaluated in terms of @dfn{sequence points}, which represent
2271169689Skana partial ordering between the execution of parts of the program: those
2272169689Skanexecuted before the sequence point, and those executed after it.  These
2273169689Skanoccur after the evaluation of a full expression (one which is not part
2274169689Skanof a larger expression), after the evaluation of the first operand of a
227590075Sobrien@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
227690075Sobrienfunction is called (but after the evaluation of its arguments and the
227790075Sobrienexpression denoting the called function), and in certain other places.
227890075SobrienOther than as expressed by the sequence point rules, the order of
227990075Sobrienevaluation of subexpressions of an expression is not specified.  All
228090075Sobrienthese rules describe only a partial order rather than a total order,
228190075Sobriensince, for example, if two functions are called within one expression
228290075Sobrienwith no sequence point between them, the order in which the functions
228390075Sobrienare called is not specified.  However, the standards committee have
228490075Sobrienruled that function calls do not overlap.
228590075Sobrien
228690075SobrienIt is not specified when between sequence points modifications to the
228790075Sobrienvalues of objects take effect.  Programs whose behavior depends on this
2288169689Skanhave undefined behavior; the C and C++ standards specify that ``Between
2289169689Skanthe previous and next sequence point an object shall have its stored
2290169689Skanvalue modified at most once by the evaluation of an expression.  
2291169689SkanFurthermore, the prior value shall be read only to determine the value
2292169689Skanto be stored.''.  If a program breaks these rules, the results on any
229390075Sobrienparticular implementation are entirely unpredictable.
229490075Sobrien
229590075SobrienExamples of code with undefined behavior are @code{a = a++;}, @code{a[n]
229690075Sobrien= b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
229790075Sobriendiagnosed by this option, and it may give an occasional false positive
229890075Sobrienresult, but in general it has been found fairly effective at detecting
229990075Sobrienthis sort of problem in programs.
230090075Sobrien
2301169689SkanThe standard is worded confusingly, therefore there is some debate
230290075Sobrienover the precise meaning of the sequence point rules in subtle cases.
230390075SobrienLinks to discussions of the problem, including proposed formal
2304132718Skandefinitions, may be found on the GCC readings page, at
230590075Sobrien@w{@uref{http://gcc.gnu.org/readings.html}}.
230690075Sobrien
2307169689SkanThis warning is enabled by @option{-Wall} for C and C++.
2308169689Skan
230990075Sobrien@item -Wreturn-type
231090075Sobrien@opindex Wreturn-type
231190075SobrienWarn whenever a function is defined with a return-type that defaults to
231290075Sobrien@code{int}.  Also warn about any @code{return} statement with no
231390075Sobrienreturn-value in a function whose return-type is not @code{void}.
231490075Sobrien
2315169689SkanFor C, also warn if the return type of a function has a type qualifier
2316169689Skansuch as @code{const}.  Such a type qualifier has no effect, since the
2317169689Skanvalue returned by a function is not an lvalue.  ISO C prohibits
2318169689Skanqualified @code{void} return types on function definitions, so such
2319169689Skanreturn types always receive a warning even without this option.
2320169689Skan
232190075SobrienFor C++, a function without return type always produces a diagnostic
232290075Sobrienmessage, even when @option{-Wno-return-type} is specified.  The only
232390075Sobrienexceptions are @samp{main} and functions defined in system headers.
232490075Sobrien
2325169689SkanThis warning is enabled by @option{-Wall}.
2326169689Skan
232790075Sobrien@item -Wswitch
232890075Sobrien@opindex Wswitch
2329132718SkanWarn whenever a @code{switch} statement has an index of enumerated type
233090075Sobrienand lacks a @code{case} for one or more of the named codes of that
233190075Sobrienenumeration.  (The presence of a @code{default} label prevents this
233290075Sobrienwarning.)  @code{case} labels outside the enumeration range also
233390075Sobrienprovoke warnings when this option is used.
2334169689SkanThis warning is enabled by @option{-Wall}.
233590075Sobrien
2336117395Skan@item -Wswitch-default
2337117395Skan@opindex Wswitch-switch
2338117395SkanWarn whenever a @code{switch} statement does not have a @code{default}
2339117395Skancase.
2340117395Skan
2341117395Skan@item -Wswitch-enum
2342117395Skan@opindex Wswitch-enum
2343132718SkanWarn whenever a @code{switch} statement has an index of enumerated type
2344117395Skanand lacks a @code{case} for one or more of the named codes of that
2345117395Skanenumeration.  @code{case} labels outside the enumeration range also
2346117395Skanprovoke warnings when this option is used.
2347117395Skan
234890075Sobrien@item -Wtrigraphs
234990075Sobrien@opindex Wtrigraphs
235090075SobrienWarn if any trigraphs are encountered that might change the meaning of
235190075Sobrienthe program (trigraphs within comments are not warned about).
2352169689SkanThis warning is enabled by @option{-Wall}.
235390075Sobrien
235490075Sobrien@item -Wunused-function
235590075Sobrien@opindex Wunused-function
235690075SobrienWarn whenever a static function is declared but not defined or a
2357169689Skannon-inline static function is unused.
2358169689SkanThis warning is enabled by @option{-Wall}.
235990075Sobrien
236090075Sobrien@item -Wunused-label
236190075Sobrien@opindex Wunused-label
236290075SobrienWarn whenever a label is declared but not used.
2363169689SkanThis warning is enabled by @option{-Wall}.
236490075Sobrien
236590075SobrienTo suppress this warning use the @samp{unused} attribute
236690075Sobrien(@pxref{Variable Attributes}).
236790075Sobrien
236890075Sobrien@item -Wunused-parameter
236990075Sobrien@opindex Wunused-parameter
237090075SobrienWarn whenever a function parameter is unused aside from its declaration.
237190075Sobrien
237290075SobrienTo suppress this warning use the @samp{unused} attribute
237390075Sobrien(@pxref{Variable Attributes}).
237490075Sobrien
237590075Sobrien@item -Wunused-variable
237690075Sobrien@opindex Wunused-variable
237790075SobrienWarn whenever a local variable or non-constant static variable is unused
2378169689Skanaside from its declaration.
2379169689SkanThis warning is enabled by @option{-Wall}.
238090075Sobrien
238190075SobrienTo suppress this warning use the @samp{unused} attribute
238290075Sobrien(@pxref{Variable Attributes}).
238390075Sobrien
238490075Sobrien@item -Wunused-value
238590075Sobrien@opindex Wunused-value
238690075SobrienWarn whenever a statement computes a result that is explicitly not used.
2387169689SkanThis warning is enabled by @option{-Wall}.
238890075Sobrien
238990075SobrienTo suppress this warning cast the expression to @samp{void}.
239090075Sobrien
239190075Sobrien@item -Wunused
239290075Sobrien@opindex Wunused
2393117395SkanAll the above @option{-Wunused} options combined.
239490075Sobrien
239590075SobrienIn order to get a warning about an unused function parameter, you must
2396132718Skaneither specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
2397132718Skan@samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
239890075Sobrien
239990075Sobrien@item -Wuninitialized
240090075Sobrien@opindex Wuninitialized
240190075SobrienWarn if an automatic variable is used without first being initialized or
240290075Sobrienif a variable may be clobbered by a @code{setjmp} call.
240390075Sobrien
240490075SobrienThese warnings are possible only in optimizing compilation,
240590075Sobrienbecause they require data flow information that is computed only
2406169689Skanwhen optimizing.  If you do not specify @option{-O}, you will not get 
2407169689Skanthese warnings. Instead, GCC will issue a warning about @option{-Wuninitialized}
2408169689Skanrequiring @option{-O}.
240990075Sobrien
2410132718SkanIf you want to warn about code which uses the uninitialized value of the
2411132718Skanvariable in its own initializer, use the @option{-Winit-self} option.
2412132718Skan
2413169689SkanThese warnings occur for individual uninitialized or clobbered
2414169689Skanelements of structure, union or array variables as well as for
2415169689Skanvariables which are uninitialized or clobbered as a whole.  They do
2416169689Skannot occur for variables or elements declared @code{volatile}.  Because
2417169689Skanthese warnings depend on optimization, the exact variables or elements
2418169689Skanfor which there are warnings will depend on the precise optimization
2419169689Skanoptions and version of GCC used.
242090075Sobrien
242190075SobrienNote that there may be no warning about a variable that is used only
242290075Sobriento compute a value that itself is never used, because such
242390075Sobriencomputations may be deleted by data flow analysis before the warnings
242490075Sobrienare printed.
242590075Sobrien
242690075SobrienThese warnings are made optional because GCC is not smart
242790075Sobrienenough to see all the reasons why the code might be correct
242890075Sobriendespite appearing to have an error.  Here is one example of how
242990075Sobrienthis can happen:
243090075Sobrien
243190075Sobrien@smallexample
243290075Sobrien@group
243390075Sobrien@{
243490075Sobrien  int x;
243590075Sobrien  switch (y)
243690075Sobrien    @{
243790075Sobrien    case 1: x = 1;
243890075Sobrien      break;
243990075Sobrien    case 2: x = 4;
244090075Sobrien      break;
244190075Sobrien    case 3: x = 5;
244290075Sobrien    @}
244390075Sobrien  foo (x);
244490075Sobrien@}
244590075Sobrien@end group
244690075Sobrien@end smallexample
244790075Sobrien
244890075Sobrien@noindent
244990075SobrienIf the value of @code{y} is always 1, 2 or 3, then @code{x} is
245090075Sobrienalways initialized, but GCC doesn't know this.  Here is
245190075Sobrienanother common case:
245290075Sobrien
245390075Sobrien@smallexample
245490075Sobrien@{
245590075Sobrien  int save_y;
245690075Sobrien  if (change_y) save_y = y, y = new_y;
245790075Sobrien  @dots{}
245890075Sobrien  if (change_y) y = save_y;
245990075Sobrien@}
246090075Sobrien@end smallexample
246190075Sobrien
246290075Sobrien@noindent
246390075SobrienThis has no bug because @code{save_y} is used only if it is set.
246490075Sobrien
246590075Sobrien@cindex @code{longjmp} warnings
246690075SobrienThis option also warns when a non-volatile automatic variable might be
246790075Sobrienchanged by a call to @code{longjmp}.  These warnings as well are possible
246890075Sobrienonly in optimizing compilation.
246990075Sobrien
247090075SobrienThe compiler sees only the calls to @code{setjmp}.  It cannot know
247190075Sobrienwhere @code{longjmp} will be called; in fact, a signal handler could
247290075Sobriencall it at any point in the code.  As a result, you may get a warning
247390075Sobrieneven when there is in fact no problem because @code{longjmp} cannot
247490075Sobrienin fact be called at the place which would cause a problem.
247590075Sobrien
247690075SobrienSome spurious warnings can be avoided if you declare all the functions
247790075Sobrienyou use that never return as @code{noreturn}.  @xref{Function
247890075SobrienAttributes}.
247990075Sobrien
2480169689SkanThis warning is enabled by @option{-Wall}.
2481169689Skan
248290075Sobrien@item -Wunknown-pragmas
248390075Sobrien@opindex Wunknown-pragmas
248490075Sobrien@cindex warning for unknown pragmas
248590075Sobrien@cindex unknown pragmas, warning
248690075Sobrien@cindex pragmas, warning of unknown
248790075SobrienWarn when a #pragma directive is encountered which is not understood by
248890075SobrienGCC@.  If this command line option is used, warnings will even be issued
248990075Sobrienfor unknown pragmas in system header files.  This is not the case if
249090075Sobrienthe warnings were only enabled by the @option{-Wall} command line option.
249190075Sobrien
2492169689Skan@item -Wno-pragmas
2493169689Skan@opindex Wno-pragmas
2494169689Skan@opindex Wpragmas
2495169689SkanDo not warn about misuses of pragmas, such as incorrect parameters,
2496169689Skaninvalid syntax, or conflicts between pragmas.  See also
2497169689Skan@samp{-Wunknown-pragmas}.
2498169689Skan
2499117395Skan@item -Wstrict-aliasing
2500117395Skan@opindex Wstrict-aliasing
2501117395SkanThis option is only active when @option{-fstrict-aliasing} is active.
2502117395SkanIt warns about code which might break the strict aliasing rules that the
2503169689Skancompiler is using for optimization.  The warning does not catch all
2504169689Skancases, but does attempt to catch the more common pitfalls.  It is
2505117395Skanincluded in @option{-Wall}.
2506117395Skan
2507169689Skan@item -Wstrict-aliasing=2
2508169689Skan@opindex Wstrict-aliasing=2
2509169689SkanThis option is only active when @option{-fstrict-aliasing} is active.
2510169689SkanIt warns about code which might break the strict aliasing rules that the
2511169689Skancompiler is using for optimization.  This warning catches more cases than
2512169689Skan@option{-Wstrict-aliasing}, but it will also give a warning for some ambiguous
2513169689Skancases that are safe.
2514169689Skan
2515169689Skan@item -Wstrict-overflow
2516169689Skan@item -Wstrict-overflow=@var{n}
2517169689Skan@opindex Wstrict-overflow
2518169689SkanThis option is only active when @option{-fstrict-overflow} is active.
2519169689SkanIt warns about cases where the compiler optimizes based on the
2520169689Skanassumption that signed overflow does not occur.  Note that it does not
2521169689Skanwarn about all cases where the code might overflow: it only warns
2522169689Skanabout cases where the compiler implements some optimization.  Thus
2523169689Skanthis warning depends on the optimization level.
2524169689Skan
2525169689SkanAn optimization which assumes that signed overflow does not occur is
2526169689Skanperfectly safe if the values of the variables involved are such that
2527169689Skanoverflow never does, in fact, occur.  Therefore this warning can
2528169689Skaneasily give a false positive: a warning about code which is not
2529169689Skanactually a problem.  To help focus on important issues, several
2530169689Skanwarning levels are defined.  No warnings are issued for the use of
2531169689Skanundefined signed overflow when estimating how many iterations a loop
2532169689Skanwill require, in particular when determining whether a loop will be
2533169689Skanexecuted at all.
2534169689Skan
2535169689Skan@table @option
2536169689Skan@item -Wstrict-overflow=1
2537169689SkanWarn about cases which are both questionable and easy to avoid.  For
2538169689Skanexample: @code{x + 1 > x}; with @option{-fstrict-overflow}, the
2539169689Skancompiler will simplify this to @code{1}.  This level of
2540169689Skan@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
2541169689Skanare not, and must be explicitly requested.
2542169689Skan
2543169689Skan@item -Wstrict-overflow=2
2544169689SkanAlso warn about other cases where a comparison is simplified to a
2545169689Skanconstant.  For example: @code{abs (x) >= 0}.  This can only be
2546169689Skansimplified when @option{-fstrict-overflow} is in effect, because
2547169689Skan@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
2548169689Skanzero.  @option{-Wstrict-overflow} (with no level) is the same as
2549169689Skan@option{-Wstrict-overflow=2}.
2550169689Skan
2551169689Skan@item -Wstrict-overflow=3
2552169689SkanAlso warn about other cases where a comparison is simplified.  For
2553169689Skanexample: @code{x + 1 > 1} will be simplified to @code{x > 0}.
2554169689Skan
2555169689Skan@item -Wstrict-overflow=4
2556169689SkanAlso warn about other simplifications not covered by the above cases.
2557169689SkanFor example: @code{(x * 10) / 5} will be simplified to @code{x * 2}.
2558169689Skan
2559169689Skan@item -Wstrict-overflow=5
2560169689SkanAlso warn about cases where the compiler reduces the magnitude of a
2561169689Skanconstant involved in a comparison.  For example: @code{x + 2 > y} will
2562169689Skanbe simplified to @code{x + 1 >= y}.  This is reported only at the
2563169689Skanhighest warning level because this simplification applies to many
2564169689Skancomparisons, so this warning level will give a very large number of
2565169689Skanfalse positives.
2566169689Skan@end table
2567169689Skan
256890075Sobrien@item -Wall
256990075Sobrien@opindex Wall
257090075SobrienAll of the above @samp{-W} options combined.  This enables all the
257190075Sobrienwarnings about constructions that some users consider questionable, and
257290075Sobrienthat are easy to avoid (or modify to prevent the warning), even in
2573117395Skanconjunction with macros.  This also enables some language-specific
2574220755Sdimwarnings described in @ref{C++ Dialect Options}.
257590075Sobrien@end table
257690075Sobrien
257790075SobrienThe following @option{-W@dots{}} options are not implied by @option{-Wall}.
257890075SobrienSome of them warn about constructions that users generally do not
257990075Sobrienconsider questionable, but which occasionally you might wish to check
258090075Sobrienfor; others warn about constructions that are necessary or hard to avoid
258190075Sobrienin some cases, and there is no simple way to modify the code to suppress
258290075Sobrienthe warning.
258390075Sobrien
258490075Sobrien@table @gcctabopt
2585132718Skan@item -Wextra
258690075Sobrien@opindex W
2587132718Skan@opindex Wextra
2588132718Skan(This option used to be called @option{-W}.  The older name is still
2589132718Skansupported, but the newer name is more descriptive.)  Print extra warning
2590132718Skanmessages for these events:
259190075Sobrien
259290075Sobrien@itemize @bullet
259390075Sobrien@item
259490075SobrienA function can return either with or without a value.  (Falling
259590075Sobrienoff the end of the function body is considered returning without
259690075Sobriena value.)  For example, this function would evoke such a
259790075Sobrienwarning:
259890075Sobrien
259990075Sobrien@smallexample
260090075Sobrien@group
260190075Sobrienfoo (a)
260290075Sobrien@{
260390075Sobrien  if (a > 0)
260490075Sobrien    return a;
260590075Sobrien@}
260690075Sobrien@end group
260790075Sobrien@end smallexample
260890075Sobrien
260990075Sobrien@item
261090075SobrienAn expression-statement or the left-hand side of a comma expression
261190075Sobriencontains no side effects.
261290075SobrienTo suppress the warning, cast the unused expression to void.
261390075SobrienFor example, an expression such as @samp{x[i,j]} will cause a warning,
261490075Sobrienbut @samp{x[(void)i,j]} will not.
261590075Sobrien
261690075Sobrien@item
2617119256SkanAn unsigned value is compared against zero with @samp{<} or @samp{>=}.
261890075Sobrien
261990075Sobrien@item
262090075SobrienStorage-class specifiers like @code{static} are not the first things in
262190075Sobriena declaration.  According to the C Standard, this usage is obsolescent.
262290075Sobrien
262390075Sobrien@item
262490075SobrienIf @option{-Wall} or @option{-Wunused} is also specified, warn about unused
262590075Sobrienarguments.
262690075Sobrien
262790075Sobrien@item
262890075SobrienA comparison between signed and unsigned values could produce an
262990075Sobrienincorrect result when the signed value is converted to unsigned.
263090075Sobrien(But don't warn if @option{-Wno-sign-compare} is also specified.)
263190075Sobrien
263290075Sobrien@item
263390075SobrienAn aggregate has an initializer which does not initialize all members.
2634169689SkanThis warning can be independently controlled by
2635169689Skan@option{-Wmissing-field-initializers}.
263690075Sobrien
2637169689Skan@item
2638169689SkanAn initialized field without side effects is overridden when using
2639169689Skandesignated initializers (@pxref{Designated Inits, , Designated
2640169689SkanInitializers}).  This warning can be independently controlled by
2641169689Skan@option{-Woverride-init}.
2642132718Skan
2643132718Skan@item
2644132718SkanA function parameter is declared without a type specifier in K&R-style
2645132718Skanfunctions:
2646132718Skan
2647132718Skan@smallexample
2648132718Skanvoid foo(bar) @{ @}
2649132718Skan@end smallexample
2650132718Skan
2651132718Skan@item
2652132718SkanAn empty body occurs in an @samp{if} or @samp{else} statement.
2653132718Skan
2654132718Skan@item
2655132718SkanA pointer is compared against integer zero with @samp{<}, @samp{<=},
2656132718Skan@samp{>}, or @samp{>=}.
2657132718Skan
2658132718Skan@item
2659132718SkanA variable might be changed by @samp{longjmp} or @samp{vfork}.
2660132718Skan
2661132718Skan@item @r{(C++ only)}
2662132718SkanAn enumerator and a non-enumerator both appear in a conditional expression.
2663132718Skan
2664132718Skan@item @r{(C++ only)}
2665132718SkanA non-static reference or non-static @samp{const} member appears in a
2666132718Skanclass without constructors.
2667132718Skan
2668132718Skan@item @r{(C++ only)}
2669132718SkanAmbiguous virtual bases.
2670132718Skan
2671132718Skan@item @r{(C++ only)}
2672132718SkanSubscripting an array which has been declared @samp{register}.
2673132718Skan
2674132718Skan@item @r{(C++ only)}
2675132718SkanTaking the address of a variable which has been declared @samp{register}.
2676132718Skan
2677132718Skan@item @r{(C++ only)}
2678132718SkanA base class is not initialized in a derived class' copy constructor.
267990075Sobrien@end itemize
268090075Sobrien
2681117395Skan@item -Wno-div-by-zero
2682117395Skan@opindex Wno-div-by-zero
2683117395Skan@opindex Wdiv-by-zero
2684117395SkanDo not warn about compile-time integer division by zero.  Floating point
2685117395Skandivision by zero is not warned about, as it can be a legitimate way of
2686117395Skanobtaining infinities and NaNs.
2687117395Skan
2688117395Skan@item -Wsystem-headers
2689117395Skan@opindex Wsystem-headers
2690117395Skan@cindex warnings from system headers
2691117395Skan@cindex system headers, warnings from
2692117395SkanPrint warning messages for constructs found in system header files.
2693117395SkanWarnings from system headers are normally suppressed, on the assumption
2694117395Skanthat they usually do not indicate real problems and would only make the
2695117395Skancompiler output harder to read.  Using this command line option tells
2696117395SkanGCC to emit warnings from system headers as if they occurred in user
2697117395Skancode.  However, note that using @option{-Wall} in conjunction with this
2698117395Skanoption will @emph{not} warn about unknown pragmas in system
2699117395Skanheaders---for that, @option{-Wunknown-pragmas} must also be used.
2700117395Skan
270190075Sobrien@item -Wfloat-equal
270290075Sobrien@opindex Wfloat-equal
270390075SobrienWarn if floating point values are used in equality comparisons.
270490075Sobrien
270590075SobrienThe idea behind this is that sometimes it is convenient (for the
270690075Sobrienprogrammer) to consider floating-point values as approximations to
270790075Sobrieninfinitely precise real numbers.  If you are doing this, then you need
2708117395Skanto compute (by analyzing the code, or in some other way) the maximum or
270990075Sobrienlikely maximum error that the computation introduces, and allow for it
271090075Sobrienwhen performing comparisons (and when producing output, but that's a
271190075Sobriendifferent problem).  In particular, instead of testing for equality, you
271290075Sobrienwould check to see whether the two values have ranges that overlap; and
271390075Sobrienthis is done with the relational operators, so equality comparisons are
271490075Sobrienprobably mistaken.
271590075Sobrien
271690075Sobrien@item -Wtraditional @r{(C only)}
271790075Sobrien@opindex Wtraditional
271890075SobrienWarn about certain constructs that behave differently in traditional and
271990075SobrienISO C@.  Also warn about ISO C constructs that have no traditional C
272090075Sobrienequivalent, and/or problematic constructs which should be avoided.
272190075Sobrien
272290075Sobrien@itemize @bullet
272390075Sobrien@item
272490075SobrienMacro parameters that appear within string literals in the macro body.
272590075SobrienIn traditional C macro replacement takes place within string literals,
272690075Sobrienbut does not in ISO C@.
272790075Sobrien
272890075Sobrien@item
272990075SobrienIn traditional C, some preprocessor directives did not exist.
273090075SobrienTraditional preprocessors would only consider a line to be a directive
273190075Sobrienif the @samp{#} appeared in column 1 on the line.  Therefore
273290075Sobrien@option{-Wtraditional} warns about directives that traditional C
273390075Sobrienunderstands but would ignore because the @samp{#} does not appear as the
273490075Sobrienfirst character on the line.  It also suggests you hide directives like
273590075Sobrien@samp{#pragma} not understood by traditional C by indenting them.  Some
273690075Sobrientraditional implementations would not recognize @samp{#elif}, so it
273790075Sobriensuggests avoiding it altogether.
273890075Sobrien
273990075Sobrien@item
274090075SobrienA function-like macro that appears without arguments.
274190075Sobrien
274290075Sobrien@item
274390075SobrienThe unary plus operator.
274490075Sobrien
274590075Sobrien@item
274690075SobrienThe @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
274790075Sobrienconstant suffixes.  (Traditional C does support the @samp{L} suffix on integer
274890075Sobrienconstants.)  Note, these suffixes appear in macros defined in the system
274990075Sobrienheaders of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
275090075SobrienUse of these macros in user code might normally lead to spurious
2751132718Skanwarnings, however GCC's integrated preprocessor has enough context to
275290075Sobrienavoid warning in these cases.
275390075Sobrien
275490075Sobrien@item
275590075SobrienA function declared external in one block and then used after the end of
275690075Sobrienthe block.
275790075Sobrien
275890075Sobrien@item
275990075SobrienA @code{switch} statement has an operand of type @code{long}.
276090075Sobrien
276190075Sobrien@item
276290075SobrienA non-@code{static} function declaration follows a @code{static} one.
276390075SobrienThis construct is not accepted by some traditional C compilers.
276490075Sobrien
276590075Sobrien@item
276690075SobrienThe ISO type of an integer constant has a different width or
276790075Sobriensignedness from its traditional type.  This warning is only issued if
276890075Sobrienthe base of the constant is ten.  I.e.@: hexadecimal or octal values, which
276990075Sobrientypically represent bit patterns, are not warned about.
277090075Sobrien
277190075Sobrien@item
277290075SobrienUsage of ISO string concatenation is detected.
277390075Sobrien
277490075Sobrien@item
277590075SobrienInitialization of automatic aggregates.
277690075Sobrien
277790075Sobrien@item
277890075SobrienIdentifier conflicts with labels.  Traditional C lacks a separate
277990075Sobriennamespace for labels.
278090075Sobrien
278190075Sobrien@item
278290075SobrienInitialization of unions.  If the initializer is zero, the warning is
278390075Sobrienomitted.  This is done under the assumption that the zero initializer in
278490075Sobrienuser code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
278590075Sobrieninitializer warnings and relies on default initialization to zero in the
278690075Sobrientraditional C case.
278790075Sobrien
278890075Sobrien@item
278990075SobrienConversions by prototypes between fixed/floating point values and vice
279090075Sobrienversa.  The absence of these prototypes when compiling with traditional
279190075SobrienC would cause serious problems.  This is a subset of the possible
279290075Sobrienconversion warnings, for the full set use @option{-Wconversion}.
2793117395Skan
2794117395Skan@item
2795117395SkanUse of ISO C style function definitions.  This warning intentionally is
2796117395Skan@emph{not} issued for prototype declarations or variadic functions
2797117395Skanbecause these ISO C features will appear in your code when using
2798117395Skanlibiberty's traditional C compatibility macros, @code{PARAMS} and
2799117395Skan@code{VPARAMS}.  This warning is also bypassed for nested functions
2800132718Skanbecause that feature is already a GCC extension and thus not relevant to
2801117395Skantraditional C compatibility.
280290075Sobrien@end itemize
280390075Sobrien
2804132718Skan@item -Wdeclaration-after-statement @r{(C only)}
2805132718Skan@opindex Wdeclaration-after-statement
2806132718SkanWarn when a declaration is found after a statement in a block.  This
2807132718Skanconstruct, known from C++, was introduced with ISO C99 and is by default
2808132718Skanallowed in GCC@.  It is not supported by ISO C90 and was not supported by
2809132718SkanGCC versions before GCC 3.0.  @xref{Mixed Declarations}.
2810132718Skan
281190075Sobrien@item -Wundef
281290075Sobrien@opindex Wundef
281390075SobrienWarn if an undefined identifier is evaluated in an @samp{#if} directive.
281490075Sobrien
2815169689Skan@item -Wno-endif-labels
2816169689Skan@opindex Wno-endif-labels
2817117395Skan@opindex Wendif-labels
2818169689SkanDo not warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
2819117395Skan
282090075Sobrien@item -Wshadow
282190075Sobrien@opindex Wshadow
282290075SobrienWarn whenever a local variable shadows another local variable, parameter or
282390075Sobrienglobal variable or whenever a built-in function is shadowed.
282490075Sobrien
282590075Sobrien@item -Wlarger-than-@var{len}
282690075Sobrien@opindex Wlarger-than
282790075SobrienWarn whenever an object of larger than @var{len} bytes is defined.
282890075Sobrien
2829169689Skan@item -Wunsafe-loop-optimizations
2830169689Skan@opindex Wunsafe-loop-optimizations
2831169689SkanWarn if the loop cannot be optimized because the compiler could not
2832169689Skanassume anything on the bounds of the loop indices.  With
2833169689Skan@option{-funsafe-loop-optimizations} warn if the compiler made
2834169689Skansuch assumptions.
2835169689Skan
283690075Sobrien@item -Wpointer-arith
283790075Sobrien@opindex Wpointer-arith
283890075SobrienWarn about anything that depends on the ``size of'' a function type or
283990075Sobrienof @code{void}.  GNU C assigns these types a size of 1, for
284090075Sobrienconvenience in calculations with @code{void *} pointers and pointers
284190075Sobriento functions.
284290075Sobrien
284390075Sobrien@item -Wbad-function-cast @r{(C only)}
284490075Sobrien@opindex Wbad-function-cast
284590075SobrienWarn whenever a function call is cast to a non-matching type.
284690075SobrienFor example, warn if @code{int malloc()} is cast to @code{anything *}.
284790075Sobrien
2848169689Skan@item -Wc++-compat
2849169689SkanWarn about ISO C constructs that are outside of the common subset of
2850169689SkanISO C and ISO C++, e.g.@: request for implicit conversion from
2851169689Skan@code{void *} to a pointer to non-@code{void} type.
2852169689Skan
285390075Sobrien@item -Wcast-qual
285490075Sobrien@opindex Wcast-qual
285590075SobrienWarn whenever a pointer is cast so as to remove a type qualifier from
285690075Sobrienthe target type.  For example, warn if a @code{const char *} is cast
285790075Sobriento an ordinary @code{char *}.
285890075Sobrien
285990075Sobrien@item -Wcast-align
286090075Sobrien@opindex Wcast-align
286190075SobrienWarn whenever a pointer is cast such that the required alignment of the
286290075Sobrientarget is increased.  For example, warn if a @code{char *} is cast to
286390075Sobrienan @code{int *} on machines where integers can only be accessed at
286490075Sobrientwo- or four-byte boundaries.
286590075Sobrien
286690075Sobrien@item -Wwrite-strings
286790075Sobrien@opindex Wwrite-strings
286890075SobrienWhen compiling C, give string constants the type @code{const
286990075Sobrienchar[@var{length}]} so that
287090075Sobriencopying the address of one into a non-@code{const} @code{char *}
287190075Sobrienpointer will get a warning; when compiling C++, warn about the
2872169689Skandeprecated conversion from string literals to @code{char *}.  This
2873169689Skanwarning, by default, is enabled for C++ programs.
287490075SobrienThese warnings will help you find at
287590075Sobriencompile time code that can try to write into a string constant, but
287690075Sobrienonly if you have been very careful about using @code{const} in
287790075Sobriendeclarations and prototypes.  Otherwise, it will just be a nuisance;
287890075Sobrienthis is why we did not make @option{-Wall} request these warnings.
287990075Sobrien
288090075Sobrien@item -Wconversion
288190075Sobrien@opindex Wconversion
288290075SobrienWarn if a prototype causes a type conversion that is different from what
288390075Sobrienwould happen to the same argument in the absence of a prototype.  This
288490075Sobrienincludes conversions of fixed point to floating and vice versa, and
288590075Sobrienconversions changing the width or signedness of a fixed point argument
288690075Sobrienexcept when the same as the default promotion.
288790075Sobrien
288890075SobrienAlso, warn if a negative integer constant expression is implicitly
288990075Sobrienconverted to an unsigned type.  For example, warn about the assignment
289090075Sobrien@code{x = -1} if @code{x} is unsigned.  But do not warn about explicit
289190075Sobriencasts like @code{(unsigned) -1}.
289290075Sobrien
289390075Sobrien@item -Wsign-compare
289490075Sobrien@opindex Wsign-compare
289590075Sobrien@cindex warning for comparison of signed and unsigned values
289690075Sobrien@cindex comparison of signed and unsigned values, warning
289790075Sobrien@cindex signed and unsigned values, comparison warning
289890075SobrienWarn when a comparison between signed and unsigned values could produce
289990075Sobrienan incorrect result when the signed value is converted to unsigned.
2900132718SkanThis warning is also enabled by @option{-Wextra}; to get the other warnings
2901132718Skanof @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
290290075Sobrien
2903169689Skan@item -Waddress
2904169689Skan@opindex Waddress
2905169689Skan@opindex Wno-address
2906169689SkanWarn about suspicious uses of memory addresses. These include using
2907169689Skanthe address of a function in a conditional expression, such as
2908169689Skan@code{void func(void); if (func)}, and comparisons against the memory
2909169689Skanaddress of a string literal, such as @code{if (x == "abc")}.  Such
2910169689Skanuses typically indicate a programmer error: the address of a function
2911169689Skanalways evaluates to true, so their use in a conditional usually
2912169689Skanindicate that the programmer forgot the parentheses in a function
2913169689Skancall; and comparisons against string literals result in unspecified
2914169689Skanbehavior and are not portable in C, so they usually indicate that the
2915169689Skanprogrammer intended to use @code{strcmp}.  This warning is enabled by
2916169689Skan@option{-Wall}.
2917169689Skan
291890075Sobrien@item -Waggregate-return
291990075Sobrien@opindex Waggregate-return
292090075SobrienWarn if any functions that return structures or unions are defined or
292190075Sobriencalled.  (In languages where you can return an array, this also elicits
292290075Sobriena warning.)
292390075Sobrien
2924169689Skan@item -Wno-attributes
2925169689Skan@opindex Wno-attributes
2926169689Skan@opindex Wattributes
2927169689SkanDo not warn if an unexpected @code{__attribute__} is used, such as
2928169689Skanunrecognized attributes, function attributes applied to variables,
2929169689Skanetc.  This will not stop errors for incorrect use of supported
2930169689Skanattributes.
2931169689Skan
293290075Sobrien@item -Wstrict-prototypes @r{(C only)}
293390075Sobrien@opindex Wstrict-prototypes
293490075SobrienWarn if a function is declared or defined without specifying the
293590075Sobrienargument types.  (An old-style function definition is permitted without
293690075Sobriena warning if preceded by a declaration which specifies the argument
293790075Sobrientypes.)
293890075Sobrien
2939132718Skan@item -Wold-style-definition @r{(C only)}
2940132718Skan@opindex Wold-style-definition
2941132718SkanWarn if an old-style function definition is used.  A warning is given
2942132718Skaneven if there is a previous prototype.
2943132718Skan
294490075Sobrien@item -Wmissing-prototypes @r{(C only)}
294590075Sobrien@opindex Wmissing-prototypes
294690075SobrienWarn if a global function is defined without a previous prototype
294790075Sobriendeclaration.  This warning is issued even if the definition itself
294890075Sobrienprovides a prototype.  The aim is to detect global functions that fail
294990075Sobriento be declared in header files.
295090075Sobrien
2951117395Skan@item -Wmissing-declarations @r{(C only)}
295290075Sobrien@opindex Wmissing-declarations
295390075SobrienWarn if a global function is defined without a previous declaration.
295490075SobrienDo so even if the definition itself provides a prototype.
295590075SobrienUse this option to detect global functions that are not declared in
295690075Sobrienheader files.
295790075Sobrien
2958169689Skan@item -Wmissing-field-initializers
2959169689Skan@opindex Wmissing-field-initializers
2960169689Skan@opindex W
2961169689Skan@opindex Wextra
2962169689SkanWarn if a structure's initializer has some fields missing.  For
2963169689Skanexample, the following code would cause such a warning, because
2964169689Skan@code{x.h} is implicitly zero:
2965169689Skan
2966169689Skan@smallexample
2967169689Skanstruct s @{ int f, g, h; @};
2968169689Skanstruct s x = @{ 3, 4 @};
2969169689Skan@end smallexample
2970169689Skan
2971169689SkanThis option does not warn about designated initializers, so the following
2972169689Skanmodification would not trigger a warning:
2973169689Skan
2974169689Skan@smallexample
2975169689Skanstruct s @{ int f, g, h; @};
2976169689Skanstruct s x = @{ .f = 3, .g = 4 @};
2977169689Skan@end smallexample
2978169689Skan
2979169689SkanThis warning is included in @option{-Wextra}.  To get other @option{-Wextra}
2980169689Skanwarnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}.
2981169689Skan
298290075Sobrien@item -Wmissing-noreturn
298390075Sobrien@opindex Wmissing-noreturn
298490075SobrienWarn about functions which might be candidates for attribute @code{noreturn}.
298590075SobrienNote these are only possible candidates, not absolute ones.  Care should
298690075Sobrienbe taken to manually verify functions actually do not ever return before
298790075Sobrienadding the @code{noreturn} attribute, otherwise subtle code generation
298890075Sobrienbugs could be introduced.  You will not get a warning for @code{main} in
298990075Sobrienhosted C environments.
299090075Sobrien
299190075Sobrien@item -Wmissing-format-attribute
299290075Sobrien@opindex Wmissing-format-attribute
299390075Sobrien@opindex Wformat
2994169689SkanWarn about function pointers which might be candidates for @code{format}
2995169689Skanattributes.  Note these are only possible candidates, not absolute ones.
2996169689SkanGCC will guess that function pointers with @code{format} attributes that
2997169689Skanare used in assignment, initialization, parameter passing or return
2998169689Skanstatements should have a corresponding @code{format} attribute in the
2999169689Skanresulting type.  I.e.@: the left-hand side of the assignment or
3000169689Skaninitialization, the type of the parameter variable, or the return type
3001169689Skanof the containing function respectively should also have a @code{format}
3002169689Skanattribute to avoid the warning.
3003169689Skan
3004169689SkanGCC will also warn about function definitions which might be
3005169689Skancandidates for @code{format} attributes.  Again, these are only
3006169689Skanpossible candidates.  GCC will guess that @code{format} attributes
3007169689Skanmight be appropriate for any function that calls a function like
3008169689Skan@code{vprintf} or @code{vscanf}, but this might not always be the
300990075Sobriencase, and some functions for which @code{format} attributes are
3010169689Skanappropriate may not be detected.
301190075Sobrien
3012117395Skan@item -Wno-multichar
3013117395Skan@opindex Wno-multichar
3014117395Skan@opindex Wmultichar
3015117395SkanDo not warn if a multicharacter constant (@samp{'FOOF'}) is used.
3016117395SkanUsually they indicate a typo in the user's code, as they have
3017117395Skanimplementation-defined values, and should not be used in portable code.
3018117395Skan
3019169689Skan@item -Wnormalized=<none|id|nfc|nfkc>
3020169689Skan@opindex Wnormalized
3021169689Skan@cindex NFC
3022169689Skan@cindex NFKC
3023169689Skan@cindex character set, input normalization
3024169689SkanIn ISO C and ISO C++, two identifiers are different if they are
3025169689Skandifferent sequences of characters.  However, sometimes when characters
3026169689Skanoutside the basic ASCII character set are used, you can have two
3027169689Skandifferent character sequences that look the same.  To avoid confusion,
3028169689Skanthe ISO 10646 standard sets out some @dfn{normalization rules} which
3029169689Skanwhen applied ensure that two sequences that look the same are turned into
3030169689Skanthe same sequence.  GCC can warn you if you are using identifiers which
3031169689Skanhave not been normalized; this option controls that warning.
3032169689Skan
3033169689SkanThere are four levels of warning that GCC supports.  The default is
3034169689Skan@option{-Wnormalized=nfc}, which warns about any identifier which is
3035169689Skannot in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
3036169689Skanrecommended form for most uses.
3037169689Skan
3038169689SkanUnfortunately, there are some characters which ISO C and ISO C++ allow
3039169689Skanin identifiers that when turned into NFC aren't allowable as
3040169689Skanidentifiers.  That is, there's no way to use these symbols in portable
3041169689SkanISO C or C++ and have all your identifiers in NFC.
3042169689Skan@option{-Wnormalized=id} suppresses the warning for these characters.
3043169689SkanIt is hoped that future versions of the standards involved will correct
3044169689Skanthis, which is why this option is not the default.
3045169689Skan
3046169689SkanYou can switch the warning off for all characters by writing
3047169689Skan@option{-Wnormalized=none}.  You would only want to do this if you
3048169689Skanwere using some other normalization scheme (like ``D''), because
3049169689Skanotherwise you can easily create bugs that are literally impossible to see.
3050169689Skan
3051169689SkanSome characters in ISO 10646 have distinct meanings but look identical
3052169689Skanin some fonts or display methodologies, especially once formatting has
3053169689Skanbeen applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
3054169689SkanLETTER N'', will display just like a regular @code{n} which has been
3055169689Skanplaced in a superscript.  ISO 10646 defines the @dfn{NFKC}
3056169689Skannormalization scheme to convert all these into a standard form as
3057169689Skanwell, and GCC will warn if your code is not in NFKC if you use
3058169689Skan@option{-Wnormalized=nfkc}.  This warning is comparable to warning
3059169689Skanabout every identifier that contains the letter O because it might be
3060169689Skanconfused with the digit 0, and so is not the default, but may be
3061169689Skanuseful as a local coding convention if the programming environment is
3062169689Skanunable to be fixed to display these characters distinctly.
3063169689Skan
306490075Sobrien@item -Wno-deprecated-declarations
306590075Sobrien@opindex Wno-deprecated-declarations
3066169689SkanDo not warn about uses of functions (@pxref{Function Attributes}),
3067169689Skanvariables (@pxref{Variable Attributes}), and types (@pxref{Type
3068169689SkanAttributes}) marked as deprecated by using the @code{deprecated}
3069169689Skanattribute.
307090075Sobrien
3071169689Skan@item -Wno-overflow
3072169689Skan@opindex Wno-overflow
3073169689SkanDo not warn about compile-time overflow in constant expressions.
3074169689Skan
3075169689Skan@item -Woverride-init
3076169689Skan@opindex Woverride-init
3077169689Skan@opindex W
3078169689Skan@opindex Wextra
3079169689SkanWarn if an initialized field without side effects is overridden when
3080169689Skanusing designated initializers (@pxref{Designated Inits, , Designated
3081169689SkanInitializers}).
3082169689Skan
3083169689SkanThis warning is included in @option{-Wextra}.  To get other
3084169689Skan@option{-Wextra} warnings without this one, use @samp{-Wextra
3085169689Skan-Wno-override-init}.
3086169689Skan
308790075Sobrien@item -Wpacked
308890075Sobrien@opindex Wpacked
308990075SobrienWarn if a structure is given the packed attribute, but the packed
309090075Sobrienattribute has no effect on the layout or size of the structure.
309190075SobrienSuch structures may be mis-aligned for little benefit.  For
309290075Sobrieninstance, in this code, the variable @code{f.x} in @code{struct bar}
309390075Sobrienwill be misaligned even though @code{struct bar} does not itself
309490075Sobrienhave the packed attribute:
309590075Sobrien
309690075Sobrien@smallexample
309790075Sobrien@group
309890075Sobrienstruct foo @{
309990075Sobrien  int x;
310090075Sobrien  char a, b, c, d;
310190075Sobrien@} __attribute__((packed));
310290075Sobrienstruct bar @{
310390075Sobrien  char z;
310490075Sobrien  struct foo f;
310590075Sobrien@};
310690075Sobrien@end group
310790075Sobrien@end smallexample
310890075Sobrien
310990075Sobrien@item -Wpadded
311090075Sobrien@opindex Wpadded
311190075SobrienWarn if padding is included in a structure, either to align an element
311290075Sobrienof the structure or to align the whole structure.  Sometimes when this
311390075Sobrienhappens it is possible to rearrange the fields of the structure to
311490075Sobrienreduce the padding and so make the structure smaller.
311590075Sobrien
311690075Sobrien@item -Wredundant-decls
311790075Sobrien@opindex Wredundant-decls
311890075SobrienWarn if anything is declared more than once in the same scope, even in
311990075Sobriencases where multiple declaration is valid and changes nothing.
312090075Sobrien
312190075Sobrien@item -Wnested-externs @r{(C only)}
312290075Sobrien@opindex Wnested-externs
312390075SobrienWarn if an @code{extern} declaration is encountered within a function.
312490075Sobrien
312590075Sobrien@item -Wunreachable-code
312690075Sobrien@opindex Wunreachable-code
312790075SobrienWarn if the compiler detects that code will never be executed.
312890075Sobrien
312990075SobrienThis option is intended to warn when the compiler detects that at
313090075Sobrienleast a whole line of source code will never be executed, because
313190075Sobriensome condition is never satisfied or because it is after a
313290075Sobrienprocedure that never returns.
313390075Sobrien
313490075SobrienIt is possible for this option to produce a warning even though there
313590075Sobrienare circumstances under which part of the affected line can be executed,
313690075Sobrienso care should be taken when removing apparently-unreachable code.
313790075Sobrien
313890075SobrienFor instance, when a function is inlined, a warning may mean that the
313990075Sobrienline is unreachable in only one inlined copy of the function.
314090075Sobrien
314190075SobrienThis option is not made part of @option{-Wall} because in a debugging
314290075Sobrienversion of a program there is often substantial code which checks
314390075Sobriencorrect functioning of the program and is, hopefully, unreachable
314490075Sobrienbecause the program does work.  Another common use of unreachable
314590075Sobriencode is to provide behavior which is selectable at compile-time.
314690075Sobrien
314790075Sobrien@item -Winline
314890075Sobrien@opindex Winline
314990075SobrienWarn if a function can not be inlined and it was declared as inline.
3150117395SkanEven with this option, the compiler will not warn about failures to
3151132718Skaninline functions declared in system headers.
315290075Sobrien
3153117395SkanThe compiler uses a variety of heuristics to determine whether or not
3154117395Skanto inline a function.  For example, the compiler takes into account
3155169689Skanthe size of the function being inlined and the amount of inlining
3156117395Skanthat has already been done in the current function.  Therefore,
3157117395Skanseemingly insignificant changes in the source program can cause the
3158117395Skanwarnings produced by @option{-Winline} to appear or disappear.
3159117395Skan
3160132718Skan@item -Wno-invalid-offsetof @r{(C++ only)}
3161132718Skan@opindex Wno-invalid-offsetof
3162132718SkanSuppress warnings from applying the @samp{offsetof} macro to a non-POD
3163132718Skantype.  According to the 1998 ISO C++ standard, applying @samp{offsetof}
3164132718Skanto a non-POD type is undefined.  In existing C++ implementations,
3165132718Skanhowever, @samp{offsetof} typically gives meaningful results even when
3166132718Skanapplied to certain kinds of non-POD types. (Such as a simple
3167132718Skan@samp{struct} that fails to be a POD type only by virtue of having a
3168132718Skanconstructor.)  This flag is for users who are aware that they are
3169132718Skanwriting nonportable code and who have deliberately chosen to ignore the
3170132718Skanwarning about it.
3171132718Skan
3172132718SkanThe restrictions on @samp{offsetof} may be relaxed in a future version
3173132718Skanof the C++ standard.
3174132718Skan
3175169689Skan@item -Wno-int-to-pointer-cast @r{(C only)}
3176169689Skan@opindex Wno-int-to-pointer-cast
3177169689SkanSuppress warnings from casts to pointer type of an integer of a
3178169689Skandifferent size.
3179169689Skan
3180169689Skan@item -Wno-pointer-to-int-cast @r{(C only)}
3181169689Skan@opindex Wno-pointer-to-int-cast
3182169689SkanSuppress warnings from casts from a pointer to an integer type of a
3183169689Skandifferent size.
3184169689Skan
3185132718Skan@item -Winvalid-pch
3186132718Skan@opindex Winvalid-pch
3187132718SkanWarn if a precompiled header (@pxref{Precompiled Headers}) is found in
3188132718Skanthe search path but can't be used.
3189132718Skan
319090075Sobrien@item -Wlong-long
319190075Sobrien@opindex Wlong-long
319290075Sobrien@opindex Wno-long-long
319390075SobrienWarn if @samp{long long} type is used.  This is default.  To inhibit
319490075Sobrienthe warning messages, use @option{-Wno-long-long}.  Flags
319590075Sobrien@option{-Wlong-long} and @option{-Wno-long-long} are taken into account
319690075Sobrienonly when @option{-pedantic} flag is used.
319790075Sobrien
3198169689Skan@item -Wvariadic-macros
3199169689Skan@opindex Wvariadic-macros
3200169689Skan@opindex Wno-variadic-macros
3201169689SkanWarn if variadic macros are used in pedantic ISO C90 mode, or the GNU
3202169689Skanalternate syntax when in pedantic ISO C99 mode.  This is default.
3203169689SkanTo inhibit the warning messages, use @option{-Wno-variadic-macros}.
3204169689Skan
3205169689Skan@item -Wvolatile-register-var
3206169689Skan@opindex Wvolatile-register-var
3207169689Skan@opindex Wno-volatile-register-var
3208169689SkanWarn if a register variable is declared volatile.  The volatile
3209169689Skanmodifier does not inhibit all optimizations that may eliminate reads
3210169689Skanand/or writes to register variables.
3211169689Skan
321290075Sobrien@item -Wdisabled-optimization
321390075Sobrien@opindex Wdisabled-optimization
321490075SobrienWarn if a requested optimization pass is disabled.  This warning does
321590075Sobriennot generally indicate that there is anything wrong with your code; it
321690075Sobrienmerely indicates that GCC's optimizers were unable to handle the code
321790075Sobrieneffectively.  Often, the problem is that your code is too big or too
321890075Sobriencomplex; GCC will refuse to optimize programs when the optimization
321990075Sobrienitself is likely to take inordinate amounts of time.
322090075Sobrien
3221169689Skan@item -Wpointer-sign
3222169689Skan@opindex Wpointer-sign
3223169689Skan@opindex Wno-pointer-sign
3224169689SkanWarn for pointer argument passing or assignment with different signedness.
3225220755SdimThis option is only supported for C.  It is implied by @option{-Wall}
3226220755Sdimand by @option{-pedantic}, which can be disabled with
3227169689Skan@option{-Wno-pointer-sign}.
3228169689Skan
322990075Sobrien@item -Werror
323090075Sobrien@opindex Werror
323190075SobrienMake all warnings into errors.
3232169689Skan
3233169689Skan@item -Werror=
3234169689Skan@opindex Werror=
3235169689SkanMake the specified warning into an errors.  The specifier for a
3236169689Skanwarning is appended, for example @option{-Werror=switch} turns the
3237169689Skanwarnings controlled by @option{-Wswitch} into errors.  This switch
3238169689Skantakes a negative form, to be used to negate @option{-Werror} for
3239169689Skanspecific warnings, for example @option{-Wno-error=switch} makes
3240169689Skan@option{-Wswitch} warnings not be errors, even when @option{-Werror}
3241169689Skanis in effect.  You can use the @option{-fdiagnostics-show-option}
3242169689Skanoption to have each controllable warning amended with the option which
3243169689Skancontrols it, to determine what to use with this option.
3244169689Skan
3245169689SkanNote that specifying @option{-Werror=}@var{foo} automatically implies
3246169689Skan@option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
3247169689Skanimply anything.
3248169689Skan
3249169689Skan@item -Wstack-protector
3250169689Skan@opindex Wstack-protector
3251169689SkanThis option is only active when @option{-fstack-protector} is active.  It
3252169689Skanwarns about functions that will not be protected against stack smashing.
3253169689Skan
3254169689Skan@item -Woverlength-strings
3255169689Skan@opindex Woverlength-strings
3256169689SkanWarn about string constants which are longer than the ``minimum
3257169689Skanmaximum'' length specified in the C standard.  Modern compilers
3258169689Skangenerally allow string constants which are much longer than the
3259169689Skanstandard's minimum limit, but very portable programs should avoid
3260169689Skanusing longer strings.
3261169689Skan
3262169689SkanThe limit applies @emph{after} string constant concatenation, and does
3263169689Skannot count the trailing NUL@.  In C89, the limit was 509 characters; in
3264169689SkanC99, it was raised to 4095.  C++98 does not specify a normative
3265169689Skanminimum maximum, so we do not diagnose overlength strings in C++@.
3266169689Skan
3267169689SkanThis option is implied by @option{-pedantic}, and can be disabled with
3268169689Skan@option{-Wno-overlength-strings}.
326990075Sobrien@end table
327090075Sobrien
327190075Sobrien@node Debugging Options
327290075Sobrien@section Options for Debugging Your Program or GCC
327390075Sobrien@cindex options, debugging
327490075Sobrien@cindex debugging information options
327590075Sobrien
327690075SobrienGCC has various special options that are used for debugging
327790075Sobrieneither your program or GCC:
327890075Sobrien
327990075Sobrien@table @gcctabopt
328090075Sobrien@item -g
328190075Sobrien@opindex g
328290075SobrienProduce debugging information in the operating system's native format
3283169689Skan(stabs, COFF, XCOFF, or DWARF 2)@.  GDB can work with this debugging
328490075Sobrieninformation.
328590075Sobrien
328690075SobrienOn most systems that use stabs format, @option{-g} enables use of extra
328790075Sobriendebugging information that only GDB can use; this extra information
328890075Sobrienmakes debugging work better in GDB but will probably make other debuggers
328990075Sobriencrash or
329090075Sobrienrefuse to read the program.  If you want to control for certain whether
329190075Sobriento generate the extra information, use @option{-gstabs+}, @option{-gstabs},
3292132718Skan@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
329390075Sobrien
3294169689SkanGCC allows you to use @option{-g} with
329590075Sobrien@option{-O}.  The shortcuts taken by optimized code may occasionally
329690075Sobrienproduce surprising results: some variables you declared may not exist
329790075Sobrienat all; flow of control may briefly move where you did not expect it;
329890075Sobriensome statements may not be executed because they compute constant
329990075Sobrienresults or their values were already at hand; some statements may
330090075Sobrienexecute in different places because they were moved out of loops.
330190075Sobrien
330290075SobrienNevertheless it proves possible to debug optimized output.  This makes
330390075Sobrienit reasonable to use the optimizer for programs that might have bugs.
330490075Sobrien
330590075SobrienThe following options are useful when GCC is generated with the
330690075Sobriencapability for more than one debugging format.
330790075Sobrien
330890075Sobrien@item -ggdb
330990075Sobrien@opindex ggdb
331090075SobrienProduce debugging information for use by GDB@.  This means to use the
331190075Sobrienmost expressive format available (DWARF 2, stabs, or the native format
331290075Sobrienif neither of those are supported), including GDB extensions if at all
331390075Sobrienpossible.
331490075Sobrien
331590075Sobrien@item -gstabs
331690075Sobrien@opindex gstabs
331790075SobrienProduce debugging information in stabs format (if that is supported),
331890075Sobrienwithout GDB extensions.  This is the format used by DBX on most BSD
331990075Sobriensystems.  On MIPS, Alpha and System V Release 4 systems this option
332090075Sobrienproduces stabs debugging output which is not understood by DBX or SDB@.
332190075SobrienOn System V Release 4 systems this option requires the GNU assembler.
332290075Sobrien
3323132718Skan@item -feliminate-unused-debug-symbols
3324132718Skan@opindex feliminate-unused-debug-symbols
3325132718SkanProduce debugging information in stabs format (if that is supported),
3326132718Skanfor only symbols that are actually used.
3327132718Skan
3328169689Skan@item -femit-class-debug-always
3329169689SkanInstead of emitting debugging information for a C++ class in only one
3330169689Skanobject file, emit it in all object files using the class.  This option
3331169689Skanshould be used only with debuggers that are unable to handle the way GCC
3332169689Skannormally emits debugging information for classes because using this
3333169689Skanoption will increase the size of debugging information by as much as a
3334169689Skanfactor of two.
3335169689Skan
333690075Sobrien@item -gstabs+
333790075Sobrien@opindex gstabs+
333890075SobrienProduce debugging information in stabs format (if that is supported),
333990075Sobrienusing GNU extensions understood only by the GNU debugger (GDB)@.  The
334090075Sobrienuse of these extensions is likely to make other debuggers crash or
334190075Sobrienrefuse to read the program.
334290075Sobrien
334390075Sobrien@item -gcoff
334490075Sobrien@opindex gcoff
334590075SobrienProduce debugging information in COFF format (if that is supported).
334690075SobrienThis is the format used by SDB on most System V systems prior to
334790075SobrienSystem V Release 4.
334890075Sobrien
334990075Sobrien@item -gxcoff
335090075Sobrien@opindex gxcoff
335190075SobrienProduce debugging information in XCOFF format (if that is supported).
335290075SobrienThis is the format used by the DBX debugger on IBM RS/6000 systems.
335390075Sobrien
335490075Sobrien@item -gxcoff+
335590075Sobrien@opindex gxcoff+
335690075SobrienProduce debugging information in XCOFF format (if that is supported),
335790075Sobrienusing GNU extensions understood only by the GNU debugger (GDB)@.  The
335890075Sobrienuse of these extensions is likely to make other debuggers crash or
335990075Sobrienrefuse to read the program, and may cause assemblers other than the GNU
336090075Sobrienassembler (GAS) to fail with an error.
336190075Sobrien
336290075Sobrien@item -gdwarf-2
336390075Sobrien@opindex gdwarf-2
336490075SobrienProduce debugging information in DWARF version 2 format (if that is
3365169689Skansupported).  This is the format used by DBX on IRIX 6.  With this
3366169689Skanoption, GCC uses features of DWARF version 3 when they are useful;
3367169689Skanversion 3 is upward compatible with version 2, but may still cause
3368169689Skanproblems for older debuggers.
336990075Sobrien
337090075Sobrien@item -gvms
337190075Sobrien@opindex gvms
337290075SobrienProduce debugging information in VMS debug format (if that is
337390075Sobriensupported).  This is the format used by DEBUG on VMS systems.
337490075Sobrien
337590075Sobrien@item -g@var{level}
337690075Sobrien@itemx -ggdb@var{level}
337790075Sobrien@itemx -gstabs@var{level}
337890075Sobrien@itemx -gcoff@var{level}
337990075Sobrien@itemx -gxcoff@var{level}
338090075Sobrien@itemx -gvms@var{level}
338190075SobrienRequest debugging information and also use @var{level} to specify how
338290075Sobrienmuch information.  The default level is 2.
338390075Sobrien
338490075SobrienLevel 1 produces minimal information, enough for making backtraces in
338590075Sobrienparts of the program that you don't plan to debug.  This includes
338690075Sobriendescriptions of functions and external variables, but no information
338790075Sobrienabout local variables and no line numbers.
338890075Sobrien
338990075SobrienLevel 3 includes extra information, such as all the macro definitions
339090075Sobrienpresent in the program.  Some debuggers support macro expansion when
339190075Sobrienyou use @option{-g3}.
339290075Sobrien
3393169689Skan@option{-gdwarf-2} does not accept a concatenated debug level, because
3394169689SkanGCC used to support an option @option{-gdwarf} that meant to generate
3395169689Skandebug information in version 1 of the DWARF format (which is very
3396169689Skandifferent from version 2), and it would have been too confusing.  That
3397169689Skandebug format is long obsolete, but the option cannot be changed now.
3398169689SkanInstead use an additional @option{-g@var{level}} option to change the
3399169689Skandebug level for DWARF2.
340096263Sobrien
3401117395Skan@item -feliminate-dwarf2-dups
3402117395Skan@opindex feliminate-dwarf2-dups
3403117395SkanCompress DWARF2 debugging information by eliminating duplicated
3404117395Skaninformation about each symbol.  This option only makes sense when
3405117395Skangenerating DWARF2 debugging information with @option{-gdwarf-2}.
3406117395Skan
3407117395Skan@cindex @command{prof}
340890075Sobrien@item -p
340990075Sobrien@opindex p
341090075SobrienGenerate extra code to write profile information suitable for the
3411117395Skananalysis program @command{prof}.  You must use this option when compiling
341290075Sobrienthe source files you want data about, and you must also use it when
341390075Sobrienlinking.
341490075Sobrien
3415117395Skan@cindex @command{gprof}
341690075Sobrien@item -pg
341790075Sobrien@opindex pg
341890075SobrienGenerate extra code to write profile information suitable for the
3419117395Skananalysis program @command{gprof}.  You must use this option when compiling
342090075Sobrienthe source files you want data about, and you must also use it when
342190075Sobrienlinking.
342290075Sobrien
342390075Sobrien@item -Q
342490075Sobrien@opindex Q
342590075SobrienMakes the compiler print out each function name as it is compiled, and
342690075Sobrienprint some statistics about each pass when it finishes.
342790075Sobrien
342890075Sobrien@item -ftime-report
342990075Sobrien@opindex ftime-report
343090075SobrienMakes the compiler print some statistics about the time consumed by each
343190075Sobrienpass when it finishes.
343290075Sobrien
343390075Sobrien@item -fmem-report
343490075Sobrien@opindex fmem-report
343590075SobrienMakes the compiler print some statistics about permanent memory
343690075Sobrienallocation when it finishes.
343790075Sobrien
343890075Sobrien@item -fprofile-arcs
343990075Sobrien@opindex fprofile-arcs
3440132718SkanAdd code so that program flow @dfn{arcs} are instrumented.  During
3441132718Skanexecution the program records how many times each branch and call is
3442132718Skanexecuted and how many times it is taken or returns.  When the compiled
3443132718Skanprogram exits it saves this data to a file called
3444169689Skan@file{@var{auxname}.gcda} for each source file.  The data may be used for
3445132718Skanprofile-directed optimizations (@option{-fbranch-probabilities}), or for
3446169689Skantest coverage analysis (@option{-ftest-coverage}).  Each object file's
3447132718Skan@var{auxname} is generated from the name of the output file, if
3448132718Skanexplicitly specified and it is not the final executable, otherwise it is
3449169689Skanthe basename of the source file.  In both cases any suffix is removed
3450169689Skan(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
3451132718Skan@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
3452169689Skan@xref{Cross-profiling}.
345390075Sobrien
3454169689Skan@cindex @command{gcov}
3455169689Skan@item --coverage
3456169689Skan@opindex coverage
3457169689Skan
3458169689SkanThis option is used to compile and link code instrumented for coverage
3459169689Skananalysis.  The option is a synonym for @option{-fprofile-arcs}
3460169689Skan@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
3461169689Skanlinking).  See the documentation for those options for more details.
3462169689Skan
3463132718Skan@itemize
3464132718Skan
3465132718Skan@item
3466132718SkanCompile the source files with @option{-fprofile-arcs} plus optimization
3467169689Skanand code generation options.  For test coverage analysis, use the
3468169689Skanadditional @option{-ftest-coverage} option.  You do not need to profile
3469132718Skanevery source file in a program.
3470132718Skan
3471132718Skan@item
3472132718SkanLink your object files with @option{-lgcov} or @option{-fprofile-arcs}
3473132718Skan(the latter implies the former).
3474132718Skan
3475132718Skan@item
3476132718SkanRun the program on a representative workload to generate the arc profile
3477169689Skaninformation.  This may be repeated any number of times.  You can run
3478132718Skanconcurrent instances of your program, and provided that the file system
3479169689Skansupports locking, the data files will be correctly updated.  Also
3480132718Skan@code{fork} calls are detected and correctly handled (double counting
3481132718Skanwill not happen).
3482132718Skan
3483132718Skan@item
3484132718SkanFor profile-directed optimizations, compile the source files again with
3485132718Skanthe same optimization and code generation options plus
348690075Sobrien@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
348790075SobrienControl Optimization}).
348890075Sobrien
3489132718Skan@item
3490132718SkanFor test coverage analysis, use @command{gcov} to produce human readable
3491169689Skaninformation from the @file{.gcno} and @file{.gcda} files.  Refer to the
3492132718Skan@command{gcov} documentation for further information.
349390075Sobrien
3494132718Skan@end itemize
3495132718Skan
349690075SobrienWith @option{-fprofile-arcs}, for each function of your program GCC
349790075Sobriencreates a program flow graph, then finds a spanning tree for the graph.
349890075SobrienOnly arcs that are not on the spanning tree have to be instrumented: the
349990075Sobriencompiler adds code to count the number of times that these arcs are
350090075Sobrienexecuted.  When an arc is the only exit or only entrance to a block, the
350190075Sobrieninstrumentation code can be added to the block; otherwise, a new basic
350290075Sobrienblock must be created to hold the instrumentation code.
350390075Sobrien
350490075Sobrien@need 2000
350590075Sobrien@item -ftest-coverage
350690075Sobrien@opindex ftest-coverage
3507132718SkanProduce a notes file that the @command{gcov} code-coverage utility
3508132718Skan(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
3509169689Skanshow program coverage.  Each source file's note file is called
3510169689Skan@file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
3511132718Skanabove for a description of @var{auxname} and instructions on how to
3512169689Skangenerate test coverage data.  Coverage data will match the source files
3513132718Skanmore closely, if you do not optimize.
351490075Sobrien
351590075Sobrien@item -d@var{letters}
3516169689Skan@item -fdump-rtl-@var{pass}
351790075Sobrien@opindex d
351890075SobrienSays to make debugging dumps during compilation at times specified by
3519169689Skan@var{letters}.    This is used for debugging the RTL-based passes of the
3520169689Skancompiler.  The file names for most of the dumps are made by appending a
3521169689Skanpass number and a word to the @var{dumpname}.  @var{dumpname} is generated
3522169689Skanfrom the name of the output file, if explicitly specified and it is not
3523169689Skanan executable, otherwise it is the basename of the source file.
352490075Sobrien
3525169689SkanMost debug dumps can be enabled either passing a letter to the @option{-d}
3526169689Skanoption, or with a long @option{-fdump-rtl} switch; here are the possible
3527169689Skanletters for use in @var{letters} and @var{pass}, and their meanings:
3528169689Skan
3529169689Skan@table @gcctabopt
3530169689Skan@item -dA
353190075Sobrien@opindex dA
353290075SobrienAnnotate the assembler output with miscellaneous debugging information.
3533169689Skan
3534169689Skan@item -dB
3535169689Skan@itemx -fdump-rtl-bbro
353690075Sobrien@opindex dB
3537169689Skan@opindex fdump-rtl-bbro
3538169689SkanDump after block reordering, to @file{@var{file}.148r.bbro}.
3539169689Skan
3540169689Skan@item -dc
3541169689Skan@itemx -fdump-rtl-combine
354290075Sobrien@opindex dc
3543169689Skan@opindex fdump-rtl-combine
3544169689SkanDump after instruction combination, to the file @file{@var{file}.129r.combine}.
3545169689Skan
3546169689Skan@item -dC
3547169689Skan@itemx -fdump-rtl-ce1
3548169689Skan@itemx -fdump-rtl-ce2
354990075Sobrien@opindex dC
3550169689Skan@opindex fdump-rtl-ce1
3551169689Skan@opindex fdump-rtl-ce2
3552169689Skan@option{-dC} and @option{-fdump-rtl-ce1} enable dumping after the
3553169689Skanfirst if conversion, to the file @file{@var{file}.117r.ce1}.  @option{-dC}
3554169689Skanand @option{-fdump-rtl-ce2} enable dumping after the second if
3555169689Skanconversion, to the file @file{@var{file}.130r.ce2}.
3556169689Skan
3557169689Skan@item -dd
3558169689Skan@itemx -fdump-rtl-btl
3559169689Skan@itemx -fdump-rtl-dbr
356090075Sobrien@opindex dd
3561169689Skan@opindex fdump-rtl-btl
3562169689Skan@opindex fdump-rtl-dbr
3563169689Skan@option{-dd} and @option{-fdump-rtl-btl} enable dumping after branch
3564169689Skantarget load optimization, to @file{@var{file}.31.btl}.  @option{-dd}
3565169689Skanand @option{-fdump-rtl-dbr} enable dumping after delayed branch
3566169689Skanscheduling, to @file{@var{file}.36.dbr}.
3567169689Skan
3568169689Skan@item -dD
356990075Sobrien@opindex dD
357090075SobrienDump all macro definitions, at the end of preprocessing, in addition to
357190075Sobriennormal output.
3572169689Skan
3573169689Skan@item -dE
3574169689Skan@itemx -fdump-rtl-ce3
357590075Sobrien@opindex dE
3576169689Skan@opindex fdump-rtl-ce3
3577169689SkanDump after the third if conversion, to @file{@var{file}.146r.ce3}.
3578169689Skan
3579169689Skan@item -df
3580169689Skan@itemx -fdump-rtl-cfg
3581169689Skan@itemx -fdump-rtl-life
358290075Sobrien@opindex df
3583169689Skan@opindex fdump-rtl-cfg
3584169689Skan@opindex fdump-rtl-life
3585169689Skan@option{-df} and @option{-fdump-rtl-cfg} enable dumping after control
3586169689Skanand data flow analysis, to @file{@var{file}.116r.cfg}.  @option{-df}
3587169689Skanand @option{-fdump-rtl-cfg} enable dumping dump after life analysis,
3588169689Skanto @file{@var{file}.128r.life1} and @file{@var{file}.135r.life2}.
3589169689Skan
3590169689Skan@item -dg
3591169689Skan@itemx -fdump-rtl-greg
359290075Sobrien@opindex dg
3593169689Skan@opindex fdump-rtl-greg
3594169689SkanDump after global register allocation, to @file{@var{file}.139r.greg}.
3595169689Skan
3596169689Skan@item -dG
3597169689Skan@itemx -fdump-rtl-gcse
3598169689Skan@itemx -fdump-rtl-bypass
3599117395Skan@opindex dG
3600169689Skan@opindex fdump-rtl-gcse
3601169689Skan@opindex fdump-rtl-bypass
3602169689Skan@option{-dG} and @option{-fdump-rtl-gcse} enable dumping after GCSE, to
3603169689Skan@file{@var{file}.114r.gcse}.  @option{-dG} and @option{-fdump-rtl-bypass}
3604169689Skanenable dumping after jump bypassing and control flow optimizations, to
3605169689Skan@file{@var{file}.115r.bypass}.
3606169689Skan
3607169689Skan@item -dh
3608169689Skan@itemx -fdump-rtl-eh
360990075Sobrien@opindex dh
3610169689Skan@opindex fdump-rtl-eh
3611169689SkanDump after finalization of EH handling code, to @file{@var{file}.02.eh}.
3612169689Skan
3613169689Skan@item -di
3614169689Skan@itemx -fdump-rtl-sibling
361590075Sobrien@opindex di
3616169689Skan@opindex fdump-rtl-sibling
3617169689SkanDump after sibling call optimizations, to @file{@var{file}.106r.sibling}.
3618169689Skan
3619169689Skan@item -dj
3620169689Skan@itemx -fdump-rtl-jump
362190075Sobrien@opindex dj
3622169689Skan@opindex fdump-rtl-jump
3623169689SkanDump after the first jump optimization, to @file{@var{file}.112r.jump}.
3624169689Skan
3625169689Skan@item -dk
3626169689Skan@itemx -fdump-rtl-stack
362790075Sobrien@opindex dk
3628169689Skan@opindex fdump-rtl-stack
3629169689SkanDump after conversion from registers to stack, to @file{@var{file}.152r.stack}.
3630169689Skan
3631169689Skan@item -dl
3632169689Skan@itemx -fdump-rtl-lreg
363390075Sobrien@opindex dl
3634169689Skan@opindex fdump-rtl-lreg
3635169689SkanDump after local register allocation, to @file{@var{file}.138r.lreg}.
3636169689Skan
3637169689Skan@item -dL
3638169689Skan@itemx -fdump-rtl-loop2
363990075Sobrien@opindex dL
3640169689Skan@opindex fdump-rtl-loop2
3641169689Skan@option{-dL} and @option{-fdump-rtl-loop2} enable dumping after the
3642169689Skanloop optimization pass, to @file{@var{file}.119r.loop2},
3643169689Skan@file{@var{file}.120r.loop2_init},
3644169689Skan@file{@var{file}.121r.loop2_invariant}, and
3645169689Skan@file{@var{file}.125r.loop2_done}.
3646169689Skan
3647169689Skan@item -dm
3648169689Skan@itemx -fdump-rtl-sms
3649169689Skan@opindex dm
3650169689Skan@opindex fdump-rtl-sms
3651169689SkanDump after modulo scheduling, to @file{@var{file}.136r.sms}.
3652169689Skan
3653169689Skan@item -dM
3654169689Skan@itemx -fdump-rtl-mach
365590075Sobrien@opindex dM
3656169689Skan@opindex fdump-rtl-mach
3657117395SkanDump after performing the machine dependent reorganization pass, to
3658169689Skan@file{@var{file}.155r.mach}.
3659169689Skan
3660169689Skan@item -dn
3661169689Skan@itemx -fdump-rtl-rnreg
366290075Sobrien@opindex dn
3663169689Skan@opindex fdump-rtl-rnreg
3664169689SkanDump after register renumbering, to @file{@var{file}.147r.rnreg}.
3665169689Skan
3666169689Skan@item -dN
3667169689Skan@itemx -fdump-rtl-regmove
366890075Sobrien@opindex dN
3669169689Skan@opindex fdump-rtl-regmove
3670169689SkanDump after the register move pass, to @file{@var{file}.132r.regmove}.
3671169689Skan
3672169689Skan@item -do
3673169689Skan@itemx -fdump-rtl-postreload
3674117395Skan@opindex do
3675169689Skan@opindex fdump-rtl-postreload
3676169689SkanDump after post-reload optimizations, to @file{@var{file}.24.postreload}.
3677169689Skan
3678169689Skan@item -dr
3679169689Skan@itemx -fdump-rtl-expand
368090075Sobrien@opindex dr
3681169689Skan@opindex fdump-rtl-expand
3682169689SkanDump after RTL generation, to @file{@var{file}.104r.expand}.
3683169689Skan
3684169689Skan@item -dR
3685169689Skan@itemx -fdump-rtl-sched2
368690075Sobrien@opindex dR
3687169689Skan@opindex fdump-rtl-sched2
3688169689SkanDump after the second scheduling pass, to @file{@var{file}.150r.sched2}.
3689169689Skan
3690169689Skan@item -ds
3691169689Skan@itemx -fdump-rtl-cse
369290075Sobrien@opindex ds
3693169689Skan@opindex fdump-rtl-cse
369490075SobrienDump after CSE (including the jump optimization that sometimes follows
3695169689SkanCSE), to @file{@var{file}.113r.cse}.
3696169689Skan
3697169689Skan@item -dS
3698169689Skan@itemx -fdump-rtl-sched
369990075Sobrien@opindex dS
3700169689Skan@opindex fdump-rtl-sched
3701169689SkanDump after the first scheduling pass, to @file{@var{file}.21.sched}.
3702169689Skan
3703169689Skan@item -dt
3704169689Skan@itemx -fdump-rtl-cse2
370590075Sobrien@opindex dt
3706169689Skan@opindex fdump-rtl-cse2
370790075SobrienDump after the second CSE pass (including the jump optimization that
3708169689Skansometimes follows CSE), to @file{@var{file}.127r.cse2}.
3709169689Skan
3710169689Skan@item -dT
3711169689Skan@itemx -fdump-rtl-tracer
3712117395Skan@opindex dT
3713169689Skan@opindex fdump-rtl-tracer
3714169689SkanDump after running tracer, to @file{@var{file}.118r.tracer}.
3715169689Skan
3716169689Skan@item -dV
3717169689Skan@itemx -fdump-rtl-vpt
3718169689Skan@itemx -fdump-rtl-vartrack
3719132718Skan@opindex dV
3720169689Skan@opindex fdump-rtl-vpt
3721169689Skan@opindex fdump-rtl-vartrack
3722169689Skan@option{-dV} and @option{-fdump-rtl-vpt} enable dumping after the value
3723169689Skanprofile transformations, to @file{@var{file}.10.vpt}.  @option{-dV}
3724169689Skanand @option{-fdump-rtl-vartrack} enable dumping after variable tracking,
3725169689Skanto @file{@var{file}.154r.vartrack}.
3726169689Skan
3727169689Skan@item -dw
3728169689Skan@itemx -fdump-rtl-flow2
372990075Sobrien@opindex dw
3730169689Skan@opindex fdump-rtl-flow2
3731169689SkanDump after the second flow pass, to @file{@var{file}.142r.flow2}.
3732169689Skan
3733169689Skan@item -dz
3734169689Skan@itemx -fdump-rtl-peephole2
373590075Sobrien@opindex dz
3736169689Skan@opindex fdump-rtl-peephole2
3737169689SkanDump after the peephole pass, to @file{@var{file}.145r.peephole2}.
3738169689Skan
3739169689Skan@item -dZ
3740169689Skan@itemx -fdump-rtl-web
3741132718Skan@opindex dZ
3742169689Skan@opindex fdump-rtl-web
3743169689SkanDump after live range splitting, to @file{@var{file}.126r.web}.
3744169689Skan
3745169689Skan@item -da
3746169689Skan@itemx -fdump-rtl-all
374790075Sobrien@opindex da
3748169689Skan@opindex fdump-rtl-all
374990075SobrienProduce all the dumps listed above.
3750169689Skan
3751169689Skan@item -dH
3752132718Skan@opindex dH
3753132718SkanProduce a core dump whenever an error occurs.
3754169689Skan
3755169689Skan@item -dm
375690075Sobrien@opindex dm
375790075SobrienPrint statistics on memory usage, at the end of the run, to
375890075Sobrienstandard error.
3759169689Skan
3760169689Skan@item -dp
376190075Sobrien@opindex dp
376290075SobrienAnnotate the assembler output with a comment indicating which
376390075Sobrienpattern and alternative was used.  The length of each instruction is
376490075Sobrienalso printed.
3765169689Skan
3766169689Skan@item -dP
376790075Sobrien@opindex dP
376890075SobrienDump the RTL in the assembler output as a comment before each instruction.
376990075SobrienAlso turns on @option{-dp} annotation.
3770169689Skan
3771169689Skan@item -dv
377290075Sobrien@opindex dv
3773169689SkanFor each of the other indicated dump files (either with @option{-d} or
3774169689Skan@option{-fdump-rtl-@var{pass}}), dump a representation of the control flow
3775169689Skangraph suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
3776169689Skan
3777169689Skan@item -dx
377890075Sobrien@opindex dx
377990075SobrienJust generate RTL for a function instead of compiling it.  Usually used
3780169689Skanwith @samp{r} (@option{-fdump-rtl-expand}).
3781169689Skan
3782169689Skan@item -dy
378390075Sobrien@opindex dy
378490075SobrienDump debugging information during parsing, to standard error.
378590075Sobrien@end table
378690075Sobrien
3787169689Skan@item -fdump-noaddr
3788169689Skan@opindex fdump-noaddr
3789169689SkanWhen doing debugging dumps (see @option{-d} option above), suppress
3790169689Skanaddress output.  This makes it more feasible to use diff on debugging
3791169689Skandumps for compiler invocations with different compiler binaries and/or
3792169689Skandifferent text / bss / data / heap / stack / dso start locations.
3793169689Skan
379490075Sobrien@item -fdump-unnumbered
379590075Sobrien@opindex fdump-unnumbered
379690075SobrienWhen doing debugging dumps (see @option{-d} option above), suppress instruction
3797169689Skannumbers, line number note and address output.  This makes it more feasible to
379890075Sobrienuse diff on debugging dumps for compiler invocations with different
379990075Sobrienoptions, in particular with and without @option{-g}.
380090075Sobrien
3801169689Skan@item -fdump-translation-unit @r{(C++ only)}
3802169689Skan@itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
380390075Sobrien@opindex fdump-translation-unit
380490075SobrienDump a representation of the tree structure for the entire translation
380590075Sobrienunit to a file.  The file name is made by appending @file{.tu} to the
380690075Sobriensource file name.  If the @samp{-@var{options}} form is used, @var{options}
380790075Sobriencontrols the details of the dump as described for the
380890075Sobrien@option{-fdump-tree} options.
380990075Sobrien
381090075Sobrien@item -fdump-class-hierarchy @r{(C++ only)}
381190075Sobrien@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
381290075Sobrien@opindex fdump-class-hierarchy
381390075SobrienDump a representation of each class's hierarchy and virtual function
381490075Sobrientable layout to a file.  The file name is made by appending @file{.class}
381590075Sobriento the source file name.  If the @samp{-@var{options}} form is used,
381690075Sobrien@var{options} controls the details of the dump as described for the
381790075Sobrien@option{-fdump-tree} options.
381890075Sobrien
3819169689Skan@item -fdump-ipa-@var{switch}
3820169689Skan@opindex fdump-ipa
3821169689SkanControl the dumping at various stages of inter-procedural analysis
3822169689Skanlanguage tree to a file.  The file name is generated by appending a switch
3823169689Skanspecific suffix to the source file name.  The following dumps are possible:
3824169689Skan
3825169689Skan@table @samp
3826169689Skan@item all
3827169689SkanEnables all inter-procedural analysis dumps; currently the only produced
3828169689Skandump is the @samp{cgraph} dump.
3829169689Skan
3830169689Skan@item cgraph
3831169689SkanDumps information about call-graph optimization, unused function removal,
3832169689Skanand inlining decisions.
3833169689Skan@end table
3834169689Skan
3835169689Skan@item -fdump-tree-@var{switch}
3836169689Skan@itemx -fdump-tree-@var{switch}-@var{options}
383790075Sobrien@opindex fdump-tree
383890075SobrienControl the dumping at various stages of processing the intermediate
383990075Sobrienlanguage tree to a file.  The file name is generated by appending a switch
384090075Sobrienspecific suffix to the source file name.  If the @samp{-@var{options}}
384190075Sobrienform is used, @var{options} is a list of @samp{-} separated options that
3842169689Skancontrol the details of the dump.  Not all options are applicable to all
3843169689Skandumps, those which are not meaningful will be ignored.  The following
384490075Sobrienoptions are available
384590075Sobrien
384690075Sobrien@table @samp
384790075Sobrien@item address
384890075SobrienPrint the address of each node.  Usually this is not meaningful as it
3849169689Skanchanges according to the environment and source file.  Its primary use
385090075Sobrienis for tying up a dump file with a debug environment.
385190075Sobrien@item slim
385290075SobrienInhibit dumping of members of a scope or body of a function merely
3853169689Skanbecause that scope has been reached.  Only dump such items when they
3854169689Skanare directly reachable by some other path.  When dumping pretty-printed
3855169689Skantrees, this option inhibits dumping the bodies of control structures.
3856169689Skan@item raw
3857169689SkanPrint a raw representation of the tree.  By default, trees are
3858169689Skanpretty-printed into a C-like representation.
3859169689Skan@item details
3860169689SkanEnable more detailed dumps (not honored by every dump option).
3861169689Skan@item stats
3862169689SkanEnable dumping various statistics about the pass (not honored by every dump
3863169689Skanoption).
3864169689Skan@item blocks
3865169689SkanEnable showing basic block boundaries (disabled in raw dumps).
3866169689Skan@item vops
3867169689SkanEnable showing virtual operands for every statement.
3868169689Skan@item lineno
3869169689SkanEnable showing line numbers for statements.
3870169689Skan@item uid
3871169689SkanEnable showing the unique ID (@code{DECL_UID}) for each variable.
387290075Sobrien@item all
3873169689SkanTurn on all options, except @option{raw}, @option{slim} and @option{lineno}.
387490075Sobrien@end table
387590075Sobrien
387690075SobrienThe following tree dumps are possible:
387790075Sobrien@table @samp
3878169689Skan
387990075Sobrien@item original
388090075SobrienDump before any tree based optimization, to @file{@var{file}.original}.
3881169689Skan
388290075Sobrien@item optimized
388390075SobrienDump after all tree based optimization, to @file{@var{file}.optimized}.
3884169689Skan
388590075Sobrien@item inlined
388690075SobrienDump after function inlining, to @file{@var{file}.inlined}.
3887169689Skan
3888169689Skan@item gimple
3889169689Skan@opindex fdump-tree-gimple
3890169689SkanDump each function before and after the gimplification pass to a file.  The
3891169689Skanfile name is made by appending @file{.gimple} to the source file name.
3892169689Skan
3893169689Skan@item cfg
3894169689Skan@opindex fdump-tree-cfg
3895169689SkanDump the control flow graph of each function to a file.  The file name is
3896169689Skanmade by appending @file{.cfg} to the source file name.
3897169689Skan
3898169689Skan@item vcg
3899169689Skan@opindex fdump-tree-vcg
3900169689SkanDump the control flow graph of each function to a file in VCG format.  The
3901169689Skanfile name is made by appending @file{.vcg} to the source file name.  Note
3902169689Skanthat if the file contains more than one function, the generated file cannot
3903169689Skanbe used directly by VCG@.  You will need to cut and paste each function's
3904169689Skangraph into its own separate file first.
3905169689Skan
3906169689Skan@item ch
3907169689Skan@opindex fdump-tree-ch
3908169689SkanDump each function after copying loop headers.  The file name is made by
3909169689Skanappending @file{.ch} to the source file name.
3910169689Skan
3911169689Skan@item ssa
3912169689Skan@opindex fdump-tree-ssa
3913169689SkanDump SSA related information to a file.  The file name is made by appending
3914169689Skan@file{.ssa} to the source file name.
3915169689Skan
3916169689Skan@item salias
3917169689Skan@opindex fdump-tree-salias
3918169689SkanDump structure aliasing variable information to a file.  This file name
3919169689Skanis made by appending @file{.salias} to the source file name.
3920169689Skan
3921169689Skan@item alias
3922169689Skan@opindex fdump-tree-alias
3923169689SkanDump aliasing information for each function.  The file name is made by
3924169689Skanappending @file{.alias} to the source file name.
3925169689Skan
3926169689Skan@item ccp
3927169689Skan@opindex fdump-tree-ccp
3928169689SkanDump each function after CCP@.  The file name is made by appending
3929169689Skan@file{.ccp} to the source file name.
3930169689Skan
3931169689Skan@item storeccp
3932169689Skan@opindex fdump-tree-storeccp
3933169689SkanDump each function after STORE-CCP.  The file name is made by appending
3934169689Skan@file{.storeccp} to the source file name.
3935169689Skan
3936169689Skan@item pre
3937169689Skan@opindex fdump-tree-pre
3938169689SkanDump trees after partial redundancy elimination.  The file name is made
3939169689Skanby appending @file{.pre} to the source file name.
3940169689Skan
3941169689Skan@item fre
3942169689Skan@opindex fdump-tree-fre
3943169689SkanDump trees after full redundancy elimination.  The file name is made
3944169689Skanby appending @file{.fre} to the source file name.
3945169689Skan
3946169689Skan@item copyprop
3947169689Skan@opindex fdump-tree-copyprop
3948169689SkanDump trees after copy propagation.  The file name is made
3949169689Skanby appending @file{.copyprop} to the source file name.
3950169689Skan
3951169689Skan@item store_copyprop
3952169689Skan@opindex fdump-tree-store_copyprop
3953169689SkanDump trees after store copy-propagation.  The file name is made
3954169689Skanby appending @file{.store_copyprop} to the source file name.
3955169689Skan
3956169689Skan@item dce
3957169689Skan@opindex fdump-tree-dce
3958169689SkanDump each function after dead code elimination.  The file name is made by
3959169689Skanappending @file{.dce} to the source file name.
3960169689Skan
3961169689Skan@item mudflap
3962169689Skan@opindex fdump-tree-mudflap
3963169689SkanDump each function after adding mudflap instrumentation.  The file name is
3964169689Skanmade by appending @file{.mudflap} to the source file name.
3965169689Skan
3966169689Skan@item sra
3967169689Skan@opindex fdump-tree-sra
3968169689SkanDump each function after performing scalar replacement of aggregates.  The
3969169689Skanfile name is made by appending @file{.sra} to the source file name.
3970169689Skan
3971169689Skan@item sink
3972169689Skan@opindex fdump-tree-sink
3973169689SkanDump each function after performing code sinking.  The file name is made
3974169689Skanby appending @file{.sink} to the source file name. 
3975169689Skan
3976169689Skan@item dom
3977169689Skan@opindex fdump-tree-dom
3978169689SkanDump each function after applying dominator tree optimizations.  The file
3979169689Skanname is made by appending @file{.dom} to the source file name.
3980169689Skan
3981169689Skan@item dse
3982169689Skan@opindex fdump-tree-dse
3983169689SkanDump each function after applying dead store elimination.  The file
3984169689Skanname is made by appending @file{.dse} to the source file name.
3985169689Skan
3986169689Skan@item phiopt
3987169689Skan@opindex fdump-tree-phiopt
3988169689SkanDump each function after optimizing PHI nodes into straightline code.  The file
3989169689Skanname is made by appending @file{.phiopt} to the source file name.
3990169689Skan
3991169689Skan@item forwprop
3992169689Skan@opindex fdump-tree-forwprop
3993169689SkanDump each function after forward propagating single use variables.  The file
3994169689Skanname is made by appending @file{.forwprop} to the source file name.
3995169689Skan
3996169689Skan@item copyrename
3997169689Skan@opindex fdump-tree-copyrename
3998169689SkanDump each function after applying the copy rename optimization.  The file
3999169689Skanname is made by appending @file{.copyrename} to the source file name.
4000169689Skan
4001169689Skan@item nrv
4002169689Skan@opindex fdump-tree-nrv
4003169689SkanDump each function after applying the named return value optimization on
4004169689Skangeneric trees.  The file name is made by appending @file{.nrv} to the source
4005169689Skanfile name.
4006169689Skan
4007169689Skan@item vect
4008169689Skan@opindex fdump-tree-vect
4009169689SkanDump each function after applying vectorization of loops.  The file name is
4010169689Skanmade by appending @file{.vect} to the source file name.
4011169689Skan
4012169689Skan@item vrp
4013169689Skan@opindex fdump-tree-vrp
4014169689SkanDump each function after Value Range Propagation (VRP).  The file name
4015169689Skanis made by appending @file{.vrp} to the source file name.
4016169689Skan
4017169689Skan@item all
4018169689Skan@opindex fdump-tree-all
4019169689SkanEnable all the available tree dumps with the flags provided in this option.
402090075Sobrien@end table
402190075Sobrien
4022169689Skan@item -ftree-vectorizer-verbose=@var{n}
4023169689Skan@opindex ftree-vectorizer-verbose
4024169689SkanThis option controls the amount of debugging output the vectorizer prints.
4025169689SkanThis information is written to standard error, unless 
4026169689Skan@option{-fdump-tree-all} or @option{-fdump-tree-vect} is specified, 
4027169689Skanin which case it is output to the usual dump listing file, @file{.vect}.
4028169689SkanFor @var{n}=0 no diagnostic information is reported.
4029169689SkanIf @var{n}=1 the vectorizer reports each loop that got vectorized, 
4030169689Skanand the total number of loops that got vectorized.
4031169689SkanIf @var{n}=2 the vectorizer also reports non-vectorized loops that passed 
4032169689Skanthe first analysis phase (vect_analyze_loop_form) - i.e. countable, 
4033169689Skaninner-most, single-bb, single-entry/exit loops.  This is the same verbosity 
4034169689Skanlevel that @option{-fdump-tree-vect-stats} uses.
4035169689SkanHigher verbosity levels mean either more information dumped for each 
4036169689Skanreported loop, or same amount of information reported for more loops:
4037169689SkanIf @var{n}=3, alignment related information is added to the reports.
4038169689SkanIf @var{n}=4, data-references related information (e.g. memory dependences, 
4039169689Skanmemory access-patterns) is added to the reports.
4040169689SkanIf @var{n}=5, the vectorizer reports also non-vectorized inner-most loops 
4041169689Skanthat did not pass the first analysis phase (i.e. may not be countable, or 
4042169689Skanmay have complicated control-flow).
4043169689SkanIf @var{n}=6, the vectorizer reports also non-vectorized nested loops.
4044169689SkanFor @var{n}=7, all the information the vectorizer generates during its 
4045169689Skananalysis and transformation is reported.  This is the same verbosity level
4046169689Skanthat @option{-fdump-tree-vect-details} uses.
4047169689Skan
4048117395Skan@item -frandom-seed=@var{string}
4049117395Skan@opindex frandom-string
4050117395SkanThis option provides a seed that GCC uses when it would otherwise use
4051132718Skanrandom numbers.  It is used to generate certain symbol names
4052169689Skanthat have to be different in every compiled file.  It is also used to
4053132718Skanplace unique stamps in coverage data files and the object files that
4054169689Skanproduce them.  You can use the @option{-frandom-seed} option to produce
4055132718Skanreproducibly identical object files.
4056117395Skan
4057117395SkanThe @var{string} should be different for every file you compile.
4058117395Skan
4059107590Sobrien@item -fsched-verbose=@var{n}
4060107590Sobrien@opindex fsched-verbose
4061107590SobrienOn targets that use instruction scheduling, this option controls the
4062107590Sobrienamount of debugging output the scheduler prints.  This information is
4063107590Sobrienwritten to standard error, unless @option{-dS} or @option{-dR} is
4064107590Sobrienspecified, in which case it is output to the usual dump
4065107590Sobrienlisting file, @file{.sched} or @file{.sched2} respectively.  However
4066107590Sobrienfor @var{n} greater than nine, the output is always printed to standard
4067107590Sobrienerror.
4068107590Sobrien
4069107590SobrienFor @var{n} greater than zero, @option{-fsched-verbose} outputs the
4070107590Sobriensame information as @option{-dRS}.  For @var{n} greater than one, it
4071107590Sobrienalso output basic block probabilities, detailed ready list information
4072107590Sobrienand unit/insn info.  For @var{n} greater than two, it includes RTL
4073107590Sobrienat abort point, control-flow and regions info.  And for @var{n} over
4074107590Sobrienfour, @option{-fsched-verbose} also includes dependence info.
4075107590Sobrien
407690075Sobrien@item -save-temps
407790075Sobrien@opindex save-temps
407890075SobrienStore the usual ``temporary'' intermediate files permanently; place them
407990075Sobrienin the current directory and name them based on the source file.  Thus,
408090075Sobriencompiling @file{foo.c} with @samp{-c -save-temps} would produce files
408190075Sobrien@file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
408290075Sobrienpreprocessed @file{foo.i} output file even though the compiler now
408390075Sobriennormally uses an integrated preprocessor.
408490075Sobrien
4085169689SkanWhen used in combination with the @option{-x} command line option,
4086169689Skan@option{-save-temps} is sensible enough to avoid over writing an
4087169689Skaninput source file with the same extension as an intermediate file.
4088169689SkanThe corresponding intermediate file may be obtained by renaming the
4089169689Skansource file before using @option{-save-temps}.
4090169689Skan
409190075Sobrien@item -time
409290075Sobrien@opindex time
409390075SobrienReport the CPU time taken by each subprocess in the compilation
409490075Sobriensequence.  For C source files, this is the compiler proper and assembler
409590075Sobrien(plus the linker if linking is done).  The output looks like this:
409690075Sobrien
409790075Sobrien@smallexample
409890075Sobrien# cc1 0.12 0.01
409990075Sobrien# as 0.00 0.01
410090075Sobrien@end smallexample
410190075Sobrien
4102169689SkanThe first number on each line is the ``user time'', that is time spent
4103169689Skanexecuting the program itself.  The second number is ``system time'',
410490075Sobrientime spent executing operating system routines on behalf of the program.
410590075SobrienBoth numbers are in seconds.
410690075Sobrien
4107169689Skan@item -fvar-tracking
4108169689Skan@opindex fvar-tracking
4109169689SkanRun variable tracking pass.  It computes where variables are stored at each
4110169689Skanposition in code.  Better debugging information is then generated
4111169689Skan(if the debugging information format supports this information).
4112169689Skan
4113169689SkanIt is enabled by default when compiling with optimization (@option{-Os},
4114169689Skan@option{-O}, @option{-O2}, ...), debugging information (@option{-g}) and
4115169689Skanthe debug info format supports it.
4116169689Skan
411790075Sobrien@item -print-file-name=@var{library}
411890075Sobrien@opindex print-file-name
411990075SobrienPrint the full absolute name of the library file @var{library} that
412090075Sobrienwould be used when linking---and don't do anything else.  With this
412190075Sobrienoption, GCC does not compile or link anything; it just prints the
412290075Sobrienfile name.
412390075Sobrien
412490075Sobrien@item -print-multi-directory
412590075Sobrien@opindex print-multi-directory
412690075SobrienPrint the directory name corresponding to the multilib selected by any
412790075Sobrienother switches present in the command line.  This directory is supposed
412890075Sobriento exist in @env{GCC_EXEC_PREFIX}.
412990075Sobrien
413090075Sobrien@item -print-multi-lib
413190075Sobrien@opindex print-multi-lib
413290075SobrienPrint the mapping from multilib directory names to compiler switches
413390075Sobrienthat enable them.  The directory name is separated from the switches by
413490075Sobrien@samp{;}, and each switch starts with an @samp{@@} instead of the
413590075Sobrien@samp{-}, without spaces between multiple switches.  This is supposed to
413690075Sobrienease shell-processing.
413790075Sobrien
413890075Sobrien@item -print-prog-name=@var{program}
413990075Sobrien@opindex print-prog-name
414090075SobrienLike @option{-print-file-name}, but searches for a program such as @samp{cpp}.
414190075Sobrien
414290075Sobrien@item -print-libgcc-file-name
414390075Sobrien@opindex print-libgcc-file-name
414490075SobrienSame as @option{-print-file-name=libgcc.a}.
414590075Sobrien
414690075SobrienThis is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
414790075Sobrienbut you do want to link with @file{libgcc.a}.  You can do
414890075Sobrien
4149132718Skan@smallexample
415090075Sobriengcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
4151132718Skan@end smallexample
415290075Sobrien
415390075Sobrien@item -print-search-dirs
415490075Sobrien@opindex print-search-dirs
415590075SobrienPrint the name of the configured installation directory and a list of
4156132718Skanprogram and library directories @command{gcc} will search---and don't do anything else.
415790075Sobrien
4158132718SkanThis is useful when @command{gcc} prints the error message
415990075Sobrien@samp{installation problem, cannot exec cpp0: No such file or directory}.
416090075SobrienTo resolve this you either need to put @file{cpp0} and the other compiler
4161132718Skancomponents where @command{gcc} expects to find them, or you can set the environment
416290075Sobrienvariable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
4163169689SkanDon't forget the trailing @samp{/}.
416490075Sobrien@xref{Environment Variables}.
416590075Sobrien
416690075Sobrien@item -dumpmachine
416790075Sobrien@opindex dumpmachine
416890075SobrienPrint the compiler's target machine (for example,
416990075Sobrien@samp{i686-pc-linux-gnu})---and don't do anything else.
417090075Sobrien
417190075Sobrien@item -dumpversion
417290075Sobrien@opindex dumpversion
417390075SobrienPrint the compiler version (for example, @samp{3.0})---and don't do
417490075Sobrienanything else.
417590075Sobrien
417690075Sobrien@item -dumpspecs
417790075Sobrien@opindex dumpspecs
417890075SobrienPrint the compiler's built-in specs---and don't do anything else.  (This
417990075Sobrienis used when GCC itself is being built.)  @xref{Spec Files}.
4180132718Skan
4181132718Skan@item -feliminate-unused-debug-types
4182132718Skan@opindex feliminate-unused-debug-types
4183132718SkanNormally, when producing DWARF2 output, GCC will emit debugging
4184132718Skaninformation for all types declared in a compilation
4185132718Skanunit, regardless of whether or not they are actually used
4186132718Skanin that compilation unit.  Sometimes this is useful, such as
4187132718Skanif, in the debugger, you want to cast a value to a type that is
4188132718Skannot actually used in your program (but is declared).  More often,
4189132718Skanhowever, this results in a significant amount of wasted space.
4190132718SkanWith this option, GCC will avoid producing debug symbol output
4191132718Skanfor types that are nowhere used in the source file being compiled.
419290075Sobrien@end table
419390075Sobrien
419490075Sobrien@node Optimize Options
419590075Sobrien@section Options That Control Optimization
419690075Sobrien@cindex optimize options
419790075Sobrien@cindex options, optimization
419890075Sobrien
4199117395SkanThese options control various sorts of optimizations.
420090075Sobrien
4201117395SkanWithout any optimization option, the compiler's goal is to reduce the
4202117395Skancost of compilation and to make debugging produce the expected
4203117395Skanresults.  Statements are independent: if you stop the program with a
4204117395Skanbreakpoint between statements, you can then assign a new value to any
4205117395Skanvariable or change the program counter to any other statement in the
4206117395Skanfunction and get exactly the results you would expect from the source
4207117395Skancode.
4208117395Skan
4209117395SkanTurning on optimization flags makes the compiler attempt to improve
4210117395Skanthe performance and/or code size at the expense of compilation time
4211117395Skanand possibly the ability to debug the program.
4212117395Skan
4213132718SkanThe compiler performs optimization based on the knowledge it has of
4214169689Skanthe program.  Optimization levels @option{-O} and above, in
4215169689Skanparticular, enable @emph{unit-at-a-time} mode, which allows the
4216169689Skancompiler to consider information gained from later functions in
4217169689Skanthe file when compiling a function.  Compiling multiple files at
4218169689Skanonce to a single output file in @emph{unit-at-a-time} mode allows
4219132718Skanthe compiler to use information gained from all of the files when
4220132718Skancompiling each of them.
4221132718Skan
4222117395SkanNot all optimizations are controlled directly by a flag.  Only
4223117395Skanoptimizations that have a flag are listed.
4224117395Skan
422590075Sobrien@table @gcctabopt
422690075Sobrien@item -O
422790075Sobrien@itemx -O1
422890075Sobrien@opindex O
422990075Sobrien@opindex O1
423090075SobrienOptimize.  Optimizing compilation takes somewhat more time, and a lot
423190075Sobrienmore memory for a large function.
423290075Sobrien
423390075SobrienWith @option{-O}, the compiler tries to reduce code size and execution
423490075Sobrientime, without performing any optimizations that take a great deal of
423590075Sobriencompilation time.
423690075Sobrien
4237132718Skan@option{-O} turns on the following optimization flags:
4238117395Skan@gccoptlist{-fdefer-pop @gol
4239169689Skan-fdelayed-branch @gol
4240169689Skan-fguess-branch-probability @gol
4241169689Skan-fcprop-registers @gol
4242117395Skan-fif-conversion @gol
4243117395Skan-fif-conversion2 @gol
4244169689Skan-ftree-ccp @gol
4245169689Skan-ftree-dce @gol
4246169689Skan-ftree-dominator-opts @gol
4247169689Skan-ftree-dse @gol
4248169689Skan-ftree-ter @gol
4249169689Skan-ftree-lrs @gol
4250169689Skan-ftree-sra @gol
4251169689Skan-ftree-copyrename @gol
4252169689Skan-ftree-fre @gol
4253169689Skan-ftree-ch @gol
4254169689Skan-funit-at-a-time @gol
4255169689Skan-fmerge-constants}
4256117395Skan
4257117395Skan@option{-O} also turns on @option{-fomit-frame-pointer} on machines
4258117395Skanwhere doing so does not interfere with debugging.
4259117395Skan
426090075Sobrien@item -O2
426190075Sobrien@opindex O2
426290075SobrienOptimize even more.  GCC performs nearly all supported optimizations
426390075Sobrienthat do not involve a space-speed tradeoff.  The compiler does not
426490075Sobrienperform loop unrolling or function inlining when you specify @option{-O2}.
426590075SobrienAs compared to @option{-O}, this option increases both compilation time
426690075Sobrienand the performance of the generated code.
426790075Sobrien
4268117395Skan@option{-O2} turns on all optimization flags specified by @option{-O}.  It
4269117395Skanalso turns on the following optimization flags:
4270169689Skan@gccoptlist{-fthread-jumps @gol
4271169689Skan-fcrossjumping @gol
4272117395Skan-foptimize-sibling-calls @gol
4273117395Skan-fcse-follow-jumps  -fcse-skip-blocks @gol
4274169689Skan-fgcse  -fgcse-lm  @gol
4275117395Skan-fexpensive-optimizations @gol
4276169689Skan-frerun-cse-after-loop  @gol
4277169689Skan-fcaller-saves @gol
4278169689Skan-fpeephole2 @gol
4279117395Skan-fschedule-insns  -fschedule-insns2 @gol
4280132718Skan-fsched-interblock  -fsched-spec @gol
4281169689Skan-fregmove @gol
4282169689Skan-fstrict-aliasing -fstrict-overflow @gol
4283169689Skan-fdelete-null-pointer-checks @gol
4284117395Skan-freorder-blocks  -freorder-functions @gol
4285117395Skan-falign-functions  -falign-jumps @gol
4286132718Skan-falign-loops  -falign-labels @gol
4287169689Skan-ftree-vrp @gol
4288169689Skan-ftree-pre}
428990075Sobrien
429090075SobrienPlease note the warning under @option{-fgcse} about
429190075Sobrieninvoking @option{-O2} on programs that use computed gotos.
429290075Sobrien
4293169689Skan@option{-O2} doesn't turn on @option{-ftree-vrp} for the Ada compiler.
4294169689SkanThis option must be explicitly specified on the command line to be
4295169689Skanenabled for the Ada compiler.
4296169689Skan
429790075Sobrien@item -O3
429890075Sobrien@opindex O3
429990075SobrienOptimize yet more.  @option{-O3} turns on all optimizations specified by
4300132718Skan@option{-O2} and also turns on the @option{-finline-functions},
4301169689Skan@option{-funswitch-loops} and @option{-fgcse-after-reload} options.
430290075Sobrien
430390075Sobrien@item -O0
430490075Sobrien@opindex O0
4305117395SkanDo not optimize.  This is the default.
430690075Sobrien
430790075Sobrien@item -Os
430890075Sobrien@opindex Os
430990075SobrienOptimize for size.  @option{-Os} enables all @option{-O2} optimizations that
431090075Sobriendo not typically increase code size.  It also performs further
431190075Sobrienoptimizations designed to reduce code size.
431290075Sobrien
4313117395Skan@option{-Os} disables the following optimization flags:
4314117395Skan@gccoptlist{-falign-functions  -falign-jumps  -falign-loops @gol
4315169689Skan-falign-labels  -freorder-blocks  -freorder-blocks-and-partition @gol
4316169689Skan-fprefetch-loop-arrays  -ftree-vect-loop-version}
4317117395Skan
431890075SobrienIf you use multiple @option{-O} options, with or without level numbers,
431990075Sobrienthe last such option is the one that is effective.
432090075Sobrien@end table
432190075Sobrien
432290075SobrienOptions of the form @option{-f@var{flag}} specify machine-independent
432390075Sobrienflags.  Most flags have both positive and negative forms; the negative
4324117395Skanform of @option{-ffoo} would be @option{-fno-foo}.  In the table
4325117395Skanbelow, only one of the forms is listed---the one you typically will
4326117395Skanuse.  You can figure out the other form by either removing @samp{no-}
4327117395Skanor adding it.
432890075Sobrien
4329117395SkanThe following options control specific optimizations.  They are either
4330117395Skanactivated by @option{-O} options or are related to ones that are.  You
4331117395Skancan use the following flags in the rare cases when ``fine-tuning'' of
4332117395Skanoptimizations to be performed is desired.
4333117395Skan
433490075Sobrien@table @gcctabopt
433590075Sobrien@item -fno-default-inline
433690075Sobrien@opindex fno-default-inline
433790075SobrienDo not make member functions inline by default merely because they are
433890075Sobriendefined inside the class scope (C++ only).  Otherwise, when you specify
433990075Sobrien@w{@option{-O}}, member functions defined inside class scope are compiled
434090075Sobrieninline by default; i.e., you don't need to add @samp{inline} in front of
434190075Sobrienthe member function name.
434290075Sobrien
434390075Sobrien@item -fno-defer-pop
434490075Sobrien@opindex fno-defer-pop
434590075SobrienAlways pop the arguments to each function call as soon as that function
434690075Sobrienreturns.  For machines which must pop arguments after a function call,
434790075Sobrienthe compiler normally lets arguments accumulate on the stack for several
434890075Sobrienfunction calls and pops them all at once.
434990075Sobrien
4350117395SkanDisabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4351117395Skan
435290075Sobrien@item -fforce-mem
435390075Sobrien@opindex fforce-mem
435490075SobrienForce memory operands to be copied into registers before doing
435590075Sobrienarithmetic on them.  This produces better code by making all memory
435690075Sobrienreferences potential common subexpressions.  When they are not common
435790075Sobriensubexpressions, instruction combination should eliminate the separate
4358169689Skanregister-load. This option is now a nop and will be removed in 4.3.
435990075Sobrien
436090075Sobrien@item -fforce-addr
436190075Sobrien@opindex fforce-addr
436290075SobrienForce memory address constants to be copied into registers before
4363169689Skandoing arithmetic on them.
436490075Sobrien
436590075Sobrien@item -fomit-frame-pointer
436690075Sobrien@opindex fomit-frame-pointer
436790075SobrienDon't keep the frame pointer in a register for functions that
436890075Sobriendon't need one.  This avoids the instructions to save, set up and
436990075Sobrienrestore frame pointers; it also makes an extra register available
437090075Sobrienin many functions.  @strong{It also makes debugging impossible on
437190075Sobriensome machines.}
437290075Sobrien
437390075SobrienOn some machines, such as the VAX, this flag has no effect, because
437490075Sobrienthe standard calling sequence automatically handles the frame pointer
437590075Sobrienand nothing is saved by pretending it doesn't exist.  The
437690075Sobrienmachine-description macro @code{FRAME_POINTER_REQUIRED} controls
437790075Sobrienwhether a target machine supports this flag.  @xref{Registers,,Register
437890075SobrienUsage, gccint, GNU Compiler Collection (GCC) Internals}.
437990075Sobrien
4380117395SkanEnabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4381117395Skan
438290075Sobrien@item -foptimize-sibling-calls
438390075Sobrien@opindex foptimize-sibling-calls
438490075SobrienOptimize sibling and tail recursive calls.
438590075Sobrien
4386117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
438790075Sobrien
438890075Sobrien@item -fno-inline
438990075Sobrien@opindex fno-inline
439090075SobrienDon't pay attention to the @code{inline} keyword.  Normally this option
439190075Sobrienis used to keep the compiler from expanding any functions inline.
439290075SobrienNote that if you are not optimizing, no functions can be expanded inline.
439390075Sobrien
439490075Sobrien@item -finline-functions
439590075Sobrien@opindex finline-functions
439690075SobrienIntegrate all simple functions into their callers.  The compiler
439790075Sobrienheuristically decides which functions are simple enough to be worth
439890075Sobrienintegrating in this way.
439990075Sobrien
440090075SobrienIf all calls to a given function are integrated, and the function is
440190075Sobriendeclared @code{static}, then the function is normally not output as
440290075Sobrienassembler code in its own right.
440390075Sobrien
4404117395SkanEnabled at level @option{-O3}.
4405117395Skan
4406169689Skan@item -finline-functions-called-once
4407169689Skan@opindex finline-functions-called-once
4408169689SkanConsider all @code{static} functions called once for inlining into their
4409169689Skancaller even if they are not marked @code{inline}.  If a call to a given
4410169689Skanfunction is integrated, then the function is not output as assembler code
4411169689Skanin its own right.
4412169689Skan
4413169689SkanEnabled if @option{-funit-at-a-time} is enabled.
4414169689Skan
4415169689Skan@item -fearly-inlining
4416169689Skan@opindex fearly-inlining
4417169689SkanInline functions marked by @code{always_inline} and functions whose body seems
4418169689Skansmaller than the function call overhead early before doing
4419169689Skan@option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
4420169689Skanmakes profiling significantly cheaper and usually inlining faster on programs
4421169689Skanhaving large chains of nested wrapper functions.
4422169689Skan
4423169689SkanEnabled by default.
4424169689Skan
442590075Sobrien@item -finline-limit=@var{n}
442690075Sobrien@opindex finline-limit
4427132718SkanBy default, GCC limits the size of functions that can be inlined.  This flag
442890075Sobrienallows the control of this limit for functions that are explicitly marked as
4429117395Skaninline (i.e., marked with the inline keyword or defined within the class
443090075Sobriendefinition in c++).  @var{n} is the size of functions that can be inlined in
443190075Sobriennumber of pseudo instructions (not counting parameter handling).  The default
443290075Sobrienvalue of @var{n} is 600.
443390075SobrienIncreasing this value can result in more inlined code at
443490075Sobrienthe cost of compilation time and memory consumption.  Decreasing usually makes
443590075Sobrienthe compilation faster and less code will be inlined (which presumably
443690075Sobrienmeans slower programs).  This option is particularly useful for programs that
443790075Sobrienuse inlining heavily such as those based on recursive templates with C++.
443890075Sobrien
4439117395SkanInlining is actually controlled by a number of parameters, which may be
4440117395Skanspecified individually by using @option{--param @var{name}=@var{value}}.
4441132718SkanThe @option{-finline-limit=@var{n}} option sets some of these parameters
4442117395Skanas follows:
4443117395Skan
4444119256Skan@table @gcctabopt
4445169689Skan@item max-inline-insns-single
4446169689Skan is set to @var{n}/2.
4447169689Skan@item max-inline-insns-auto
4448169689Skan is set to @var{n}/2.
4449169689Skan@item min-inline-insns
4450169689Skan is set to 130 or @var{n}/4, whichever is smaller.
4451169689Skan@item max-inline-insns-rtl
4452169689Skan is set to @var{n}.
4453119256Skan@end table
4454117395Skan
4455132718SkanSee below for a documentation of the individual
4456117395Skanparameters controlling inlining.
4457117395Skan
445890075Sobrien@emph{Note:} pseudo instruction represents, in this particular context, an
4459169689Skanabstract measurement of function's size.  In no way does it represent a count
446090075Sobrienof assembly instructions and as such its exact meaning might change from one
446190075Sobrienrelease to an another.
446290075Sobrien
446390075Sobrien@item -fkeep-inline-functions
446490075Sobrien@opindex fkeep-inline-functions
4465169689SkanIn C, emit @code{static} functions that are declared @code{inline}
4466169689Skaninto the object file, even if the function has been inlined into all
4467169689Skanof its callers.  This switch does not affect functions using the
4468169689Skan@code{extern inline} extension in GNU C@.  In C++, emit any and all
4469169689Skaninline functions into the object file.
447090075Sobrien
447190075Sobrien@item -fkeep-static-consts
447290075Sobrien@opindex fkeep-static-consts
447390075SobrienEmit variables declared @code{static const} when optimization isn't turned
447490075Sobrienon, even if the variables aren't referenced.
447590075Sobrien
447690075SobrienGCC enables this option by default.  If you want to force the compiler to
447790075Sobriencheck if the variable was referenced, regardless of whether or not
447890075Sobrienoptimization is turned on, use the @option{-fno-keep-static-consts} option.
447990075Sobrien
448090075Sobrien@item -fmerge-constants
448190075SobrienAttempt to merge identical constants (string constants and floating point
4482117395Skanconstants) across compilation units.
448390075Sobrien
4484117395SkanThis option is the default for optimized compilation if the assembler and
4485117395Skanlinker support it.  Use @option{-fno-merge-constants} to inhibit this
4486117395Skanbehavior.
448790075Sobrien
4488117395SkanEnabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4489117395Skan
449090075Sobrien@item -fmerge-all-constants
449190075SobrienAttempt to merge identical constants and identical variables.
449290075Sobrien
449390075SobrienThis option implies @option{-fmerge-constants}.  In addition to
4494169689Skan@option{-fmerge-constants} this considers e.g.@: even constant initialized
449590075Sobrienarrays or initialized constant variables with integral or floating point
449690075Sobrientypes.  Languages like C or C++ require each non-automatic variable to
449790075Sobrienhave distinct location, so using this option will result in non-conforming
449890075Sobrienbehavior.
449990075Sobrien
4500169689Skan@item -fmodulo-sched
4501169689Skan@opindex fmodulo-sched
4502169689SkanPerform swing modulo scheduling immediately before the first scheduling
4503169689Skanpass.  This pass looks at innermost loops and reorders their
4504169689Skaninstructions by overlapping different iterations.
4505132718Skan
4506107590Sobrien@item -fno-branch-count-reg
4507107590Sobrien@opindex fno-branch-count-reg
4508107590SobrienDo not use ``decrement and branch'' instructions on a count register,
4509107590Sobrienbut instead generate a sequence of instructions that decrement a
4510107590Sobrienregister, compare it against zero, then branch based upon the result.
4511107590SobrienThis option is only meaningful on architectures that support such
4512107590Sobrieninstructions, which include x86, PowerPC, IA-64 and S/390.
4513107590Sobrien
4514169689SkanThe default is @option{-fbranch-count-reg}.
4515117395Skan
451690075Sobrien@item -fno-function-cse
451790075Sobrien@opindex fno-function-cse
451890075SobrienDo not put function addresses in registers; make each instruction that
451990075Sobriencalls a constant function contain the function's address explicitly.
452090075Sobrien
452190075SobrienThis option results in less efficient code, but some strange hacks
452290075Sobrienthat alter the assembler output may be confused by the optimizations
452390075Sobrienperformed when this option is not used.
452490075Sobrien
4525117395SkanThe default is @option{-ffunction-cse}
452690075Sobrien
4527117395Skan@item -fno-zero-initialized-in-bss
4528117395Skan@opindex fno-zero-initialized-in-bss
4529117395SkanIf the target supports a BSS section, GCC by default puts variables that
4530117395Skanare initialized to zero into BSS@.  This can save space in the resulting
4531117395Skancode.
453290075Sobrien
4533117395SkanThis option turns off this behavior because some programs explicitly
4534117395Skanrely on variables going to the data section.  E.g., so that the
4535117395Skanresulting executable can find the beginning of that section and/or make
4536117395Skanassumptions based on that.
453790075Sobrien
4538117395SkanThe default is @option{-fzero-initialized-in-bss}.
453990075Sobrien
4540169689Skan@item -fbounds-check
4541169689Skan@opindex fbounds-check
4542169689SkanFor front-ends that support it, generate additional code to check that
4543169689Skanindices used to access arrays are within the declared range.  This is
4544169689Skancurrently only supported by the Java and Fortran front-ends, where
4545169689Skanthis option defaults to true and false respectively.
454690075Sobrien
4547169689Skan@item -fmudflap -fmudflapth -fmudflapir
4548169689Skan@opindex fmudflap
4549169689Skan@opindex fmudflapth
4550169689Skan@opindex fmudflapir
4551169689Skan@cindex bounds checking
4552169689Skan@cindex mudflap
4553169689SkanFor front-ends that support it (C and C++), instrument all risky
4554169689Skanpointer/array dereferencing operations, some standard library
4555169689Skanstring/heap functions, and some other associated constructs with
4556169689Skanrange/validity tests.  Modules so instrumented should be immune to
4557169689Skanbuffer overflows, invalid heap use, and some other classes of C/C++
4558169689Skanprogramming errors.  The instrumentation relies on a separate runtime
4559169689Skanlibrary (@file{libmudflap}), which will be linked into a program if
4560169689Skan@option{-fmudflap} is given at link time.  Run-time behavior of the
4561169689Skaninstrumented program is controlled by the @env{MUDFLAP_OPTIONS}
4562169689Skanenvironment variable.  See @code{env MUDFLAP_OPTIONS=-help a.out}
4563169689Skanfor its options.
4564117395Skan
4565169689SkanUse @option{-fmudflapth} instead of @option{-fmudflap} to compile and to
4566169689Skanlink if your program is multi-threaded.  Use @option{-fmudflapir}, in
4567169689Skanaddition to @option{-fmudflap} or @option{-fmudflapth}, if
4568169689Skaninstrumentation should ignore pointer reads.  This produces less
4569169689Skaninstrumentation (and therefore faster execution) and still provides
4570169689Skansome protection against outright memory corrupting writes, but allows
4571169689Skanerroneously read data to propagate within a program.
4572169689Skan
457390075Sobrien@item -fthread-jumps
457490075Sobrien@opindex fthread-jumps
457590075SobrienPerform optimizations where we check to see if a jump branches to a
457690075Sobrienlocation where another comparison subsumed by the first is found.  If
457790075Sobrienso, the first branch is redirected to either the destination of the
457890075Sobriensecond branch or a point immediately following it, depending on whether
457990075Sobrienthe condition is known to be true or false.
458090075Sobrien
4581169689SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4582117395Skan
458390075Sobrien@item -fcse-follow-jumps
458490075Sobrien@opindex fcse-follow-jumps
458590075SobrienIn common subexpression elimination, scan through jump instructions
458690075Sobrienwhen the target of the jump is not reached by any other path.  For
458790075Sobrienexample, when CSE encounters an @code{if} statement with an
458890075Sobrien@code{else} clause, CSE will follow the jump when the condition
458990075Sobrientested is false.
459090075Sobrien
4591117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4592117395Skan
459390075Sobrien@item -fcse-skip-blocks
459490075Sobrien@opindex fcse-skip-blocks
459590075SobrienThis is similar to @option{-fcse-follow-jumps}, but causes CSE to
459690075Sobrienfollow jumps which conditionally skip over blocks.  When CSE
459790075Sobrienencounters a simple @code{if} statement with no else clause,
459890075Sobrien@option{-fcse-skip-blocks} causes CSE to follow the jump around the
459990075Sobrienbody of the @code{if}.
460090075Sobrien
4601117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4602117395Skan
460390075Sobrien@item -frerun-cse-after-loop
460490075Sobrien@opindex frerun-cse-after-loop
460590075SobrienRe-run common subexpression elimination after loop optimizations has been
460690075Sobrienperformed.
460790075Sobrien
4608117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4609117395Skan
461090075Sobrien@item -fgcse
461190075Sobrien@opindex fgcse
461290075SobrienPerform a global common subexpression elimination pass.
461390075SobrienThis pass also performs global constant and copy propagation.
461490075Sobrien
461590075Sobrien@emph{Note:} When compiling a program using computed gotos, a GCC
461690075Sobrienextension, you may get better runtime performance if you disable
4617117395Skanthe global common subexpression elimination pass by adding
461890075Sobrien@option{-fno-gcse} to the command line.
461990075Sobrien
4620117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4621117395Skan
462290075Sobrien@item -fgcse-lm
462390075Sobrien@opindex fgcse-lm
462490075SobrienWhen @option{-fgcse-lm} is enabled, global common subexpression elimination will
462590075Sobrienattempt to move loads which are only killed by stores into themselves.  This
462690075Sobrienallows a loop containing a load/store sequence to be changed to a load outside
462790075Sobrienthe loop, and a copy/store within the loop.
462890075Sobrien
4629117395SkanEnabled by default when gcse is enabled.
4630117395Skan
463190075Sobrien@item -fgcse-sm
463290075Sobrien@opindex fgcse-sm
4633132718SkanWhen @option{-fgcse-sm} is enabled, a store motion pass is run after
4634132718Skanglobal common subexpression elimination.  This pass will attempt to move
4635132718Skanstores out of loops.  When used in conjunction with @option{-fgcse-lm},
4636132718Skanloops containing a load/store sequence can be changed to a load before
4637132718Skanthe loop and a store after the loop.
463890075Sobrien
4639169689SkanNot enabled at any optimization level.
4640117395Skan
4641132718Skan@item -fgcse-las
4642132718Skan@opindex fgcse-las
4643132718SkanWhen @option{-fgcse-las} is enabled, the global common subexpression
4644132718Skanelimination pass eliminates redundant loads that come after stores to the
4645132718Skansame memory location (both partial and full redundancies).
4646132718Skan
4647169689SkanNot enabled at any optimization level.
4648132718Skan
4649169689Skan@item -fgcse-after-reload
4650169689Skan@opindex fgcse-after-reload
4651169689SkanWhen @option{-fgcse-after-reload} is enabled, a redundant load elimination
4652169689Skanpass is performed after reload.  The purpose of this pass is to cleanup
4653169689Skanredundant spilling.
4654117395Skan
4655169689Skan@item -funsafe-loop-optimizations
4656169689Skan@opindex funsafe-loop-optimizations
4657169689SkanIf given, the loop optimizer will assume that loop indices do not
4658169689Skanoverflow, and that the loops with nontrivial exit condition are not
4659169689Skaninfinite.  This enables a wider range of loop optimizations even if
4660169689Skanthe loop optimizer itself cannot prove that these assumptions are valid.
4661169689SkanUsing @option{-Wunsafe-loop-optimizations}, the compiler will warn you
4662169689Skanif it finds this kind of loop.
4663117395Skan
4664117395Skan@item -fcrossjumping
4665117395Skan@opindex crossjumping
4666169689SkanPerform cross-jumping transformation.  This transformation unifies equivalent code and save code size.  The
4667117395Skanresulting code may or may not perform better than without cross-jumping.
4668117395Skan
4669169689SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4670117395Skan
4671117395Skan@item -fif-conversion
4672117395Skan@opindex if-conversion
4673117395SkanAttempt to transform conditional jumps into branch-less equivalents.  This
4674117395Skaninclude use of conditional moves, min, max, set flags and abs instructions, and
4675117395Skansome tricks doable by standard arithmetics.  The use of conditional execution
4676117395Skanon chips where it is available is controlled by @code{if-conversion2}.
4677117395Skan
4678117395SkanEnabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4679117395Skan
4680117395Skan@item -fif-conversion2
4681117395Skan@opindex if-conversion2
4682117395SkanUse conditional execution (where available) to transform conditional jumps into
4683117395Skanbranch-less equivalents.
4684117395Skan
4685117395SkanEnabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4686117395Skan
468790075Sobrien@item -fdelete-null-pointer-checks
468890075Sobrien@opindex fdelete-null-pointer-checks
468990075SobrienUse global dataflow analysis to identify and eliminate useless checks
469090075Sobrienfor null pointers.  The compiler assumes that dereferencing a null
469190075Sobrienpointer would have halted the program.  If a pointer is checked after
469290075Sobrienit has already been dereferenced, it cannot be null.
469390075Sobrien
469490075SobrienIn some environments, this assumption is not true, and programs can
469590075Sobriensafely dereference null pointers.  Use
469690075Sobrien@option{-fno-delete-null-pointer-checks} to disable this optimization
469790075Sobrienfor programs which depend on that behavior.
469890075Sobrien
4699117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4700117395Skan
470190075Sobrien@item -fexpensive-optimizations
470290075Sobrien@opindex fexpensive-optimizations
470390075SobrienPerform a number of minor optimizations that are relatively expensive.
470490075Sobrien
4705117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4706117395Skan
470790075Sobrien@item -foptimize-register-move
470890075Sobrien@itemx -fregmove
470990075Sobrien@opindex foptimize-register-move
471090075Sobrien@opindex fregmove
471190075SobrienAttempt to reassign register numbers in move instructions and as
471290075Sobrienoperands of other simple instructions in order to maximize the amount of
471390075Sobrienregister tying.  This is especially helpful on machines with two-operand
4714117395Skaninstructions.
471590075Sobrien
471690075SobrienNote @option{-fregmove} and @option{-foptimize-register-move} are the same
471790075Sobrienoptimization.
471890075Sobrien
4719117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4720117395Skan
472190075Sobrien@item -fdelayed-branch
472290075Sobrien@opindex fdelayed-branch
472390075SobrienIf supported for the target machine, attempt to reorder instructions
472490075Sobriento exploit instruction slots available after delayed branch
472590075Sobrieninstructions.
472690075Sobrien
4727117395SkanEnabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4728117395Skan
472990075Sobrien@item -fschedule-insns
473090075Sobrien@opindex fschedule-insns
473190075SobrienIf supported for the target machine, attempt to reorder instructions to
473290075Sobrieneliminate execution stalls due to required data being unavailable.  This
473390075Sobrienhelps machines that have slow floating point or memory load instructions
473490075Sobrienby allowing other instructions to be issued until the result of the load
473590075Sobrienor floating point instruction is required.
473690075Sobrien
4737117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4738117395Skan
473990075Sobrien@item -fschedule-insns2
474090075Sobrien@opindex fschedule-insns2
474190075SobrienSimilar to @option{-fschedule-insns}, but requests an additional pass of
474290075Sobrieninstruction scheduling after register allocation has been done.  This is
474390075Sobrienespecially useful on machines with a relatively small number of
474490075Sobrienregisters and where memory load instructions take more than one cycle.
474590075Sobrien
4746117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4747117395Skan
4748107590Sobrien@item -fno-sched-interblock
4749107590Sobrien@opindex fno-sched-interblock
4750107590SobrienDon't schedule instructions across basic blocks.  This is normally
4751107590Sobrienenabled by default when scheduling before register allocation, i.e.@:
4752107590Sobrienwith @option{-fschedule-insns} or at @option{-O2} or higher.
4753107590Sobrien
4754107590Sobrien@item -fno-sched-spec
4755107590Sobrien@opindex fno-sched-spec
4756107590SobrienDon't allow speculative motion of non-load instructions.  This is normally
4757107590Sobrienenabled by default when scheduling before register allocation, i.e.@:
4758107590Sobrienwith @option{-fschedule-insns} or at @option{-O2} or higher.
4759107590Sobrien
4760107590Sobrien@item -fsched-spec-load
4761107590Sobrien@opindex fsched-spec-load
4762107590SobrienAllow speculative motion of some load instructions.  This only makes
4763107590Sobriensense when scheduling before register allocation, i.e.@: with
4764107590Sobrien@option{-fschedule-insns} or at @option{-O2} or higher.
4765107590Sobrien
4766107590Sobrien@item -fsched-spec-load-dangerous
4767107590Sobrien@opindex fsched-spec-load-dangerous
4768107590SobrienAllow speculative motion of more load instructions.  This only makes
4769107590Sobriensense when scheduling before register allocation, i.e.@: with
4770107590Sobrien@option{-fschedule-insns} or at @option{-O2} or higher.
4771107590Sobrien
4772132718Skan@item -fsched-stalled-insns=@var{n}
4773132718Skan@opindex fsched-stalled-insns
4774132718SkanDefine how many insns (if any) can be moved prematurely from the queue
4775132718Skanof stalled insns into the ready list, during the second scheduling pass.
4776132718Skan
4777132718Skan@item -fsched-stalled-insns-dep=@var{n}
4778132718Skan@opindex fsched-stalled-insns-dep
4779132718SkanDefine how many insn groups (cycles) will be examined for a dependency
4780132718Skanon a stalled insn that is candidate for premature removal from the queue
4781132718Skanof stalled insns.  Has an effect only during the second scheduling pass,
4782132718Skanand only if @option{-fsched-stalled-insns} is used and its value is not zero.
4783132718Skan
4784132718Skan@item -fsched2-use-superblocks
4785132718Skan@opindex fsched2-use-superblocks
4786132718SkanWhen scheduling after register allocation, do use superblock scheduling
4787132718Skanalgorithm.  Superblock scheduling allows motion across basic block boundaries
4788132718Skanresulting on faster schedules.  This option is experimental, as not all machine
4789132718Skandescriptions used by GCC model the CPU closely enough to avoid unreliable
4790132718Skanresults from the algorithm.
4791132718Skan
4792132718SkanThis only makes sense when scheduling after register allocation, i.e.@: with
4793132718Skan@option{-fschedule-insns2} or at @option{-O2} or higher.
4794132718Skan
4795132718Skan@item -fsched2-use-traces
4796132718Skan@opindex fsched2-use-traces
4797132718SkanUse @option{-fsched2-use-superblocks} algorithm when scheduling after register
4798132718Skanallocation and additionally perform code duplication in order to increase the
4799132718Skansize of superblocks using tracer pass.  See @option{-ftracer} for details on
4800132718Skantrace formation.
4801132718Skan
4802132718SkanThis mode should produce faster but significantly longer programs.  Also
4803169689Skanwithout @option{-fbranch-probabilities} the traces constructed may not
4804169689Skanmatch the reality and hurt the performance.  This only makes
4805132718Skansense when scheduling after register allocation, i.e.@: with
4806132718Skan@option{-fschedule-insns2} or at @option{-O2} or higher.
4807132718Skan
4808169689Skan@item -fsee
4809169689Skan@opindex fsee
4810169689SkanEliminates redundant extension instructions and move the non redundant
4811169689Skanones to optimal placement using LCM.
4812169689Skan
4813169689Skan@item -freschedule-modulo-scheduled-loops
4814169689Skan@opindex fscheduling-in-modulo-scheduled-loops
4815169689SkanThe modulo scheduling comes before the traditional scheduling, if a loop was modulo scheduled
4816169689Skanwe may want to prevent the later scheduling passes from changing its schedule, we use this
4817169689Skanoption to control that.
4818169689Skan
481990075Sobrien@item -fcaller-saves
482090075Sobrien@opindex fcaller-saves
482190075SobrienEnable values to be allocated in registers that will be clobbered by
482290075Sobrienfunction calls, by emitting extra instructions to save and restore the
482390075Sobrienregisters around such calls.  Such allocation is done only when it
482490075Sobrienseems to result in better code than would otherwise be produced.
482590075Sobrien
482690075SobrienThis option is always enabled by default on certain machines, usually
482790075Sobrienthose which have no call-preserved registers to use instead.
482890075Sobrien
4829117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
483090075Sobrien
4831169689Skan@item -ftree-pre
4832169689SkanPerform Partial Redundancy Elimination (PRE) on trees.  This flag is
4833169689Skanenabled by default at @option{-O2} and @option{-O3}.
483490075Sobrien
4835169689Skan@item -ftree-fre
4836169689SkanPerform Full Redundancy Elimination (FRE) on trees.  The difference
4837169689Skanbetween FRE and PRE is that FRE only considers expressions
4838169689Skanthat are computed on all paths leading to the redundant computation.
4839169689SkanThis analysis faster than PRE, though it exposes fewer redundancies.
4840169689SkanThis flag is enabled by default at @option{-O} and higher.
484190075Sobrien
4842169689Skan@item -ftree-copy-prop
4843169689SkanPerform copy propagation on trees.  This pass eliminates unnecessary
4844169689Skancopy operations.  This flag is enabled by default at @option{-O} and
4845169689Skanhigher.
484690075Sobrien
4847169689Skan@item -ftree-store-copy-prop
4848169689SkanPerform copy propagation of memory loads and stores.  This pass
4849169689Skaneliminates unnecessary copy operations in memory references
4850169689Skan(structures, global variables, arrays, etc).  This flag is enabled by
4851169689Skandefault at @option{-O2} and higher.
4852169689Skan
4853169689Skan@item -ftree-salias
4854169689SkanPerform structural alias analysis on trees.  This flag
4855169689Skanis enabled by default at @option{-O} and higher.
4856169689Skan
4857169689Skan@item -fipa-pta
4858169689SkanPerform interprocedural pointer analysis.
4859169689Skan
4860169689Skan@item -ftree-sink
4861169689SkanPerform forward store motion  on trees.  This flag is
4862169689Skanenabled by default at @option{-O} and higher.
4863169689Skan
4864169689Skan@item -ftree-ccp
4865169689SkanPerform sparse conditional constant propagation (CCP) on trees.  This
4866169689Skanpass only operates on local scalar variables and is enabled by default
4867169689Skanat @option{-O} and higher.
4868169689Skan
4869169689Skan@item -ftree-store-ccp
4870169689SkanPerform sparse conditional constant propagation (CCP) on trees.  This
4871169689Skanpass operates on both local scalar variables and memory stores and
4872169689Skanloads (global variables, structures, arrays, etc).  This flag is
4873169689Skanenabled by default at @option{-O2} and higher.
4874169689Skan
4875169689Skan@item -ftree-dce
4876169689SkanPerform dead code elimination (DCE) on trees.  This flag is enabled by
4877169689Skandefault at @option{-O} and higher.
4878169689Skan
4879169689Skan@item -ftree-dominator-opts
4880169689SkanPerform a variety of simple scalar cleanups (constant/copy
4881169689Skanpropagation, redundancy elimination, range propagation and expression
4882169689Skansimplification) based on a dominator tree traversal.  This also
4883169689Skanperforms jump threading (to reduce jumps to jumps). This flag is
4884169689Skanenabled by default at @option{-O} and higher.
4885169689Skan
4886169689Skan@item -ftree-ch
4887169689SkanPerform loop header copying on trees.  This is beneficial since it increases
4888169689Skaneffectiveness of code motion optimizations.  It also saves one jump.  This flag
4889169689Skanis enabled by default at @option{-O} and higher.  It is not enabled
4890169689Skanfor @option{-Os}, since it usually increases code size.
4891169689Skan
4892169689Skan@item -ftree-loop-optimize
4893169689SkanPerform loop optimizations on trees.  This flag is enabled by default
4894169689Skanat @option{-O} and higher.
4895169689Skan
4896169689Skan@item -ftree-loop-linear
4897169689SkanPerform linear loop transformations on tree.  This flag can improve cache
4898169689Skanperformance and allow further loop optimizations to take place.
4899169689Skan
4900169689Skan@item -ftree-loop-im
4901169689SkanPerform loop invariant motion on trees.  This pass moves only invariants that
4902169689Skanwould be hard to handle at RTL level (function calls, operations that expand to
4903169689Skannontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
4904169689Skanoperands of conditions that are invariant out of the loop, so that we can use
4905169689Skanjust trivial invariantness analysis in loop unswitching.  The pass also includes
4906169689Skanstore motion.
4907169689Skan
4908169689Skan@item -ftree-loop-ivcanon
4909169689SkanCreate a canonical counter for number of iterations in the loop for that
4910169689Skandetermining number of iterations requires complicated analysis.  Later
4911169689Skanoptimizations then may determine the number easily.  Useful especially
4912169689Skanin connection with unrolling.
4913169689Skan
4914169689Skan@item -fivopts
4915169689SkanPerform induction variable optimizations (strength reduction, induction
4916169689Skanvariable merging and induction variable elimination) on trees.
4917169689Skan
4918169689Skan@item -ftree-sra
4919169689SkanPerform scalar replacement of aggregates.  This pass replaces structure
4920169689Skanreferences with scalars to prevent committing structures to memory too
4921169689Skanearly.  This flag is enabled by default at @option{-O} and higher.
4922169689Skan
4923169689Skan@item -ftree-copyrename
4924169689SkanPerform copy renaming on trees.  This pass attempts to rename compiler
4925169689Skantemporaries to other variables at copy locations, usually resulting in
4926169689Skanvariable names which more closely resemble the original variables.  This flag
4927169689Skanis enabled by default at @option{-O} and higher.
4928169689Skan
4929169689Skan@item -ftree-ter
4930169689SkanPerform temporary expression replacement during the SSA->normal phase.  Single
4931169689Skanuse/single def temporaries are replaced at their use location with their
4932169689Skandefining expression.  This results in non-GIMPLE code, but gives the expanders
4933169689Skanmuch more complex trees to work on resulting in better RTL generation.  This is
4934169689Skanenabled by default at @option{-O} and higher.
4935169689Skan
4936169689Skan@item -ftree-lrs
4937169689SkanPerform live range splitting during the SSA->normal phase.  Distinct live
4938169689Skanranges of a variable are split into unique variables, allowing for better
4939169689Skanoptimization later.  This is enabled by default at @option{-O} and higher.
4940169689Skan
4941169689Skan@item -ftree-vectorize
4942169689SkanPerform loop vectorization on trees.
4943169689Skan
4944169689Skan@item -ftree-vect-loop-version
4945169689Skan@opindex ftree-vect-loop-version
4946169689SkanPerform loop versioning when doing loop vectorization on trees.  When a loop
4947169689Skanappears to be vectorizable except that data alignment or data dependence cannot
4948169689Skanbe determined at compile time then vectorized and non-vectorized versions of
4949169689Skanthe loop are generated along with runtime checks for alignment or dependence
4950169689Skanto control which version is executed.  This option is enabled by default
4951169689Skanexcept at level @option{-Os} where it is disabled.
4952169689Skan
4953169689Skan@item -ftree-vrp
4954169689SkanPerform Value Range Propagation on trees.  This is similar to the
4955169689Skanconstant propagation pass, but instead of values, ranges of values are
4956169689Skanpropagated.  This allows the optimizers to remove unnecessary range
4957169689Skanchecks like array bound checks and null pointer checks.  This is
4958169689Skanenabled by default at @option{-O2} and higher.  Null pointer check
4959169689Skanelimination is only done if @option{-fdelete-null-pointer-checks} is
4960169689Skanenabled.
4961169689Skan
4962169689Skan@item -ftracer
4963169689Skan@opindex ftracer
4964169689SkanPerform tail duplication to enlarge superblock size.  This transformation
4965169689Skansimplifies the control flow of the function allowing other optimizations to do
4966169689Skanbetter job.
4967169689Skan
4968169689Skan@item -funroll-loops
4969169689Skan@opindex funroll-loops
4970169689SkanUnroll loops whose number of iterations can be determined at compile
4971169689Skantime or upon entry to the loop.  @option{-funroll-loops} implies
4972169689Skan@option{-frerun-cse-after-loop}.  This option makes code larger,
4973169689Skanand may or may not make it run faster.
4974169689Skan
4975169689Skan@item -funroll-all-loops
4976169689Skan@opindex funroll-all-loops
4977169689SkanUnroll all loops, even if their number of iterations is uncertain when
4978169689Skanthe loop is entered.  This usually makes programs run more slowly.
4979169689Skan@option{-funroll-all-loops} implies the same options as
4980169689Skan@option{-funroll-loops},
4981169689Skan
4982169689Skan@item -fsplit-ivs-in-unroller
4983169689Skan@opindex fsplit-ivs-in-unroller
4984169689SkanEnables expressing of values of induction variables in later iterations
4985169689Skanof the unrolled loop using the value in the first iteration.  This breaks
4986169689Skanlong dependency chains, thus improving efficiency of the scheduling passes.
4987169689Skan
4988169689SkanCombination of @option{-fweb} and CSE is often sufficient to obtain the
4989169689Skansame effect.  However in cases the loop body is more complicated than
4990169689Skana single basic block, this is not reliable.  It also does not work at all
4991169689Skanon some of the architectures due to restrictions in the CSE pass.
4992169689Skan
4993169689SkanThis optimization is enabled by default.
4994169689Skan
4995169689Skan@item -fvariable-expansion-in-unroller
4996169689Skan@opindex fvariable-expansion-in-unroller
4997169689SkanWith this option, the compiler will create multiple copies of some
4998169689Skanlocal variables when unrolling a loop which can result in superior code.
4999169689Skan
5000169689Skan@item -fprefetch-loop-arrays
5001169689Skan@opindex fprefetch-loop-arrays
5002169689SkanIf supported by the target machine, generate instructions to prefetch
5003169689Skanmemory to improve the performance of loops that access large arrays.
5004169689Skan
5005169689SkanThis option may generate better or worse code; results are highly
500690075Sobriendependent on the structure of loops within the source code.
500790075Sobrien
5008169689SkanDisabled at level @option{-Os}.
500990075Sobrien
501090075Sobrien@item -fno-peephole
501190075Sobrien@itemx -fno-peephole2
501290075Sobrien@opindex fno-peephole
501390075Sobrien@opindex fno-peephole2
501490075SobrienDisable any machine-specific peephole optimizations.  The difference
501590075Sobrienbetween @option{-fno-peephole} and @option{-fno-peephole2} is in how they
501690075Sobrienare implemented in the compiler; some targets use one, some use the
501790075Sobrienother, a few use both.
501890075Sobrien
5019117395Skan@option{-fpeephole} is enabled by default.
5020117395Skan@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5021117395Skan
502290075Sobrien@item -fno-guess-branch-probability
502390075Sobrien@opindex fno-guess-branch-probability
5024169689SkanDo not guess branch probabilities using heuristics.
502590075Sobrien
5026169689SkanGCC will use heuristics to guess branch probabilities if they are
5027169689Skannot provided by profiling feedback (@option{-fprofile-arcs}).  These
5028169689Skanheuristics are based on the control flow graph.  If some branch probabilities
5029169689Skanare specified by @samp{__builtin_expect}, then the heuristics will be
5030169689Skanused to guess branch probabilities for the rest of the control flow graph,
5031169689Skantaking the @samp{__builtin_expect} info into account.  The interactions
5032169689Skanbetween the heuristics and @samp{__builtin_expect} can be complex, and in
5033169689Skansome cases, it may be useful to disable the heuristics so that the effects
5034169689Skanof @samp{__builtin_expect} are easier to understand.
503590075Sobrien
5036117395SkanThe default is @option{-fguess-branch-probability} at levels
5037117395Skan@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5038117395Skan
5039117395Skan@item -freorder-blocks
5040117395Skan@opindex freorder-blocks
5041117395SkanReorder basic blocks in the compiled function in order to reduce number of
5042117395Skantaken branches and improve code locality.
5043117395Skan
5044117395SkanEnabled at levels @option{-O2}, @option{-O3}.
5045117395Skan
5046169689Skan@item -freorder-blocks-and-partition
5047169689Skan@opindex freorder-blocks-and-partition
5048169689SkanIn addition to reordering basic blocks in the compiled function, in order
5049169689Skanto reduce number of taken branches, partitions hot and cold basic blocks
5050169689Skaninto separate sections of the assembly and .o files, to improve
5051169689Skanpaging and cache locality performance.
5052169689Skan
5053169689SkanThis optimization is automatically turned off in the presence of
5054169689Skanexception handling, for linkonce sections, for functions with a user-defined
5055169689Skansection attribute and on any architecture that does not support named
5056169689Skansections.
5057169689Skan
5058117395Skan@item -freorder-functions
5059117395Skan@opindex freorder-functions
5060169689SkanReorder functions in the object file in order to
5061169689Skanimprove code locality.  This is implemented by using special
5062146895Skansubsections @code{.text.hot} for most frequently executed functions and
5063146895Skan@code{.text.unlikely} for unlikely executed functions.  Reordering is done by
5064117395Skanthe linker so object file format must support named sections and linker must
5065117395Skanplace them in a reasonable way.
5066117395Skan
5067117395SkanAlso profile feedback must be available in to make this option effective.  See
5068117395Skan@option{-fprofile-arcs} for details.
5069117395Skan
5070117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5071117395Skan
507290075Sobrien@item -fstrict-aliasing
507390075Sobrien@opindex fstrict-aliasing
507490075SobrienAllows the compiler to assume the strictest aliasing rules applicable to
507590075Sobrienthe language being compiled.  For C (and C++), this activates
507690075Sobrienoptimizations based on the type of expressions.  In particular, an
507790075Sobrienobject of one type is assumed never to reside at the same address as an
507890075Sobrienobject of a different type, unless the types are almost the same.  For
507990075Sobrienexample, an @code{unsigned int} can alias an @code{int}, but not a
508090075Sobrien@code{void*} or a @code{double}.  A character type may alias any other
508190075Sobrientype.
508290075Sobrien
508390075SobrienPay special attention to code like this:
5084132718Skan@smallexample
508590075Sobrienunion a_union @{
508690075Sobrien  int i;
508790075Sobrien  double d;
508890075Sobrien@};
508990075Sobrien
509090075Sobrienint f() @{
509190075Sobrien  a_union t;
509290075Sobrien  t.d = 3.0;
509390075Sobrien  return t.i;
509490075Sobrien@}
5095132718Skan@end smallexample
509690075SobrienThe practice of reading from a different union member than the one most
509790075Sobrienrecently written to (called ``type-punning'') is common.  Even with
509890075Sobrien@option{-fstrict-aliasing}, type-punning is allowed, provided the memory
509990075Sobrienis accessed through the union type.  So, the code above will work as
510090075Sobrienexpected.  However, this code might not:
5101132718Skan@smallexample
510290075Sobrienint f() @{
510390075Sobrien  a_union t;
510490075Sobrien  int* ip;
510590075Sobrien  t.d = 3.0;
510690075Sobrien  ip = &t.i;
510790075Sobrien  return *ip;
510890075Sobrien@}
5109132718Skan@end smallexample
511090075Sobrien
511190075SobrienEvery language that wishes to perform language-specific alias analysis
511290075Sobrienshould define a function that computes, given an @code{tree}
511390075Sobriennode, an alias set for the node.  Nodes in different alias sets are not
511490075Sobrienallowed to alias.  For an example, see the C front-end function
511590075Sobrien@code{c_get_alias_set}.
511690075Sobrien
5117117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5118117395Skan
5119169689Skan@item -fstrict-overflow
5120169689Skan@opindex fstrict-overflow
5121169689SkanAllow the compiler to assume strict signed overflow rules, depending
5122169689Skanon the language being compiled.  For C (and C++) this means that
5123169689Skanoverflow when doing arithmetic with signed numbers is undefined, which
5124169689Skanmeans that the compiler may assume that it will not happen.  This
5125169689Skanpermits various optimizations.  For example, the compiler will assume
5126169689Skanthat an expression like @code{i + 10 > i} will always be true for
5127169689Skansigned @code{i}.  This assumption is only valid if signed overflow is
5128169689Skanundefined, as the expression is false if @code{i + 10} overflows when
5129169689Skanusing twos complement arithmetic.  When this option is in effect any
5130169689Skanattempt to determine whether an operation on signed numbers will
5131169689Skanoverflow must be written carefully to not actually involve overflow.
5132169689Skan
5133169689SkanSee also the @option{-fwrapv} option.  Using @option{-fwrapv} means
5134169689Skanthat signed overflow is fully defined: it wraps.  When
5135169689Skan@option{-fwrapv} is used, there is no difference between
5136169689Skan@option{-fstrict-overflow} and @option{-fno-strict-overflow}.  With
5137169689Skan@option{-fwrapv} certain types of overflow are permitted.  For
5138169689Skanexample, if the compiler gets an overflow when doing arithmetic on
5139169689Skanconstants, the overflowed value can still be used with
5140169689Skan@option{-fwrapv}, but not otherwise.
5141169689Skan
5142169689SkanThe @option{-fstrict-overflow} option is enabled at levels
5143169689Skan@option{-O2}, @option{-O3}, @option{-Os}.
5144169689Skan
514590075Sobrien@item -falign-functions
514690075Sobrien@itemx -falign-functions=@var{n}
514790075Sobrien@opindex falign-functions
514890075SobrienAlign the start of functions to the next power-of-two greater than
514990075Sobrien@var{n}, skipping up to @var{n} bytes.  For instance,
515090075Sobrien@option{-falign-functions=32} aligns functions to the next 32-byte
515190075Sobrienboundary, but @option{-falign-functions=24} would align to the next
515290075Sobrien32-byte boundary only if this can be done by skipping 23 bytes or less.
515390075Sobrien
515490075Sobrien@option{-fno-align-functions} and @option{-falign-functions=1} are
515590075Sobrienequivalent and mean that functions will not be aligned.
515690075Sobrien
515790075SobrienSome assemblers only support this flag when @var{n} is a power of two;
515890075Sobrienin that case, it is rounded up.
515990075Sobrien
5160117395SkanIf @var{n} is not specified or is zero, use a machine-dependent default.
516190075Sobrien
5162117395SkanEnabled at levels @option{-O2}, @option{-O3}.
5163117395Skan
516490075Sobrien@item -falign-labels
516590075Sobrien@itemx -falign-labels=@var{n}
516690075Sobrien@opindex falign-labels
516790075SobrienAlign all branch targets to a power-of-two boundary, skipping up to
516890075Sobrien@var{n} bytes like @option{-falign-functions}.  This option can easily
516990075Sobrienmake code slower, because it must insert dummy operations for when the
517090075Sobrienbranch target is reached in the usual flow of the code.
517190075Sobrien
5172117395Skan@option{-fno-align-labels} and @option{-falign-labels=1} are
5173117395Skanequivalent and mean that labels will not be aligned.
5174117395Skan
517590075SobrienIf @option{-falign-loops} or @option{-falign-jumps} are applicable and
517690075Sobrienare greater than this value, then their values are used instead.
517790075Sobrien
5178117395SkanIf @var{n} is not specified or is zero, use a machine-dependent default
5179117395Skanwhich is very likely to be @samp{1}, meaning no alignment.
518090075Sobrien
5181117395SkanEnabled at levels @option{-O2}, @option{-O3}.
5182117395Skan
518390075Sobrien@item -falign-loops
518490075Sobrien@itemx -falign-loops=@var{n}
518590075Sobrien@opindex falign-loops
518690075SobrienAlign loops to a power-of-two boundary, skipping up to @var{n} bytes
518790075Sobrienlike @option{-falign-functions}.  The hope is that the loop will be
518890075Sobrienexecuted many times, which will make up for any execution of the dummy
518990075Sobrienoperations.
519090075Sobrien
5191117395Skan@option{-fno-align-loops} and @option{-falign-loops=1} are
5192117395Skanequivalent and mean that loops will not be aligned.
519390075Sobrien
5194117395SkanIf @var{n} is not specified or is zero, use a machine-dependent default.
5195117395Skan
5196117395SkanEnabled at levels @option{-O2}, @option{-O3}.
5197117395Skan
519890075Sobrien@item -falign-jumps
519990075Sobrien@itemx -falign-jumps=@var{n}
520090075Sobrien@opindex falign-jumps
520190075SobrienAlign branch targets to a power-of-two boundary, for branch targets
520290075Sobrienwhere the targets can only be reached by jumping, skipping up to @var{n}
520390075Sobrienbytes like @option{-falign-functions}.  In this case, no dummy operations
520490075Sobrienneed be executed.
520590075Sobrien
5206117395Skan@option{-fno-align-jumps} and @option{-falign-jumps=1} are
5207117395Skanequivalent and mean that loops will not be aligned.
520890075Sobrien
5209117395SkanIf @var{n} is not specified or is zero, use a machine-dependent default.
5210117395Skan
5211117395SkanEnabled at levels @option{-O2}, @option{-O3}.
5212117395Skan
5213169689Skan@item -funit-at-a-time
5214169689Skan@opindex funit-at-a-time
5215169689SkanParse the whole compilation unit before starting to produce code.
5216169689SkanThis allows some extra optimizations to take place but consumes
5217169689Skanmore memory (in general).  There are some compatibility issues
5218169689Skanwith @emph{unit-at-a-time} mode:
5219169689Skan@itemize @bullet
5220169689Skan@item
5221169689Skanenabling @emph{unit-at-a-time} mode may change the order
5222169689Skanin which functions, variables, and top-level @code{asm} statements
5223169689Skanare emitted, and will likely break code relying on some particular
5224169689Skanordering.  The majority of such top-level @code{asm} statements,
5225169689Skanthough, can be replaced by @code{section} attributes.  The
5226169689Skan@option{fno-toplevel-reorder} option may be used to keep the ordering
5227169689Skanused in the input file, at the cost of some optimizations.
5228117395Skan
5229169689Skan@item
5230169689Skan@emph{unit-at-a-time} mode removes unreferenced static variables
5231169689Skanand functions.  This may result in undefined references
5232169689Skanwhen an @code{asm} statement refers directly to variables or functions
5233169689Skanthat are otherwise unused.  In that case either the variable/function
5234169689Skanshall be listed as an operand of the @code{asm} statement operand or,
5235169689Skanin the case of top-level @code{asm} statements the attribute @code{used}
5236169689Skanshall be used on the declaration.
5237169689Skan
5238169689Skan@item
5239169689SkanStatic functions now can use non-standard passing conventions that
5240169689Skanmay break @code{asm} statements calling functions directly.  Again,
5241169689Skanattribute @code{used} will prevent this behavior.
5242169689Skan@end itemize
5243169689Skan
5244169689SkanAs a temporary workaround, @option{-fno-unit-at-a-time} can be used,
5245169689Skanbut this scheme may not be supported by future releases of GCC@.
5246169689Skan
5247169689SkanEnabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5248169689Skan
5249169689Skan@item -fno-toplevel-reorder
5250169689SkanDo not reorder top-level functions, variables, and @code{asm}
5251169689Skanstatements.  Output them in the same order that they appear in the
5252169689Skaninput file.  When this option is used, unreferenced static variables
5253169689Skanwill not be removed.  This option is intended to support existing code
5254169689Skanwhich relies on a particular ordering.  For new code, it is better to
5255169689Skanuse attributes.
5256169689Skan
5257132718Skan@item -fweb
5258132718Skan@opindex fweb
5259132718SkanConstructs webs as commonly used for register allocation purposes and assign
5260132718Skaneach web individual pseudo register.  This allows the register allocation pass
5261132718Skanto operate on pseudos directly, but also strengthens several other optimization
5262132718Skanpasses, such as CSE, loop optimizer and trivial dead code remover.  It can,
5263132718Skanhowever, make debugging impossible, since variables will no longer stay in a
5264132718Skan``home register''.
5265132718Skan
5266169689SkanEnabled by default with @option{-funroll-loops}.
5267117395Skan
5268169689Skan@item -fwhole-program
5269169689Skan@opindex fwhole-program
5270169689SkanAssume that the current compilation unit represents whole program being
5271169689Skancompiled.  All public functions and variables with the exception of @code{main}
5272169689Skanand those merged by attribute @code{externally_visible} become static functions
5273169689Skanand in a affect gets more aggressively optimized by interprocedural optimizers.
5274169689SkanWhile this option is equivalent to proper use of @code{static} keyword for
5275169689Skanprograms consisting of single file, in combination with option
5276169689Skan@option{--combine} this flag can be used to compile most of smaller scale C
5277169689Skanprograms since the functions and variables become local for the whole combined
5278169689Skancompilation unit, not for the single source file itself.
5279169689Skan
5280169689Skan
5281117395Skan@item -fno-cprop-registers
5282117395Skan@opindex fno-cprop-registers
5283117395SkanAfter register allocation and post-register allocation instruction splitting,
5284117395Skanwe perform a copy-propagation pass to try to reduce scheduling dependencies
5285117395Skanand occasionally eliminate the copy.
5286117395Skan
5287117395SkanDisabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5288117395Skan
5289132718Skan@item -fprofile-generate
5290132718Skan@opindex fprofile-generate
5291132718Skan
5292132718SkanEnable options usually used for instrumenting application to produce
5293132718Skanprofile useful for later recompilation with profile feedback based
5294169689Skanoptimization.  You must use @option{-fprofile-generate} both when
5295132718Skancompiling and when linking your program.
5296132718Skan
5297132718SkanThe following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
5298132718Skan
5299132718Skan@item -fprofile-use
5300132718Skan@opindex fprofile-use
5301132718SkanEnable profile feedback directed optimizations, and optimizations
5302132718Skangenerally profitable only with profile feedback available.
5303132718Skan
5304169689SkanThe following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
5305169689Skan@code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}
5306132718Skan
5307117395Skan@end table
5308117395Skan
5309117395SkanThe following options control compiler behavior regarding floating
5310117395Skanpoint arithmetic.  These options trade off between speed and
5311117395Skancorrectness.  All must be specifically enabled.
5312117395Skan
5313117395Skan@table @gcctabopt
5314117395Skan@item -ffloat-store
5315117395Skan@opindex ffloat-store
5316117395SkanDo not store floating point variables in registers, and inhibit other
5317117395Skanoptions that might change whether a floating point value is taken from a
5318117395Skanregister or memory.
5319117395Skan
5320117395Skan@cindex floating point precision
5321117395SkanThis option prevents undesirable excess precision on machines such as
5322117395Skanthe 68000 where the floating registers (of the 68881) keep more
5323117395Skanprecision than a @code{double} is supposed to have.  Similarly for the
5324117395Skanx86 architecture.  For most programs, the excess precision does only
5325117395Skangood, but a few programs rely on the precise definition of IEEE floating
5326117395Skanpoint.  Use @option{-ffloat-store} for such programs, after modifying
5327117395Skanthem to store all pertinent intermediate computations into variables.
5328117395Skan
5329117395Skan@item -ffast-math
5330117395Skan@opindex ffast-math
5331117395SkanSets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @*
5332132718Skan@option{-fno-trapping-math}, @option{-ffinite-math-only},
5333169689Skan@option{-fno-rounding-math}, @option{-fno-signaling-nans}
5334169689Skanand @option{fcx-limited-range}.
5335117395Skan
5336117395SkanThis option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
5337117395Skan
5338117395SkanThis option should never be turned on by any @option{-O} option since
5339117395Skanit can result in incorrect output for programs which depend on
5340117395Skanan exact implementation of IEEE or ISO rules/specifications for
5341117395Skanmath functions.
5342117395Skan
5343117395Skan@item -fno-math-errno
5344117395Skan@opindex fno-math-errno
5345117395SkanDo not set ERRNO after calling math functions that are executed
5346117395Skanwith a single instruction, e.g., sqrt.  A program that relies on
5347117395SkanIEEE exceptions for math error handling may want to use this flag
5348117395Skanfor speed while maintaining IEEE arithmetic compatibility.
5349117395Skan
5350117395SkanThis option should never be turned on by any @option{-O} option since
5351117395Skanit can result in incorrect output for programs which depend on
5352117395Skanan exact implementation of IEEE or ISO rules/specifications for
5353117395Skanmath functions.
5354117395Skan
5355117395SkanThe default is @option{-fmath-errno}.
5356117395Skan
5357181540SdasOn Darwin and FreeBSD systems, the math library never sets @code{errno}.
5358181540SdasThere is therefore
5359169689Skanno reason for the compiler to consider the possibility that it might,
5360169689Skanand @option{-fno-math-errno} is the default.
5361169689Skan
5362117395Skan@item -funsafe-math-optimizations
5363117395Skan@opindex funsafe-math-optimizations
5364117395SkanAllow optimizations for floating-point arithmetic that (a) assume
5365117395Skanthat arguments and results are valid and (b) may violate IEEE or
5366117395SkanANSI standards.  When used at link-time, it may include libraries
5367117395Skanor startup files that change the default FPU control word or other
5368117395Skansimilar optimizations.
5369117395Skan
5370117395SkanThis option should never be turned on by any @option{-O} option since
5371117395Skanit can result in incorrect output for programs which depend on
5372117395Skanan exact implementation of IEEE or ISO rules/specifications for
5373117395Skanmath functions.
5374117395Skan
5375117395SkanThe default is @option{-fno-unsafe-math-optimizations}.
5376117395Skan
5377117395Skan@item -ffinite-math-only
5378117395Skan@opindex ffinite-math-only
5379117395SkanAllow optimizations for floating-point arithmetic that assume
5380117395Skanthat arguments and results are not NaNs or +-Infs.
5381117395Skan
5382117395SkanThis option should never be turned on by any @option{-O} option since
5383117395Skanit can result in incorrect output for programs which depend on
5384117395Skanan exact implementation of IEEE or ISO rules/specifications.
5385117395Skan
5386117395SkanThe default is @option{-fno-finite-math-only}.
5387117395Skan
5388117395Skan@item -fno-trapping-math
5389117395Skan@opindex fno-trapping-math
5390117395SkanCompile code assuming that floating-point operations cannot generate
5391117395Skanuser-visible traps.  These traps include division by zero, overflow,
5392117395Skanunderflow, inexact result and invalid operation.  This option implies
5393117395Skan@option{-fno-signaling-nans}.  Setting this option may allow faster
5394117395Skancode if one relies on ``non-stop'' IEEE arithmetic, for example.
5395117395Skan
5396117395SkanThis option should never be turned on by any @option{-O} option since
5397117395Skanit can result in incorrect output for programs which depend on
5398117395Skanan exact implementation of IEEE or ISO rules/specifications for
5399117395Skanmath functions.
5400117395Skan
5401117395SkanThe default is @option{-ftrapping-math}.
5402117395Skan
5403132718Skan@item -frounding-math
5404132718Skan@opindex frounding-math
5405132718SkanDisable transformations and optimizations that assume default floating
5406132718Skanpoint rounding behavior.  This is round-to-zero for all floating point
5407132718Skanto integer conversions, and round-to-nearest for all other arithmetic
5408132718Skantruncations.  This option should be specified for programs that change
5409132718Skanthe FP rounding mode dynamically, or that may be executed with a
5410132718Skannon-default rounding mode.  This option disables constant folding of
5411132718Skanfloating point expressions at compile-time (which may be affected by
5412132718Skanrounding mode) and arithmetic transformations that are unsafe in the
5413132718Skanpresence of sign-dependent rounding modes.
5414132718Skan
5415132718SkanThe default is @option{-fno-rounding-math}.
5416132718Skan
5417132718SkanThis option is experimental and does not currently guarantee to
5418132718Skandisable all GCC optimizations that are affected by rounding mode.
5419132718SkanFuture versions of GCC may provide finer control of this setting
5420132718Skanusing C99's @code{FENV_ACCESS} pragma.  This command line option
5421132718Skanwill be used to specify the default state for @code{FENV_ACCESS}.
5422132718Skan
5423169689Skan@item -frtl-abstract-sequences
5424169689Skan@opindex frtl-abstract-sequences
5425169689SkanIt is a size optimization method. This option is to find identical
5426169689Skansequences of code, which can be turned into pseudo-procedures  and
5427169689Skanthen  replace  all  occurrences with  calls to  the  newly created
5428169689Skansubroutine. It is kind of an opposite of @option{-finline-functions}.
5429169689SkanThis optimization runs at RTL level.
5430169689Skan
5431117395Skan@item -fsignaling-nans
5432117395Skan@opindex fsignaling-nans
5433117395SkanCompile code assuming that IEEE signaling NaNs may generate user-visible
5434117395Skantraps during floating-point operations.  Setting this option disables
5435117395Skanoptimizations that may change the number of exceptions visible with
5436117395Skansignaling NaNs.  This option implies @option{-ftrapping-math}.
5437117395Skan
5438117395SkanThis option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
5439117395Skanbe defined.
5440117395Skan
5441117395SkanThe default is @option{-fno-signaling-nans}.
5442117395Skan
5443117395SkanThis option is experimental and does not currently guarantee to
5444117395Skandisable all GCC optimizations that affect signaling NaN behavior.
5445117395Skan
5446117395Skan@item -fsingle-precision-constant
5447117395Skan@opindex fsingle-precision-constant
5448117395SkanTreat floating point constant as single precision constant instead of
5449117395Skanimplicitly converting it to double precision constant.
5450117395Skan
5451169689Skan@item -fcx-limited-range
5452169689Skan@itemx -fno-cx-limited-range
5453169689Skan@opindex fcx-limited-range
5454169689Skan@opindex fno-cx-limited-range
5455169689SkanWhen enabled, this option states that a range reduction step is not
5456169689Skanneeded when performing complex division.  The default is
5457169689Skan@option{-fno-cx-limited-range}, but is enabled by @option{-ffast-math}.
5458117395Skan
5459169689SkanThis option controls the default setting of the ISO C99 
5460169689Skan@code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
5461169689Skanall languages.
5462169689Skan
5463117395Skan@end table
5464117395Skan
5465117395SkanThe following options control optimizations that may improve
5466117395Skanperformance, but are not enabled by any @option{-O} options.  This
5467117395Skansection includes experimental options that may produce broken code.
5468117395Skan
5469117395Skan@table @gcctabopt
5470117395Skan@item -fbranch-probabilities
5471117395Skan@opindex fbranch-probabilities
5472117395SkanAfter running a program compiled with @option{-fprofile-arcs}
5473117395Skan(@pxref{Debugging Options,, Options for Debugging Your Program or
5474117395Skan@command{gcc}}), you can compile it a second time using
5475117395Skan@option{-fbranch-probabilities}, to improve optimizations based on
5476117395Skanthe number of times each branch was taken.  When the program
5477117395Skancompiled with @option{-fprofile-arcs} exits it saves arc execution
5478132718Skancounts to a file called @file{@var{sourcename}.gcda} for each source
5479117395Skanfile  The information in this data file is very dependent on the
5480117395Skanstructure of the generated code, so you must use the same source code
5481117395Skanand the same optimization options for both compilations.
5482117395Skan
5483132718SkanWith @option{-fbranch-probabilities}, GCC puts a
5484117395Skan@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
5485117395SkanThese can be used to improve optimization.  Currently, they are only
5486117395Skanused in one place: in @file{reorg.c}, instead of guessing which path a
5487117395Skanbranch is mostly to take, the @samp{REG_BR_PROB} values are used to
5488117395Skanexactly determine which path is taken more often.
5489117395Skan
5490132718Skan@item -fprofile-values
5491132718Skan@opindex fprofile-values
5492132718SkanIf combined with @option{-fprofile-arcs}, it adds code so that some
5493132718Skandata about values of expressions in the program is gathered.
5494132718Skan
5495132718SkanWith @option{-fbranch-probabilities}, it reads back the data gathered
5496132718Skanfrom profiling values of expressions and adds @samp{REG_VALUE_PROFILE}
5497132718Skannotes to instructions for their later usage in optimizations.
5498132718Skan
5499169689SkanEnabled with @option{-fprofile-generate} and @option{-fprofile-use}.
5500169689Skan
5501132718Skan@item -fvpt
5502132718Skan@opindex fvpt
5503132718SkanIf combined with @option{-fprofile-arcs}, it instructs the compiler to add
5504132718Skana code to gather information about values of expressions.
5505132718Skan
5506132718SkanWith @option{-fbranch-probabilities}, it reads back the data gathered
5507132718Skanand actually performs the optimizations based on them.
5508132718SkanCurrently the optimizations include specialization of division operation
5509132718Skanusing the knowledge about the value of the denominator.
5510132718Skan
5511169689Skan@item -frename-registers
5512169689Skan@opindex frename-registers
5513169689SkanAttempt to avoid false dependencies in scheduled code by making use
5514169689Skanof registers left over after register allocation.  This optimization
5515169689Skanwill most benefit processors with lots of registers.  Depending on the
5516169689Skandebug information format adopted by the target, however, it can
5517169689Skanmake debugging impossible, since variables will no longer stay in
5518169689Skana ``home register''.
5519117395Skan
5520169689SkanEnabled by default with @option{-funroll-loops}.
5521169689Skan
5522117395Skan@item -ftracer
5523117395Skan@opindex ftracer
5524169689SkanPerform tail duplication to enlarge superblock size.  This transformation
5525117395Skansimplifies the control flow of the function allowing other optimizations to do
5526117395Skanbetter job.
5527117395Skan
5528169689SkanEnabled with @option{-fprofile-use}.
5529132718Skan
5530117395Skan@item -funroll-loops
5531117395Skan@opindex funroll-loops
5532132718SkanUnroll loops whose number of iterations can be determined at compile time or
5533132718Skanupon entry to the loop.  @option{-funroll-loops} implies
5534169689Skan@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}. 
5535169689SkanIt also turns on complete loop peeling (i.e.@: complete removal of loops with
5536169689Skansmall constant number of iterations).  This option makes code larger, and may
5537169689Skanor may not make it run faster.
5538117395Skan
5539169689SkanEnabled with @option{-fprofile-use}.
5540169689Skan
5541117395Skan@item -funroll-all-loops
5542117395Skan@opindex funroll-all-loops
5543117395SkanUnroll all loops, even if their number of iterations is uncertain when
5544117395Skanthe loop is entered.  This usually makes programs run more slowly.
5545117395Skan@option{-funroll-all-loops} implies the same options as
5546132718Skan@option{-funroll-loops}.
5547117395Skan
5548132718Skan@item -fpeel-loops
5549132718Skan@opindex fpeel-loops
5550132718SkanPeels the loops for that there is enough information that they do not
5551132718Skanroll much (from profile feedback).  It also turns on complete loop peeling
5552169689Skan(i.e.@: complete removal of loops with small constant number of iterations).
5553132718Skan
5554169689SkanEnabled with @option{-fprofile-use}.
5555132718Skan
5556169689Skan@item -fmove-loop-invariants
5557169689Skan@opindex fmove-loop-invariants
5558169689SkanEnables the loop invariant motion pass in the RTL loop optimizer.  Enabled
5559169689Skanat level @option{-O1}
5560132718Skan
5561132718Skan@item -funswitch-loops
5562132718Skan@opindex funswitch-loops
5563132718SkanMove branches with loop invariant conditions out of the loop, with duplicates
5564132718Skanof the loop on both branches (modified according to result of the condition).
5565132718Skan
5566117395Skan@item -ffunction-sections
5567117395Skan@itemx -fdata-sections
5568117395Skan@opindex ffunction-sections
5569117395Skan@opindex fdata-sections
5570117395SkanPlace each function or data item into its own section in the output
5571117395Skanfile if the target supports arbitrary sections.  The name of the
5572117395Skanfunction or the name of the data item determines the section's name
5573117395Skanin the output file.
5574117395Skan
5575117395SkanUse these options on systems where the linker can perform optimizations
5576117395Skanto improve locality of reference in the instruction space.  Most systems
5577117395Skanusing the ELF object format and SPARC processors running Solaris 2 have
5578117395Skanlinkers with such optimizations.  AIX may have these optimizations in
5579117395Skanthe future.
5580117395Skan
5581117395SkanOnly use these options when there are significant benefits from doing
5582117395Skanso.  When you specify these options, the assembler and linker will
5583117395Skancreate larger object and executable files and will also be slower.
5584117395SkanYou will not be able to use @code{gprof} on all systems if you
5585117395Skanspecify this option and you may have problems with debugging if
5586117395Skanyou specify both this option and @option{-g}.
5587117395Skan
5588132718Skan@item -fbranch-target-load-optimize
5589132718Skan@opindex fbranch-target-load-optimize
5590132718SkanPerform branch target register load optimization before prologue / epilogue
5591132718Skanthreading.
5592132718SkanThe use of target registers can typically be exposed only during reload,
5593132718Skanthus hoisting loads out of loops and doing inter-block scheduling needs
5594132718Skana separate optimization pass.
559590075Sobrien
5596132718Skan@item -fbranch-target-load-optimize2
5597132718Skan@opindex fbranch-target-load-optimize2
5598132718SkanPerform branch target register load optimization after prologue / epilogue
5599132718Skanthreading.
560090075Sobrien
5601169689Skan@item -fbtr-bb-exclusive
5602169689Skan@opindex fbtr-bb-exclusive
5603169689SkanWhen performing branch target register load optimization, don't reuse
5604169689Skanbranch target registers in within any basic block.
5605169689Skan
5606169689Skan@item -fstack-protector
5607169689SkanEmit extra code to check for buffer overflows, such as stack smashing
5608169689Skanattacks.  This is done by adding a guard variable to functions with
5609169689Skanvulnerable objects.  This includes functions that call alloca, and
5610169689Skanfunctions with buffers larger than 8 bytes.  The guards are initialized
5611169689Skanwhen a function is entered and then checked when the function exits.
5612169689SkanIf a guard check fails, an error message is printed and the program exits.
5613169689Skan
5614169689Skan@item -fstack-protector-all
5615169689SkanLike @option{-fstack-protector} except that all functions are protected.
5616169689Skan
5617169689Skan@item -fsection-anchors
5618169689Skan@opindex fsection-anchors
5619169689SkanTry to reduce the number of symbolic address calculations by using
5620169689Skanshared ``anchor'' symbols to address nearby objects.  This transformation
5621169689Skancan help to reduce the number of GOT entries and GOT accesses on some
5622169689Skantargets.
5623169689Skan
5624169689SkanFor example, the implementation of the following function @code{foo}:
5625169689Skan
5626169689Skan@smallexample
5627169689Skanstatic int a, b, c;
5628169689Skanint foo (void) @{ return a + b + c; @}
5629169689Skan@end smallexample
5630169689Skan
5631169689Skanwould usually calculate the addresses of all three variables, but if you
5632169689Skancompile it with @option{-fsection-anchors}, it will access the variables
5633169689Skanfrom a common anchor point instead.  The effect is similar to the
5634169689Skanfollowing pseudocode (which isn't valid C):
5635169689Skan
5636169689Skan@smallexample
5637169689Skanint foo (void)
5638169689Skan@{
5639169689Skan  register int *xr = &x;
5640169689Skan  return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
5641169689Skan@}
5642169689Skan@end smallexample
5643169689Skan
5644169689SkanNot all targets support this option.
5645169689Skan
564690075Sobrien@item --param @var{name}=@var{value}
564790075Sobrien@opindex param
564890075SobrienIn some places, GCC uses various constants to control the amount of
564990075Sobrienoptimization that is done.  For example, GCC will not inline functions
565090075Sobrienthat contain more that a certain number of instructions.  You can
565190075Sobriencontrol some of these constants on the command-line using the
565290075Sobrien@option{--param} option.
565390075Sobrien
5654132718SkanThe names of specific parameters, and the meaning of the values, are
5655132718Skantied to the internals of the compiler, and are subject to change
5656132718Skanwithout notice in future releases.
5657132718Skan
565890075SobrienIn each case, the @var{value} is an integer.  The allowable choices for
565990075Sobrien@var{name} are given in the following table:
566090075Sobrien
566190075Sobrien@table @gcctabopt
5662169689Skan@item salias-max-implicit-fields
5663169689SkanThe maximum number of fields in a variable without direct
5664169689Skanstructure accesses for which structure aliasing will consider trying 
5665169689Skanto track each field.  The default is 5
5666169689Skan
5667169689Skan@item salias-max-array-elements
5668169689SkanThe maximum number of elements an array can have and its elements
5669169689Skanstill be tracked individually by structure aliasing. The default is 4
5670169689Skan
5671169689Skan@item sra-max-structure-size
5672169689SkanThe maximum structure size, in bytes, at which the scalar replacement
5673169689Skanof aggregates (SRA) optimization will perform block copies.  The
5674169689Skandefault value, 0, implies that GCC will select the most appropriate
5675169689Skansize itself.
5676169689Skan
5677169689Skan@item sra-field-structure-ratio
5678169689SkanThe threshold ratio (as a percentage) between instantiated fields and
5679169689Skanthe complete structure size.  We say that if the ratio of the number
5680169689Skanof bytes in instantiated fields to the number of bytes in the complete
5681169689Skanstructure exceeds this parameter, then block copies are not used.  The
5682169689Skandefault is 75.
5683169689Skan
5684117395Skan@item max-crossjump-edges
5685117395SkanThe maximum number of incoming edges to consider for crossjumping.
5686117395SkanThe algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
5687117395Skanthe number of edges incoming to each block.  Increasing values mean
5688117395Skanmore aggressive optimization, making the compile time increase with
5689117395Skanprobably small improvement in executable size.
5690117395Skan
5691169689Skan@item min-crossjump-insns
5692169689SkanThe minimum number of instructions which must be matched at the end
5693169689Skanof two blocks before crossjumping will be performed on them.  This
5694169689Skanvalue is ignored in the case where all instructions in the block being
5695169689Skancrossjumped from are matched.  The default value is 5.
5696169689Skan
5697169689Skan@item max-grow-copy-bb-insns
5698169689SkanThe maximum code size expansion factor when copying basic blocks
5699169689Skaninstead of jumping.  The expansion is relative to a jump instruction.
5700169689SkanThe default value is 8.
5701169689Skan
5702169689Skan@item max-goto-duplication-insns
5703169689SkanThe maximum number of instructions to duplicate to a block that jumps
5704169689Skanto a computed goto.  To avoid @math{O(N^2)} behavior in a number of
5705169689Skanpasses, GCC factors computed gotos early in the compilation process,
5706169689Skanand unfactors them as late as possible.  Only computed jumps at the
5707169689Skanend of a basic blocks with no more than max-goto-duplication-insns are
5708169689Skanunfactored.  The default value is 8.
5709169689Skan
571090075Sobrien@item max-delay-slot-insn-search
571190075SobrienThe maximum number of instructions to consider when looking for an
571290075Sobrieninstruction to fill a delay slot.  If more than this arbitrary number of
571390075Sobrieninstructions is searched, the time savings from filling the delay slot
571490075Sobrienwill be minimal so stop searching.  Increasing values mean more
571590075Sobrienaggressive optimization, making the compile time increase with probably
571690075Sobriensmall improvement in executable run time.
571790075Sobrien
571890075Sobrien@item max-delay-slot-live-search
571990075SobrienWhen trying to fill delay slots, the maximum number of instructions to
572090075Sobrienconsider when searching for a block with valid live register
572190075Sobrieninformation.  Increasing this arbitrarily chosen value means more
572290075Sobrienaggressive optimization, increasing the compile time.  This parameter
572390075Sobrienshould be removed when the delay slot code is rewritten to maintain the
572490075Sobriencontrol-flow graph.
572590075Sobrien
572690075Sobrien@item max-gcse-memory
572790075SobrienThe approximate maximum amount of memory that will be allocated in
572890075Sobrienorder to perform the global common subexpression elimination
572990075Sobrienoptimization.  If more memory than specified is required, the
573090075Sobrienoptimization will not be done.
573190075Sobrien
573290075Sobrien@item max-gcse-passes
5733169689SkanThe maximum number of passes of GCSE to run.  The default is 1.
573490075Sobrien
573590075Sobrien@item max-pending-list-length
573690075SobrienThe maximum number of pending dependencies scheduling will allow
573790075Sobrienbefore flushing the current state and starting over.  Large functions
573890075Sobrienwith few branches or calls can create excessively large lists which
573990075Sobrienneedlessly consume memory and resources.
574090075Sobrien
5741117395Skan@item max-inline-insns-single
5742117395SkanSeveral parameters control the tree inliner used in gcc.
5743132718SkanThis number sets the maximum number of instructions (counted in GCC's
5744132718Skaninternal representation) in a single function that the tree inliner
5745117395Skanwill consider for inlining.  This only affects functions declared
5746117395Skaninline and methods implemented in a class declaration (C++).
5747169689SkanThe default value is 450.
5748117395Skan
5749117395Skan@item max-inline-insns-auto
5750117395SkanWhen you use @option{-finline-functions} (included in @option{-O3}),
5751117395Skana lot of functions that would otherwise not be considered for inlining
5752117395Skanby the compiler will be investigated.  To those functions, a different
5753117395Skan(more restrictive) limit compared to functions declared inline can
5754117395Skanbe applied.
5755169689SkanThe default value is 90.
5756117395Skan
5757132718Skan@item large-function-insns
5758169689SkanThe limit specifying really large functions.  For functions larger than this
5759169689Skanlimit after inlining inlining is constrained by
5760169689Skan@option{--param large-function-growth}.  This parameter is useful primarily
5761169689Skanto avoid extreme compilation time caused by non-linear algorithms used by the
5762169689Skanbackend.
5763132718SkanThis parameter is ignored when @option{-funit-at-a-time} is not used.
5764169689SkanThe default value is 2700.
576590075Sobrien
5766132718Skan@item large-function-growth
5767132718SkanSpecifies maximal growth of large function caused by inlining in percents.
5768132718SkanThis parameter is ignored when @option{-funit-at-a-time} is not used.
5769169689SkanThe default value is 100 which limits large function growth to 2.0 times
5770169689Skanthe original size.
5771117395Skan
5772169689Skan@item large-unit-insns
5773169689SkanThe limit specifying large translation unit.  Growth caused by inlining of
5774169689Skanunits larger than this limit is limited by @option{--param inline-unit-growth}.
5775169689SkanFor small units this might be too tight (consider unit consisting of function A
5776169689Skanthat is inline and B that just calls A three time.  If B is small relative to
5777169689SkanA, the growth of unit is 300\% and yet such inlining is very sane.  For very
5778169689Skanlarge units consisting of small inlininable functions however the overall unit
5779169689Skangrowth limit is needed to avoid exponential explosion of code size.  Thus for
5780169689Skansmaller units, the size is increased to @option{--param large-unit-insns}
5781169689Skanbefore applying @option{--param inline-unit-growth}.  The default is 10000
5782169689Skan
5783132718Skan@item inline-unit-growth
5784132718SkanSpecifies maximal overall growth of the compilation unit caused by inlining.
5785132718SkanThis parameter is ignored when @option{-funit-at-a-time} is not used.
5786169689SkanThe default value is 50 which limits unit growth to 1.5 times the original
5787169689Skansize.
5788117395Skan
5789169689Skan@item max-inline-insns-recursive
5790169689Skan@itemx max-inline-insns-recursive-auto
5791169689SkanSpecifies maximum number of instructions out-of-line copy of self recursive inline
5792169689Skanfunction can grow into by performing recursive inlining.
5793117395Skan
5794169689SkanFor functions declared inline @option{--param max-inline-insns-recursive} is
5795169689Skantaken into account.  For function not declared inline, recursive inlining
5796169689Skanhappens only when @option{-finline-functions} (included in @option{-O3}) is
5797169689Skanenabled and @option{--param max-inline-insns-recursive-auto} is used.  The
5798169689Skandefault value is 450.
5799169689Skan
5800169689Skan@item max-inline-recursive-depth
5801169689Skan@itemx max-inline-recursive-depth-auto
5802169689SkanSpecifies maximum recursion depth used by the recursive inlining.
5803169689Skan
5804169689SkanFor functions declared inline @option{--param max-inline-recursive-depth} is
5805169689Skantaken into account.  For function not declared inline, recursive inlining
5806169689Skanhappens only when @option{-finline-functions} (included in @option{-O3}) is
5807169689Skanenabled and @option{--param max-inline-recursive-depth-auto} is used.  The
5808169689Skandefault value is 450.
5809169689Skan
5810169689Skan@item min-inline-recursive-probability
5811169689SkanRecursive inlining is profitable only for function having deep recursion
5812169689Skanin average and can hurt for function having little recursion depth by
5813169689Skanincreasing the prologue size or complexity of function body to other
5814169689Skanoptimizers.
5815169689Skan
5816169689SkanWhen profile feedback is available (see @option{-fprofile-generate}) the actual
5817169689Skanrecursion depth can be guessed from probability that function will recurse via
5818169689Skangiven call expression.  This parameter limits inlining only to call expression
5819169689Skanwhose probability exceeds given threshold (in percents).  The default value is
5820169689Skan10.
5821169689Skan
5822169689Skan@item inline-call-cost
5823169689SkanSpecify cost of call instruction relative to simple arithmetics operations
5824169689Skan(having cost of 1).  Increasing this cost disqualifies inlining of non-leaf
5825169689Skanfunctions and at the same time increases size of leaf function that is believed to
5826169689Skanreduce function size by being inlined.  In effect it increases amount of
5827169689Skaninlining for code having large abstraction penalty (many functions that just
5828169689Skanpass the arguments to other functions) and decrease inlining for code with low
5829169689Skanabstraction penalty.  The default value is 16.
5830169689Skan
5831117395Skan@item max-unrolled-insns
5832117395SkanThe maximum number of instructions that a loop should have if that loop
5833117395Skanis unrolled, and if the loop is unrolled, it determines how many times
5834117395Skanthe loop code is unrolled.
5835117395Skan
5836132718Skan@item max-average-unrolled-insns
5837132718SkanThe maximum number of instructions biased by probabilities of their execution
5838132718Skanthat a loop should have if that loop is unrolled, and if the loop is unrolled,
5839132718Skanit determines how many times the loop code is unrolled.
5840132718Skan
5841132718Skan@item max-unroll-times
5842132718SkanThe maximum number of unrollings of a single loop.
5843132718Skan
5844132718Skan@item max-peeled-insns
5845132718SkanThe maximum number of instructions that a loop should have if that loop
5846132718Skanis peeled, and if the loop is peeled, it determines how many times
5847132718Skanthe loop code is peeled.
5848132718Skan
5849132718Skan@item max-peel-times
5850132718SkanThe maximum number of peelings of a single loop.
5851132718Skan
5852132718Skan@item max-completely-peeled-insns
5853132718SkanThe maximum number of insns of a completely peeled loop.
5854132718Skan
5855132718Skan@item max-completely-peel-times
5856132718SkanThe maximum number of iterations of a loop to be suitable for complete peeling.
5857132718Skan
5858132718Skan@item max-unswitch-insns
5859132718SkanThe maximum number of insns of an unswitched loop.
5860132718Skan
5861132718Skan@item max-unswitch-level
5862132718SkanThe maximum number of branches unswitched in a single loop.
5863132718Skan
5864169689Skan@item lim-expensive
5865169689SkanThe minimum cost of an expensive expression in the loop invariant motion.
5866169689Skan
5867169689Skan@item iv-consider-all-candidates-bound
5868169689SkanBound on number of candidates for induction variables below that
5869169689Skanall candidates are considered for each use in induction variable
5870169689Skanoptimizations.  Only the most relevant candidates are considered
5871169689Skanif there are more candidates, to avoid quadratic time complexity.
5872169689Skan
5873169689Skan@item iv-max-considered-uses
5874169689SkanThe induction variable optimizations give up on loops that contain more
5875169689Skaninduction variable uses.
5876169689Skan
5877169689Skan@item iv-always-prune-cand-set-bound
5878169689SkanIf number of candidates in the set is smaller than this value,
5879169689Skanwe always try to remove unnecessary ivs from the set during its
5880169689Skanoptimization when a new iv is added to the set.
5881169689Skan
5882169689Skan@item scev-max-expr-size
5883169689SkanBound on size of expressions used in the scalar evolutions analyzer.
5884169689SkanLarge expressions slow the analyzer.
5885169689Skan
5886169689Skan@item vect-max-version-checks
5887169689SkanThe maximum number of runtime checks that can be performed when doing
5888169689Skanloop versioning in the vectorizer.  See option ftree-vect-loop-version
5889169689Skanfor more information.
5890169689Skan
5891169689Skan@item max-iterations-to-track
5892169689Skan
5893169689SkanThe maximum number of iterations of a loop the brute force algorithm
5894169689Skanfor analysis of # of iterations of the loop tries to evaluate.
5895169689Skan
5896117395Skan@item hot-bb-count-fraction
5897117395SkanSelect fraction of the maximal count of repetitions of basic block in program
5898117395Skangiven basic block needs to have to be considered hot.
5899117395Skan
5900117395Skan@item hot-bb-frequency-fraction
5901117395SkanSelect fraction of the maximal frequency of executions of basic block in
5902117395Skanfunction given basic block needs to have to be considered hot
5903117395Skan
5904169689Skan@item max-predicted-iterations
5905169689SkanThe maximum number of loop iterations we predict statically.  This is useful
5906169689Skanin cases where function contain single loop with known bound and other loop
5907169689Skanwith unknown.  We predict the known number of iterations correctly, while
5908169689Skanthe unknown number of iterations average to roughly 10.  This means that the
5909169689Skanloop without bounds would appear artificially cold relative to the other one.
5910169689Skan
5911117395Skan@item tracer-dynamic-coverage
5912117395Skan@itemx tracer-dynamic-coverage-feedback
5913117395Skan
5914117395SkanThis value is used to limit superblock formation once the given percentage of
5915117395Skanexecuted instructions is covered.  This limits unnecessary code size
5916117395Skanexpansion.
5917117395Skan
5918117395SkanThe @option{tracer-dynamic-coverage-feedback} is used only when profile
5919117395Skanfeedback is available.  The real profiles (as opposed to statically estimated
5920117395Skanones) are much less balanced allowing the threshold to be larger value.
5921117395Skan
5922117395Skan@item tracer-max-code-growth
5923117395SkanStop tail duplication once code growth has reached given percentage.  This is
5924117395Skanrather hokey argument, as most of the duplicates will be eliminated later in
5925117395Skancross jumping, so it may be set to much higher values than is the desired code
5926117395Skangrowth.
5927117395Skan
5928117395Skan@item tracer-min-branch-ratio
5929117395Skan
5930117395SkanStop reverse growth when the reverse probability of best edge is less than this
5931117395Skanthreshold (in percent).
5932117395Skan
5933117395Skan@item tracer-min-branch-ratio
5934117395Skan@itemx tracer-min-branch-ratio-feedback
5935117395Skan
5936117395SkanStop forward growth if the best edge do have probability lower than this
5937117395Skanthreshold.
5938117395Skan
5939117395SkanSimilarly to @option{tracer-dynamic-coverage} two values are present, one for
5940117395Skancompilation for profile feedback and one for compilation without.  The value
5941117395Skanfor compilation with profile feedback needs to be more conservative (higher) in
5942117395Skanorder to make tracer effective.
5943117395Skan
5944132718Skan@item max-cse-path-length
5945132718Skan
5946169689SkanMaximum number of basic blocks on path that cse considers.  The default is 10.
5947132718Skan
5948169689Skan@item max-cse-insns
5949169689SkanThe maximum instructions CSE process before flushing. The default is 1000.
5950146895Skan
5951169689Skan@item global-var-threshold
5952146895Skan
5953169689SkanCounts the number of function calls (@var{n}) and the number of
5954169689Skancall-clobbered variables (@var{v}).  If @var{n}x@var{v} is larger than this limit, a
5955169689Skansingle artificial variable will be created to represent all the
5956169689Skancall-clobbered variables at function call sites.  This artificial
5957169689Skanvariable will then be made to alias every call-clobbered variable.
5958169689Skan(done as @code{int * size_t} on the host machine; beware overflow).
5959169689Skan
5960169689Skan@item max-aliased-vops
5961169689Skan
5962169689SkanMaximum number of virtual operands allowed to represent aliases
5963169689Skanbefore triggering the alias grouping heuristic.  Alias grouping
5964169689Skanreduces compile times and memory consumption needed for aliasing at
5965169689Skanthe expense of precision loss in alias information.
5966169689Skan
5967117395Skan@item ggc-min-expand
5968117395Skan
5969117395SkanGCC uses a garbage collector to manage its own memory allocation.  This
5970117395Skanparameter specifies the minimum percentage by which the garbage
5971117395Skancollector's heap should be allowed to expand between collections.
5972117395SkanTuning this may improve compilation speed; it has no effect on code
5973117395Skangeneration.
5974117395Skan
5975117395SkanThe default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
5976169689SkanRAM >= 1GB@.  If @code{getrlimit} is available, the notion of "RAM" is
5977169689Skanthe smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
5978117395SkanGCC is not able to calculate RAM on a particular platform, the lower
5979117395Skanbound of 30% is used.  Setting this parameter and
5980117395Skan@option{ggc-min-heapsize} to zero causes a full collection to occur at
5981117395Skanevery opportunity.  This is extremely slow, but can be useful for
5982117395Skandebugging.
5983117395Skan
5984117395Skan@item ggc-min-heapsize
5985117395Skan
5986117395SkanMinimum size of the garbage collector's heap before it begins bothering
5987117395Skanto collect garbage.  The first collection occurs after the heap expands
5988117395Skanby @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
5989117395Skantuning this may improve compilation speed, and has no effect on code
5990117395Skangeneration.
5991117395Skan
5992169689SkanThe default is the smaller of RAM/8, RLIMIT_RSS, or a limit which
5993169689Skantries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
5994169689Skanwith a lower bound of 4096 (four megabytes) and an upper bound of
5995169689Skan131072 (128 megabytes).  If GCC is not able to calculate RAM on a
5996169689Skanparticular platform, the lower bound is used.  Setting this parameter
5997169689Skanvery large effectively disables garbage collection.  Setting this
5998169689Skanparameter and @option{ggc-min-expand} to zero causes a full collection
5999169689Skanto occur at every opportunity.
6000117395Skan
6001132718Skan@item max-reload-search-insns
6002132718SkanThe maximum number of instruction reload should look backward for equivalent
6003132718Skanregister.  Increasing values mean more aggressive optimization, making the
6004132718Skancompile time increase with probably slightly better performance.  The default
6005132718Skanvalue is 100.
6006132718Skan
6007169689Skan@item max-cselib-memory-locations
6008169689SkanThe maximum number of memory locations cselib should take into account.
6009132718SkanIncreasing values mean more aggressive optimization, making the compile time
6010132718Skanincrease with probably slightly better performance.  The default value is 500.
6011132718Skan
6012169689Skan@item max-flow-memory-locations
6013169689SkanSimilar as @option{max-cselib-memory-locations} but for dataflow liveness.
6014169689SkanThe default value is 100.
6015169689Skan
6016132718Skan@item reorder-blocks-duplicate
6017132718Skan@itemx reorder-blocks-duplicate-feedback
6018132718Skan
6019132718SkanUsed by basic block reordering pass to decide whether to use unconditional
6020132718Skanbranch or duplicate the code on its destination.  Code is duplicated when its
6021132718Skanestimated size is smaller than this value multiplied by the estimated size of
6022132718Skanunconditional jump in the hot spots of the program.
6023132718Skan
6024132718SkanThe @option{reorder-block-duplicate-feedback} is used only when profile
6025132718Skanfeedback is available and may be set to higher values than
6026132718Skan@option{reorder-block-duplicate} since information about the hot spots is more
6027132718Skanaccurate.
6028169689Skan
6029169689Skan@item max-sched-ready-insns
6030169689SkanThe maximum number of instructions ready to be issued the scheduler should
6031169689Skanconsider at any given time during the first scheduling pass.  Increasing
6032169689Skanvalues mean more thorough searches, making the compilation time increase
6033169689Skanwith probably little benefit.  The default value is 100.
6034169689Skan
6035169689Skan@item max-sched-region-blocks
6036169689SkanThe maximum number of blocks in a region to be considered for
6037169689Skaninterblock scheduling.  The default value is 10.
6038169689Skan
6039169689Skan@item max-sched-region-insns
6040169689SkanThe maximum number of insns in a region to be considered for
6041169689Skaninterblock scheduling.  The default value is 100.
6042169689Skan
6043169689Skan@item min-spec-prob
6044169689SkanThe minimum probability (in percents) of reaching a source block
6045169689Skanfor interblock speculative scheduling.  The default value is 40.
6046169689Skan
6047169689Skan@item max-sched-extend-regions-iters
6048169689SkanThe maximum number of iterations through CFG to extend regions.
6049169689Skan0 - disable region extension,
6050169689SkanN - do at most N iterations.
6051169689SkanThe default value is 0.
6052169689Skan
6053169689Skan@item max-sched-insn-conflict-delay
6054169689SkanThe maximum conflict delay for an insn to be considered for speculative motion.
6055169689SkanThe default value is 3.
6056169689Skan
6057169689Skan@item sched-spec-prob-cutoff
6058169689SkanThe minimal probability of speculation success (in percents), so that
6059169689Skanspeculative insn will be scheduled.
6060169689SkanThe default value is 40.
6061169689Skan
6062169689Skan@item max-last-value-rtl
6063169689Skan
6064169689SkanThe maximum size measured as number of RTLs that can be recorded in an expression
6065169689Skanin combiner for a pseudo register as last known value of that register.  The default
6066169689Skanis 10000.
6067169689Skan
6068169689Skan@item integer-share-limit
6069169689SkanSmall integer constants can use a shared data structure, reducing the
6070169689Skancompiler's memory usage and increasing its speed.  This sets the maximum
6071169689Skanvalue of a shared integer constant's.  The default value is 256.
6072169689Skan
6073169689Skan@item min-virtual-mappings
6074169689SkanSpecifies the minimum number of virtual mappings in the incremental
6075169689SkanSSA updater that should be registered to trigger the virtual mappings
6076169689Skanheuristic defined by virtual-mappings-ratio.  The default value is
6077169689Skan100.
6078169689Skan
6079169689Skan@item virtual-mappings-ratio
6080169689SkanIf the number of virtual mappings is virtual-mappings-ratio bigger
6081169689Skanthan the number of virtual symbols to be updated, then the incremental
6082169689SkanSSA updater switches to a full update for those symbols.  The default
6083169689Skanratio is 3.
6084169689Skan
6085169689Skan@item ssp-buffer-size
6086169689SkanThe minimum size of buffers (i.e. arrays) that will receive stack smashing
6087169689Skanprotection when @option{-fstack-protection} is used.
6088169689Skan
6089169689Skan@item max-jump-thread-duplication-stmts
6090169689SkanMaximum number of statements allowed in a block that needs to be
6091169689Skanduplicated when threading jumps.
6092169689Skan
6093169689Skan@item max-fields-for-field-sensitive
6094169689SkanMaximum number of fields in a structure we will treat in
6095169689Skana field sensitive manner during pointer analysis.
6096169689Skan
609790075Sobrien@end table
609890075Sobrien@end table
609990075Sobrien
610090075Sobrien@node Preprocessor Options
610190075Sobrien@section Options Controlling the Preprocessor
610290075Sobrien@cindex preprocessor options
610390075Sobrien@cindex options, preprocessor
610490075Sobrien
610590075SobrienThese options control the C preprocessor, which is run on each C source
610690075Sobrienfile before actual compilation.
610790075Sobrien
610890075SobrienIf you use the @option{-E} option, nothing is done except preprocessing.
610990075SobrienSome of these options make sense only together with @option{-E} because
611090075Sobrienthey cause the preprocessor output to be unsuitable for actual
611190075Sobriencompilation.
611290075Sobrien
6113132718Skan@table @gcctabopt
611496263Sobrien@opindex Wp
611596263SobrienYou can use @option{-Wp,@var{option}} to bypass the compiler driver
611696263Sobrienand pass @var{option} directly through to the preprocessor.  If
611796263Sobrien@var{option} contains commas, it is split into multiple options at the
611896263Sobriencommas.  However, many options are modified, translated or interpreted
611996263Sobrienby the compiler driver before being passed to the preprocessor, and
612096263Sobrien@option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
612196263Sobrieninterface is undocumented and subject to change, so whenever possible
612296263Sobrienyou should avoid using @option{-Wp} and let the driver handle the
612396263Sobrienoptions instead.
612490075Sobrien
6125132718Skan@item -Xpreprocessor @var{option}
6126132718Skan@opindex preprocessor
6127132718SkanPass @var{option} as an option to the preprocessor.  You can use this to
6128132718Skansupply system-specific preprocessor options which GCC does not know how to
6129132718Skanrecognize.
6130132718Skan
6131132718SkanIf you want to pass an option that takes an argument, you must use
6132132718Skan@option{-Xpreprocessor} twice, once for the option and once for the argument.
6133132718Skan@end table
6134132718Skan
613596263Sobrien@include cppopts.texi
613690075Sobrien
613790075Sobrien@node Assembler Options
613890075Sobrien@section Passing Options to the Assembler
613990075Sobrien
614090075Sobrien@c prevent bad page break with this line
614190075SobrienYou can pass options to the assembler.
614290075Sobrien
614390075Sobrien@table @gcctabopt
614490075Sobrien@item -Wa,@var{option}
614590075Sobrien@opindex Wa
614690075SobrienPass @var{option} as an option to the assembler.  If @var{option}
614790075Sobriencontains commas, it is split into multiple options at the commas.
6148132718Skan
6149132718Skan@item -Xassembler @var{option}
6150132718Skan@opindex Xassembler
6151132718SkanPass @var{option} as an option to the assembler.  You can use this to
6152132718Skansupply system-specific assembler options which GCC does not know how to
6153132718Skanrecognize.
6154132718Skan
6155132718SkanIf you want to pass an option that takes an argument, you must use
6156132718Skan@option{-Xassembler} twice, once for the option and once for the argument.
6157132718Skan
615890075Sobrien@end table
615990075Sobrien
616090075Sobrien@node Link Options
616190075Sobrien@section Options for Linking
616290075Sobrien@cindex link options
616390075Sobrien@cindex options, linking
616490075Sobrien
616590075SobrienThese options come into play when the compiler links object files into
616690075Sobrienan executable output file.  They are meaningless if the compiler is
616790075Sobriennot doing a link step.
616890075Sobrien
616990075Sobrien@table @gcctabopt
617090075Sobrien@cindex file names
617190075Sobrien@item @var{object-file-name}
617290075SobrienA file name that does not end in a special recognized suffix is
617390075Sobrienconsidered to name an object file or library.  (Object files are
617490075Sobriendistinguished from libraries by the linker according to the file
617590075Sobriencontents.)  If linking is done, these object files are used as input
617690075Sobriento the linker.
617790075Sobrien
617890075Sobrien@item -c
617990075Sobrien@itemx -S
618090075Sobrien@itemx -E
618190075Sobrien@opindex c
618290075Sobrien@opindex S
618390075Sobrien@opindex E
618490075SobrienIf any of these options is used, then the linker is not run, and
618590075Sobrienobject file names should not be used as arguments.  @xref{Overall
618690075SobrienOptions}.
618790075Sobrien
618890075Sobrien@cindex Libraries
618990075Sobrien@item -l@var{library}
619090075Sobrien@itemx -l @var{library}
619190075Sobrien@opindex l
619290075SobrienSearch the library named @var{library} when linking.  (The second
619390075Sobrienalternative with the library as a separate argument is only for
619490075SobrienPOSIX compliance and is not recommended.)
619590075Sobrien
619690075SobrienIt makes a difference where in the command you write this option; the
619790075Sobrienlinker searches and processes libraries and object files in the order they
619890075Sobrienare specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
619990075Sobrienafter file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
620090075Sobriento functions in @samp{z}, those functions may not be loaded.
620190075Sobrien
620290075SobrienThe linker searches a standard list of directories for the library,
620390075Sobrienwhich is actually a file named @file{lib@var{library}.a}.  The linker
620490075Sobrienthen uses this file as if it had been specified precisely by name.
620590075Sobrien
620690075SobrienThe directories searched include several standard system directories
620790075Sobrienplus any that you specify with @option{-L}.
620890075Sobrien
620990075SobrienNormally the files found this way are library files---archive files
621090075Sobrienwhose members are object files.  The linker handles an archive file by
621190075Sobrienscanning through it for members which define symbols that have so far
621290075Sobrienbeen referenced but not defined.  But if the file that is found is an
621390075Sobrienordinary object file, it is linked in the usual fashion.  The only
621490075Sobriendifference between using an @option{-l} option and specifying a file name
621590075Sobrienis that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
621690075Sobrienand searches several directories.
621790075Sobrien
621890075Sobrien@item -nostartfiles
621990075Sobrien@opindex nostartfiles
622090075SobrienDo not use the standard system startup files when linking.
622190075SobrienThe standard system libraries are used normally, unless @option{-nostdlib}
622290075Sobrienor @option{-nodefaultlibs} is used.
622390075Sobrien
622490075Sobrien@item -nodefaultlibs
622590075Sobrien@opindex nodefaultlibs
622690075SobrienDo not use the standard system libraries when linking.
622790075SobrienOnly the libraries you specify will be passed to the linker.
622890075SobrienThe standard startup files are used normally, unless @option{-nostartfiles}
6229169689Skanis used.  The compiler may generate calls to @code{memcmp},
6230169689Skan@code{memset}, @code{memcpy} and @code{memmove}.
6231169689SkanThese entries are usually resolved by entries in
623290075Sobrienlibc.  These entry points should be supplied through some other
623390075Sobrienmechanism when this option is specified.
623490075Sobrien
623590075Sobrien@item -nostdlib
623690075Sobrien@opindex nostdlib
623790075SobrienDo not use the standard system startup files or libraries when linking.
623890075SobrienNo startup files and only the libraries you specify will be passed to
6239169689Skanthe linker.  The compiler may generate calls to @code{memcmp}, @code{memset},
6240169689Skan@code{memcpy} and @code{memmove}.
6241169689SkanThese entries are usually resolved by entries in
624290075Sobrienlibc.  These entry points should be supplied through some other
624390075Sobrienmechanism when this option is specified.
624490075Sobrien
624590075Sobrien@cindex @option{-lgcc}, use with @option{-nostdlib}
624690075Sobrien@cindex @option{-nostdlib} and unresolved references
624790075Sobrien@cindex unresolved references and @option{-nostdlib}
624890075Sobrien@cindex @option{-lgcc}, use with @option{-nodefaultlibs}
624990075Sobrien@cindex @option{-nodefaultlibs} and unresolved references
625090075Sobrien@cindex unresolved references and @option{-nodefaultlibs}
625190075SobrienOne of the standard libraries bypassed by @option{-nostdlib} and
625290075Sobrien@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
625390075Sobrienthat GCC uses to overcome shortcomings of particular machines, or special
625490075Sobrienneeds for some languages.
625590075Sobrien(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
625690075SobrienCollection (GCC) Internals},
625790075Sobrienfor more discussion of @file{libgcc.a}.)
625890075SobrienIn most cases, you need @file{libgcc.a} even when you want to avoid
625990075Sobrienother standard libraries.  In other words, when you specify @option{-nostdlib}
626090075Sobrienor @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
626190075SobrienThis ensures that you have no unresolved references to internal GCC
626290075Sobrienlibrary subroutines.  (For example, @samp{__main}, used to ensure C++
626390075Sobrienconstructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
626490075SobrienGNU Compiler Collection (GCC) Internals}.)
626590075Sobrien
6266132718Skan@item -pie
6267132718Skan@opindex pie
6268132718SkanProduce a position independent executable on targets which support it.
6269132718SkanFor predictable results, you must also specify the same set of options
6270132718Skanthat were used to generate code (@option{-fpie}, @option{-fPIE},
6271132718Skanor model suboptions) when you specify this option.
6272132718Skan
6273169689Skan@item -rdynamic
6274169689Skan@opindex rdynamic
6275169689SkanPass the flag @option{-export-dynamic} to the ELF linker, on targets
6276169689Skanthat support it. This instructs the linker to add all symbols, not
6277169689Skanonly used ones, to the dynamic symbol table. This option is needed
6278169689Skanfor some uses of @code{dlopen} or to allow obtaining backtraces
6279169689Skanfrom within a program.
6280169689Skan
628190075Sobrien@item -s
628290075Sobrien@opindex s
628390075SobrienRemove all symbol table and relocation information from the executable.
628490075Sobrien
628590075Sobrien@item -static
628690075Sobrien@opindex static
628790075SobrienOn systems that support dynamic linking, this prevents linking with the shared
628890075Sobrienlibraries.  On other systems, this option has no effect.
628990075Sobrien
629090075Sobrien@item -shared
629190075Sobrien@opindex shared
629290075SobrienProduce a shared object which can then be linked with other objects to
629390075Sobrienform an executable.  Not all systems support this option.  For predictable
629490075Sobrienresults, you must also specify the same set of options that were used to
629590075Sobriengenerate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
629690075Sobrienwhen you specify this option.@footnote{On some systems, @samp{gcc -shared}
629790075Sobrienneeds to build supplementary stub code for constructors to work.  On
629890075Sobrienmulti-libbed systems, @samp{gcc -shared} must select the correct support
629990075Sobrienlibraries to link against.  Failing to supply the correct flags may lead
630090075Sobriento subtle defects.  Supplying them in cases where they are not necessary
630190075Sobrienis innocuous.}
630290075Sobrien
630390075Sobrien@item -shared-libgcc
630490075Sobrien@itemx -static-libgcc
630590075Sobrien@opindex shared-libgcc
630690075Sobrien@opindex static-libgcc
630790075SobrienOn systems that provide @file{libgcc} as a shared library, these options
630890075Sobrienforce the use of either the shared or static version respectively.
630990075SobrienIf no shared version of @file{libgcc} was built when the compiler was
631090075Sobrienconfigured, these options have no effect.
631190075Sobrien
631290075SobrienThere are several situations in which an application should use the
631390075Sobrienshared @file{libgcc} instead of the static version.  The most common
631490075Sobrienof these is when the application wishes to throw and catch exceptions
631590075Sobrienacross different shared libraries.  In that case, each of the libraries
631690075Sobrienas well as the application itself should use the shared @file{libgcc}.
631790075Sobrien
631896263SobrienTherefore, the G++ and GCJ drivers automatically add
631996263Sobrien@option{-shared-libgcc} whenever you build a shared library or a main
632096263Sobrienexecutable, because C++ and Java programs typically use exceptions, so
632196263Sobrienthis is the right thing to do.
632290075Sobrien
632396263SobrienIf, instead, you use the GCC driver to create shared libraries, you may
632496263Sobrienfind that they will not always be linked with the shared @file{libgcc}.
6325132718SkanIf GCC finds, at its configuration time, that you have a non-GNU linker
6326132718Skanor a GNU linker that does not support option @option{--eh-frame-hdr},
6327132718Skanit will link the shared version of @file{libgcc} into shared libraries
6328132718Skanby default.  Otherwise, it will take advantage of the linker and optimize
6329132718Skanaway the linking with the shared version of @file{libgcc}, linking with
6330132718Skanthe static version of libgcc by default.  This allows exceptions to
6331132718Skanpropagate through such shared libraries, without incurring relocation
6332132718Skancosts at library load time.
633396263Sobrien
633496263SobrienHowever, if a library or main executable is supposed to throw or catch
633596263Sobrienexceptions, you must link it using the G++ or GCJ driver, as appropriate
633696263Sobrienfor the languages used in the program, or using the option
633796263Sobrien@option{-shared-libgcc}, such that it is linked with the shared
633890075Sobrien@file{libgcc}.
633990075Sobrien
634090075Sobrien@item -symbolic
634190075Sobrien@opindex symbolic
634290075SobrienBind references to global symbols when building a shared object.  Warn
634390075Sobrienabout any unresolved references (unless overridden by the link editor
634490075Sobrienoption @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
634590075Sobrienthis option.
634690075Sobrien
634790075Sobrien@item -Xlinker @var{option}
634890075Sobrien@opindex Xlinker
634990075SobrienPass @var{option} as an option to the linker.  You can use this to
635090075Sobriensupply system-specific linker options which GCC does not know how to
635190075Sobrienrecognize.
635290075Sobrien
635390075SobrienIf you want to pass an option that takes an argument, you must use
635490075Sobrien@option{-Xlinker} twice, once for the option and once for the argument.
635590075SobrienFor example, to pass @option{-assert definitions}, you must write
635690075Sobrien@samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
635790075Sobrien@option{-Xlinker "-assert definitions"}, because this passes the entire
635890075Sobrienstring as a single argument, which is not what the linker expects.
635990075Sobrien
636090075Sobrien@item -Wl,@var{option}
636190075Sobrien@opindex Wl
636290075SobrienPass @var{option} as an option to the linker.  If @var{option} contains
636390075Sobriencommas, it is split into multiple options at the commas.
636490075Sobrien
636590075Sobrien@item -u @var{symbol}
636690075Sobrien@opindex u
636790075SobrienPretend the symbol @var{symbol} is undefined, to force linking of
636890075Sobrienlibrary modules to define it.  You can use @option{-u} multiple times with
636990075Sobriendifferent symbols to force loading of additional library modules.
637090075Sobrien@end table
637190075Sobrien
637290075Sobrien@node Directory Options
637390075Sobrien@section Options for Directory Search
637490075Sobrien@cindex directory options
637590075Sobrien@cindex options, directory search
637690075Sobrien@cindex search path
637790075Sobrien
637890075SobrienThese options specify directories to search for header files, for
637990075Sobrienlibraries and for parts of the compiler:
638090075Sobrien
638190075Sobrien@table @gcctabopt
638290075Sobrien@item -I@var{dir}
638390075Sobrien@opindex I
638490075SobrienAdd the directory @var{dir} to the head of the list of directories to be
638590075Sobriensearched for header files.  This can be used to override a system header
638690075Sobrienfile, substituting your own version, since these directories are
638790075Sobriensearched before the system header file directories.  However, you should
638890075Sobriennot use this option to add directories that contain vendor-supplied
638990075Sobriensystem header files (use @option{-isystem} for that).  If you use more than
639090075Sobrienone @option{-I} option, the directories are scanned in left-to-right
639190075Sobrienorder; the standard system directories come after.
639290075Sobrien
639390075SobrienIf a standard system include directory, or a directory specified with
6394104752Skan@option{-isystem}, is also specified with @option{-I}, the @option{-I}
6395104752Skanoption will be ignored.  The directory will still be searched but as a
6396104752Skansystem directory at its normal position in the system include chain.
6397104752SkanThis is to ensure that GCC's procedure to fix buggy system headers and
6398117395Skanthe ordering for the include_next directive are not inadvertently changed.
6399104752SkanIf you really need to change the search order for system directories,
6400104752Skanuse the @option{-nostdinc} and/or @option{-isystem} options.
640190075Sobrien
6402169689Skan@item -iquote@var{dir}
6403169689Skan@opindex iquote
6404169689SkanAdd the directory @var{dir} to the head of the list of directories to
6405169689Skanbe searched for header files only for the case of @samp{#include
6406169689Skan"@var{file}"}; they are not searched for @samp{#include <@var{file}>},
6407169689Skanotherwise just like @option{-I}.
640890075Sobrien
640990075Sobrien@item -L@var{dir}
641090075Sobrien@opindex L
641190075SobrienAdd directory @var{dir} to the list of directories to be searched
641290075Sobrienfor @option{-l}.
641390075Sobrien
641490075Sobrien@item -B@var{prefix}
641590075Sobrien@opindex B
641690075SobrienThis option specifies where to find the executables, libraries,
641790075Sobrieninclude files, and data files of the compiler itself.
641890075Sobrien
641990075SobrienThe compiler driver program runs one or more of the subprograms
642090075Sobrien@file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
642190075Sobrien@var{prefix} as a prefix for each program it tries to run, both with and
642290075Sobrienwithout @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
642390075Sobrien
642490075SobrienFor each subprogram to be run, the compiler driver first tries the
642590075Sobrien@option{-B} prefix, if any.  If that name is not found, or if @option{-B}
642690075Sobrienwas not specified, the driver tries two standard prefixes, which are
6427132718Skan@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
642890075Sobrienthose results in a file name that is found, the unmodified program
642990075Sobrienname is searched for using the directories specified in your
643090075Sobrien@env{PATH} environment variable.
643190075Sobrien
643290075SobrienThe compiler will check to see if the path provided by the @option{-B}
643390075Sobrienrefers to a directory, and if necessary it will add a directory
643490075Sobrienseparator character at the end of the path.
643590075Sobrien
643690075Sobrien@option{-B} prefixes that effectively specify directory names also apply
643790075Sobriento libraries in the linker, because the compiler translates these
643890075Sobrienoptions into @option{-L} options for the linker.  They also apply to
643990075Sobrienincludes files in the preprocessor, because the compiler translates these
644090075Sobrienoptions into @option{-isystem} options for the preprocessor.  In this case,
644190075Sobrienthe compiler appends @samp{include} to the prefix.
644290075Sobrien
644390075SobrienThe run-time support file @file{libgcc.a} can also be searched for using
644490075Sobrienthe @option{-B} prefix, if needed.  If it is not found there, the two
644590075Sobrienstandard prefixes above are tried, and that is all.  The file is left
644690075Sobrienout of the link if it is not found by those means.
644790075Sobrien
644890075SobrienAnother way to specify a prefix much like the @option{-B} prefix is to use
644990075Sobrienthe environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
645090075SobrienVariables}.
645190075Sobrien
645290075SobrienAs a special kludge, if the path provided by @option{-B} is
645390075Sobrien@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
645490075Sobrien9, then it will be replaced by @file{[dir/]include}.  This is to help
645590075Sobrienwith boot-strapping the compiler.
645690075Sobrien
645790075Sobrien@item -specs=@var{file}
645890075Sobrien@opindex specs
645990075SobrienProcess @var{file} after the compiler reads in the standard @file{specs}
646090075Sobrienfile, in order to override the defaults that the @file{gcc} driver
646190075Sobrienprogram uses when determining what switches to pass to @file{cc1},
646290075Sobrien@file{cc1plus}, @file{as}, @file{ld}, etc.  More than one
646390075Sobrien@option{-specs=@var{file}} can be specified on the command line, and they
646490075Sobrienare processed in order, from left to right.
6465169689Skan
6466169689Skan@item --sysroot=@var{dir}
6467169689Skan@opindex sysroot
6468169689SkanUse @var{dir} as the logical root directory for headers and libraries.
6469169689SkanFor example, if the compiler would normally search for headers in
6470169689Skan@file{/usr/include} and libraries in @file{/usr/lib}, it will instead
6471169689Skansearch @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.  
6472169689Skan
6473169689SkanIf you use both this option and the @option{-isysroot} option, then
6474169689Skanthe @option{--sysroot} option will apply to libraries, but the
6475169689Skan@option{-isysroot} option will apply to header files.
6476169689Skan
6477169689SkanThe GNU linker (beginning with version 2.16) has the necessary support
6478169689Skanfor this option.  If your linker does not support this option, the
6479169689Skanheader file aspect of @option{--sysroot} will still work, but the
6480169689Skanlibrary aspect will not.
6481169689Skan
6482169689Skan@item -I-
6483169689Skan@opindex I-
6484169689SkanThis option has been deprecated.  Please use @option{-iquote} instead for
6485169689Skan@option{-I} directories before the @option{-I-} and remove the @option{-I-}.
6486169689SkanAny directories you specify with @option{-I} options before the @option{-I-}
6487169689Skanoption are searched only for the case of @samp{#include "@var{file}"};
6488169689Skanthey are not searched for @samp{#include <@var{file}>}.
6489169689Skan
6490169689SkanIf additional directories are specified with @option{-I} options after
6491169689Skanthe @option{-I-}, these directories are searched for all @samp{#include}
6492169689Skandirectives.  (Ordinarily @emph{all} @option{-I} directories are used
6493169689Skanthis way.)
6494169689Skan
6495169689SkanIn addition, the @option{-I-} option inhibits the use of the current
6496169689Skandirectory (where the current input file came from) as the first search
6497169689Skandirectory for @samp{#include "@var{file}"}.  There is no way to
6498169689Skanoverride this effect of @option{-I-}.  With @option{-I.} you can specify
6499169689Skansearching the directory which was current when the compiler was
6500169689Skaninvoked.  That is not exactly the same as what the preprocessor does
6501169689Skanby default, but it is often satisfactory.
6502169689Skan
6503169689Skan@option{-I-} does not inhibit the use of the standard system directories
6504169689Skanfor header files.  Thus, @option{-I-} and @option{-nostdinc} are
6505169689Skanindependent.
650690075Sobrien@end table
650790075Sobrien
650890075Sobrien@c man end
650990075Sobrien
651090075Sobrien@node Spec Files
651190075Sobrien@section Specifying subprocesses and the switches to pass to them
651290075Sobrien@cindex Spec Files
6513117395Skan
651490075Sobrien@command{gcc} is a driver program.  It performs its job by invoking a
651590075Sobriensequence of other programs to do the work of compiling, assembling and
651690075Sobrienlinking.  GCC interprets its command-line parameters and uses these to
651790075Sobriendeduce which programs it should invoke, and which command-line options
651890075Sobrienit ought to place on their command lines.  This behavior is controlled
651990075Sobrienby @dfn{spec strings}.  In most cases there is one spec string for each
652090075Sobrienprogram that GCC can invoke, but a few programs have multiple spec
652190075Sobrienstrings to control their behavior.  The spec strings built into GCC can
652290075Sobrienbe overridden by using the @option{-specs=} command-line switch to specify
652390075Sobriena spec file.
652490075Sobrien
652590075Sobrien@dfn{Spec files} are plaintext files that are used to construct spec
652690075Sobrienstrings.  They consist of a sequence of directives separated by blank
652790075Sobrienlines.  The type of directive is determined by the first non-whitespace
652890075Sobriencharacter on the line and it can be one of the following:
652990075Sobrien
653090075Sobrien@table @code
653190075Sobrien@item %@var{command}
653290075SobrienIssues a @var{command} to the spec file processor.  The commands that can
653390075Sobrienappear here are:
653490075Sobrien
653590075Sobrien@table @code
653690075Sobrien@item %include <@var{file}>
653790075Sobrien@cindex %include
653890075SobrienSearch for @var{file} and insert its text at the current point in the
653990075Sobrienspecs file.
654090075Sobrien
654190075Sobrien@item %include_noerr <@var{file}>
654290075Sobrien@cindex %include_noerr
654390075SobrienJust like @samp{%include}, but do not generate an error message if the include
654490075Sobrienfile cannot be found.
654590075Sobrien
654690075Sobrien@item %rename @var{old_name} @var{new_name}
654790075Sobrien@cindex %rename
654890075SobrienRename the spec string @var{old_name} to @var{new_name}.
654990075Sobrien
655090075Sobrien@end table
655190075Sobrien
655290075Sobrien@item *[@var{spec_name}]:
655390075SobrienThis tells the compiler to create, override or delete the named spec
655490075Sobrienstring.  All lines after this directive up to the next directive or
655590075Sobrienblank line are considered to be the text for the spec string.  If this
655690075Sobrienresults in an empty string then the spec will be deleted.  (Or, if the
655790075Sobrienspec did not exist, then nothing will happened.)  Otherwise, if the spec
655890075Sobriendoes not currently exist a new spec will be created.  If the spec does
655990075Sobrienexist then its contents will be overridden by the text of this
656090075Sobriendirective, unless the first character of that text is the @samp{+}
656190075Sobriencharacter, in which case the text will be appended to the spec.
656290075Sobrien
656390075Sobrien@item [@var{suffix}]:
656490075SobrienCreates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
656590075Sobrienand up to the next directive or blank line are considered to make up the
656690075Sobrienspec string for the indicated suffix.  When the compiler encounters an
656790075Sobrieninput file with the named suffix, it will processes the spec string in
656890075Sobrienorder to work out how to compile that file.  For example:
656990075Sobrien
657090075Sobrien@smallexample
657190075Sobrien.ZZ:
657290075Sobrienz-compile -input %i
657390075Sobrien@end smallexample
657490075Sobrien
657590075SobrienThis says that any input file whose name ends in @samp{.ZZ} should be
657690075Sobrienpassed to the program @samp{z-compile}, which should be invoked with the
657790075Sobriencommand-line switch @option{-input} and with the result of performing the
657890075Sobrien@samp{%i} substitution.  (See below.)
657990075Sobrien
658090075SobrienAs an alternative to providing a spec string, the text that follows a
658190075Sobriensuffix directive can be one of the following:
658290075Sobrien
658390075Sobrien@table @code
658490075Sobrien@item @@@var{language}
658590075SobrienThis says that the suffix is an alias for a known @var{language}.  This is
658690075Sobriensimilar to using the @option{-x} command-line switch to GCC to specify a
658790075Sobrienlanguage explicitly.  For example:
658890075Sobrien
658990075Sobrien@smallexample
659090075Sobrien.ZZ:
659190075Sobrien@@c++
659290075Sobrien@end smallexample
659390075Sobrien
659490075SobrienSays that .ZZ files are, in fact, C++ source files.
659590075Sobrien
659690075Sobrien@item #@var{name}
659790075SobrienThis causes an error messages saying:
659890075Sobrien
659990075Sobrien@smallexample
660090075Sobrien@var{name} compiler not installed on this system.
660190075Sobrien@end smallexample
660290075Sobrien@end table
660390075Sobrien
660490075SobrienGCC already has an extensive list of suffixes built into it.
660590075SobrienThis directive will add an entry to the end of the list of suffixes, but
660690075Sobriensince the list is searched from the end backwards, it is effectively
660790075Sobrienpossible to override earlier entries using this technique.
660890075Sobrien
660990075Sobrien@end table
661090075Sobrien
661190075SobrienGCC has the following spec strings built into it.  Spec files can
661290075Sobrienoverride these strings or create their own.  Note that individual
661390075Sobrientargets can also add their own spec strings to this list.
661490075Sobrien
661590075Sobrien@smallexample
661690075Sobrienasm          Options to pass to the assembler
661790075Sobrienasm_final    Options to pass to the assembler post-processor
661890075Sobriencpp          Options to pass to the C preprocessor
661990075Sobriencc1          Options to pass to the C compiler
662090075Sobriencc1plus      Options to pass to the C++ compiler
662190075Sobrienendfile      Object files to include at the end of the link
662290075Sobrienlink         Options to pass to the linker
662390075Sobrienlib          Libraries to include on the command line to the linker
662490075Sobrienlibgcc       Decides which GCC support library to pass to the linker
662590075Sobrienlinker       Sets the name of the linker
662690075Sobrienpredefines   Defines to be passed to the C preprocessor
662790075Sobriensigned_char  Defines to pass to CPP to say whether @code{char} is signed
662890075Sobrien             by default
662990075Sobrienstartfile    Object files to include at the start of the link
663090075Sobrien@end smallexample
663190075Sobrien
663290075SobrienHere is a small example of a spec file:
663390075Sobrien
663490075Sobrien@smallexample
663590075Sobrien%rename lib                 old_lib
663690075Sobrien
663790075Sobrien*lib:
663890075Sobrien--start-group -lgcc -lc -leval1 --end-group %(old_lib)
663990075Sobrien@end smallexample
664090075Sobrien
664190075SobrienThis example renames the spec called @samp{lib} to @samp{old_lib} and
664290075Sobrienthen overrides the previous definition of @samp{lib} with a new one.
664390075SobrienThe new definition adds in some extra command-line options before
664490075Sobrienincluding the text of the old definition.
664590075Sobrien
664690075Sobrien@dfn{Spec strings} are a list of command-line options to be passed to their
664790075Sobriencorresponding program.  In addition, the spec strings can contain
664890075Sobrien@samp{%}-prefixed sequences to substitute variable text or to
664990075Sobrienconditionally insert text into the command line.  Using these constructs
665090075Sobrienit is possible to generate quite complex command lines.
665190075Sobrien
665290075SobrienHere is a table of all defined @samp{%}-sequences for spec
665390075Sobrienstrings.  Note that spaces are not generated automatically around the
665490075Sobrienresults of expanding these sequences.  Therefore you can concatenate them
665590075Sobrientogether or combine them with constant text in a single argument.
665690075Sobrien
665790075Sobrien@table @code
665890075Sobrien@item %%
665990075SobrienSubstitute one @samp{%} into the program name or argument.
666090075Sobrien
666190075Sobrien@item %i
666290075SobrienSubstitute the name of the input file being processed.
666390075Sobrien
666490075Sobrien@item %b
666590075SobrienSubstitute the basename of the input file being processed.
666690075SobrienThis is the substring up to (and not including) the last period
666790075Sobrienand not including the directory.
666890075Sobrien
666990075Sobrien@item %B
667090075SobrienThis is the same as @samp{%b}, but include the file suffix (text after
667190075Sobrienthe last period).
667290075Sobrien
667390075Sobrien@item %d
667490075SobrienMarks the argument containing or following the @samp{%d} as a
667590075Sobrientemporary file name, so that that file will be deleted if GCC exits
667690075Sobriensuccessfully.  Unlike @samp{%g}, this contributes no text to the
667790075Sobrienargument.
667890075Sobrien
667990075Sobrien@item %g@var{suffix}
668090075SobrienSubstitute a file name that has suffix @var{suffix} and is chosen
668190075Sobrienonce per compilation, and mark the argument in the same way as
668290075Sobrien@samp{%d}.  To reduce exposure to denial-of-service attacks, the file
668390075Sobrienname is now chosen in a way that is hard to predict even when previously
668490075Sobrienchosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
668590075Sobrienmight turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
668690075Sobrienthe regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
668790075Sobrientreated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
668890075Sobrienwas simply substituted with a file name chosen once per compilation,
668990075Sobrienwithout regard to any appended suffix (which was therefore treated
669090075Sobrienjust like ordinary text), making such attacks more likely to succeed.
669190075Sobrien
669290075Sobrien@item %u@var{suffix}
669390075SobrienLike @samp{%g}, but generates a new temporary file name even if
669490075Sobrien@samp{%u@var{suffix}} was already seen.
669590075Sobrien
669690075Sobrien@item %U@var{suffix}
669790075SobrienSubstitutes the last file name generated with @samp{%u@var{suffix}}, generating a
669890075Sobriennew one if there is no such last file name.  In the absence of any
669990075Sobrien@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
670090075Sobrienthe same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
670190075Sobrienwould involve the generation of two distinct file names, one
670290075Sobrienfor each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
670390075Sobriensimply substituted with a file name chosen for the previous @samp{%u},
670490075Sobrienwithout regard to any appended suffix.
670590075Sobrien
6706119256Skan@item %j@var{suffix}
670790075SobrienSubstitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
670890075Sobrienwritable, and if save-temps is off; otherwise, substitute the name
670990075Sobrienof a temporary file, just like @samp{%u}.  This temporary file is not
671090075Sobrienmeant for communication between processes, but rather as a junk
671190075Sobriendisposal mechanism.
671290075Sobrien
6713132718Skan@item %|@var{suffix}
6714132718Skan@itemx %m@var{suffix}
6715132718SkanLike @samp{%g}, except if @option{-pipe} is in effect.  In that case
6716132718Skan@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
6717132718Skanall.  These are the two most common ways to instruct a program that it
6718132718Skanshould read from standard input or write to standard output.  If you
6719132718Skanneed something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
6720132718Skanconstruct: see for example @file{f/lang-specs.h}.
6721132718Skan
672290075Sobrien@item %.@var{SUFFIX}
672390075SobrienSubstitutes @var{.SUFFIX} for the suffixes of a matched switch's args
672490075Sobrienwhen it is subsequently output with @samp{%*}.  @var{SUFFIX} is
672590075Sobrienterminated by the next space or %.
672690075Sobrien
672790075Sobrien@item %w
672890075SobrienMarks the argument containing or following the @samp{%w} as the
672990075Sobriendesignated output file of this compilation.  This puts the argument
673090075Sobrieninto the sequence of arguments that @samp{%o} will substitute later.
673190075Sobrien
673290075Sobrien@item %o
673390075SobrienSubstitutes the names of all the output files, with spaces
673490075Sobrienautomatically placed around them.  You should write spaces
673590075Sobrienaround the @samp{%o} as well or the results are undefined.
673690075Sobrien@samp{%o} is for use in the specs for running the linker.
673790075SobrienInput files whose names have no recognized suffix are not compiled
673890075Sobrienat all, but they are included among the output files, so they will
673990075Sobrienbe linked.
674090075Sobrien
674190075Sobrien@item %O
674290075SobrienSubstitutes the suffix for object files.  Note that this is
674390075Sobrienhandled specially when it immediately follows @samp{%g, %u, or %U},
674490075Sobrienbecause of the need for those to form complete file names.  The
674590075Sobrienhandling is such that @samp{%O} is treated exactly as if it had already
674690075Sobrienbeen substituted, except that @samp{%g, %u, and %U} do not currently
674790075Sobriensupport additional @var{suffix} characters following @samp{%O} as they would
674890075Sobrienfollowing, for example, @samp{.o}.
674990075Sobrien
675090075Sobrien@item %p
675190075SobrienSubstitutes the standard macro predefinitions for the
675290075Sobriencurrent target machine.  Use this when running @code{cpp}.
675390075Sobrien
675490075Sobrien@item %P
675590075SobrienLike @samp{%p}, but puts @samp{__} before and after the name of each
675690075Sobrienpredefined macro, except for macros that start with @samp{__} or with
675790075Sobrien@samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
675890075SobrienC@.
675990075Sobrien
676090075Sobrien@item %I
6761132718SkanSubstitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
6762169689Skan@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
6763132718Skan@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
6764169689Skanand @option{-imultilib} as necessary.
676590075Sobrien
676690075Sobrien@item %s
676790075SobrienCurrent argument is the name of a library or startup file of some sort.
676890075SobrienSearch for that file in a standard list of directories and substitute
676990075Sobrienthe full name found.
677090075Sobrien
677190075Sobrien@item %e@var{str}
677290075SobrienPrint @var{str} as an error message.  @var{str} is terminated by a newline.
677390075SobrienUse this when inconsistent options are detected.
677490075Sobrien
677590075Sobrien@item %(@var{name})
677690075SobrienSubstitute the contents of spec string @var{name} at this point.
677790075Sobrien
677890075Sobrien@item %[@var{name}]
677990075SobrienLike @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
678090075Sobrien
678190075Sobrien@item %x@{@var{option}@}
678290075SobrienAccumulate an option for @samp{%X}.
678390075Sobrien
678490075Sobrien@item %X
678590075SobrienOutput the accumulated linker options specified by @option{-Wl} or a @samp{%x}
678690075Sobrienspec string.
678790075Sobrien
678890075Sobrien@item %Y
678990075SobrienOutput the accumulated assembler options specified by @option{-Wa}.
679090075Sobrien
679190075Sobrien@item %Z
679290075SobrienOutput the accumulated preprocessor options specified by @option{-Wp}.
679390075Sobrien
679490075Sobrien@item %a
679590075SobrienProcess the @code{asm} spec.  This is used to compute the
679690075Sobrienswitches to be passed to the assembler.
679790075Sobrien
679890075Sobrien@item %A
679990075SobrienProcess the @code{asm_final} spec.  This is a spec string for
680090075Sobrienpassing switches to an assembler post-processor, if such a program is
680190075Sobrienneeded.
680290075Sobrien
680390075Sobrien@item %l
680490075SobrienProcess the @code{link} spec.  This is the spec for computing the
680590075Sobriencommand line passed to the linker.  Typically it will make use of the
680690075Sobrien@samp{%L %G %S %D and %E} sequences.
680790075Sobrien
680890075Sobrien@item %D
680990075SobrienDump out a @option{-L} option for each directory that GCC believes might
681090075Sobriencontain startup files.  If the target supports multilibs then the
681190075Sobriencurrent multilib directory will be prepended to each of these paths.
681290075Sobrien
681390075Sobrien@item %L
681490075SobrienProcess the @code{lib} spec.  This is a spec string for deciding which
681590075Sobrienlibraries should be included on the command line to the linker.
681690075Sobrien
681790075Sobrien@item %G
681890075SobrienProcess the @code{libgcc} spec.  This is a spec string for deciding
681990075Sobrienwhich GCC support library should be included on the command line to the linker.
682090075Sobrien
682190075Sobrien@item %S
682290075SobrienProcess the @code{startfile} spec.  This is a spec for deciding which
682390075Sobrienobject files should be the first ones passed to the linker.  Typically
682490075Sobrienthis might be a file named @file{crt0.o}.
682590075Sobrien
682690075Sobrien@item %E
682790075SobrienProcess the @code{endfile} spec.  This is a spec string that specifies
682890075Sobrienthe last object files that will be passed to the linker.
682990075Sobrien
683090075Sobrien@item %C
683190075SobrienProcess the @code{cpp} spec.  This is used to construct the arguments
683290075Sobriento be passed to the C preprocessor.
683390075Sobrien
683490075Sobrien@item %1
683590075SobrienProcess the @code{cc1} spec.  This is used to construct the options to be
683690075Sobrienpassed to the actual C compiler (@samp{cc1}).
683790075Sobrien
683890075Sobrien@item %2
683990075SobrienProcess the @code{cc1plus} spec.  This is used to construct the options to be
684090075Sobrienpassed to the actual C++ compiler (@samp{cc1plus}).
684190075Sobrien
684290075Sobrien@item %*
684390075SobrienSubstitute the variable part of a matched option.  See below.
684490075SobrienNote that each comma in the substituted string is replaced by
684590075Sobriena single space.
684690075Sobrien
6847132718Skan@item %<@code{S}
6848132718SkanRemove all occurrences of @code{-S} from the command line.  Note---this
6849132718Skancommand is position dependent.  @samp{%} commands in the spec string
6850132718Skanbefore this one will see @code{-S}, @samp{%} commands in the spec string
6851132718Skanafter this one will not.
6852132718Skan
6853117395Skan@item %:@var{function}(@var{args})
6854117395SkanCall the named function @var{function}, passing it @var{args}.
6855117395Skan@var{args} is first processed as a nested spec string, then split
6856117395Skaninto an argument vector in the usual fashion.  The function returns
6857117395Skana string which is processed as if it had appeared literally as part
6858117395Skanof the current spec.
6859117395Skan
6860117395SkanThe following built-in spec functions are provided:
6861117395Skan
6862117395Skan@table @code
6863117395Skan@item @code{if-exists}
6864117395SkanThe @code{if-exists} spec function takes one argument, an absolute
6865117395Skanpathname to a file.  If the file exists, @code{if-exists} returns the
6866117395Skanpathname.  Here is a small example of its usage:
6867117395Skan
6868117395Skan@smallexample
6869117395Skan*startfile:
6870117395Skancrt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
6871117395Skan@end smallexample
6872117395Skan
6873117395Skan@item @code{if-exists-else}
6874117395SkanThe @code{if-exists-else} spec function is similar to the @code{if-exists}
6875117395Skanspec function, except that it takes two arguments.  The first argument is
6876117395Skanan absolute pathname to a file.  If the file exists, @code{if-exists-else}
6877117395Skanreturns the pathname.  If it does not exist, it returns the second argument.
6878117395SkanThis way, @code{if-exists-else} can be used to select one file or another,
6879117395Skanbased on the existence of the first.  Here is a small example of its usage:
6880117395Skan
6881132718Skan@smallexample
6882117395Skan*startfile:
6883117395Skancrt0%O%s %:if-exists(crti%O%s) \
6884117395Skan%:if-exists-else(crtbeginT%O%s crtbegin%O%s)
6885117395Skan@end smallexample
6886169689Skan
6887169689Skan@item @code{replace-outfile}
6888169689SkanThe @code{replace-outfile} spec function takes two arguments.  It looks for the
6889169689Skanfirst argument in the outfiles array and replaces it with the second argument.  Here
6890169689Skanis a small example of its usage:
6891169689Skan
6892169689Skan@smallexample
6893220755Sdim%@{static|static-libgcc|static-libstdc++:%:replace-outfile(-lstdc++ \
6894220755Sdimlibstdc++.a%s)@}
6895220755Sdim
6896169689Skan@end smallexample
6897169689Skan
6898132718Skan@end table
6899117395Skan
690090075Sobrien@item %@{@code{S}@}
690190075SobrienSubstitutes the @code{-S} switch, if that switch was given to GCC@.
690290075SobrienIf that switch was not specified, this substitutes nothing.  Note that
690390075Sobrienthe leading dash is omitted when specifying this option, and it is
690490075Sobrienautomatically inserted if the substitution is performed.  Thus the spec
690590075Sobrienstring @samp{%@{foo@}} would match the command-line option @option{-foo}
690690075Sobrienand would output the command line option @option{-foo}.
690790075Sobrien
690890075Sobrien@item %W@{@code{S}@}
690990075SobrienLike %@{@code{S}@} but mark last argument supplied within as a file to be
691090075Sobriendeleted on failure.
691190075Sobrien
691290075Sobrien@item %@{@code{S}*@}
691390075SobrienSubstitutes all the switches specified to GCC whose names start
691490075Sobrienwith @code{-S}, but which also take an argument.  This is used for
691590075Sobrienswitches like @option{-o}, @option{-D}, @option{-I}, etc.
691690075SobrienGCC considers @option{-o foo} as being
691790075Sobrienone switch whose names starts with @samp{o}.  %@{o*@} would substitute this
691890075Sobrientext, including the space.  Thus two arguments would be generated.
691990075Sobrien
692090075Sobrien@item %@{@code{S}*&@code{T}*@}
692190075SobrienLike %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
692290075Sobrien(the order of @code{S} and @code{T} in the spec is not significant).
692390075SobrienThere can be any number of ampersand-separated variables; for each the
692490075Sobrienwild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
692590075Sobrien
692690075Sobrien@item %@{@code{S}:@code{X}@}
6927132718SkanSubstitutes @code{X}, if the @samp{-S} switch was given to GCC@.
692890075Sobrien
692990075Sobrien@item %@{!@code{S}:@code{X}@}
6930132718SkanSubstitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
693190075Sobrien
6932132718Skan@item %@{@code{S}*:@code{X}@}
6933132718SkanSubstitutes @code{X} if one or more switches whose names start with
6934132718Skan@code{-S} are specified to GCC@.  Normally @code{X} is substituted only
6935132718Skanonce, no matter how many such switches appeared.  However, if @code{%*}
6936132718Skanappears somewhere in @code{X}, then @code{X} will be substituted once
6937132718Skanfor each matching switch, with the @code{%*} replaced by the part of
6938132718Skanthat switch that matched the @code{*}.
693990075Sobrien
694090075Sobrien@item %@{.@code{S}:@code{X}@}
6941132718SkanSubstitutes @code{X}, if processing a file with suffix @code{S}.
694290075Sobrien
694390075Sobrien@item %@{!.@code{S}:@code{X}@}
6944132718SkanSubstitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
694590075Sobrien
694690075Sobrien@item %@{@code{S}|@code{P}:@code{X}@}
6947132718SkanSubstitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@.
6948132718SkanThis may be combined with @samp{!}, @samp{.}, and @code{*} sequences as well,
6949132718Skanalthough they have a stronger binding than the @samp{|}.  If @code{%*}
6950132718Skanappears in @code{X}, all of the alternatives must be starred, and only
6951132718Skanthe first matching alternative is substituted.
695290075Sobrien
6953132718SkanFor example, a spec string like this:
6954132718Skan
695590075Sobrien@smallexample
695690075Sobrien%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
695790075Sobrien@end smallexample
695890075Sobrien
695990075Sobrienwill output the following command-line options from the following input
696090075Sobriencommand-line options:
696190075Sobrien
696290075Sobrien@smallexample
696390075Sobrienfred.c        -foo -baz
696490075Sobrienjim.d         -bar -boggle
696590075Sobrien-d fred.c     -foo -baz -boggle
696690075Sobrien-d jim.d      -bar -baz -boggle
696790075Sobrien@end smallexample
696890075Sobrien
6969132718Skan@item %@{S:X; T:Y; :D@}
6970132718Skan
6971132718SkanIf @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
6972132718Skangiven to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
6973132718Skanbe as many clauses as you need.  This may be combined with @code{.},
6974132718Skan@code{!}, @code{|}, and @code{*} as needed.
6975132718Skan
6976132718Skan
697790075Sobrien@end table
697890075Sobrien
6979132718SkanThe conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
6980132718Skanconstruct may contain other nested @samp{%} constructs or spaces, or
6981132718Skaneven newlines.  They are processed as usual, as described above.
6982132718SkanTrailing white space in @code{X} is ignored.  White space may also
6983132718Skanappear anywhere on the left side of the colon in these constructs,
6984132718Skanexcept between @code{.} or @code{*} and the corresponding word.
698590075Sobrien
6986132718SkanThe @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
6987132718Skanhandled specifically in these constructs.  If another value of
6988132718Skan@option{-O} or the negated form of a @option{-f}, @option{-m}, or
6989132718Skan@option{-W} switch is found later in the command line, the earlier
6990132718Skanswitch value is ignored, except with @{@code{S}*@} where @code{S} is
6991132718Skanjust one letter, which passes all matching options.
699290075Sobrien
6993132718SkanThe character @samp{|} at the beginning of the predicate text is used to
6994132718Skanindicate that a command should be piped to the following command, but
6995132718Skanonly if @option{-pipe} is specified.
699690075Sobrien
699790075SobrienIt is built into GCC which switches take arguments and which do not.
699890075Sobrien(You might think it would be useful to generalize this to allow each
699990075Sobriencompiler's spec to say which switches take arguments.  But this cannot
700090075Sobrienbe done in a consistent fashion.  GCC cannot even decide which input
700190075Sobrienfiles have been specified without knowing which switches take arguments,
700290075Sobrienand it must know which input files to compile in order to tell which
700390075Sobriencompilers to run).
700490075Sobrien
700590075SobrienGCC also knows implicitly that arguments starting in @option{-l} are to be
700690075Sobrientreated as compiler output files, and passed to the linker in their
700790075Sobrienproper position among the other output files.
700890075Sobrien
700990075Sobrien@c man begin OPTIONS
701090075Sobrien
701190075Sobrien@node Target Options
701290075Sobrien@section Specifying Target Machine and Compiler Version
701390075Sobrien@cindex target options
701490075Sobrien@cindex cross compiling
701590075Sobrien@cindex specifying machine version
701690075Sobrien@cindex specifying compiler version and target machine
701790075Sobrien@cindex compiler version, specifying
701890075Sobrien@cindex target machine, specifying
701990075Sobrien
7020117395SkanThe usual way to run GCC is to run the executable called @file{gcc}, or
7021117395Skan@file{<machine>-gcc} when cross-compiling, or
7022117395Skan@file{<machine>-gcc-<version>} to run a version other than the one that
7023117395Skanwas installed last.  Sometimes this is inconvenient, so GCC provides
7024117395Skanoptions that will switch to another cross-compiler or version.
702590075Sobrien
702690075Sobrien@table @gcctabopt
702790075Sobrien@item -b @var{machine}
702890075Sobrien@opindex b
702990075SobrienThe argument @var{machine} specifies the target machine for compilation.
703090075Sobrien
703190075SobrienThe value to use for @var{machine} is the same as was specified as the
703290075Sobrienmachine type when configuring GCC as a cross-compiler.  For
703390075Sobrienexample, if a cross-compiler was configured with @samp{configure
7034169689Skanarm-elf}, meaning to compile for an arm processor with elf binaries,
7035169689Skanthen you would specify @option{-b arm-elf} to run that cross compiler.
7036169689SkanBecause there are other options beginning with @option{-b}, the
7037169689Skanconfiguration must contain a hyphen. 
703890075Sobrien
703990075Sobrien@item -V @var{version}
704090075Sobrien@opindex V
704190075SobrienThe argument @var{version} specifies which version of GCC to run.
704290075SobrienThis is useful when multiple versions are installed.  For example,
7043169689Skan@var{version} might be @samp{4.0}, meaning to run GCC version 4.0.
704490075Sobrien@end table
704590075Sobrien
7046117395SkanThe @option{-V} and @option{-b} options work by running the
7047117395Skan@file{<machine>-gcc-<version>} executable, so there's no real reason to
7048117395Skanuse them if you can just run that directly.
704990075Sobrien
705090075Sobrien@node Submodel Options
705190075Sobrien@section Hardware Models and Configurations
705290075Sobrien@cindex submodel options
705390075Sobrien@cindex specifying hardware config
705490075Sobrien@cindex hardware models and configurations, specifying
705590075Sobrien@cindex machine dependent options
705690075Sobrien
705790075SobrienEarlier we discussed the standard option @option{-b} which chooses among
705890075Sobriendifferent installed compilers for completely different target
705990075Sobrienmachines, such as VAX vs.@: 68000 vs.@: 80386.
706090075Sobrien
706190075SobrienIn addition, each of these target machine types can have its own
706290075Sobrienspecial options, starting with @samp{-m}, to choose among various
706390075Sobrienhardware models or configurations---for example, 68010 vs 68020,
706490075Sobrienfloating coprocessor or none.  A single installed version of the
706590075Sobriencompiler can compile for any model or configuration, according to the
706690075Sobrienoptions specified.
706790075Sobrien
706890075SobrienSome configurations of the compiler also support additional special
706990075Sobrienoptions, usually for compatibility with other compilers on the same
707090075Sobrienplatform.
707190075Sobrien
7072169689Skan@c This list is ordered alphanumerically by subsection name.
7073169689Skan@c It should be the same order and spelling as these options are listed
7074169689Skan@c in Machine Dependent Options
707590075Sobrien
707690075Sobrien@menu
7077169689Skan* ARC Options::
707890075Sobrien* ARM Options::
7079169689Skan* AVR Options::
7080169689Skan* Blackfin Options::
7081169689Skan* CRIS Options::
7082169689Skan* CRX Options::
7083117395Skan* Darwin Options::
708490075Sobrien* DEC Alpha Options::
708590075Sobrien* DEC Alpha/VMS Options::
7086169689Skan* FRV Options::
7087169689Skan* GNU/Linux Options::
708890075Sobrien* H8/300 Options::
7089169689Skan* HPPA Options::
7090169689Skan* i386 and x86-64 Options::
7091169689Skan* IA-64 Options::
7092169689Skan* M32C Options::
7093169689Skan* M32R/D Options::
7094169689Skan* M680x0 Options::
7095169689Skan* M68hc1x Options::
7096169689Skan* MCore Options::
7097169689Skan* MIPS Options::
7098169689Skan* MMIX Options::
7099169689Skan* MN10300 Options::
7100169689Skan* MT Options::
7101169689Skan* PDP-11 Options::
7102169689Skan* PowerPC Options::
7103169689Skan* RS/6000 and PowerPC Options::
7104169689Skan* S/390 and zSeries Options::
7105169689Skan* Score Options::
710690075Sobrien* SH Options::
7107169689Skan* SPARC Options::
710890075Sobrien* System V Options::
710990075Sobrien* TMS320C3x/C4x Options::
711090075Sobrien* V850 Options::
7111169689Skan* VAX Options::
7112169689Skan* x86-64 Options::
711390075Sobrien* Xstormy16 Options::
711490075Sobrien* Xtensa Options::
7115169689Skan* zSeries Options::
711690075Sobrien@end menu
711790075Sobrien
7118169689Skan@node ARC Options
7119169689Skan@subsection ARC Options
7120169689Skan@cindex ARC Options
712190075Sobrien
7122169689SkanThese options are defined for ARC implementations:
712390075Sobrien
712490075Sobrien@table @gcctabopt
7125169689Skan@item -EL
7126169689Skan@opindex EL
7127169689SkanCompile code for little endian mode.  This is the default.
712890075Sobrien
7129169689Skan@item -EB
7130169689Skan@opindex EB
7131169689SkanCompile code for big endian mode.
713290075Sobrien
7133169689Skan@item -mmangle-cpu
7134169689Skan@opindex mmangle-cpu
7135169689SkanPrepend the name of the cpu to all public symbol names.
7136169689SkanIn multiple-processor systems, there are many ARC variants with different
7137169689Skaninstruction and register set characteristics.  This flag prevents code
7138169689Skancompiled for one cpu to be linked with code compiled for another.
7139169689SkanNo facility exists for handling variants that are ``almost identical''.
7140169689SkanThis is an all or nothing option.
714190075Sobrien
7142169689Skan@item -mcpu=@var{cpu}
714390075Sobrien@opindex mcpu
7144169689SkanCompile code for ARC variant @var{cpu}.
7145169689SkanWhich variants are supported depend on the configuration.
7146169689SkanAll variants support @option{-mcpu=base}, this is the default.
714790075Sobrien
7148169689Skan@item -mtext=@var{text-section}
7149169689Skan@itemx -mdata=@var{data-section}
7150169689Skan@itemx -mrodata=@var{readonly-data-section}
7151169689Skan@opindex mtext
7152169689Skan@opindex mdata
7153169689Skan@opindex mrodata
7154169689SkanPut functions, data, and readonly data in @var{text-section},
7155169689Skan@var{data-section}, and @var{readonly-data-section} respectively
7156169689Skanby default.  This can be overridden with the @code{section} attribute.
7157169689Skan@xref{Variable Attributes}.
715890075Sobrien
715990075Sobrien@end table
716090075Sobrien
716190075Sobrien@node ARM Options
716290075Sobrien@subsection ARM Options
716390075Sobrien@cindex ARM options
716490075Sobrien
716590075SobrienThese @samp{-m} options are defined for Advanced RISC Machines (ARM)
716690075Sobrienarchitectures:
716790075Sobrien
716890075Sobrien@table @gcctabopt
7169169689Skan@item -mabi=@var{name}
7170169689Skan@opindex mabi
7171169689SkanGenerate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
7172169689Skan@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
7173169689Skan
717490075Sobrien@item -mapcs-frame
717590075Sobrien@opindex mapcs-frame
717690075SobrienGenerate a stack frame that is compliant with the ARM Procedure Call
717790075SobrienStandard for all functions, even if this is not strictly necessary for
717890075Sobriencorrect execution of the code.  Specifying @option{-fomit-frame-pointer}
717990075Sobrienwith this option will cause the stack frames not to be generated for
718090075Sobrienleaf functions.  The default is @option{-mno-apcs-frame}.
718190075Sobrien
718290075Sobrien@item -mapcs
718390075Sobrien@opindex mapcs
718490075SobrienThis is a synonym for @option{-mapcs-frame}.
718590075Sobrien
718690075Sobrien@ignore
718790075Sobrien@c not currently implemented
718890075Sobrien@item -mapcs-stack-check
718990075Sobrien@opindex mapcs-stack-check
719090075SobrienGenerate code to check the amount of stack space available upon entry to
719190075Sobrienevery function (that actually uses some stack space).  If there is
719290075Sobrieninsufficient space available then either the function
719390075Sobrien@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
719490075Sobriencalled, depending upon the amount of stack space required.  The run time
719590075Sobriensystem is required to provide these functions.  The default is
719690075Sobrien@option{-mno-apcs-stack-check}, since this produces smaller code.
719790075Sobrien
719890075Sobrien@c not currently implemented
719990075Sobrien@item -mapcs-float
720090075Sobrien@opindex mapcs-float
720190075SobrienPass floating point arguments using the float point registers.  This is
720290075Sobrienone of the variants of the APCS@.  This option is recommended if the
720390075Sobrientarget hardware has a floating point unit or if a lot of floating point
720490075Sobrienarithmetic is going to be performed by the code.  The default is
720590075Sobrien@option{-mno-apcs-float}, since integer only code is slightly increased in
720690075Sobriensize if @option{-mapcs-float} is used.
720790075Sobrien
720890075Sobrien@c not currently implemented
720990075Sobrien@item -mapcs-reentrant
721090075Sobrien@opindex mapcs-reentrant
721190075SobrienGenerate reentrant, position independent code.  The default is
721290075Sobrien@option{-mno-apcs-reentrant}.
721390075Sobrien@end ignore
721490075Sobrien
721590075Sobrien@item -mthumb-interwork
721690075Sobrien@opindex mthumb-interwork
721790075SobrienGenerate code which supports calling between the ARM and Thumb
721890075Sobrieninstruction sets.  Without this option the two instruction sets cannot
721990075Sobrienbe reliably used inside one program.  The default is
722090075Sobrien@option{-mno-thumb-interwork}, since slightly larger code is generated
722190075Sobrienwhen @option{-mthumb-interwork} is specified.
722290075Sobrien
722390075Sobrien@item -mno-sched-prolog
722490075Sobrien@opindex mno-sched-prolog
722590075SobrienPrevent the reordering of instructions in the function prolog, or the
722690075Sobrienmerging of those instruction with the instructions in the function's
722790075Sobrienbody.  This means that all functions will start with a recognizable set
722890075Sobrienof instructions (or in fact one of a choice from a small set of
722990075Sobriendifferent function prologues), and this information can be used to
723090075Sobrienlocate the start if functions inside an executable piece of code.  The
723190075Sobriendefault is @option{-msched-prolog}.
723290075Sobrien
723390075Sobrien@item -mhard-float
723490075Sobrien@opindex mhard-float
723590075SobrienGenerate output containing floating point instructions.  This is the
723690075Sobriendefault.
723790075Sobrien
723890075Sobrien@item -msoft-float
723990075Sobrien@opindex msoft-float
724090075SobrienGenerate output containing library calls for floating point.
724190075Sobrien@strong{Warning:} the requisite libraries are not available for all ARM
724290075Sobrientargets.  Normally the facilities of the machine's usual C compiler are
724390075Sobrienused, but this cannot be done directly in cross-compilation.  You must make
724490075Sobrienyour own arrangements to provide suitable library functions for
724590075Sobriencross-compilation.
724690075Sobrien
724790075Sobrien@option{-msoft-float} changes the calling convention in the output file;
724890075Sobrientherefore, it is only useful if you compile @emph{all} of a program with
724990075Sobrienthis option.  In particular, you need to compile @file{libgcc.a}, the
725090075Sobrienlibrary that comes with GCC, with @option{-msoft-float} in order for
725190075Sobrienthis to work.
725290075Sobrien
7253169689Skan@item -mfloat-abi=@var{name}
7254169689Skan@opindex mfloat-abi
7255169689SkanSpecifies which ABI to use for floating point values.  Permissible values
7256169689Skanare: @samp{soft}, @samp{softfp} and @samp{hard}.
7257169689Skan
7258169689Skan@samp{soft} and @samp{hard} are equivalent to @option{-msoft-float}
7259169689Skanand @option{-mhard-float} respectively.  @samp{softfp} allows the generation
7260169689Skanof floating point instructions, but still uses the soft-float calling
7261169689Skanconventions.
7262169689Skan
726390075Sobrien@item -mlittle-endian
726490075Sobrien@opindex mlittle-endian
726590075SobrienGenerate code for a processor running in little-endian mode.  This is
726690075Sobrienthe default for all standard configurations.
726790075Sobrien
726890075Sobrien@item -mbig-endian
726990075Sobrien@opindex mbig-endian
727090075SobrienGenerate code for a processor running in big-endian mode; the default is
727190075Sobriento compile code for a little-endian processor.
727290075Sobrien
727390075Sobrien@item -mwords-little-endian
727490075Sobrien@opindex mwords-little-endian
727590075SobrienThis option only applies when generating code for big-endian processors.
727690075SobrienGenerate code for a little-endian word order but a big-endian byte
727790075Sobrienorder.  That is, a byte order of the form @samp{32107654}.  Note: this
727890075Sobrienoption should only be used if you require compatibility with code for
727990075Sobrienbig-endian ARM processors generated by versions of the compiler prior to
728090075Sobrien2.8.
728190075Sobrien
728290075Sobrien@item -mcpu=@var{name}
728390075Sobrien@opindex mcpu
728490075SobrienThis specifies the name of the target ARM processor.  GCC uses this name
728590075Sobriento determine what kind of instructions it can emit when generating
728690075Sobrienassembly code.  Permissible names are: @samp{arm2}, @samp{arm250},
728790075Sobrien@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
728890075Sobrien@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
728990075Sobrien@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
729090075Sobrien@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
7291169689Skan@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
7292169689Skan@samp{arm8}, @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
729390075Sobrien@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
7294169689Skan@samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
7295169689Skan@samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
7296169689Skan@samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
7297169689Skan@samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
7298169689Skan@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
7299169689Skan@samp{arm1176jz-s}, @samp{arm1176jzf-s}, @samp{xscale}, @samp{iwmmxt},
7300132718Skan@samp{ep9312}.
730190075Sobrien
730290075Sobrien@itemx -mtune=@var{name}
730390075Sobrien@opindex mtune
730490075SobrienThis option is very similar to the @option{-mcpu=} option, except that
730590075Sobrieninstead of specifying the actual target processor type, and hence
730690075Sobrienrestricting which instructions can be used, it specifies that GCC should
730790075Sobrientune the performance of the code as if the target were of the type
730890075Sobrienspecified in this option, but still choosing the instructions that it
730990075Sobrienwill generate based on the cpu specified by a @option{-mcpu=} option.
731090075SobrienFor some ARM implementations better performance can be obtained by using
731190075Sobrienthis option.
731290075Sobrien
731390075Sobrien@item -march=@var{name}
731490075Sobrien@opindex march
731590075SobrienThis specifies the name of the target ARM architecture.  GCC uses this
731690075Sobrienname to determine what kind of instructions it can emit when generating
731790075Sobrienassembly code.  This option can be used in conjunction with or instead
731890075Sobrienof the @option{-mcpu=} option.  Permissible names are: @samp{armv2},
731990075Sobrien@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
7320169689Skan@samp{armv5}, @samp{armv5t}, @samp{armv5te}, @samp{armv6}, @samp{armv6j},
7321132718Skan@samp{iwmmxt}, @samp{ep9312}.
732290075Sobrien
7323169689Skan@item -mfpu=@var{name}
7324169689Skan@itemx -mfpe=@var{number}
732590075Sobrien@itemx -mfp=@var{number}
7326169689Skan@opindex mfpu
732790075Sobrien@opindex mfpe
732890075Sobrien@opindex mfp
7329169689SkanThis specifies what floating point hardware (or hardware emulation) is
7330169689Skanavailable on the target.  Permissible names are: @samp{fpa}, @samp{fpe2},
7331169689Skan@samp{fpe3}, @samp{maverick}, @samp{vfp}.  @option{-mfp} and @option{-mfpe}
7332169689Skanare synonyms for @option{-mfpu}=@samp{fpe}@var{number}, for compatibility
7333169689Skanwith older versions of GCC@.
733490075Sobrien
7335169689SkanIf @option{-msoft-float} is specified this specifies the format of
7336169689Skanfloating point values.
7337169689Skan
733890075Sobrien@item -mstructure-size-boundary=@var{n}
733990075Sobrien@opindex mstructure-size-boundary
734090075SobrienThe size of all structures and unions will be rounded up to a multiple
7341169689Skanof the number of bits set by this option.  Permissible values are 8, 32
7342169689Skanand 64.  The default value varies for different toolchains.  For the COFF
7343169689Skantargeted toolchain the default value is 8.  A value of 64 is only allowed
7344169689Skanif the underlying ABI supports it.
734590075Sobrien
7346169689SkanSpecifying the larger number can produce faster, more efficient code, but
7347169689Skancan also increase the size of the program.  Different values are potentially
7348169689Skanincompatible.  Code compiled with one value cannot necessarily expect to
7349169689Skanwork with code or libraries compiled with another value, if they exchange
7350169689Skaninformation using structures or unions.
7351169689Skan
735290075Sobrien@item -mabort-on-noreturn
735390075Sobrien@opindex mabort-on-noreturn
735490075SobrienGenerate a call to the function @code{abort} at the end of a
735590075Sobrien@code{noreturn} function.  It will be executed if the function tries to
735690075Sobrienreturn.
735790075Sobrien
735890075Sobrien@item -mlong-calls
735990075Sobrien@itemx -mno-long-calls
736090075Sobrien@opindex mlong-calls
736190075Sobrien@opindex mno-long-calls
736290075SobrienTells the compiler to perform function calls by first loading the
736390075Sobrienaddress of the function into a register and then performing a subroutine
736490075Sobriencall on this register.  This switch is needed if the target function
736590075Sobrienwill lie outside of the 64 megabyte addressing range of the offset based
736690075Sobrienversion of subroutine call instruction.
736790075Sobrien
736890075SobrienEven if this switch is enabled, not all function calls will be turned
736990075Sobrieninto long calls.  The heuristic is that static functions, functions
737090075Sobrienwhich have the @samp{short-call} attribute, functions that are inside
737190075Sobrienthe scope of a @samp{#pragma no_long_calls} directive and functions whose
737290075Sobriendefinitions have already been compiled within the current compilation
737390075Sobrienunit, will not be turned into long calls.  The exception to this rule is
737490075Sobrienthat weak function definitions, functions with the @samp{long-call}
737590075Sobrienattribute or the @samp{section} attribute, and functions that are within
737690075Sobrienthe scope of a @samp{#pragma long_calls} directive, will always be
737790075Sobrienturned into long calls.
737890075Sobrien
737990075SobrienThis feature is not enabled by default.  Specifying
738090075Sobrien@option{-mno-long-calls} will restore the default behavior, as will
738190075Sobrienplacing the function calls within the scope of a @samp{#pragma
738290075Sobrienlong_calls_off} directive.  Note these switches have no effect on how
738390075Sobrienthe compiler generates code to handle function calls via function
738490075Sobrienpointers.
738590075Sobrien
738690075Sobrien@item -mnop-fun-dllimport
738790075Sobrien@opindex mnop-fun-dllimport
738890075SobrienDisable support for the @code{dllimport} attribute.
738990075Sobrien
739090075Sobrien@item -msingle-pic-base
739190075Sobrien@opindex msingle-pic-base
739290075SobrienTreat the register used for PIC addressing as read-only, rather than
739390075Sobrienloading it in the prologue for each function.  The run-time system is
739490075Sobrienresponsible for initializing this register with an appropriate value
739590075Sobrienbefore execution begins.
739690075Sobrien
739790075Sobrien@item -mpic-register=@var{reg}
739890075Sobrien@opindex mpic-register
739990075SobrienSpecify the register to be used for PIC addressing.  The default is R10
740090075Sobrienunless stack-checking is enabled, when R9 is used.
740190075Sobrien
7402132718Skan@item -mcirrus-fix-invalid-insns
7403132718Skan@opindex mcirrus-fix-invalid-insns
7404132718Skan@opindex mno-cirrus-fix-invalid-insns
7405132718SkanInsert NOPs into the instruction stream to in order to work around
7406132718Skanproblems with invalid Maverick instruction combinations.  This option
7407132718Skanis only valid if the @option{-mcpu=ep9312} option has been used to
7408132718Skanenable generation of instructions for the Cirrus Maverick floating
7409132718Skanpoint co-processor.  This option is not enabled by default, since the
7410132718Skanproblem is only present in older Maverick implementations.  The default
7411132718Skancan be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
7412132718Skanswitch.
7413132718Skan
741490075Sobrien@item -mpoke-function-name
741590075Sobrien@opindex mpoke-function-name
741690075SobrienWrite the name of each function into the text section, directly
741790075Sobrienpreceding the function prologue.  The generated code is similar to this:
741890075Sobrien
741990075Sobrien@smallexample
742090075Sobrien     t0
742190075Sobrien         .ascii "arm_poke_function_name", 0
742290075Sobrien         .align
742390075Sobrien     t1
742490075Sobrien         .word 0xff000000 + (t1 - t0)
742590075Sobrien     arm_poke_function_name
742690075Sobrien         mov     ip, sp
742790075Sobrien         stmfd   sp!, @{fp, ip, lr, pc@}
742890075Sobrien         sub     fp, ip, #4
742990075Sobrien@end smallexample
743090075Sobrien
743190075SobrienWhen performing a stack backtrace, code can inspect the value of
743290075Sobrien@code{pc} stored at @code{fp + 0}.  If the trace function then looks at
743390075Sobrienlocation @code{pc - 12} and the top 8 bits are set, then we know that
743490075Sobrienthere is a function name embedded immediately preceding this location
743590075Sobrienand has length @code{((pc[-3]) & 0xff000000)}.
743690075Sobrien
743790075Sobrien@item -mthumb
743890075Sobrien@opindex mthumb
743990075SobrienGenerate code for the 16-bit Thumb instruction set.  The default is to
744090075Sobrienuse the 32-bit ARM instruction set.
744190075Sobrien
744290075Sobrien@item -mtpcs-frame
744390075Sobrien@opindex mtpcs-frame
744490075SobrienGenerate a stack frame that is compliant with the Thumb Procedure Call
744590075SobrienStandard for all non-leaf functions.  (A leaf function is one that does
744690075Sobriennot call any other functions.)  The default is @option{-mno-tpcs-frame}.
744790075Sobrien
744890075Sobrien@item -mtpcs-leaf-frame
744990075Sobrien@opindex mtpcs-leaf-frame
745090075SobrienGenerate a stack frame that is compliant with the Thumb Procedure Call
745190075SobrienStandard for all leaf functions.  (A leaf function is one that does
745290075Sobriennot call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
745390075Sobrien
745490075Sobrien@item -mcallee-super-interworking
745590075Sobrien@opindex mcallee-super-interworking
745690075SobrienGives all externally visible functions in the file being compiled an ARM
745790075Sobrieninstruction set header which switches to Thumb mode before executing the
745890075Sobrienrest of the function.  This allows these functions to be called from
745990075Sobriennon-interworking code.
746090075Sobrien
746190075Sobrien@item -mcaller-super-interworking
746290075Sobrien@opindex mcaller-super-interworking
746390075SobrienAllows calls via function pointers (including virtual functions) to
746490075Sobrienexecute correctly regardless of whether the target code has been
746590075Sobriencompiled for interworking or not.  There is a small overhead in the cost
746690075Sobrienof executing a function pointer if this option is enabled.
746790075Sobrien
7468169689Skan@item -mtp=@var{name}
7469169689Skan@opindex mtp
7470169689SkanSpecify the access model for the thread local storage pointer.  The valid
7471169689Skanmodels are @option{soft}, which generates calls to @code{__aeabi_read_tp},
7472169689Skan@option{cp15}, which fetches the thread pointer from @code{cp15} directly
7473169689Skan(supported in the arm6k architecture), and @option{auto}, which uses the
7474169689Skanbest available method for the selected processor.  The default setting is
7475169689Skan@option{auto}.
747690075Sobrien
747790075Sobrien@end table
747890075Sobrien
7479169689Skan@node AVR Options
7480169689Skan@subsection AVR Options
7481169689Skan@cindex AVR Options
748290075Sobrien
7483169689SkanThese options are defined for AVR implementations:
748490075Sobrien
748590075Sobrien@table @gcctabopt
7486169689Skan@item -mmcu=@var{mcu}
7487169689Skan@opindex mmcu
7488169689SkanSpecify ATMEL AVR instruction set or MCU type.
7489132718Skan
7490169689SkanInstruction set avr1 is for the minimal AVR core, not supported by the C
7491169689Skancompiler, only for assembler programs (MCU types: at90s1200, attiny10,
7492169689Skanattiny11, attiny12, attiny15, attiny28).
749390075Sobrien
7494169689SkanInstruction set avr2 (default) is for the classic AVR core with up to
7495169689Skan8K program memory space (MCU types: at90s2313, at90s2323, attiny22,
7496169689Skanat90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
7497169689Skanat90c8534, at90s8535).
749890075Sobrien
7499169689SkanInstruction set avr3 is for the classic AVR core with up to 128K program
7500169689Skanmemory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
750190075Sobrien
7502169689SkanInstruction set avr4 is for the enhanced AVR core with up to 8K program
7503169689Skanmemory space (MCU types: atmega8, atmega83, atmega85).
750490075Sobrien
7505169689SkanInstruction set avr5 is for the enhanced AVR core with up to 128K program
7506169689Skanmemory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
7507169689Skanatmega64, atmega128, at43usb355, at94k).
750890075Sobrien
7509169689Skan@item -msize
7510169689Skan@opindex msize
7511169689SkanOutput instruction sizes to the asm file.
751290075Sobrien
7513169689Skan@item -minit-stack=@var{N}
7514169689Skan@opindex minit-stack
7515169689SkanSpecify the initial stack address, which may be a symbol or numeric value,
7516169689Skan@samp{__stack} is the default.
751790075Sobrien
7518169689Skan@item -mno-interrupts
7519169689Skan@opindex mno-interrupts
7520169689SkanGenerated code is not compatible with hardware interrupts.
7521169689SkanCode size will be smaller.
752290075Sobrien
7523169689Skan@item -mcall-prologues
7524169689Skan@opindex mcall-prologues
7525169689SkanFunctions prologues/epilogues expanded as call to appropriate
7526169689Skansubroutines.  Code size will be smaller.
752790075Sobrien
7528169689Skan@item -mno-tablejump
7529169689Skan@opindex mno-tablejump
7530169689SkanDo not generate tablejump insns which sometimes increase code size.
753190075Sobrien
7532169689Skan@item -mtiny-stack
7533169689Skan@opindex mtiny-stack
7534169689SkanChange only the low 8 bits of the stack pointer.
753590075Sobrien
7536169689Skan@item -mint8
7537169689Skan@opindex mint8
7538169689SkanAssume int to be 8 bit integer.  This affects the sizes of all types: A
7539169689Skanchar will be 1 byte, an int will be 1 byte, an long will be 2 bytes
7540169689Skanand long long will be 4 bytes.  Please note that this option does not
7541169689Skancomply to the C standards, but it will provide you with smaller code
7542169689Skansize.
754390075Sobrien@end table
754490075Sobrien
7545169689Skan@node Blackfin Options
7546169689Skan@subsection Blackfin Options
7547169689Skan@cindex Blackfin Options
754890075Sobrien
754990075Sobrien@table @gcctabopt
7550169689Skan@item -momit-leaf-frame-pointer
7551169689Skan@opindex momit-leaf-frame-pointer
7552169689SkanDon't keep the frame pointer in a register for leaf functions.  This
7553169689Skanavoids the instructions to save, set up and restore frame pointers and
7554169689Skanmakes an extra register available in leaf functions.  The option
7555169689Skan@option{-fomit-frame-pointer} removes the frame pointer for all functions
7556169689Skanwhich might make debugging harder.
755790075Sobrien
7558169689Skan@item -mspecld-anomaly
7559169689Skan@opindex mspecld-anomaly
7560169689SkanWhen enabled, the compiler will ensure that the generated code does not
7561169689Skancontain speculative loads after jump instructions.  This option is enabled
7562169689Skanby default.
756390075Sobrien
7564169689Skan@item -mno-specld-anomaly
7565169689Skan@opindex mno-specld-anomaly
7566169689SkanDon't generate extra code to prevent speculative loads from occurring.
756790075Sobrien
7568169689Skan@item -mcsync-anomaly
7569169689Skan@opindex mcsync-anomaly
7570169689SkanWhen enabled, the compiler will ensure that the generated code does not
7571169689Skancontain CSYNC or SSYNC instructions too soon after conditional branches.
7572169689SkanThis option is enabled by default.
757390075Sobrien
7574169689Skan@item -mno-csync-anomaly
7575169689Skan@opindex mno-csync-anomaly
7576169689SkanDon't generate extra code to prevent CSYNC or SSYNC instructions from
7577169689Skanoccurring too soon after a conditional branch.
757890075Sobrien
7579169689Skan@item -mlow-64k
7580169689Skan@opindex mlow-64k
7581169689SkanWhen enabled, the compiler is free to take advantage of the knowledge that
7582169689Skanthe entire program fits into the low 64k of memory.
758390075Sobrien
7584169689Skan@item -mno-low-64k
7585169689Skan@opindex mno-low-64k
7586169689SkanAssume that the program is arbitrarily large.  This is the default.
758790075Sobrien
7588169689Skan@item -mid-shared-library
7589169689Skan@opindex mid-shared-library
7590169689SkanGenerate code that supports shared libraries via the library ID method.
7591169689SkanThis allows for execute in place and shared libraries in an environment
7592169689Skanwithout virtual memory management.  This option implies @option{-fPIC}.
759390075Sobrien
7594169689Skan@item -mno-id-shared-library
7595169689Skan@opindex mno-id-shared-library
7596169689SkanGenerate code that doesn't assume ID based shared libraries are being used.
7597169689SkanThis is the default.
759890075Sobrien
7599169689Skan@item -mshared-library-id=n
7600169689Skan@opindex mshared-library-id
7601169689SkanSpecified the identification number of the ID based shared library being
7602169689Skancompiled.  Specifying a value of 0 will generate more compact code, specifying
7603169689Skanother values will force the allocation of that number to the current
7604169689Skanlibrary but is no more space or time efficient than omitting this option.
760590075Sobrien
7606169689Skan@item -mlong-calls
7607169689Skan@itemx -mno-long-calls
7608169689Skan@opindex mlong-calls
7609169689Skan@opindex mno-long-calls
7610169689SkanTells the compiler to perform function calls by first loading the
7611169689Skanaddress of the function into a register and then performing a subroutine
7612169689Skancall on this register.  This switch is needed if the target function
7613169689Skanwill lie outside of the 24 bit addressing range of the offset based
7614169689Skanversion of subroutine call instruction.
761590075Sobrien
7616169689SkanThis feature is not enabled by default.  Specifying
7617169689Skan@option{-mno-long-calls} will restore the default behavior.  Note these
7618169689Skanswitches have no effect on how the compiler generates code to handle
7619169689Skanfunction calls via function pointers.
7620169689Skan@end table
762190075Sobrien
7622169689Skan@node CRIS Options
7623169689Skan@subsection CRIS Options
7624169689Skan@cindex CRIS Options
762590075Sobrien
7626169689SkanThese options are defined specifically for the CRIS ports.
762790075Sobrien
7628169689Skan@table @gcctabopt
7629169689Skan@item -march=@var{architecture-type}
7630169689Skan@itemx -mcpu=@var{architecture-type}
7631169689Skan@opindex march
7632169689Skan@opindex mcpu
7633169689SkanGenerate code for the specified architecture.  The choices for
7634169689Skan@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
7635169689Skanrespectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
7636169689SkanDefault is @samp{v0} except for cris-axis-linux-gnu, where the default is
7637169689Skan@samp{v10}.
763890075Sobrien
7639169689Skan@item -mtune=@var{architecture-type}
764090075Sobrien@opindex mtune
7641169689SkanTune to @var{architecture-type} everything applicable about the generated
7642169689Skancode, except for the ABI and the set of available instructions.  The
7643169689Skanchoices for @var{architecture-type} are the same as for
7644169689Skan@option{-march=@var{architecture-type}}.
764590075Sobrien
7646169689Skan@item -mmax-stack-frame=@var{n}
7647169689Skan@opindex mmax-stack-frame
7648169689SkanWarn when the stack frame of a function exceeds @var{n} bytes.
764990075Sobrien
7650169689Skan@item -melinux-stacksize=@var{n}
7651169689Skan@opindex melinux-stacksize
7652169689SkanOnly available with the @samp{cris-axis-aout} target.  Arranges for
7653169689Skanindications in the program to the kernel loader that the stack of the
7654169689Skanprogram should be set to @var{n} bytes.
7655117395Skan
7656169689Skan@item -metrax4
7657169689Skan@itemx -metrax100
7658169689Skan@opindex metrax4
7659169689Skan@opindex metrax100
7660169689SkanThe options @option{-metrax4} and @option{-metrax100} are synonyms for
7661169689Skan@option{-march=v3} and @option{-march=v8} respectively.
7662117395Skan
7663169689Skan@item -mmul-bug-workaround
7664169689Skan@itemx -mno-mul-bug-workaround
7665169689Skan@opindex mmul-bug-workaround
7666169689Skan@opindex mno-mul-bug-workaround
7667169689SkanWork around a bug in the @code{muls} and @code{mulu} instructions for CPU
7668169689Skanmodels where it applies.  This option is active by default.
7669117395Skan
7670169689Skan@item -mpdebug
7671169689Skan@opindex mpdebug
7672169689SkanEnable CRIS-specific verbose debug-related information in the assembly
7673169689Skancode.  This option also has the effect to turn off the @samp{#NO_APP}
7674169689Skanformatted-code indicator to the assembler at the beginning of the
7675169689Skanassembly file.
7676132718Skan
7677169689Skan@item -mcc-init
7678169689Skan@opindex mcc-init
7679169689SkanDo not use condition-code results from previous instruction; always emit
7680169689Skancompare and test instructions before use of condition codes.
7681132718Skan
7682169689Skan@item -mno-side-effects
7683169689Skan@opindex mno-side-effects
7684169689SkanDo not emit instructions with side-effects in addressing modes other than
7685169689Skanpost-increment.
768690075Sobrien
7687169689Skan@item -mstack-align
7688169689Skan@itemx -mno-stack-align
7689169689Skan@itemx -mdata-align
7690169689Skan@itemx -mno-data-align
7691169689Skan@itemx -mconst-align
7692169689Skan@itemx -mno-const-align
7693169689Skan@opindex mstack-align
7694169689Skan@opindex mno-stack-align
7695169689Skan@opindex mdata-align
7696169689Skan@opindex mno-data-align
7697169689Skan@opindex mconst-align
7698169689Skan@opindex mno-const-align
7699169689SkanThese options (no-options) arranges (eliminate arrangements) for the
7700169689Skanstack-frame, individual data and constants to be aligned for the maximum
7701169689Skansingle data access size for the chosen CPU model.  The default is to
7702169689Skanarrange for 32-bit alignment.  ABI details such as structure layout are
7703169689Skannot affected by these options.
770490075Sobrien
7705169689Skan@item -m32-bit
7706169689Skan@itemx -m16-bit
7707169689Skan@itemx -m8-bit
7708169689Skan@opindex m32-bit
7709169689Skan@opindex m16-bit
7710169689Skan@opindex m8-bit
7711169689SkanSimilar to the stack- data- and const-align options above, these options
7712169689Skanarrange for stack-frame, writable data and constants to all be 32-bit,
7713169689Skan16-bit or 8-bit aligned.  The default is 32-bit alignment.
771490075Sobrien
7715169689Skan@item -mno-prologue-epilogue
7716169689Skan@itemx -mprologue-epilogue
7717169689Skan@opindex mno-prologue-epilogue
7718169689Skan@opindex mprologue-epilogue
7719169689SkanWith @option{-mno-prologue-epilogue}, the normal function prologue and
7720169689Skanepilogue that sets up the stack-frame are omitted and no return
7721169689Skaninstructions or return sequences are generated in the code.  Use this
7722169689Skanoption only together with visual inspection of the compiled code: no
7723169689Skanwarnings or errors are generated when call-saved registers must be saved,
7724169689Skanor storage for local variable needs to be allocated.
772590075Sobrien
7726169689Skan@item -mno-gotplt
7727169689Skan@itemx -mgotplt
7728169689Skan@opindex mno-gotplt
7729169689Skan@opindex mgotplt
7730169689SkanWith @option{-fpic} and @option{-fPIC}, don't generate (do generate)
7731169689Skaninstruction sequences that load addresses for functions from the PLT part
7732169689Skanof the GOT rather than (traditional on other architectures) calls to the
7733169689SkanPLT@.  The default is @option{-mgotplt}.
7734146895Skan
7735169689Skan@item -maout
7736169689Skan@opindex maout
7737169689SkanLegacy no-op option only recognized with the cris-axis-aout target.
773890075Sobrien
7739169689Skan@item -melf
7740169689Skan@opindex melf
7741169689SkanLegacy no-op option only recognized with the cris-axis-elf and
7742169689Skancris-axis-linux-gnu targets.
774390075Sobrien
7744169689Skan@item -melinux
7745169689Skan@opindex melinux
7746169689SkanOnly recognized with the cris-axis-aout target, where it selects a
7747169689SkanGNU/linux-like multilib, include files and instruction set for
7748169689Skan@option{-march=v8}.
7749132718Skan
7750169689Skan@item -mlinux
7751169689Skan@opindex mlinux
7752169689SkanLegacy no-op option only recognized with the cris-axis-linux-gnu target.
775390075Sobrien
7754169689Skan@item -sim
7755169689Skan@opindex sim
7756169689SkanThis option, recognized for the cris-axis-aout and cris-axis-elf arranges
7757169689Skanto link with input-output functions from a simulator library.  Code,
7758169689Skaninitialized data and zero-initialized data are allocated consecutively.
775990075Sobrien
7760169689Skan@item -sim2
7761169689Skan@opindex sim2
7762169689SkanLike @option{-sim}, but pass linker options to locate initialized data at
7763169689Skan0x40000000 and zero-initialized data at 0x80000000.
7764169689Skan@end table
776590075Sobrien
7766169689Skan@node CRX Options
7767169689Skan@subsection CRX Options
7768169689Skan@cindex CRX Options
776990075Sobrien
7770169689SkanThese options are defined specifically for the CRX ports.
777190075Sobrien
7772169689Skan@table @gcctabopt
777390075Sobrien
7774169689Skan@item -mmac
7775169689Skan@opindex mmac
7776169689SkanEnable the use of multiply-accumulate instructions. Disabled by default.
777790075Sobrien
7778169689Skan@item -mpush-args
7779169689Skan@opindex mpush-args
7780169689SkanPush instructions will be used to pass outgoing arguments when functions
7781169689Skanare called. Enabled by default.
7782169689Skan@end table
778390075Sobrien
7784169689Skan@node Darwin Options
7785169689Skan@subsection Darwin Options
7786169689Skan@cindex Darwin options
778790075Sobrien
7788169689SkanThese options are defined for all architectures running the Darwin operating
7789169689Skansystem.
779090075Sobrien
7791169689SkanFSF GCC on Darwin does not create ``fat'' object files; it will create
7792169689Skanan object file for the single architecture that it was built to
7793169689Skantarget.  Apple's GCC on Darwin does create ``fat'' files if multiple
7794169689Skan@option{-arch} options are used; it does so by running the compiler or
7795169689Skanlinker multiple times and joining the results together with
7796169689Skan@file{lipo}.
779790075Sobrien
7798169689SkanThe subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
7799169689Skan@samp{i686}) is determined by the flags that specify the ISA
7800169689Skanthat GCC is targetting, like @option{-mcpu} or @option{-march}.  The
7801169689Skan@option{-force_cpusubtype_ALL} option can be used to override this.
780290075Sobrien
7803169689SkanThe Darwin tools vary in their behavior when presented with an ISA
7804169689Skanmismatch.  The assembler, @file{as}, will only permit instructions to
7805169689Skanbe used that are valid for the subtype of the file it is generating,
7806169689Skanso you cannot put 64-bit instructions in an @samp{ppc750} object file.
7807169689SkanThe linker for shared libraries, @file{/usr/bin/libtool}, will fail
7808169689Skanand print an error if asked to create a shared library with a less
7809169689Skanrestrictive subtype than its input files (for instance, trying to put
7810169689Skana @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
7811169689Skanfor executables, @file{ld}, will quietly give the executable the most
7812169689Skanrestrictive subtype of any of its input files.
781390075Sobrien
7814169689Skan@table @gcctabopt
7815169689Skan@item -F@var{dir}
7816169689Skan@opindex F
7817169689SkanAdd the framework directory @var{dir} to the head of the list of
7818169689Skandirectories to be searched for header files.  These directories are
7819169689Skaninterleaved with those specified by @option{-I} options and are
7820169689Skanscanned in a left-to-right order.
7821132718Skan
7822169689SkanA framework directory is a directory with frameworks in it.  A
7823169689Skanframework is a directory with a @samp{"Headers"} and/or
7824169689Skan@samp{"PrivateHeaders"} directory contained directly in it that ends
7825169689Skanin @samp{".framework"}.  The name of a framework is the name of this
7826169689Skandirectory excluding the @samp{".framework"}.  Headers associated with
7827169689Skanthe framework are found in one of those two directories, with
7828169689Skan@samp{"Headers"} being searched first.  A subframework is a framework
7829169689Skandirectory that is in a framework's @samp{"Frameworks"} directory.
7830169689SkanIncludes of subframework headers can only appear in a header of a
7831169689Skanframework that contains the subframework, or in a sibling subframework
7832169689Skanheader.  Two subframeworks are siblings if they occur in the same
7833169689Skanframework.  A subframework should not have the same name as a
7834169689Skanframework, a warning will be issued if this is violated.  Currently a
7835169689Skansubframework cannot have subframeworks, in the future, the mechanism
7836169689Skanmay be extended to support this.  The standard frameworks can be found
7837169689Skanin @samp{"/System/Library/Frameworks"} and
7838169689Skan@samp{"/Library/Frameworks"}.  An example include looks like
7839169689Skan@code{#include <Framework/header.h>}, where @samp{Framework} denotes
7840169689Skanthe name of the framework and header.h is found in the
7841169689Skan@samp{"PrivateHeaders"} or @samp{"Headers"} directory.
7842132718Skan
7843169689Skan@item -gused
7844169689Skan@opindex gused
7845169689SkanEmit debugging information for symbols that are used.  For STABS
7846169689Skandebugging format, this enables @option{-feliminate-unused-debug-symbols}.
7847169689SkanThis is by default ON@.
7848132718Skan
7849169689Skan@item -gfull
7850169689Skan@opindex gfull
7851169689SkanEmit debugging information for all symbols and types.
7852132718Skan
7853169689Skan@item -mmacosx-version-min=@var{version}
7854169689SkanThe earliest version of MacOS X that this executable will run on
7855169689Skanis @var{version}.  Typical values of @var{version} include @code{10.1},
7856169689Skan@code{10.2}, and @code{10.3.9}.
785790075Sobrien
7858169689SkanThe default for this option is to make choices that seem to be most
7859169689Skanuseful.  
786090075Sobrien
7861169689Skan@item -mkernel
7862169689Skan@opindex mkernel
7863169689SkanEnable kernel development mode.  The @option{-mkernel} option sets
7864169689Skan@option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit},
7865169689Skan@option{-fno-exceptions}, @option{-fno-non-call-exceptions},
7866169689Skan@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
7867169689Skanapplicable.  This mode also sets @option{-mno-altivec},
7868169689Skan@option{-msoft-float}, @option{-fno-builtin} and
7869169689Skan@option{-mlong-branch} for PowerPC targets.
787090075Sobrien
7871169689Skan@item -mone-byte-bool
7872169689Skan@opindex mone-byte-bool
7873169689SkanOverride the defaults for @samp{bool} so that @samp{sizeof(bool)==1}.
7874169689SkanBy default @samp{sizeof(bool)} is @samp{4} when compiling for
7875169689SkanDarwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this
7876169689Skanoption has no effect on x86.
787790075Sobrien
7878169689Skan@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
7879169689Skanto generate code that is not binary compatible with code generated
7880169689Skanwithout that switch.  Using this switch may require recompiling all
7881169689Skanother modules in a program, including system libraries.  Use this
7882169689Skanswitch to conform to a non-default data model.
788390075Sobrien
7884169689Skan@item -mfix-and-continue
7885169689Skan@itemx -ffix-and-continue
7886169689Skan@itemx -findirect-data
7887169689Skan@opindex mfix-and-continue
7888169689Skan@opindex ffix-and-continue
7889169689Skan@opindex findirect-data
7890169689SkanGenerate code suitable for fast turn around development.  Needed to
7891169689Skanenable gdb to dynamically load @code{.o} files into already running
7892169689Skanprograms.  @option{-findirect-data} and @option{-ffix-and-continue}
7893169689Skanare provided for backwards compatibility.
789490075Sobrien
7895132718Skan@item -all_load
7896132718Skan@opindex all_load
7897117395SkanLoads all members of static archive libraries.
7898117395SkanSee man ld(1) for more information.
7899117395Skan
7900117395Skan@item -arch_errors_fatal
7901117395Skan@opindex arch_errors_fatal
7902117395SkanCause the errors having to do with files that have the wrong architecture
7903117395Skanto be fatal.
7904117395Skan
7905117395Skan@item -bind_at_load
7906117395Skan@opindex bind_at_load
7907117395SkanCauses the output file to be marked such that the dynamic linker will
7908117395Skanbind all undefined references when the file is loaded or launched.
7909117395Skan
7910132718Skan@item -bundle
7911117395Skan@opindex bundle
7912117395SkanProduce a Mach-o bundle format file.
7913117395SkanSee man ld(1) for more information.
7914117395Skan
7915117395Skan@item -bundle_loader @var{executable}
7916117395Skan@opindex bundle_loader
7917169689SkanThis option specifies the @var{executable} that will be loading the build
7918169689Skanoutput file being linked.  See man ld(1) for more information.
7919117395Skan
7920169689Skan@item -dynamiclib
7921169689Skan@opindex dynamiclib
7922169689SkanWhen passed this option, GCC will produce a dynamic library instead of
7923169689Skanan executable when linking, using the Darwin @file{libtool} command.
7924169689Skan
7925169689Skan@item -force_cpusubtype_ALL
7926169689Skan@opindex force_cpusubtype_ALL
7927169689SkanThis causes GCC's output file to have the @var{ALL} subtype, instead of
7928169689Skanone controlled by the @option{-mcpu} or @option{-march} option.
7929169689Skan
7930117395Skan@item -allowable_client  @var{client_name}
7931132718Skan@itemx -client_name
7932132718Skan@itemx -compatibility_version
7933132718Skan@itemx -current_version
7934169689Skan@itemx -dead_strip
7935132718Skan@itemx -dependency-file
7936132718Skan@itemx -dylib_file
7937132718Skan@itemx -dylinker_install_name
7938132718Skan@itemx -dynamic
7939132718Skan@itemx -exported_symbols_list
7940132718Skan@itemx -filelist
7941132718Skan@itemx -flat_namespace
7942132718Skan@itemx -force_flat_namespace
7943132718Skan@itemx -headerpad_max_install_names
7944132718Skan@itemx -image_base
7945132718Skan@itemx -init
7946132718Skan@itemx -install_name
7947132718Skan@itemx -keep_private_externs
7948132718Skan@itemx -multi_module
7949132718Skan@itemx -multiply_defined
7950132718Skan@itemx -multiply_defined_unused
7951132718Skan@itemx -noall_load
7952169689Skan@itemx -no_dead_strip_inits_and_terms
7953132718Skan@itemx -nofixprebinding
7954132718Skan@itemx -nomultidefs
7955132718Skan@itemx -noprebind
7956132718Skan@itemx -noseglinkedit
7957132718Skan@itemx -pagezero_size
7958132718Skan@itemx -prebind
7959132718Skan@itemx -prebind_all_twolevel_modules
7960132718Skan@itemx -private_bundle
7961132718Skan@itemx -read_only_relocs
7962132718Skan@itemx -sectalign
7963132718Skan@itemx -sectobjectsymbols
7964132718Skan@itemx -whyload
7965132718Skan@itemx -seg1addr
7966132718Skan@itemx -sectcreate
7967132718Skan@itemx -sectobjectsymbols
7968132718Skan@itemx -sectorder
7969169689Skan@itemx -segaddr
7970169689Skan@itemx -segs_read_only_addr
7971169689Skan@itemx -segs_read_write_addr
7972132718Skan@itemx -seg_addr_table
7973132718Skan@itemx -seg_addr_table_filename
7974132718Skan@itemx -seglinkedit
7975132718Skan@itemx -segprot
7976132718Skan@itemx -segs_read_only_addr
7977132718Skan@itemx -segs_read_write_addr
7978132718Skan@itemx -single_module
7979132718Skan@itemx -static
7980132718Skan@itemx -sub_library
7981132718Skan@itemx -sub_umbrella
7982132718Skan@itemx -twolevel_namespace
7983132718Skan@itemx -umbrella
7984132718Skan@itemx -undefined
7985132718Skan@itemx -unexported_symbols_list
7986132718Skan@itemx -weak_reference_mismatches
7987132718Skan@itemx -whatsloaded
7988117395Skan
7989117395Skan@opindex allowable_client
7990117395Skan@opindex client_name
7991117395Skan@opindex compatibility_version
7992117395Skan@opindex current_version
7993169689Skan@opindex dead_strip
7994117395Skan@opindex dependency-file
7995117395Skan@opindex dylib_file
7996117395Skan@opindex dylinker_install_name
7997117395Skan@opindex dynamic
7998117395Skan@opindex exported_symbols_list
7999132718Skan@opindex filelist
8000132718Skan@opindex flat_namespace
8001117395Skan@opindex force_flat_namespace
8002117395Skan@opindex headerpad_max_install_names
8003117395Skan@opindex image_base
8004132718Skan@opindex init
8005117395Skan@opindex install_name
8006117395Skan@opindex keep_private_externs
8007132718Skan@opindex multi_module
8008117395Skan@opindex multiply_defined
8009132718Skan@opindex multiply_defined_unused
8010132718Skan@opindex noall_load
8011169689Skan@opindex no_dead_strip_inits_and_terms
8012132718Skan@opindex nofixprebinding
8013132718Skan@opindex nomultidefs
8014117395Skan@opindex noprebind
8015132718Skan@opindex noseglinkedit
8016117395Skan@opindex pagezero_size
8017117395Skan@opindex prebind
8018117395Skan@opindex prebind_all_twolevel_modules
8019132718Skan@opindex private_bundle
8020117395Skan@opindex read_only_relocs
8021132718Skan@opindex sectalign
8022132718Skan@opindex sectobjectsymbols
8023132718Skan@opindex whyload
8024117395Skan@opindex seg1addr
8025132718Skan@opindex sectcreate
8026132718Skan@opindex sectobjectsymbols
8027132718Skan@opindex sectorder
8028169689Skan@opindex segaddr
8029169689Skan@opindex segs_read_only_addr
8030169689Skan@opindex segs_read_write_addr
8031117395Skan@opindex seg_addr_table
8032117395Skan@opindex seg_addr_table_filename
8033117395Skan@opindex seglinkedit
8034117395Skan@opindex segprot
8035117395Skan@opindex segs_read_only_addr
8036117395Skan@opindex segs_read_write_addr
8037117395Skan@opindex single_module
8038117395Skan@opindex static
8039117395Skan@opindex sub_library
8040117395Skan@opindex sub_umbrella
8041117395Skan@opindex twolevel_namespace
8042117395Skan@opindex umbrella
8043117395Skan@opindex undefined
8044117395Skan@opindex unexported_symbols_list
8045117395Skan@opindex weak_reference_mismatches
8046117395Skan@opindex whatsloaded
8047117395Skan
8048169689SkanThese options are passed to the Darwin linker.  The Darwin linker man page
8049117395Skandescribes them in detail.
8050117395Skan@end table
8051117395Skan
8052169689Skan@node DEC Alpha Options
8053169689Skan@subsection DEC Alpha Options
8054117395Skan
8055169689SkanThese @samp{-m} options are defined for the DEC Alpha implementations:
805690075Sobrien
805790075Sobrien@table @gcctabopt
8058169689Skan@item -mno-soft-float
8059169689Skan@itemx -msoft-float
8060169689Skan@opindex mno-soft-float
8061169689Skan@opindex msoft-float
8062169689SkanUse (do not use) the hardware floating-point instructions for
8063169689Skanfloating-point operations.  When @option{-msoft-float} is specified,
8064169689Skanfunctions in @file{libgcc.a} will be used to perform floating-point
8065169689Skanoperations.  Unless they are replaced by routines that emulate the
8066169689Skanfloating-point operations, or compiled in such a way as to call such
8067169689Skanemulations routines, these routines will issue floating-point
8068169689Skanoperations.   If you are compiling for an Alpha without floating-point
8069169689Skanoperations, you must ensure that the library is built so as not to call
8070169689Skanthem.
807190075Sobrien
8072169689SkanNote that Alpha implementations without floating-point operations are
8073169689Skanrequired to have floating-point registers.
8074132718Skan
8075169689Skan@item -mfp-reg
8076169689Skan@itemx -mno-fp-regs
8077169689Skan@opindex mfp-reg
8078169689Skan@opindex mno-fp-regs
8079169689SkanGenerate code that uses (does not use) the floating-point register set.
8080169689Skan@option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
8081169689Skanregister set is not used, floating point operands are passed in integer
8082169689Skanregisters as if they were integers and floating-point results are passed
8083169689Skanin @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
8084169689Skanso any function with a floating-point argument or return value called by code
8085169689Skancompiled with @option{-mno-fp-regs} must also be compiled with that
8086169689Skanoption.
8087132718Skan
8088169689SkanA typical use of this option is building a kernel that does not use,
8089169689Skanand hence need not save and restore, any floating-point registers.
809090075Sobrien
8091169689Skan@item -mieee
8092169689Skan@opindex mieee
8093169689SkanThe Alpha architecture implements floating-point hardware optimized for
8094169689Skanmaximum performance.  It is mostly compliant with the IEEE floating
8095169689Skanpoint standard.  However, for full compliance, software assistance is
8096169689Skanrequired.  This option generates code fully IEEE compliant code
8097169689Skan@emph{except} that the @var{inexact-flag} is not maintained (see below).
8098169689SkanIf this option is turned on, the preprocessor macro @code{_IEEE_FP} is
8099169689Skandefined during compilation.  The resulting code is less efficient but is
8100169689Skanable to correctly support denormalized numbers and exceptional IEEE
8101169689Skanvalues such as not-a-number and plus/minus infinity.  Other Alpha
8102169689Skancompilers call this option @option{-ieee_with_no_inexact}.
8103117395Skan
8104169689Skan@item -mieee-with-inexact
8105169689Skan@opindex mieee-with-inexact
8106169689SkanThis is like @option{-mieee} except the generated code also maintains
8107169689Skanthe IEEE @var{inexact-flag}.  Turning on this option causes the
8108169689Skangenerated code to implement fully-compliant IEEE math.  In addition to
8109169689Skan@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
8110169689Skanmacro.  On some Alpha implementations the resulting code may execute
8111169689Skansignificantly slower than the code generated by default.  Since there is
8112169689Skanvery little code that depends on the @var{inexact-flag}, you should
8113169689Skannormally not specify this option.  Other Alpha compilers call this
8114169689Skanoption @option{-ieee_with_inexact}.
8115117395Skan
8116169689Skan@item -mfp-trap-mode=@var{trap-mode}
8117169689Skan@opindex mfp-trap-mode
8118169689SkanThis option controls what floating-point related traps are enabled.
8119169689SkanOther Alpha compilers call this option @option{-fptm @var{trap-mode}}.
8120169689SkanThe trap mode can be set to one of four values:
8121117395Skan
8122169689Skan@table @samp
8123169689Skan@item n
8124169689SkanThis is the default (normal) setting.  The only traps that are enabled
8125169689Skanare the ones that cannot be disabled in software (e.g., division by zero
8126169689Skantrap).
812790075Sobrien
8128169689Skan@item u
8129169689SkanIn addition to the traps enabled by @samp{n}, underflow traps are enabled
8130169689Skanas well.
813190075Sobrien
8132169689Skan@item su
8133169689SkanLike @samp{u}, but the instructions are marked to be safe for software
8134169689Skancompletion (see Alpha architecture manual for details).
8135117395Skan
8136169689Skan@item sui
8137169689SkanLike @samp{su}, but inexact traps are enabled as well.
8138169689Skan@end table
813990075Sobrien
8140169689Skan@item -mfp-rounding-mode=@var{rounding-mode}
8141169689Skan@opindex mfp-rounding-mode
8142169689SkanSelects the IEEE rounding mode.  Other Alpha compilers call this option
8143169689Skan@option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
8144169689Skanof:
814590075Sobrien
8146169689Skan@table @samp
8147169689Skan@item n
8148169689SkanNormal IEEE rounding mode.  Floating point numbers are rounded towards
8149169689Skanthe nearest machine number or towards the even machine number in case
8150169689Skanof a tie.
815190075Sobrien
8152169689Skan@item m
8153169689SkanRound towards minus infinity.
815490075Sobrien
8155169689Skan@item c
8156169689SkanChopped rounding mode.  Floating point numbers are rounded towards zero.
815790075Sobrien
8158169689Skan@item d
8159169689SkanDynamic rounding mode.  A field in the floating point control register
8160169689Skan(@var{fpcr}, see Alpha architecture reference manual) controls the
8161169689Skanrounding mode in effect.  The C library initializes this register for
8162169689Skanrounding towards plus infinity.  Thus, unless your program modifies the
8163169689Skan@var{fpcr}, @samp{d} corresponds to round towards plus infinity.
8164169689Skan@end table
8165132718Skan
8166169689Skan@item -mtrap-precision=@var{trap-precision}
8167169689Skan@opindex mtrap-precision
8168169689SkanIn the Alpha architecture, floating point traps are imprecise.  This
8169169689Skanmeans without software assistance it is impossible to recover from a
8170169689Skanfloating trap and program execution normally needs to be terminated.
8171169689SkanGCC can generate code that can assist operating system trap handlers
8172169689Skanin determining the exact location that caused a floating point trap.
8173169689SkanDepending on the requirements of an application, different levels of
8174169689Skanprecisions can be selected:
817590075Sobrien
8176169689Skan@table @samp
8177169689Skan@item p
8178169689SkanProgram precision.  This option is the default and means a trap handler
8179169689Skancan only identify which program caused a floating point exception.
818090075Sobrien
8181169689Skan@item f
8182169689SkanFunction precision.  The trap handler can determine the function that
8183169689Skancaused a floating point exception.
818490075Sobrien
8185169689Skan@item i
8186169689SkanInstruction precision.  The trap handler can determine the exact
8187169689Skaninstruction that caused a floating point exception.
8188169689Skan@end table
8189117395Skan
8190169689SkanOther Alpha compilers provide the equivalent options called
8191169689Skan@option{-scope_safe} and @option{-resumption_safe}.
819290075Sobrien
8193169689Skan@item -mieee-conformant
8194169689Skan@opindex mieee-conformant
8195169689SkanThis option marks the generated code as IEEE conformant.  You must not
8196169689Skanuse this option unless you also specify @option{-mtrap-precision=i} and either
8197169689Skan@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
8198169689Skanis to emit the line @samp{.eflag 48} in the function prologue of the
8199169689Skangenerated assembly file.  Under DEC Unix, this has the effect that
8200169689SkanIEEE-conformant math library routines will be linked in.
820190075Sobrien
8202169689Skan@item -mbuild-constants
8203169689Skan@opindex mbuild-constants
8204169689SkanNormally GCC examines a 32- or 64-bit integer constant to
8205169689Skansee if it can construct it from smaller constants in two or three
8206169689Skaninstructions.  If it cannot, it will output the constant as a literal and
8207169689Skangenerate code to load it from the data segment at runtime.
820890075Sobrien
8209169689SkanUse this option to require GCC to construct @emph{all} integer constants
8210169689Skanusing code, even if it takes more instructions (the maximum is six).
821190075Sobrien
8212169689SkanYou would typically use this option to build a shared library dynamic
8213169689Skanloader.  Itself a shared library, it must relocate itself in memory
8214169689Skanbefore it can find the variables and constants in its own data segment.
821590075Sobrien
8216169689Skan@item -malpha-as
8217169689Skan@itemx -mgas
8218169689Skan@opindex malpha-as
8219169689Skan@opindex mgas
8220169689SkanSelect whether to generate code to be assembled by the vendor-supplied
8221169689Skanassembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
822290075Sobrien
8223169689Skan@item -mbwx
8224169689Skan@itemx -mno-bwx
8225169689Skan@itemx -mcix
8226169689Skan@itemx -mno-cix
8227169689Skan@itemx -mfix
8228169689Skan@itemx -mno-fix
8229169689Skan@itemx -mmax
8230169689Skan@itemx -mno-max
8231169689Skan@opindex mbwx
8232169689Skan@opindex mno-bwx
8233169689Skan@opindex mcix
8234169689Skan@opindex mno-cix
8235169689Skan@opindex mfix
8236169689Skan@opindex mno-fix
8237169689Skan@opindex mmax
8238169689Skan@opindex mno-max
8239169689SkanIndicate whether GCC should generate code to use the optional BWX,
8240169689SkanCIX, FIX and MAX instruction sets.  The default is to use the instruction
8241169689Skansets supported by the CPU type specified via @option{-mcpu=} option or that
8242169689Skanof the CPU on which GCC was built if none was specified.
824390075Sobrien
8244169689Skan@item -mfloat-vax
8245169689Skan@itemx -mfloat-ieee
8246169689Skan@opindex mfloat-vax
8247169689Skan@opindex mfloat-ieee
8248169689SkanGenerate code that uses (does not use) VAX F and G floating point
8249169689Skanarithmetic instead of IEEE single and double precision.
825090075Sobrien
8251169689Skan@item -mexplicit-relocs
8252169689Skan@itemx -mno-explicit-relocs
8253169689Skan@opindex mexplicit-relocs
8254169689Skan@opindex mno-explicit-relocs
8255169689SkanOlder Alpha assemblers provided no way to generate symbol relocations
8256169689Skanexcept via assembler macros.  Use of these macros does not allow
8257169689Skanoptimal instruction scheduling.  GNU binutils as of version 2.12
8258169689Skansupports a new syntax that allows the compiler to explicitly mark
8259169689Skanwhich relocations should apply to which instructions.  This option
8260169689Skanis mostly useful for debugging, as GCC detects the capabilities of
8261169689Skanthe assembler when it is built and sets the default accordingly.
826290075Sobrien
8263169689Skan@item -msmall-data
8264169689Skan@itemx -mlarge-data
8265169689Skan@opindex msmall-data
8266169689Skan@opindex mlarge-data
8267169689SkanWhen @option{-mexplicit-relocs} is in effect, static data is
8268169689Skanaccessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
8269169689Skanis used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
8270169689Skan(the @code{.sdata} and @code{.sbss} sections) and are accessed via
8271169689Skan16-bit relocations off of the @code{$gp} register.  This limits the
8272169689Skansize of the small data area to 64KB, but allows the variables to be
8273169689Skandirectly accessed via a single instruction.
8274132718Skan
8275169689SkanThe default is @option{-mlarge-data}.  With this option the data area
8276169689Skanis limited to just below 2GB@.  Programs that require more than 2GB of
8277169689Skandata must use @code{malloc} or @code{mmap} to allocate the data in the
8278169689Skanheap instead of in the program's data segment.
8279132718Skan
8280169689SkanWhen generating code for shared libraries, @option{-fpic} implies
8281169689Skan@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
8282132718Skan
8283169689Skan@item -msmall-text
8284169689Skan@itemx -mlarge-text
8285169689Skan@opindex msmall-text
8286169689Skan@opindex mlarge-text
8287169689SkanWhen @option{-msmall-text} is used, the compiler assumes that the
8288169689Skancode of the entire program (or shared library) fits in 4MB, and is
8289169689Skanthus reachable with a branch instruction.  When @option{-msmall-data}
8290169689Skanis used, the compiler can assume that all local symbols share the
8291169689Skansame @code{$gp} value, and thus reduce the number of instructions
8292169689Skanrequired for a function call from 4 to 1.
8293169689Skan
8294169689SkanThe default is @option{-mlarge-text}.
8295169689Skan
8296169689Skan@item -mcpu=@var{cpu_type}
8297169689Skan@opindex mcpu
8298169689SkanSet the instruction set and instruction scheduling parameters for
8299169689Skanmachine type @var{cpu_type}.  You can specify either the @samp{EV}
8300169689Skanstyle name or the corresponding chip number.  GCC supports scheduling
8301169689Skanparameters for the EV4, EV5 and EV6 family of processors and will
8302169689Skanchoose the default values for the instruction set from the processor
8303169689Skanyou specify.  If you do not specify a processor type, GCC will default
8304169689Skanto the processor on which the compiler was built.
8305169689Skan
8306169689SkanSupported values for @var{cpu_type} are
8307169689Skan
8308169689Skan@table @samp
8309169689Skan@item ev4
8310169689Skan@itemx ev45
8311169689Skan@itemx 21064
8312169689SkanSchedules as an EV4 and has no instruction set extensions.
8313169689Skan
8314169689Skan@item ev5
8315169689Skan@itemx 21164
8316169689SkanSchedules as an EV5 and has no instruction set extensions.
8317169689Skan
8318169689Skan@item ev56
8319169689Skan@itemx 21164a
8320169689SkanSchedules as an EV5 and supports the BWX extension.
8321169689Skan
8322169689Skan@item pca56
8323169689Skan@itemx 21164pc
8324169689Skan@itemx 21164PC
8325169689SkanSchedules as an EV5 and supports the BWX and MAX extensions.
8326169689Skan
8327169689Skan@item ev6
8328169689Skan@itemx 21264
8329169689SkanSchedules as an EV6 and supports the BWX, FIX, and MAX extensions.
8330169689Skan
8331169689Skan@item ev67
8332169689Skan@itemx 21264a
8333169689SkanSchedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
8334169689Skan@end table
8335169689Skan
8336169689Skan@item -mtune=@var{cpu_type}
8337169689Skan@opindex mtune
8338169689SkanSet only the instruction scheduling parameters for machine type
8339169689Skan@var{cpu_type}.  The instruction set is not changed.
8340169689Skan
8341169689Skan@item -mmemory-latency=@var{time}
8342169689Skan@opindex mmemory-latency
8343169689SkanSets the latency the scheduler should assume for typical memory
8344169689Skanreferences as seen by the application.  This number is highly
8345169689Skandependent on the memory access patterns used by the application
8346169689Skanand the size of the external cache on the machine.
8347169689Skan
8348169689SkanValid options for @var{time} are
8349169689Skan
8350169689Skan@table @samp
8351169689Skan@item @var{number}
8352169689SkanA decimal number representing clock cycles.
8353169689Skan
8354169689Skan@item L1
8355169689Skan@itemx L2
8356169689Skan@itemx L3
8357169689Skan@itemx main
8358169689SkanThe compiler contains estimates of the number of clock cycles for
8359169689Skan``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
8360169689Skan(also called Dcache, Scache, and Bcache), as well as to main memory.
8361169689SkanNote that L3 is only valid for EV5.
8362169689Skan
8363169689Skan@end table
8364169689Skan@end table
8365169689Skan
8366169689Skan@node DEC Alpha/VMS Options
8367169689Skan@subsection DEC Alpha/VMS Options
8368169689Skan
8369169689SkanThese @samp{-m} options are defined for the DEC Alpha/VMS implementations:
8370169689Skan
8371169689Skan@table @gcctabopt
8372169689Skan@item -mvms-return-codes
8373169689Skan@opindex mvms-return-codes
8374169689SkanReturn VMS condition codes from main.  The default is to return POSIX
8375169689Skanstyle condition (e.g.@ error) codes.
8376169689Skan@end table
8377169689Skan
8378169689Skan@node FRV Options
8379169689Skan@subsection FRV Options
8380169689Skan@cindex FRV Options
8381169689Skan
8382169689Skan@table @gcctabopt
8383169689Skan@item -mgpr-32
8384169689Skan@opindex mgpr-32
8385169689Skan
8386169689SkanOnly use the first 32 general purpose registers.
8387169689Skan
8388169689Skan@item -mgpr-64
8389169689Skan@opindex mgpr-64
8390169689Skan
8391169689SkanUse all 64 general purpose registers.
8392169689Skan
8393169689Skan@item -mfpr-32
8394169689Skan@opindex mfpr-32
8395169689Skan
8396169689SkanUse only the first 32 floating point registers.
8397169689Skan
8398169689Skan@item -mfpr-64
8399169689Skan@opindex mfpr-64
8400169689Skan
8401169689SkanUse all 64 floating point registers
8402169689Skan
840390075Sobrien@item -mhard-float
840490075Sobrien@opindex mhard-float
840590075Sobrien
8406169689SkanUse hardware instructions for floating point operations.
8407169689Skan
8408132718Skan@item -msoft-float
8409132718Skan@opindex msoft-float
841090075Sobrien
8411169689SkanUse library routines for floating point operations.
841290075Sobrien
8413169689Skan@item -malloc-cc
8414169689Skan@opindex malloc-cc
841590075Sobrien
8416169689SkanDynamically allocate condition code registers.
841790075Sobrien
8418169689Skan@item -mfixed-cc
8419169689Skan@opindex mfixed-cc
8420132718Skan
8421169689SkanDo not try to dynamically allocate condition code registers, only
8422169689Skanuse @code{icc0} and @code{fcc0}.
8423132718Skan
8424169689Skan@item -mdword
8425169689Skan@opindex mdword
8426132718Skan
8427169689SkanChange ABI to use double word insns.
8428132718Skan
8429169689Skan@item -mno-dword
8430169689Skan@opindex mno-dword
8431132718Skan
8432169689SkanDo not use double word instructions.
843390075Sobrien
8434169689Skan@item -mdouble
8435169689Skan@opindex mdouble
843690075Sobrien
8437169689SkanUse floating point double instructions.
843890075Sobrien
8439169689Skan@item -mno-double
8440169689Skan@opindex mno-double
8441132718Skan
8442169689SkanDo not use floating point double instructions.
8443132718Skan
8444169689Skan@item -mmedia
8445169689Skan@opindex mmedia
8446132718Skan
8447169689SkanUse media instructions.
8448132718Skan
8449169689Skan@item -mno-media
8450169689Skan@opindex mno-media
8451132718Skan
8452169689SkanDo not use media instructions.
8453132718Skan
8454169689Skan@item -mmuladd
8455169689Skan@opindex mmuladd
8456132718Skan
8457169689SkanUse multiply and add/subtract instructions.
8458169689Skan
8459169689Skan@item -mno-muladd
8460169689Skan@opindex mno-muladd
8461169689Skan
8462169689SkanDo not use multiply and add/subtract instructions.
8463169689Skan
8464169689Skan@item -mfdpic
8465169689Skan@opindex mfdpic
8466169689Skan
8467169689SkanSelect the FDPIC ABI, that uses function descriptors to represent
8468169689Skanpointers to functions.  Without any PIC/PIE-related options, it
8469169689Skanimplies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
8470169689Skanassumes GOT entries and small data are within a 12-bit range from the
8471169689SkanGOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
8472169689Skanare computed with 32 bits.
8473169689Skan
8474169689Skan@item -minline-plt
8475169689Skan@opindex minline-plt
8476169689Skan
8477169689SkanEnable inlining of PLT entries in function calls to functions that are
8478169689Skannot known to bind locally.  It has no effect without @option{-mfdpic}.
8479169689SkanIt's enabled by default if optimizing for speed and compiling for
8480169689Skanshared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
8481169689Skanoptimization option such as @option{-O3} or above is present in the
8482169689Skancommand line.
8483169689Skan
8484169689Skan@item -mTLS
8485169689Skan@opindex TLS
8486169689Skan
8487169689SkanAssume a large TLS segment when generating thread-local code.
8488169689Skan
8489169689Skan@item -mtls
8490169689Skan@opindex tls
8491169689Skan
8492169689SkanDo not assume a large TLS segment when generating thread-local code.
8493169689Skan
8494169689Skan@item -mgprel-ro
8495169689Skan@opindex mgprel-ro
8496169689Skan
8497169689SkanEnable the use of @code{GPREL} relocations in the FDPIC ABI for data
8498169689Skanthat is known to be in read-only sections.  It's enabled by default,
8499169689Skanexcept for @option{-fpic} or @option{-fpie}: even though it may help
8500169689Skanmake the global offset table smaller, it trades 1 instruction for 4.
8501169689SkanWith @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
8502169689Skanone of which may be shared by multiple symbols, and it avoids the need
8503169689Skanfor a GOT entry for the referenced symbol, so it's more likely to be a
8504169689Skanwin.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
8505169689Skan
8506169689Skan@item -multilib-library-pic
8507169689Skan@opindex multilib-library-pic
8508169689Skan
8509169689SkanLink with the (library, not FD) pic libraries.  It's implied by
8510169689Skan@option{-mlibrary-pic}, as well as by @option{-fPIC} and
8511169689Skan@option{-fpic} without @option{-mfdpic}.  You should never have to use
8512169689Skanit explicitly.
8513169689Skan
8514169689Skan@item -mlinked-fp
8515169689Skan@opindex mlinked-fp
8516169689Skan
8517169689SkanFollow the EABI requirement of always creating a frame pointer whenever
8518169689Skana stack frame is allocated.  This option is enabled by default and can
8519169689Skanbe disabled with @option{-mno-linked-fp}.
8520169689Skan
8521132718Skan@item -mlong-calls
8522132718Skan@opindex mlong-calls
8523169689Skan
8524169689SkanUse indirect addressing to call functions outside the current
8525169689Skancompilation unit.  This allows the functions to be placed anywhere
8526169689Skanwithin the 32-bit address space.
8527169689Skan
8528169689Skan@item -malign-labels
8529169689Skan@opindex malign-labels
8530169689Skan
8531169689SkanTry to align labels to an 8-byte boundary by inserting nops into the
8532169689Skanprevious packet.  This option only has an effect when VLIW packing
8533169689Skanis enabled.  It doesn't create new packets; it merely adds nops to
8534169689Skanexisting ones.
8535169689Skan
8536169689Skan@item -mlibrary-pic
8537169689Skan@opindex mlibrary-pic
8538169689Skan
8539169689SkanGenerate position-independent EABI code.
8540169689Skan
8541169689Skan@item -macc-4
8542169689Skan@opindex macc-4
8543169689Skan
8544169689SkanUse only the first four media accumulator registers.
8545169689Skan
8546169689Skan@item -macc-8
8547169689Skan@opindex macc-8
8548169689Skan
8549169689SkanUse all eight media accumulator registers.
8550169689Skan
8551169689Skan@item -mpack
8552169689Skan@opindex mpack
8553169689Skan
8554169689SkanPack VLIW instructions.
8555169689Skan
8556169689Skan@item -mno-pack
8557169689Skan@opindex mno-pack
8558169689Skan
8559169689SkanDo not pack VLIW instructions.
8560169689Skan
8561169689Skan@item -mno-eflags
8562169689Skan@opindex mno-eflags
8563169689Skan
8564169689SkanDo not mark ABI switches in e_flags.
8565169689Skan
8566169689Skan@item -mcond-move
8567169689Skan@opindex mcond-move
8568169689Skan
8569169689SkanEnable the use of conditional-move instructions (default).
8570169689Skan
8571169689SkanThis switch is mainly for debugging the compiler and will likely be removed
8572169689Skanin a future version.
8573169689Skan
8574169689Skan@item -mno-cond-move
8575169689Skan@opindex mno-cond-move
8576169689Skan
8577169689SkanDisable the use of conditional-move instructions.
8578169689Skan
8579169689SkanThis switch is mainly for debugging the compiler and will likely be removed
8580169689Skanin a future version.
8581169689Skan
8582169689Skan@item -mscc
8583169689Skan@opindex mscc
8584169689Skan
8585169689SkanEnable the use of conditional set instructions (default).
8586169689Skan
8587169689SkanThis switch is mainly for debugging the compiler and will likely be removed
8588169689Skanin a future version.
8589169689Skan
8590169689Skan@item -mno-scc
8591169689Skan@opindex mno-scc
8592169689Skan
8593169689SkanDisable the use of conditional set instructions.
8594169689Skan
8595169689SkanThis switch is mainly for debugging the compiler and will likely be removed
8596169689Skanin a future version.
8597169689Skan
8598169689Skan@item -mcond-exec
8599169689Skan@opindex mcond-exec
8600169689Skan
8601169689SkanEnable the use of conditional execution (default).
8602169689Skan
8603169689SkanThis switch is mainly for debugging the compiler and will likely be removed
8604169689Skanin a future version.
8605169689Skan
8606169689Skan@item -mno-cond-exec
8607169689Skan@opindex mno-cond-exec
8608169689Skan
8609169689SkanDisable the use of conditional execution.
8610169689Skan
8611169689SkanThis switch is mainly for debugging the compiler and will likely be removed
8612169689Skanin a future version.
8613169689Skan
8614169689Skan@item -mvliw-branch
8615169689Skan@opindex mvliw-branch
8616169689Skan
8617169689SkanRun a pass to pack branches into VLIW instructions (default).
8618169689Skan
8619169689SkanThis switch is mainly for debugging the compiler and will likely be removed
8620169689Skanin a future version.
8621169689Skan
8622169689Skan@item -mno-vliw-branch
8623169689Skan@opindex mno-vliw-branch
8624169689Skan
8625169689SkanDo not run a pass to pack branches into VLIW instructions.
8626169689Skan
8627169689SkanThis switch is mainly for debugging the compiler and will likely be removed
8628169689Skanin a future version.
8629169689Skan
8630169689Skan@item -mmulti-cond-exec
8631169689Skan@opindex mmulti-cond-exec
8632169689Skan
8633169689SkanEnable optimization of @code{&&} and @code{||} in conditional execution
8634169689Skan(default).
8635169689Skan
8636169689SkanThis switch is mainly for debugging the compiler and will likely be removed
8637169689Skanin a future version.
8638169689Skan
8639169689Skan@item -mno-multi-cond-exec
8640169689Skan@opindex mno-multi-cond-exec
8641169689Skan
8642169689SkanDisable optimization of @code{&&} and @code{||} in conditional execution.
8643169689Skan
8644169689SkanThis switch is mainly for debugging the compiler and will likely be removed
8645169689Skanin a future version.
8646169689Skan
8647169689Skan@item -mnested-cond-exec
8648169689Skan@opindex mnested-cond-exec
8649169689Skan
8650169689SkanEnable nested conditional execution optimizations (default).
8651169689Skan
8652169689SkanThis switch is mainly for debugging the compiler and will likely be removed
8653169689Skanin a future version.
8654169689Skan
8655169689Skan@item -mno-nested-cond-exec
8656169689Skan@opindex mno-nested-cond-exec
8657169689Skan
8658169689SkanDisable nested conditional execution optimizations.
8659169689Skan
8660169689SkanThis switch is mainly for debugging the compiler and will likely be removed
8661169689Skanin a future version.
8662169689Skan
8663169689Skan@item -moptimize-membar
8664169689Skan@opindex moptimize-membar
8665169689Skan
8666169689SkanThis switch removes redundant @code{membar} instructions from the
8667169689Skancompiler generated code.  It is enabled by default.
8668169689Skan
8669169689Skan@item -mno-optimize-membar
8670169689Skan@opindex mno-optimize-membar
8671169689Skan
8672169689SkanThis switch disables the automatic removal of redundant @code{membar}
8673169689Skaninstructions from the generated code.
8674169689Skan
8675169689Skan@item -mtomcat-stats
8676169689Skan@opindex mtomcat-stats
8677169689Skan
8678169689SkanCause gas to print out tomcat statistics.
8679169689Skan
8680169689Skan@item -mcpu=@var{cpu}
8681169689Skan@opindex mcpu
8682169689Skan
8683169689SkanSelect the processor type for which to generate code.  Possible values are
8684169689Skan@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
8685169689Skan@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
8686169689Skan
8687169689Skan@end table
8688169689Skan
8689169689Skan@node GNU/Linux Options
8690169689Skan@subsection GNU/Linux Options
8691169689Skan
8692169689SkanThese @samp{-m} options are defined for GNU/Linux targets:
8693169689Skan
8694169689Skan@table @gcctabopt
8695169689Skan@item -mglibc
8696169689Skan@opindex mglibc
8697169689SkanUse the GNU C library instead of uClibc.  This is the default except
8698169689Skanon @samp{*-*-linux-*uclibc*} targets.
8699169689Skan
8700169689Skan@item -muclibc
8701169689Skan@opindex muclibc
8702169689SkanUse uClibc instead of the GNU C library.  This is the default on
8703169689Skan@samp{*-*-linux-*uclibc*} targets.
8704169689Skan@end table
8705169689Skan
8706169689Skan@node H8/300 Options
8707169689Skan@subsection H8/300 Options
8708169689Skan
8709169689SkanThese @samp{-m} options are defined for the H8/300 implementations:
8710169689Skan
8711169689Skan@table @gcctabopt
8712169689Skan@item -mrelax
8713169689Skan@opindex mrelax
8714169689SkanShorten some address references at link time, when possible; uses the
8715169689Skanlinker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
8716169689Skanld, Using ld}, for a fuller description.
8717169689Skan
8718169689Skan@item -mh
8719169689Skan@opindex mh
8720169689SkanGenerate code for the H8/300H@.
8721169689Skan
8722169689Skan@item -ms
8723169689Skan@opindex ms
8724169689SkanGenerate code for the H8S@.
8725169689Skan
8726169689Skan@item -mn
8727169689Skan@opindex mn
8728169689SkanGenerate code for the H8S and H8/300H in the normal mode.  This switch
8729169689Skanmust be used either with @option{-mh} or @option{-ms}.
8730169689Skan
8731169689Skan@item -ms2600
8732169689Skan@opindex ms2600
8733169689SkanGenerate code for the H8S/2600.  This switch must be used with @option{-ms}.
8734169689Skan
8735169689Skan@item -mint32
8736169689Skan@opindex mint32
8737169689SkanMake @code{int} data 32 bits by default.
8738169689Skan
8739169689Skan@item -malign-300
8740169689Skan@opindex malign-300
8741169689SkanOn the H8/300H and H8S, use the same alignment rules as for the H8/300.
8742169689SkanThe default for the H8/300H and H8S is to align longs and floats on 4
8743169689Skanbyte boundaries.
8744169689Skan@option{-malign-300} causes them to be aligned on 2 byte boundaries.
8745169689SkanThis option has no effect on the H8/300.
8746169689Skan@end table
8747169689Skan
8748169689Skan@node HPPA Options
8749169689Skan@subsection HPPA Options
8750169689Skan@cindex HPPA Options
8751169689Skan
8752169689SkanThese @samp{-m} options are defined for the HPPA family of computers:
8753169689Skan
8754169689Skan@table @gcctabopt
8755169689Skan@item -march=@var{architecture-type}
8756169689Skan@opindex march
8757169689SkanGenerate code for the specified architecture.  The choices for
8758169689Skan@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
8759169689Skan1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
8760169689Skan@file{/usr/lib/sched.models} on an HP-UX system to determine the proper
8761169689Skanarchitecture option for your machine.  Code compiled for lower numbered
8762169689Skanarchitectures will run on higher numbered architectures, but not the
8763169689Skanother way around.
8764169689Skan
8765169689Skan@item -mpa-risc-1-0
8766169689Skan@itemx -mpa-risc-1-1
8767169689Skan@itemx -mpa-risc-2-0
8768169689Skan@opindex mpa-risc-1-0
8769169689Skan@opindex mpa-risc-1-1
8770169689Skan@opindex mpa-risc-2-0
8771169689SkanSynonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
8772169689Skan
8773169689Skan@item -mbig-switch
8774169689Skan@opindex mbig-switch
8775169689SkanGenerate code suitable for big switch tables.  Use this option only if
8776169689Skanthe assembler/linker complain about out of range branches within a switch
8777169689Skantable.
8778169689Skan
8779169689Skan@item -mjump-in-delay
8780169689Skan@opindex mjump-in-delay
8781169689SkanFill delay slots of function calls with unconditional jump instructions
8782169689Skanby modifying the return pointer for the function call to be the target
8783169689Skanof the conditional jump.
8784169689Skan
8785169689Skan@item -mdisable-fpregs
8786169689Skan@opindex mdisable-fpregs
8787169689SkanPrevent floating point registers from being used in any manner.  This is
8788169689Skannecessary for compiling kernels which perform lazy context switching of
8789169689Skanfloating point registers.  If you use this option and attempt to perform
8790169689Skanfloating point operations, the compiler will abort.
8791169689Skan
8792169689Skan@item -mdisable-indexing
8793169689Skan@opindex mdisable-indexing
8794169689SkanPrevent the compiler from using indexing address modes.  This avoids some
8795169689Skanrather obscure problems when compiling MIG generated code under MACH@.
8796169689Skan
8797169689Skan@item -mno-space-regs
8798169689Skan@opindex mno-space-regs
8799169689SkanGenerate code that assumes the target has no space registers.  This allows
8800169689SkanGCC to generate faster indirect calls and use unscaled index address modes.
8801169689Skan
8802169689SkanSuch code is suitable for level 0 PA systems and kernels.
8803169689Skan
8804169689Skan@item -mfast-indirect-calls
8805169689Skan@opindex mfast-indirect-calls
8806169689SkanGenerate code that assumes calls never cross space boundaries.  This
8807169689Skanallows GCC to emit code which performs faster indirect calls.
8808169689Skan
8809169689SkanThis option will not work in the presence of shared libraries or nested
8810169689Skanfunctions.
8811169689Skan
8812169689Skan@item -mfixed-range=@var{register-range}
8813169689Skan@opindex mfixed-range
8814169689SkanGenerate code treating the given register range as fixed registers.
8815169689SkanA fixed register is one that the register allocator can not use.  This is
8816169689Skanuseful when compiling kernel code.  A register range is specified as
8817169689Skantwo registers separated by a dash.  Multiple register ranges can be
8818169689Skanspecified separated by a comma.
8819169689Skan
8820169689Skan@item -mlong-load-store
8821169689Skan@opindex mlong-load-store
8822169689SkanGenerate 3-instruction load and store sequences as sometimes required by
8823169689Skanthe HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
8824169689Skanthe HP compilers.
8825169689Skan
8826169689Skan@item -mportable-runtime
8827169689Skan@opindex mportable-runtime
8828169689SkanUse the portable calling conventions proposed by HP for ELF systems.
8829169689Skan
8830169689Skan@item -mgas
8831169689Skan@opindex mgas
8832169689SkanEnable the use of assembler directives only GAS understands.
8833169689Skan
8834169689Skan@item -mschedule=@var{cpu-type}
8835169689Skan@opindex mschedule
8836169689SkanSchedule code according to the constraints for the machine type
8837169689Skan@var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
8838169689Skan@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
8839169689Skanto @file{/usr/lib/sched.models} on an HP-UX system to determine the
8840169689Skanproper scheduling option for your machine.  The default scheduling is
8841169689Skan@samp{8000}.
8842169689Skan
8843169689Skan@item -mlinker-opt
8844169689Skan@opindex mlinker-opt
8845169689SkanEnable the optimization pass in the HP-UX linker.  Note this makes symbolic
8846169689Skandebugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
8847169689Skanlinkers in which they give bogus error messages when linking some programs.
8848169689Skan
8849169689Skan@item -msoft-float
8850169689Skan@opindex msoft-float
8851169689SkanGenerate output containing library calls for floating point.
8852169689Skan@strong{Warning:} the requisite libraries are not available for all HPPA
8853169689Skantargets.  Normally the facilities of the machine's usual C compiler are
8854169689Skanused, but this cannot be done directly in cross-compilation.  You must make
8855169689Skanyour own arrangements to provide suitable library functions for
8856169689Skancross-compilation.  The embedded target @samp{hppa1.1-*-pro}
8857169689Skandoes provide software floating point support.
8858169689Skan
8859169689Skan@option{-msoft-float} changes the calling convention in the output file;
8860169689Skantherefore, it is only useful if you compile @emph{all} of a program with
8861169689Skanthis option.  In particular, you need to compile @file{libgcc.a}, the
8862169689Skanlibrary that comes with GCC, with @option{-msoft-float} in order for
8863169689Skanthis to work.
8864169689Skan
8865169689Skan@item -msio
8866169689Skan@opindex msio
8867169689SkanGenerate the predefine, @code{_SIO}, for server IO@.  The default is
8868169689Skan@option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
8869169689Skan@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
8870169689Skanoptions are available under HP-UX and HI-UX@.
8871169689Skan
8872169689Skan@item -mgnu-ld
8873169689Skan@opindex gnu-ld
8874169689SkanUse GNU ld specific options.  This passes @option{-shared} to ld when
8875169689Skanbuilding a shared library.  It is the default when GCC is configured,
8876169689Skanexplicitly or implicitly, with the GNU linker.  This option does not
8877169689Skanhave any affect on which ld is called, it only changes what parameters
8878169689Skanare passed to that ld.  The ld that is called is determined by the
8879169689Skan@option{--with-ld} configure option, GCC's program search path, and
8880169689Skanfinally by the user's @env{PATH}.  The linker used by GCC can be printed
8881169689Skanusing @samp{which `gcc -print-prog-name=ld`}.  This option is only available
8882169689Skanon the 64 bit HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}.
8883169689Skan
8884169689Skan@item -mhp-ld
8885169689Skan@opindex hp-ld
8886169689SkanUse HP ld specific options.  This passes @option{-b} to ld when building
8887169689Skana shared library and passes @option{+Accept TypeMismatch} to ld on all
8888169689Skanlinks.  It is the default when GCC is configured, explicitly or
8889169689Skanimplicitly, with the HP linker.  This option does not have any affect on
8890169689Skanwhich ld is called, it only changes what parameters are passed to that
8891169689Skanld.  The ld that is called is determined by the @option{--with-ld}
8892169689Skanconfigure option, GCC's program search path, and finally by the user's
8893169689Skan@env{PATH}.  The linker used by GCC can be printed using @samp{which
8894169689Skan`gcc -print-prog-name=ld`}.  This option is only available on the 64 bit
8895169689SkanHP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}.
8896169689Skan
8897169689Skan@item -mlong-calls
8898132718Skan@opindex mno-long-calls
8899169689SkanGenerate code that uses long call sequences.  This ensures that a call
8900169689Skanis always able to reach linker generated stubs.  The default is to generate
8901169689Skanlong calls only when the distance from the call site to the beginning
8902169689Skanof the function or translation unit, as the case may be, exceeds a
8903169689Skanpredefined limit set by the branch type being used.  The limits for
8904169689Skannormal calls are 7,600,000 and 240,000 bytes, respectively for the
8905169689SkanPA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
8906169689Skan240,000 bytes.
8907132718Skan
8908169689SkanDistances are measured from the beginning of functions when using the
8909169689Skan@option{-ffunction-sections} option, or when using the @option{-mgas}
8910169689Skanand @option{-mno-portable-runtime} options together under HP-UX with
8911169689Skanthe SOM linker.
8912132718Skan
8913169689SkanIt is normally not desirable to use this option as it will degrade
8914169689Skanperformance.  However, it may be useful in large applications,
8915169689Skanparticularly when partial linking is used to build the application.
891690075Sobrien
8917169689SkanThe types of long calls used depends on the capabilities of the
8918169689Skanassembler and linker, and the type of code being generated.  The
8919169689Skanimpact on systems that support long absolute calls, and long pic
8920169689Skansymbol-difference or pc-relative calls should be relatively small.
8921169689SkanHowever, an indirect call is used on 32-bit ELF systems in pic code
8922169689Skanand it is quite long.
892390075Sobrien
8924169689Skan@item -munix=@var{unix-std}
8925169689Skan@opindex march
8926169689SkanGenerate compiler predefines and select a startfile for the specified
8927169689SkanUNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
8928169689Skanand @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
8929169689Skanis available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
8930169689Skan11.11 and later.  The default values are @samp{93} for HP-UX 10.00,
8931169689Skan@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
8932169689Skanand later.
893390075Sobrien
8934169689Skan@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
8935169689Skan@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
8936169689Skanand @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
8937169689Skan@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
8938169689Skan@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
8939169689Skan@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
894090075Sobrien
8941169689SkanIt is @emph{important} to note that this option changes the interfaces
8942169689Skanfor various library routines.  It also affects the operational behavior
8943169689Skanof the C library.  Thus, @emph{extreme} care is needed in using this
8944169689Skanoption.
894590075Sobrien
8946169689SkanLibrary code that is intended to operate with more than one UNIX
8947169689Skanstandard must test, set and restore the variable @var{__xpg4_extended_mask}
8948169689Skanas appropriate.  Most GNU software doesn't provide this capability.
8949117395Skan
8950169689Skan@item -nolibdld
8951169689Skan@opindex nolibdld
8952169689SkanSuppress the generation of link options to search libdld.sl when the
8953169689Skan@option{-static} option is specified on HP-UX 10 and later.
8954169689Skan
8955169689Skan@item -static
8956169689Skan@opindex static
8957169689SkanThe HP-UX implementation of setlocale in libc has a dependency on
8958169689Skanlibdld.sl.  There isn't an archive version of libdld.sl.  Thus,
8959169689Skanwhen the @option{-static} option is specified, special link options
8960169689Skanare needed to resolve this dependency.
8961169689Skan
8962169689SkanOn HP-UX 10 and later, the GCC driver adds the necessary options to
8963169689Skanlink with libdld.sl when the @option{-static} option is specified.
8964169689SkanThis causes the resulting binary to be dynamic.  On the 64-bit port,
8965169689Skanthe linkers generate dynamic binaries by default in any case.  The
8966169689Skan@option{-nolibdld} option can be used to prevent the GCC driver from
8967169689Skanadding these link options.
8968169689Skan
8969169689Skan@item -threads
8970169689Skan@opindex threads
8971169689SkanAdd support for multithreading with the @dfn{dce thread} library
8972169689Skanunder HP-UX@.  This option sets flags for both the preprocessor and
8973169689Skanlinker.
897490075Sobrien@end table
897590075Sobrien
897690075Sobrien@node i386 and x86-64 Options
897790075Sobrien@subsection Intel 386 and AMD x86-64 Options
897890075Sobrien@cindex i386 Options
897990075Sobrien@cindex x86-64 Options
898090075Sobrien@cindex Intel 386 Options
898190075Sobrien@cindex AMD x86-64 Options
898290075Sobrien
898390075SobrienThese @samp{-m} options are defined for the i386 and x86-64 family of
898490075Sobriencomputers:
898590075Sobrien
898690075Sobrien@table @gcctabopt
8987132718Skan@item -mtune=@var{cpu-type}
8988132718Skan@opindex mtune
898990075SobrienTune to @var{cpu-type} everything applicable about the generated code, except
899090075Sobrienfor the ABI and the set of available instructions.  The choices for
8991132718Skan@var{cpu-type} are:
8992132718Skan@table @emph
8993169689Skan@item generic
8994169689SkanProduce code optimized for the most common IA32/AMD64/EM64T processors.
8995169689SkanIf you know the CPU on which your code will run, then you should use
8996169689Skanthe corresponding @option{-mtune} option instead of
8997169689Skan@option{-mtune=generic}.  But, if you do not know exactly what CPU users
8998169689Skanof your application will have, then you should use this option.
8999169689Skan
9000169689SkanAs new processors are deployed in the marketplace, the behavior of this
9001169689Skanoption will change.  Therefore, if you upgrade to a newer version of
9002169689SkanGCC, the code generated option will change to reflect the processors
9003169689Skanthat were most common when that version of GCC was released.
9004169689Skan
9005169689SkanThere is no @option{-march=generic} option because @option{-march}
9006169689Skanindicates the instruction set the compiler can use, and there is no
9007169689Skangeneric instruction set applicable to all processors.  In contrast,
9008169689Skan@option{-mtune} indicates the processor (or, in this case, collection of
9009169689Skanprocessors) for which the code is optimized.
9010169689Skan@item native
9011169689SkanThis selects the CPU to tune for at compilation time by determining
9012169689Skanthe processor type of the compiling machine.  Using @option{-mtune=native}
9013169689Skanwill produce code optimized for the local machine under the constraints
9014169689Skanof the selected instruction set.  Using @option{-march=native} will
9015169689Skanenable all instruction subsets supported by the local machine (hence
9016169689Skanthe result might not run on different machines).
9017132718Skan@item i386
9018169689SkanOriginal Intel's i386 CPU@.
9019132718Skan@item i486
9020169689SkanIntel's i486 CPU@.  (No scheduling is implemented for this chip.)
9021132718Skan@item i586, pentium
9022132718SkanIntel Pentium CPU with no MMX support.
9023132718Skan@item pentium-mmx
9024132718SkanIntel PentiumMMX CPU based on Pentium core with MMX instruction set support.
9025169689Skan@item pentiumpro
9026169689SkanIntel PentiumPro CPU@.
9027169689Skan@item i686
9028169689SkanSame as @code{generic}, but when used as @code{march} option, PentiumPro
9029169689Skaninstruction set will be used, so the code will run on all i686 family chips.
9030132718Skan@item pentium2
9031132718SkanIntel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
9032132718Skan@item pentium3, pentium3m
9033132718SkanIntel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
9034132718Skansupport.
9035132718Skan@item pentium-m
9036132718SkanLow power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set
9037132718Skansupport.  Used by Centrino notebooks.
9038132718Skan@item pentium4, pentium4m
9039132718SkanIntel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
9040132718Skan@item prescott
9041132718SkanImproved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction
9042132718Skanset support.
9043132718Skan@item nocona
9044132718SkanImproved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE,
9045132718SkanSSE2 and SSE3 instruction set support.
9046219374Smm@item core2
9047219374SmmIntel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
9048219374Smminstruction set support.
9049132718Skan@item k6
9050132718SkanAMD K6 CPU with MMX instruction set support.
9051132718Skan@item k6-2, k6-3
9052132718SkanImproved versions of AMD K6 CPU with MMX and 3dNOW! instruction set support.
9053132718Skan@item athlon, athlon-tbird
9054132718SkanAMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE prefetch instructions
9055132718Skansupport.
9056132718Skan@item athlon-4, athlon-xp, athlon-mp
9057132718SkanImproved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and full SSE
9058132718Skaninstruction set support.
9059132718Skan@item k8, opteron, athlon64, athlon-fx
9060132718SkanAMD K8 core based CPUs with x86-64 instruction set support.  (This supersets
9061132718SkanMMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.)
9062218895Smm@item k8-sse3, opteron-sse3, athlon64-sse3
9063218895SmmImproved versions of k8, opteron and athlon64 with SSE3 instruction set support.
9064251212Spfg@item amdfam10, barcelona
9065251212SpfgAMD Family 10h core based CPUs with x86-64 instruction set support.  (This
9066251212Spfgsupersets MMX, SSE, SSE2, SSE3, SSE4A, 3dNOW!, enhanced 3dNOW!, ABM and 64-bit
9067251212Spfginstruction set extensions.)
9068132718Skan@item winchip-c6
9069132718SkanIDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
9070132718Skanset support.
9071132718Skan@item winchip2
9072132718SkanIDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW!
9073132718Skaninstruction set support.
9074132718Skan@item c3
9075169689SkanVia C3 CPU with MMX and 3dNOW! instruction set support.  (No scheduling is
9076132718Skanimplemented for this chip.)
9077132718Skan@item c3-2
9078132718SkanVia C3-2 CPU with MMX and SSE instruction set support.  (No scheduling is
9079132718Skanimplemented for this chip.)
9080219374Smm@item geode
9081219374SmmEmbedded AMD CPU with MMX and 3dNOW! instruction set support.
9082132718Skan@end table
908390075Sobrien
908490075SobrienWhile picking a specific @var{cpu-type} will schedule things appropriately
908590075Sobrienfor that particular chip, the compiler will not generate any code that
908690075Sobriendoes not run on the i386 without the @option{-march=@var{cpu-type}} option
9087132718Skanbeing used.
908890075Sobrien
908990075Sobrien@item -march=@var{cpu-type}
909090075Sobrien@opindex march
909190075SobrienGenerate instructions for the machine type @var{cpu-type}.  The choices
9092132718Skanfor @var{cpu-type} are the same as for @option{-mtune}.  Moreover,
9093132718Skanspecifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
909490075Sobrien
9095132718Skan@item -mcpu=@var{cpu-type}
9096132718Skan@opindex mcpu
9097132718SkanA deprecated synonym for @option{-mtune}.
9098132718Skan
909990075Sobrien@item -m386
910090075Sobrien@itemx -m486
910190075Sobrien@itemx -mpentium
910290075Sobrien@itemx -mpentiumpro
910390075Sobrien@opindex m386
910490075Sobrien@opindex m486
910590075Sobrien@opindex mpentium
910690075Sobrien@opindex mpentiumpro
9107132718SkanThese options are synonyms for @option{-mtune=i386}, @option{-mtune=i486},
9108132718Skan@option{-mtune=pentium}, and @option{-mtune=pentiumpro} respectively.
910990075SobrienThese synonyms are deprecated.
911090075Sobrien
911190075Sobrien@item -mfpmath=@var{unit}
911290075Sobrien@opindex march
9113132718SkanGenerate floating point arithmetics for selected unit @var{unit}.  The choices
911490075Sobrienfor @var{unit} are:
911590075Sobrien
911690075Sobrien@table @samp
911790075Sobrien@item 387
911890075SobrienUse the standard 387 floating point coprocessor present majority of chips and
911990075Sobrienemulated otherwise.  Code compiled with this option will run almost everywhere.
9120117395SkanThe temporary results are computed in 80bit precision instead of precision
912190075Sobrienspecified by the type resulting in slightly different results compared to most
9122169689Skanof other chips.  See @option{-ffloat-store} for more detailed description.
912390075Sobrien
912490075SobrienThis is the default choice for i386 compiler.
912590075Sobrien
912690075Sobrien@item sse
912790075SobrienUse scalar floating point instructions present in the SSE instruction set.
912890075SobrienThis instruction set is supported by Pentium3 and newer chips, in the AMD line
912990075Sobrienby Athlon-4, Athlon-xp and Athlon-mp chips.  The earlier version of SSE
913090075Sobrieninstruction set supports only single precision arithmetics, thus the double and
913190075Sobrienextended precision arithmetics is still done using 387.  Later version, present
913290075Sobrienonly in Pentium4 and the future AMD x86-64 chips supports double precision
913390075Sobrienarithmetics too.
913490075Sobrien
9135169689SkanFor the i386 compiler, you need to use @option{-march=@var{cpu-type}}, @option{-msse}
9136169689Skanor @option{-msse2} switches to enable SSE extensions and make this option
9137169689Skaneffective.  For the x86-64 compiler, these extensions are enabled by default.
913890075Sobrien
9139132718SkanThe resulting code should be considerably faster in the majority of cases and avoid
914090075Sobrienthe numerical instability problems of 387 code, but may break some existing
914190075Sobriencode that expects temporaries to be 80bit.
914290075Sobrien
9143132718SkanThis is the default choice for the x86-64 compiler.
914490075Sobrien
914590075Sobrien@item sse,387
9146117395SkanAttempt to utilize both instruction sets at once.  This effectively double the
914790075Sobrienamount of available registers and on chips with separate execution units for
914890075Sobrien387 and SSE the execution resources too.  Use this option with care, as it is
9149132718Skanstill experimental, because the GCC register allocator does not model separate
915090075Sobrienfunctional units well resulting in instable performance.
915190075Sobrien@end table
915290075Sobrien
915390075Sobrien@item -masm=@var{dialect}
915490075Sobrien@opindex masm=@var{dialect}
9155169689SkanOutput asm instructions using selected @var{dialect}.  Supported
9156169689Skanchoices are @samp{intel} or @samp{att} (the default one).  Darwin does
9157169689Skannot support @samp{intel}.
915890075Sobrien
915990075Sobrien@item -mieee-fp
916090075Sobrien@itemx -mno-ieee-fp
916190075Sobrien@opindex mieee-fp
916290075Sobrien@opindex mno-ieee-fp
916390075SobrienControl whether or not the compiler uses IEEE floating point
916490075Sobriencomparisons.  These handle correctly the case where the result of a
916590075Sobriencomparison is unordered.
916690075Sobrien
916790075Sobrien@item -msoft-float
916890075Sobrien@opindex msoft-float
916990075SobrienGenerate output containing library calls for floating point.
917090075Sobrien@strong{Warning:} the requisite libraries are not part of GCC@.
917190075SobrienNormally the facilities of the machine's usual C compiler are used, but
917290075Sobrienthis can't be done directly in cross-compilation.  You must make your
917390075Sobrienown arrangements to provide suitable library functions for
917490075Sobriencross-compilation.
917590075Sobrien
917690075SobrienOn machines where a function returns floating point results in the 80387
917790075Sobrienregister stack, some floating point opcodes may be emitted even if
917890075Sobrien@option{-msoft-float} is used.
917990075Sobrien
918090075Sobrien@item -mno-fp-ret-in-387
918190075Sobrien@opindex mno-fp-ret-in-387
918290075SobrienDo not use the FPU registers for return values of functions.
918390075Sobrien
918490075SobrienThe usual calling convention has functions return values of types
918590075Sobrien@code{float} and @code{double} in an FPU register, even if there
918690075Sobrienis no FPU@.  The idea is that the operating system should emulate
918790075Sobrienan FPU@.
918890075Sobrien
918990075SobrienThe option @option{-mno-fp-ret-in-387} causes such values to be returned
919090075Sobrienin ordinary CPU registers instead.
919190075Sobrien
919290075Sobrien@item -mno-fancy-math-387
919390075Sobrien@opindex mno-fancy-math-387
919490075SobrienSome 387 emulators do not support the @code{sin}, @code{cos} and
919590075Sobrien@code{sqrt} instructions for the 387.  Specify this option to avoid
9196181540Sdasgenerating those instructions.  This option is the default on
919796263SobrienOpenBSD and NetBSD@.  This option is overridden when @option{-march}
919896263Sobrienindicates that the target cpu will always have an FPU and so the
919996263Sobrieninstruction will not need emulation.  As of revision 2.6.1, these
920096263Sobrieninstructions are not generated unless you also use the
920196263Sobrien@option{-funsafe-math-optimizations} switch.
920290075Sobrien
920390075Sobrien@item -malign-double
920490075Sobrien@itemx -mno-align-double
920590075Sobrien@opindex malign-double
920690075Sobrien@opindex mno-align-double
920790075SobrienControl whether GCC aligns @code{double}, @code{long double}, and
920890075Sobrien@code{long long} variables on a two word boundary or a one word
920990075Sobrienboundary.  Aligning @code{double} variables on a two word boundary will
921090075Sobrienproduce code that runs somewhat faster on a @samp{Pentium} at the
921190075Sobrienexpense of more memory.
921290075Sobrien
9213169689SkanOn x86-64, @option{-malign-double} is enabled by default.
9214169689Skan
9215110611Skan@strong{Warning:} if you use the @option{-malign-double} switch,
9216102780Skanstructures containing the above types will be aligned differently than
9217110611Skanthe published application binary interface specifications for the 386
9218110611Skanand will not be binary compatible with structures in code compiled
9219110611Skanwithout that switch.
9220102780Skan
9221119256Skan@item -m96bit-long-double
9222132718Skan@itemx -m128bit-long-double
9223119256Skan@opindex m96bit-long-double
922490075Sobrien@opindex m128bit-long-double
9225169689SkanThese switches control the size of @code{long double} type.  The i386
9226132718Skanapplication binary interface specifies the size to be 96 bits,
9227119256Skanso @option{-m96bit-long-double} is the default in 32 bit mode.
922890075Sobrien
9229119256SkanModern architectures (Pentium and newer) would prefer @code{long double}
9230132718Skanto be aligned to an 8 or 16 byte boundary.  In arrays or structures
9231132718Skanconforming to the ABI, this would not be possible.  So specifying a
9232119256Skan@option{-m128bit-long-double} will align @code{long double}
9233119256Skanto a 16 byte boundary by padding the @code{long double} with an additional
9234132718Skan32 bit zero.
9235119256Skan
9236119256SkanIn the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
9237119256Skanits ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
9238132718Skan
9239119256SkanNotice that neither of these options enable any extra precision over the x87
9240132718Skanstandard of 80 bits for a @code{long double}.
9241119256Skan
9242119256Skan@strong{Warning:} if you override the default value for your target ABI, the
9243132718Skanstructures and arrays containing @code{long double} variables will change
9244132718Skantheir size as well as function calling convention for function taking
9245132718Skan@code{long double} will be modified.  Hence they will not be binary
9246132718Skancompatible with arrays or structures in code compiled without that switch.
924790075Sobrien
9248169689Skan@item -mmlarge-data-threshold=@var{number}
9249169689Skan@opindex mlarge-data-threshold=@var{number}
9250169689SkanWhen @option{-mcmodel=medium} is specified, the data greater than
9251169689Skan@var{threshold} are placed in large data section.  This value must be the
9252169689Skansame across all object linked into the binary and defaults to 65535.
925390075Sobrien
925490075Sobrien@item -msvr3-shlib
925590075Sobrien@itemx -mno-svr3-shlib
925690075Sobrien@opindex msvr3-shlib
925790075Sobrien@opindex mno-svr3-shlib
925890075SobrienControl whether GCC places uninitialized local variables into the
925990075Sobrien@code{bss} or @code{data} segments.  @option{-msvr3-shlib} places them
926090075Sobrieninto @code{bss}.  These options are meaningful only on System V Release 3.
926190075Sobrien
926290075Sobrien@item -mrtd
926390075Sobrien@opindex mrtd
926490075SobrienUse a different function-calling convention, in which functions that
926590075Sobrientake a fixed number of arguments return with the @code{ret} @var{num}
926690075Sobrieninstruction, which pops their arguments while returning.  This saves one
926790075Sobrieninstruction in the caller since there is no need to pop the arguments
926890075Sobrienthere.
926990075Sobrien
927090075SobrienYou can specify that an individual function is called with this calling
927190075Sobriensequence with the function attribute @samp{stdcall}.  You can also
927290075Sobrienoverride the @option{-mrtd} option by using the function attribute
927390075Sobrien@samp{cdecl}.  @xref{Function Attributes}.
927490075Sobrien
927590075Sobrien@strong{Warning:} this calling convention is incompatible with the one
927690075Sobriennormally used on Unix, so you cannot use it if you need to call
927790075Sobrienlibraries compiled with the Unix compiler.
927890075Sobrien
927990075SobrienAlso, you must provide function prototypes for all functions that
928090075Sobrientake variable numbers of arguments (including @code{printf});
928190075Sobrienotherwise incorrect code will be generated for calls to those
928290075Sobrienfunctions.
928390075Sobrien
928490075SobrienIn addition, seriously incorrect code will result if you call a
928590075Sobrienfunction with too many arguments.  (Normally, extra arguments are
928690075Sobrienharmlessly ignored.)
928790075Sobrien
928890075Sobrien@item -mregparm=@var{num}
928990075Sobrien@opindex mregparm
929090075SobrienControl how many registers are used to pass integer arguments.  By
929190075Sobriendefault, no registers are used to pass arguments, and at most 3
929290075Sobrienregisters can be used.  You can control this behavior for a specific
929390075Sobrienfunction by using the function attribute @samp{regparm}.
929490075Sobrien@xref{Function Attributes}.
929590075Sobrien
929690075Sobrien@strong{Warning:} if you use this switch, and
929790075Sobrien@var{num} is nonzero, then you must build all modules with the same
929890075Sobrienvalue, including any libraries.  This includes the system libraries and
929990075Sobrienstartup modules.
930090075Sobrien
9301169689Skan@item -msseregparm
9302169689Skan@opindex msseregparm
9303169689SkanUse SSE register passing conventions for float and double arguments
9304169689Skanand return values.  You can control this behavior for a specific
9305169689Skanfunction by using the function attribute @samp{sseregparm}.
9306169689Skan@xref{Function Attributes}.
9307169689Skan
9308169689Skan@strong{Warning:} if you use this switch then you must build all
9309169689Skanmodules with the same value, including any libraries.  This includes
9310169689Skanthe system libraries and startup modules.
9311169689Skan
9312169689Skan@item -mstackrealign
9313169689Skan@opindex mstackrealign
9314169689SkanRealign the stack at entry.  On the Intel x86, the
9315169689Skan@option{-mstackrealign} option will generate an alternate prologue and
9316169689Skanepilogue that realigns the runtime stack.  This supports mixing legacy
9317169689Skancodes that keep a 4-byte aligned stack with modern codes that keep a
9318169689Skan16-byte stack for SSE compatibility.  The alternate prologue and
9319169689Skanepilogue are slower and bigger than the regular ones, and the
9320169689Skanalternate prologue requires an extra scratch register; this lowers the
9321169689Skannumber of registers available if used in conjunction with the
9322169689Skan@code{regparm} attribute.  The @option{-mstackrealign} option is
9323169689Skanincompatible with the nested function prologue; this is considered a
9324169689Skanhard error.  See also the attribute @code{force_align_arg_pointer},
9325169689Skanapplicable to individual functions.
9326169689Skan
932790075Sobrien@item -mpreferred-stack-boundary=@var{num}
932890075Sobrien@opindex mpreferred-stack-boundary
932990075SobrienAttempt to keep the stack boundary aligned to a 2 raised to @var{num}
933090075Sobrienbyte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
9331169689Skanthe default is 4 (16 bytes or 128 bits).
933290075Sobrien
933390075SobrienOn Pentium and PentiumPro, @code{double} and @code{long double} values
933490075Sobrienshould be aligned to an 8 byte boundary (see @option{-malign-double}) or
933590075Sobriensuffer significant run time performance penalties.  On Pentium III, the
9336169689SkanStreaming SIMD Extension (SSE) data type @code{__m128} may not work
9337169689Skanproperly if it is not 16 byte aligned.
933890075Sobrien
933990075SobrienTo ensure proper alignment of this values on the stack, the stack boundary
934090075Sobrienmust be as aligned as that required by any value stored on the stack.
934190075SobrienFurther, every function must be generated such that it keeps the stack
934290075Sobrienaligned.  Thus calling a function compiled with a higher preferred
934390075Sobrienstack boundary from a function compiled with a lower preferred stack
934490075Sobrienboundary will most likely misalign the stack.  It is recommended that
934590075Sobrienlibraries that use callbacks always use the default setting.
934690075Sobrien
934790075SobrienThis extra alignment does consume extra stack space, and generally
934890075Sobrienincreases code size.  Code that is sensitive to stack space usage, such
934990075Sobrienas embedded systems and operating system kernels, may want to reduce the
935090075Sobrienpreferred alignment to @option{-mpreferred-stack-boundary=2}.
935190075Sobrien
935290075Sobrien@item -mmmx
935390075Sobrien@itemx -mno-mmx
935490075Sobrien@item -msse
935590075Sobrien@itemx -mno-sse
935690075Sobrien@item -msse2
935790075Sobrien@itemx -mno-sse2
9358132718Skan@item -msse3
9359132718Skan@itemx -mno-sse3
9360219639Smm@item -mssse3
9361219639Smm@itemx -mno-ssse3
9362251212Spfg@item -msse4a
9363251212Spfg@item -mno-sse4a
936490075Sobrien@item -m3dnow
936590075Sobrien@itemx -mno-3dnow
9366251212Spfg@item -mpopcnt
9367251212Spfg@itemx -mno-popcnt
9368251212Spfg@item -mabm
9369251212Spfg@itemx -mno-abm
9370255185Sjmg@item -maes
9371255185Sjmg@itemx -mno-aes
937290075Sobrien@opindex mmmx
937390075Sobrien@opindex mno-mmx
937490075Sobrien@opindex msse
937590075Sobrien@opindex mno-sse
937690075Sobrien@opindex m3dnow
937790075Sobrien@opindex mno-3dnow
9378169689SkanThese switches enable or disable the use of instructions in the MMX,
9379255185SjmgSSE, SSE2, SSE3, SSSE3, SSE4A, ABM, AES or 3DNow! extended
9380255185Sjmginstruction sets.  These extensions are also available as built-in
9381255185Sjmgfunctions: see @ref{X86 Built-in Functions}, for details of the functions
9382255185Sjmgenabled and disabled by these switches.
938390075Sobrien
9384117395SkanTo have SSE/SSE2 instructions generated automatically from floating-point
9385169689Skancode (as opposed to 387 instructions), see @option{-mfpmath=sse}.
9386107590Sobrien
9387169689SkanThese options will enable GCC to use these extended instructions in
9388169689Skangenerated code, even without @option{-mfpmath=sse}.  Applications which
9389169689Skanperform runtime CPU detection must compile separate files for each
9390169689Skansupported architecture, using the appropriate flags.  In particular,
9391169689Skanthe file containing the CPU detection code should be compiled without
9392169689Skanthese options.
9393169689Skan
939490075Sobrien@item -mpush-args
939590075Sobrien@itemx -mno-push-args
939690075Sobrien@opindex mpush-args
939790075Sobrien@opindex mno-push-args
939890075SobrienUse PUSH operations to store outgoing parameters.  This method is shorter
939990075Sobrienand usually equally fast as method using SUB/MOV operations and is enabled
940090075Sobrienby default.  In some cases disabling it may improve performance because of
940190075Sobrienimproved scheduling and reduced dependencies.
940290075Sobrien
940390075Sobrien@item -maccumulate-outgoing-args
940490075Sobrien@opindex maccumulate-outgoing-args
940590075SobrienIf enabled, the maximum amount of space required for outgoing arguments will be
940690075Sobriencomputed in the function prologue.  This is faster on most modern CPUs
940790075Sobrienbecause of reduced dependencies, improved scheduling and reduced stack usage
940890075Sobrienwhen preferred stack boundary is not equal to 2.  The drawback is a notable
940990075Sobrienincrease in code size.  This switch implies @option{-mno-push-args}.
941090075Sobrien
941190075Sobrien@item -mthreads
941290075Sobrien@opindex mthreads
941390075SobrienSupport thread-safe exception handling on @samp{Mingw32}.  Code that relies
941490075Sobrienon thread-safe exception handling must compile and link all code with the
941590075Sobrien@option{-mthreads} option.  When compiling, @option{-mthreads} defines
941690075Sobrien@option{-D_MT}; when linking, it links in a special thread helper library
941790075Sobrien@option{-lmingwthrd} which cleans up per thread exception handling data.
941890075Sobrien
941990075Sobrien@item -mno-align-stringops
942090075Sobrien@opindex mno-align-stringops
942190075SobrienDo not align destination of inlined string operations.  This switch reduces
942290075Sobriencode size and improves performance in case the destination is already aligned,
9423132718Skanbut GCC doesn't know about it.
942490075Sobrien
942590075Sobrien@item -minline-all-stringops
942690075Sobrien@opindex minline-all-stringops
942790075SobrienBy default GCC inlines string operations only when destination is known to be
942890075Sobrienaligned at least to 4 byte boundary.  This enables more inlining, increase code
942990075Sobriensize, but may improve performance of code that depends on fast memcpy, strlen
943090075Sobrienand memset for short lengths.
943190075Sobrien
943290075Sobrien@item -momit-leaf-frame-pointer
943390075Sobrien@opindex momit-leaf-frame-pointer
943490075SobrienDon't keep the frame pointer in a register for leaf functions.  This
943590075Sobrienavoids the instructions to save, set up and restore frame pointers and
943690075Sobrienmakes an extra register available in leaf functions.  The option
943790075Sobrien@option{-fomit-frame-pointer} removes the frame pointer for all functions
943890075Sobrienwhich might make debugging harder.
9439132718Skan
9440132718Skan@item -mtls-direct-seg-refs
9441132718Skan@itemx -mno-tls-direct-seg-refs
9442132718Skan@opindex mtls-direct-seg-refs
9443132718SkanControls whether TLS variables may be accessed with offsets from the
9444132718SkanTLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
9445132718Skanor whether the thread base pointer must be added.  Whether or not this
9446132718Skanis legal depends on the operating system, and whether it maps the
9447132718Skansegment to cover the entire TLS area.
9448132718Skan
9449132718SkanFor systems that use GNU libc, the default is on.
945090075Sobrien@end table
945190075Sobrien
945290075SobrienThese @samp{-m} switches are supported in addition to the above
945390075Sobrienon AMD x86-64 processors in 64-bit environments.
945490075Sobrien
945590075Sobrien@table @gcctabopt
945690075Sobrien@item -m32
945790075Sobrien@itemx -m64
945890075Sobrien@opindex m32
945990075Sobrien@opindex m64
946090075SobrienGenerate code for a 32-bit or 64-bit environment.
946190075SobrienThe 32-bit environment sets int, long and pointer to 32 bits and
946290075Sobriengenerates code that runs on any i386 system.
946390075SobrienThe 64-bit environment sets int to 32 bits and long and pointer
9464169689Skanto 64 bits and generates code for AMD's x86-64 architecture. For
9465169689Skandarwin only the -m64 option turns off the @option{-fno-pic} and
9466169689Skan@option{-mdynamic-no-pic} options.
946790075Sobrien
946890075Sobrien@item -mno-red-zone
946990075Sobrien@opindex no-red-zone
947090075SobrienDo not use a so called red zone for x86-64 code.  The red zone is mandated
947190075Sobrienby the x86-64 ABI, it is a 128-byte area beyond the location of the
947290075Sobrienstack pointer that will not be modified by signal or interrupt handlers
947390075Sobrienand therefore can be used for temporary data without adjusting the stack
947490075Sobrienpointer.  The flag @option{-mno-red-zone} disables this red zone.
9475102780Skan
9476102780Skan@item -mcmodel=small
9477102780Skan@opindex mcmodel=small
9478102780SkanGenerate code for the small code model: the program and its symbols must
9479102780Skanbe linked in the lower 2 GB of the address space.  Pointers are 64 bits.
9480102780SkanPrograms can be statically or dynamically linked.  This is the default
9481102780Skancode model.
9482102780Skan
9483102780Skan@item -mcmodel=kernel
9484102780Skan@opindex mcmodel=kernel
9485102780SkanGenerate code for the kernel code model.  The kernel runs in the
9486102780Skannegative 2 GB of the address space.
9487102780SkanThis model has to be used for Linux kernel code.
9488102780Skan
9489102780Skan@item -mcmodel=medium
9490102780Skan@opindex mcmodel=medium
9491102780SkanGenerate code for the medium model: The program is linked in the lower 2
9492102780SkanGB of the address space but symbols can be located anywhere in the
9493102780Skanaddress space.  Programs can be statically or dynamically linked, but
9494102780Skanbuilding of shared libraries are not supported with the medium model.
9495102780Skan
9496102780Skan@item -mcmodel=large
9497102780Skan@opindex mcmodel=large
9498102780SkanGenerate code for the large model: This model makes no assumptions
9499102780Skanabout addresses and sizes of sections.  Currently GCC does not implement
9500102780Skanthis model.
950190075Sobrien@end table
950290075Sobrien
9503169689Skan@node IA-64 Options
9504169689Skan@subsection IA-64 Options
9505169689Skan@cindex IA-64 Options
950690075Sobrien
9507169689SkanThese are the @samp{-m} options defined for the Intel IA-64 architecture.
950890075Sobrien
950990075Sobrien@table @gcctabopt
9510169689Skan@item -mbig-endian
9511169689Skan@opindex mbig-endian
9512169689SkanGenerate code for a big endian target.  This is the default for HP-UX@.
951390075Sobrien
9514169689Skan@item -mlittle-endian
9515169689Skan@opindex mlittle-endian
9516169689SkanGenerate code for a little endian target.  This is the default for AIX5
9517169689Skanand GNU/Linux.
951890075Sobrien
9519169689Skan@item -mgnu-as
9520169689Skan@itemx -mno-gnu-as
9521169689Skan@opindex mgnu-as
9522169689Skan@opindex mno-gnu-as
9523169689SkanGenerate (or don't) code for the GNU assembler.  This is the default.
9524169689Skan@c Also, this is the default if the configure option @option{--with-gnu-as}
9525169689Skan@c is used.
952690075Sobrien
9527117395Skan@item -mgnu-ld
9528169689Skan@itemx -mno-gnu-ld
9529169689Skan@opindex mgnu-ld
9530169689Skan@opindex mno-gnu-ld
9531169689SkanGenerate (or don't) code for the GNU linker.  This is the default.
9532169689Skan@c Also, this is the default if the configure option @option{--with-gnu-ld}
9533169689Skan@c is used.
9534117395Skan
9535169689Skan@item -mno-pic
9536169689Skan@opindex mno-pic
9537169689SkanGenerate code that does not use a global pointer register.  The result
9538169689Skanis not position independent code, and violates the IA-64 ABI@.
9539117395Skan
9540169689Skan@item -mvolatile-asm-stop
9541169689Skan@itemx -mno-volatile-asm-stop
9542169689Skan@opindex mvolatile-asm-stop
9543169689Skan@opindex mno-volatile-asm-stop
9544169689SkanGenerate (or don't) a stop bit immediately before and after volatile asm
9545169689Skanstatements.
9546117395Skan
9547169689Skan@item -mregister-names
9548169689Skan@itemx -mno-register-names
9549169689Skan@opindex mregister-names
9550169689Skan@opindex mno-register-names
9551169689SkanGenerate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
9552169689Skanthe stacked registers.  This may make assembler output more readable.
9553117395Skan
9554169689Skan@item -mno-sdata
9555169689Skan@itemx -msdata
9556169689Skan@opindex mno-sdata
9557169689Skan@opindex msdata
9558169689SkanDisable (or enable) optimizations that use the small data section.  This may
9559169689Skanbe useful for working around optimizer bugs.
9560117395Skan
9561169689Skan@item -mconstant-gp
9562169689Skan@opindex mconstant-gp
9563169689SkanGenerate code that uses a single constant global pointer value.  This is
9564169689Skanuseful when compiling kernel code.
9565117395Skan
9566169689Skan@item -mauto-pic
9567169689Skan@opindex mauto-pic
9568169689SkanGenerate code that is self-relocatable.  This implies @option{-mconstant-gp}.
9569169689SkanThis is useful when compiling firmware code.
9570117395Skan
9571169689Skan@item -minline-float-divide-min-latency
9572169689Skan@opindex minline-float-divide-min-latency
9573169689SkanGenerate code for inline divides of floating point values
9574169689Skanusing the minimum latency algorithm.
9575117395Skan
9576169689Skan@item -minline-float-divide-max-throughput
9577169689Skan@opindex minline-float-divide-max-throughput
9578169689SkanGenerate code for inline divides of floating point values
9579169689Skanusing the maximum throughput algorithm.
9580117395Skan
9581169689Skan@item -minline-int-divide-min-latency
9582169689Skan@opindex minline-int-divide-min-latency
9583169689SkanGenerate code for inline divides of integer values
9584169689Skanusing the minimum latency algorithm.
958590075Sobrien
9586169689Skan@item -minline-int-divide-max-throughput
9587169689Skan@opindex minline-int-divide-max-throughput
9588169689SkanGenerate code for inline divides of integer values
9589169689Skanusing the maximum throughput algorithm.
959090075Sobrien
9591169689Skan@item -minline-sqrt-min-latency
9592169689Skan@opindex minline-sqrt-min-latency
9593169689SkanGenerate code for inline square roots
9594169689Skanusing the minimum latency algorithm.
959590075Sobrien
9596169689Skan@item -minline-sqrt-max-throughput
9597169689Skan@opindex minline-sqrt-max-throughput
9598169689SkanGenerate code for inline square roots
9599169689Skanusing the maximum throughput algorithm.
960090075Sobrien
9601169689Skan@item -mno-dwarf2-asm
9602169689Skan@itemx -mdwarf2-asm
9603169689Skan@opindex mno-dwarf2-asm
9604169689Skan@opindex mdwarf2-asm
9605169689SkanDon't (or do) generate assembler code for the DWARF2 line number debugging
9606169689Skaninfo.  This may be useful when not using the GNU assembler.
960790075Sobrien
9608169689Skan@item -mearly-stop-bits
9609169689Skan@itemx -mno-early-stop-bits
9610169689Skan@opindex mearly-stop-bits
9611169689Skan@opindex mno-early-stop-bits
9612169689SkanAllow stop bits to be placed earlier than immediately preceding the
9613169689Skaninstruction that triggered the stop bit.  This can improve instruction
9614169689Skanscheduling, but does not always do so.
961590075Sobrien
9616169689Skan@item -mfixed-range=@var{register-range}
9617169689Skan@opindex mfixed-range
9618169689SkanGenerate code treating the given register range as fixed registers.
9619169689SkanA fixed register is one that the register allocator can not use.  This is
9620169689Skanuseful when compiling kernel code.  A register range is specified as
9621169689Skantwo registers separated by a dash.  Multiple register ranges can be
9622169689Skanspecified separated by a comma.
962390075Sobrien
9624169689Skan@item -mtls-size=@var{tls-size}
9625169689Skan@opindex mtls-size
9626169689SkanSpecify bit size of immediate TLS offsets.  Valid values are 14, 22, and
9627169689Skan64.
962890075Sobrien
9629169689Skan@item -mtune=@var{cpu-type}
9630169689Skan@opindex mtune
9631169689SkanTune the instruction scheduling for a particular CPU, Valid values are
9632169689Skanitanium, itanium1, merced, itanium2, and mckinley.
963390075Sobrien
9634169689Skan@item -mt
9635169689Skan@itemx -pthread
9636169689Skan@opindex mt
9637169689Skan@opindex pthread
9638169689SkanAdd support for multithreading using the POSIX threads library.  This
9639169689Skanoption sets flags for both the preprocessor and linker.  It does
9640169689Skannot affect the thread safety of object code produced by the compiler or
9641169689Skanthat of libraries supplied with it.  These are HP-UX specific flags.
964290075Sobrien
9643169689Skan@item -milp32
9644169689Skan@itemx -mlp64
9645169689Skan@opindex milp32
9646169689Skan@opindex mlp64
9647169689SkanGenerate code for a 32-bit or 64-bit environment.
9648169689SkanThe 32-bit environment sets int, long and pointer to 32 bits.
9649169689SkanThe 64-bit environment sets int to 32 bits and long and pointer
9650169689Skanto 64 bits.  These are HP-UX specific flags.
965190075Sobrien
9652169689Skan@item -mno-sched-br-data-spec
9653169689Skan@itemx -msched-br-data-spec
9654169689Skan@opindex mno-sched-br-data-spec
9655169689Skan@opindex msched-br-data-spec
9656169689Skan(Dis/En)able data speculative scheduling before reload.
9657169689SkanThis will result in generation of the ld.a instructions and
9658169689Skanthe corresponding check instructions (ld.c / chk.a).
9659169689SkanThe default is 'disable'.
966090075Sobrien
9661169689Skan@item -msched-ar-data-spec
9662169689Skan@itemx -mno-sched-ar-data-spec
9663169689Skan@opindex msched-ar-data-spec
9664169689Skan@opindex mno-sched-ar-data-spec
9665169689Skan(En/Dis)able data speculative scheduling after reload.
9666169689SkanThis will result in generation of the ld.a instructions and
9667169689Skanthe corresponding check instructions (ld.c / chk.a).
9668169689SkanThe default is 'enable'.
966990075Sobrien
9670169689Skan@item -mno-sched-control-spec
9671169689Skan@itemx -msched-control-spec
9672169689Skan@opindex mno-sched-control-spec
9673169689Skan@opindex msched-control-spec
9674169689Skan(Dis/En)able control speculative scheduling.  This feature is
9675169689Skanavailable only during region scheduling (i.e. before reload).
9676169689SkanThis will result in generation of the ld.s instructions and
9677169689Skanthe corresponding check instructions chk.s .
9678169689SkanThe default is 'disable'.
967990075Sobrien
9680169689Skan@item -msched-br-in-data-spec
9681169689Skan@itemx -mno-sched-br-in-data-spec
9682169689Skan@opindex msched-br-in-data-spec
9683169689Skan@opindex mno-sched-br-in-data-spec
9684169689Skan(En/Dis)able speculative scheduling of the instructions that
9685169689Skanare dependent on the data speculative loads before reload.
9686169689SkanThis is effective only with @option{-msched-br-data-spec} enabled.
9687169689SkanThe default is 'enable'.
968890075Sobrien
9689169689Skan@item -msched-ar-in-data-spec
9690169689Skan@itemx -mno-sched-ar-in-data-spec
9691169689Skan@opindex msched-ar-in-data-spec
9692169689Skan@opindex mno-sched-ar-in-data-spec
9693169689Skan(En/Dis)able speculative scheduling of the instructions that
9694169689Skanare dependent on the data speculative loads after reload.
9695169689SkanThis is effective only with @option{-msched-ar-data-spec} enabled.
9696169689SkanThe default is 'enable'.
969790075Sobrien
9698169689Skan@item -msched-in-control-spec
9699169689Skan@itemx -mno-sched-in-control-spec
9700169689Skan@opindex msched-in-control-spec
9701169689Skan@opindex mno-sched-in-control-spec
9702169689Skan(En/Dis)able speculative scheduling of the instructions that
9703169689Skanare dependent on the control speculative loads.
9704169689SkanThis is effective only with @option{-msched-control-spec} enabled.
9705169689SkanThe default is 'enable'.
970690075Sobrien
9707169689Skan@item -msched-ldc
9708169689Skan@itemx -mno-sched-ldc
9709169689Skan@opindex msched-ldc
9710169689Skan@opindex mno-sched-ldc
9711169689Skan(En/Dis)able use of simple data speculation checks ld.c .
9712169689SkanIf disabled, only chk.a instructions will be emitted to check
9713169689Skandata speculative loads.
9714169689SkanThe default is 'enable'.
971590075Sobrien
9716169689Skan@item -mno-sched-control-ldc
9717169689Skan@itemx -msched-control-ldc
9718169689Skan@opindex mno-sched-control-ldc
9719169689Skan@opindex msched-control-ldc 
9720169689Skan(Dis/En)able use of ld.c instructions to check control speculative loads.
9721169689SkanIf enabled, in case of control speculative load with no speculatively
9722169689Skanscheduled dependent instructions this load will be emitted as ld.sa and
9723169689Skanld.c will be used to check it.
9724169689SkanThe default is 'disable'.
972590075Sobrien
9726169689Skan@item -mno-sched-spec-verbose
9727169689Skan@itemx -msched-spec-verbose
9728169689Skan@opindex mno-sched-spec-verbose
9729169689Skan@opindex msched-spec-verbose
9730169689Skan(Dis/En)able printing of the information about speculative motions.
973190075Sobrien
9732169689Skan@item -mno-sched-prefer-non-data-spec-insns
9733169689Skan@itemx -msched-prefer-non-data-spec-insns
9734169689Skan@opindex mno-sched-prefer-non-data-spec-insns
9735169689Skan@opindex msched-prefer-non-data-spec-insns
9736169689SkanIf enabled, data speculative instructions will be chosen for schedule
9737169689Skanonly if there are no other choices at the moment.  This will make
9738169689Skanthe use of the data speculation much more conservative.
9739169689SkanThe default is 'disable'.
974090075Sobrien
9741169689Skan@item -mno-sched-prefer-non-control-spec-insns
9742169689Skan@itemx -msched-prefer-non-control-spec-insns
9743169689Skan@opindex mno-sched-prefer-non-control-spec-insns
9744169689Skan@opindex msched-prefer-non-control-spec-insns
9745169689SkanIf enabled, control speculative instructions will be chosen for schedule
9746169689Skanonly if there are no other choices at the moment.  This will make
9747169689Skanthe use of the control speculation much more conservative.
9748169689SkanThe default is 'disable'.
974990075Sobrien
9750169689Skan@item -mno-sched-count-spec-in-critical-path
9751169689Skan@itemx -msched-count-spec-in-critical-path
9752169689Skan@opindex mno-sched-count-spec-in-critical-path
9753169689Skan@opindex msched-count-spec-in-critical-path
9754169689SkanIf enabled, speculative dependencies will be considered during
9755169689Skancomputation of the instructions priorities.  This will make the use of the
9756169689Skanspeculation a bit more conservative.
9757169689SkanThe default is 'disable'.
975890075Sobrien
975990075Sobrien@end table
976090075Sobrien
9761169689Skan@node M32C Options
9762169689Skan@subsection M32C Options
9763169689Skan@cindex M32C options
976490075Sobrien
976590075Sobrien@table @gcctabopt
9766169689Skan@item -mcpu=@var{name}
9767169689Skan@opindex mcpu=
9768169689SkanSelect the CPU for which code is generated.  @var{name} may be one of
9769169689Skan@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
9770169689Skan/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
9771169689Skanthe M32C/80 series.
977290075Sobrien
9773169689Skan@item -msim
9774169689Skan@opindex msim
9775169689SkanSpecifies that the program will be run on the simulator.  This causes
9776169689Skanan alternate runtime library to be linked in which supports, for
9777169689Skanexample, file I/O.  You must not use this option when generating
9778169689Skanprograms that will run on real hardware; you must provide your own
9779169689Skanruntime library for whatever I/O functions are needed.
978090075Sobrien
9781169689Skan@item -memregs=@var{number}
9782169689Skan@opindex memregs=
9783169689SkanSpecifies the number of memory-based pseudo-registers GCC will use
9784169689Skanduring code generation.  These pseudo-registers will be used like real
9785169689Skanregisters, so there is a tradeoff between GCC's ability to fit the
9786169689Skancode into available registers, and the performance penalty of using
9787169689Skanmemory instead of registers.  Note that all modules in a program must
9788169689Skanbe compiled with the same value for this option.  Because of that, you
9789169689Skanmust not use this option with the default runtime libraries gcc
9790169689Skanbuilds.
979190075Sobrien
979290075Sobrien@end table
979390075Sobrien
9794169689Skan@node M32R/D Options
9795169689Skan@subsection M32R/D Options
9796169689Skan@cindex M32R/D options
979790075Sobrien
9798169689SkanThese @option{-m} options are defined for Renesas M32R/D architectures:
979990075Sobrien
980090075Sobrien@table @gcctabopt
9801169689Skan@item -m32r2
9802169689Skan@opindex m32r2
9803169689SkanGenerate code for the M32R/2@.
980490075Sobrien
9805169689Skan@item -m32rx
9806169689Skan@opindex m32rx
9807169689SkanGenerate code for the M32R/X@.
980890075Sobrien
9809169689Skan@item -m32r
9810169689Skan@opindex m32r
9811169689SkanGenerate code for the M32R@.  This is the default.
9812132718Skan
9813169689Skan@item -mmodel=small
9814169689Skan@opindex mmodel=small
9815169689SkanAssume all objects live in the lower 16MB of memory (so that their addresses
9816169689Skancan be loaded with the @code{ld24} instruction), and assume all subroutines
9817169689Skanare reachable with the @code{bl} instruction.
9818169689SkanThis is the default.
981990075Sobrien
9820169689SkanThe addressability of a particular object can be set with the
9821169689Skan@code{model} attribute.
982290075Sobrien
9823169689Skan@item -mmodel=medium
9824169689Skan@opindex mmodel=medium
9825169689SkanAssume objects may be anywhere in the 32-bit address space (the compiler
9826169689Skanwill generate @code{seth/add3} instructions to load their addresses), and
9827169689Skanassume all subroutines are reachable with the @code{bl} instruction.
982890075Sobrien
9829169689Skan@item -mmodel=large
9830169689Skan@opindex mmodel=large
9831169689SkanAssume objects may be anywhere in the 32-bit address space (the compiler
9832169689Skanwill generate @code{seth/add3} instructions to load their addresses), and
9833169689Skanassume subroutines may not be reachable with the @code{bl} instruction
9834169689Skan(the compiler will generate the much slower @code{seth/add3/jl}
9835169689Skaninstruction sequence).
983690075Sobrien
9837169689Skan@item -msdata=none
9838169689Skan@opindex msdata=none
9839169689SkanDisable use of the small data area.  Variables will be put into
9840169689Skanone of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
9841169689Skan@code{section} attribute has been specified).
9842169689SkanThis is the default.
984390075Sobrien
9844169689SkanThe small data area consists of sections @samp{.sdata} and @samp{.sbss}.
9845169689SkanObjects may be explicitly put in the small data area with the
9846169689Skan@code{section} attribute using one of these sections.
984790075Sobrien
9848169689Skan@item -msdata=sdata
9849169689Skan@opindex msdata=sdata
9850169689SkanPut small global and static data in the small data area, but do not
9851169689Skangenerate special code to reference them.
985290075Sobrien
9853169689Skan@item -msdata=use
9854169689Skan@opindex msdata=use
9855169689SkanPut small global and static data in the small data area, and generate
9856169689Skanspecial instructions to reference them.
985790075Sobrien
9858169689Skan@item -G @var{num}
985990075Sobrien@opindex G
9860169689Skan@cindex smaller data references
9861169689SkanPut global and static objects less than or equal to @var{num} bytes
9862169689Skaninto the small data or bss sections instead of the normal data or bss
9863169689Skansections.  The default value of @var{num} is 8.
9864169689SkanThe @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
9865169689Skanfor this option to have any effect.
986690075Sobrien
9867169689SkanAll modules should be compiled with the same @option{-G @var{num}} value.
9868169689SkanCompiling with different values of @var{num} may or may not work; if it
9869169689Skandoesn't the linker will give an error message---incorrect code will not be
9870169689Skangenerated.
987190075Sobrien
9872169689Skan@item -mdebug
9873169689Skan@opindex mdebug
9874169689SkanMakes the M32R specific code in the compiler display some statistics
9875169689Skanthat might help in debugging programs.
987690075Sobrien
9877169689Skan@item -malign-loops
9878169689Skan@opindex malign-loops
9879169689SkanAlign all loops to a 32-byte boundary.
988090075Sobrien
9881169689Skan@item -mno-align-loops
9882169689Skan@opindex mno-align-loops
9883169689SkanDo not enforce a 32-byte alignment for loops.  This is the default.
988490075Sobrien
9885169689Skan@item -missue-rate=@var{number}
9886169689Skan@opindex missue-rate=@var{number}
9887169689SkanIssue @var{number} instructions per cycle.  @var{number} can only be 1
9888169689Skanor 2.
988990075Sobrien
9890169689Skan@item -mbranch-cost=@var{number}
9891169689Skan@opindex mbranch-cost=@var{number}
9892169689Skan@var{number} can only be 1 or 2.  If it is 1 then branches will be
9893169689Skanpreferred over conditional code, if it is 2, then the opposite will
9894169689Skanapply.
989590075Sobrien
9896169689Skan@item -mflush-trap=@var{number}
9897169689Skan@opindex mflush-trap=@var{number}
9898169689SkanSpecifies the trap number to use to flush the cache.  The default is
9899169689Skan12.  Valid numbers are between 0 and 15 inclusive.
990090075Sobrien
9901169689Skan@item -mno-flush-trap
9902169689Skan@opindex mno-flush-trap
9903169689SkanSpecifies that the cache cannot be flushed by using a trap.
990490075Sobrien
9905169689Skan@item -mflush-func=@var{name}
9906169689Skan@opindex mflush-func=@var{name}
9907169689SkanSpecifies the name of the operating system function to call to flush
9908169689Skanthe cache.  The default is @emph{_flush_cache}, but a function call
9909169689Skanwill only be used if a trap is not available.
991090075Sobrien
9911169689Skan@item -mno-flush-func
9912169689Skan@opindex mno-flush-func
9913169689SkanIndicates that there is no OS function for flushing the cache.
991490075Sobrien
991590075Sobrien@end table
991690075Sobrien
9917169689Skan@node M680x0 Options
9918169689Skan@subsection M680x0 Options
9919169689Skan@cindex M680x0 options
992090075Sobrien
9921169689SkanThese are the @samp{-m} options defined for the 68000 series.  The default
9922169689Skanvalues for these options depends on which style of 68000 was selected when
9923169689Skanthe compiler was configured; the defaults for the most common choices are
9924169689Skangiven below.
992590075Sobrien
992690075Sobrien@table @gcctabopt
9927169689Skan@item -m68000
9928169689Skan@itemx -mc68000
9929169689Skan@opindex m68000
9930169689Skan@opindex mc68000
9931169689SkanGenerate output for a 68000.  This is the default
9932169689Skanwhen the compiler is configured for 68000-based systems.
993390075Sobrien
9934169689SkanUse this option for microcontrollers with a 68000 or EC000 core,
9935169689Skanincluding the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
993690075Sobrien
9937169689Skan@item -m68020
9938169689Skan@itemx -mc68020
9939169689Skan@opindex m68020
9940169689Skan@opindex mc68020
9941169689SkanGenerate output for a 68020.  This is the default
9942169689Skanwhen the compiler is configured for 68020-based systems.
994390075Sobrien
9944169689Skan@item -m68881
9945169689Skan@opindex m68881
9946169689SkanGenerate output containing 68881 instructions for floating point.
9947169689SkanThis is the default for most 68020 systems unless @option{--nfp} was
9948169689Skanspecified when the compiler was configured.
994990075Sobrien
9950169689Skan@item -m68030
9951169689Skan@opindex m68030
9952169689SkanGenerate output for a 68030.  This is the default when the compiler is
9953169689Skanconfigured for 68030-based systems.
995490075Sobrien
9955169689Skan@item -m68040
9956169689Skan@opindex m68040
9957169689SkanGenerate output for a 68040.  This is the default when the compiler is
9958169689Skanconfigured for 68040-based systems.
995990075Sobrien
9960169689SkanThis option inhibits the use of 68881/68882 instructions that have to be
9961169689Skanemulated by software on the 68040.  Use this option if your 68040 does not
9962169689Skanhave code to emulate those instructions.
996390075Sobrien
9964169689Skan@item -m68060
9965169689Skan@opindex m68060
9966169689SkanGenerate output for a 68060.  This is the default when the compiler is
9967169689Skanconfigured for 68060-based systems.
996890075Sobrien
9969169689SkanThis option inhibits the use of 68020 and 68881/68882 instructions that
9970169689Skanhave to be emulated by software on the 68060.  Use this option if your 68060
9971169689Skandoes not have code to emulate those instructions.
9972117395Skan
9973169689Skan@item -mcpu32
9974169689Skan@opindex mcpu32
9975169689SkanGenerate output for a CPU32.  This is the default
9976169689Skanwhen the compiler is configured for CPU32-based systems.
9977117395Skan
9978169689SkanUse this option for microcontrollers with a
9979169689SkanCPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
9980169689Skan68336, 68340, 68341, 68349 and 68360.
9981132718Skan
9982169689Skan@item -m5200
9983169689Skan@opindex m5200
9984169689SkanGenerate output for a 520X ``coldfire'' family cpu.  This is the default
9985169689Skanwhen the compiler is configured for 520X-based systems.
9986132718Skan
9987169689SkanUse this option for microcontroller with a 5200 core, including
9988169689Skanthe MCF5202, MCF5203, MCF5204 and MCF5202.
9989117395Skan
9990169689Skan@item -mcfv4e
9991169689Skan@opindex mcfv4e
9992169689SkanGenerate output for a ColdFire V4e family cpu (e.g.@: 547x/548x).
9993169689SkanThis includes use of hardware floating point instructions.
9994117395Skan
9995169689Skan@item -m68020-40
9996169689Skan@opindex m68020-40
9997169689SkanGenerate output for a 68040, without using any of the new instructions.
9998169689SkanThis results in code which can run relatively efficiently on either a
9999169689Skan68020/68881 or a 68030 or a 68040.  The generated code does use the
10000169689Skan68881 instructions that are emulated on the 68040.
10001117395Skan
10002169689Skan@item -m68020-60
10003169689Skan@opindex m68020-60
10004169689SkanGenerate output for a 68060, without using any of the new instructions.
10005169689SkanThis results in code which can run relatively efficiently on either a
10006169689Skan68020/68881 or a 68030 or a 68040.  The generated code does use the
10007169689Skan68881 instructions that are emulated on the 68060.
10008117395Skan
1000990075Sobrien@item -msoft-float
1001090075Sobrien@opindex msoft-float
1001190075SobrienGenerate output containing library calls for floating point.
10012169689Skan@strong{Warning:} the requisite libraries are not available for all m68k
10013169689Skantargets.  Normally the facilities of the machine's usual C compiler are
10014169689Skanused, but this can't be done directly in cross-compilation.  You must
10015169689Skanmake your own arrangements to provide suitable library functions for
10016169689Skancross-compilation.  The embedded targets @samp{m68k-*-aout} and
10017169689Skan@samp{m68k-*-coff} do provide software floating point support.
1001890075Sobrien
10019169689Skan@item -mshort
10020169689Skan@opindex mshort
10021169689SkanConsider type @code{int} to be 16 bits wide, like @code{short int}.
10022169689SkanAdditionally, parameters passed on the stack are also aligned to a
10023169689Skan16-bit boundary even on targets whose API mandates promotion to 32-bit.
10024117395Skan
1002590075Sobrien@item -mnobitfield
1002690075Sobrien@opindex mnobitfield
10027169689SkanDo not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
10028169689Skanand @option{-m5200} options imply @w{@option{-mnobitfield}}.
1002990075Sobrien
1003090075Sobrien@item -mbitfield
1003190075Sobrien@opindex mbitfield
10032169689SkanDo use the bit-field instructions.  The @option{-m68020} option implies
10033169689Skan@option{-mbitfield}.  This is the default if you use a configuration
10034169689Skandesigned for a 68020.
1003590075Sobrien
1003690075Sobrien@item -mrtd
1003790075Sobrien@opindex mrtd
1003890075SobrienUse a different function-calling convention, in which functions
10039169689Skanthat take a fixed number of arguments return with the @code{rtd}
10040169689Skaninstruction, which pops their arguments while returning.  This
10041169689Skansaves one instruction in the caller since there is no need to pop
10042169689Skanthe arguments there.
1004390075Sobrien
1004490075SobrienThis calling convention is incompatible with the one normally
1004590075Sobrienused on Unix, so you cannot use it if you need to call libraries
1004690075Sobriencompiled with the Unix compiler.
1004790075Sobrien
1004890075SobrienAlso, you must provide function prototypes for all functions that
1004990075Sobrientake variable numbers of arguments (including @code{printf});
1005090075Sobrienotherwise incorrect code will be generated for calls to those
1005190075Sobrienfunctions.
1005290075Sobrien
1005390075SobrienIn addition, seriously incorrect code will result if you call a
1005490075Sobrienfunction with too many arguments.  (Normally, extra arguments are
1005590075Sobrienharmlessly ignored.)
1005690075Sobrien
10057169689SkanThe @code{rtd} instruction is supported by the 68010, 68020, 68030,
10058169689Skan68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
1005990075Sobrien
10060169689Skan@item -malign-int
10061169689Skan@itemx -mno-align-int
10062169689Skan@opindex malign-int
10063169689Skan@opindex mno-align-int
10064169689SkanControl whether GCC aligns @code{int}, @code{long}, @code{long long},
10065169689Skan@code{float}, @code{double}, and @code{long double} variables on a 32-bit
10066169689Skanboundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
10067169689SkanAligning variables on 32-bit boundaries produces code that runs somewhat
10068169689Skanfaster on processors with 32-bit busses at the expense of more memory.
1006990075Sobrien
10070169689Skan@strong{Warning:} if you use the @option{-malign-int} switch, GCC will
10071169689Skanalign structures containing the above types  differently than
10072169689Skanmost published application binary interface specifications for the m68k.
1007390075Sobrien
10074169689Skan@item -mpcrel
10075169689Skan@opindex mpcrel
10076169689SkanUse the pc-relative addressing mode of the 68000 directly, instead of
10077169689Skanusing a global offset table.  At present, this option implies @option{-fpic},
10078169689Skanallowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
10079169689Skannot presently supported with @option{-mpcrel}, though this could be supported for
10080169689Skan68020 and higher processors.
1008190075Sobrien
10082169689Skan@item -mno-strict-align
10083169689Skan@itemx -mstrict-align
10084169689Skan@opindex mno-strict-align
10085169689Skan@opindex mstrict-align
10086169689SkanDo not (do) assume that unaligned memory references will be handled by
10087169689Skanthe system.
1008890075Sobrien
10089169689Skan@item -msep-data
10090169689SkanGenerate code that allows the data segment to be located in a different
10091169689Skanarea of memory from the text segment.  This allows for execute in place in
10092169689Skanan environment without virtual memory management.  This option implies
10093169689Skan@option{-fPIC}.
1009490075Sobrien
10095169689Skan@item -mno-sep-data
10096169689SkanGenerate code that assumes that the data segment follows the text segment.
10097169689SkanThis is the default.
1009890075Sobrien
10099169689Skan@item -mid-shared-library
10100169689SkanGenerate code that supports shared libraries via the library ID method.
10101169689SkanThis allows for execute in place and shared libraries in an environment
10102169689Skanwithout virtual memory management.  This option implies @option{-fPIC}.
1010390075Sobrien
10104169689Skan@item -mno-id-shared-library
10105169689SkanGenerate code that doesn't assume ID based shared libraries are being used.
10106169689SkanThis is the default.
1010790075Sobrien
10108169689Skan@item -mshared-library-id=n
10109169689SkanSpecified the identification number of the ID based shared library being
10110169689Skancompiled.  Specifying a value of 0 will generate more compact code, specifying
10111169689Skanother values will force the allocation of that number to the current
10112169689Skanlibrary but is no more space or time efficient than omitting this option.
1011390075Sobrien
1011490075Sobrien@end table
1011590075Sobrien
10116169689Skan@node M68hc1x Options
10117169689Skan@subsection M68hc1x Options
10118169689Skan@cindex M68hc1x options
1011990075Sobrien
10120169689SkanThese are the @samp{-m} options defined for the 68hc11 and 68hc12
10121169689Skanmicrocontrollers.  The default values for these options depends on
10122169689Skanwhich style of microcontroller was selected when the compiler was configured;
10123169689Skanthe defaults for the most common choices are given below.
1012490075Sobrien
1012590075Sobrien@table @gcctabopt
10126169689Skan@item -m6811
10127169689Skan@itemx -m68hc11
10128169689Skan@opindex m6811
10129169689Skan@opindex m68hc11
10130169689SkanGenerate output for a 68HC11.  This is the default
10131169689Skanwhen the compiler is configured for 68HC11-based systems.
1013290075Sobrien
10133169689Skan@item -m6812
10134169689Skan@itemx -m68hc12
10135169689Skan@opindex m6812
10136169689Skan@opindex m68hc12
10137169689SkanGenerate output for a 68HC12.  This is the default
10138169689Skanwhen the compiler is configured for 68HC12-based systems.
1013990075Sobrien
10140169689Skan@item -m68S12
10141169689Skan@itemx -m68hcs12
10142169689Skan@opindex m68S12
10143169689Skan@opindex m68hcs12
10144169689SkanGenerate output for a 68HCS12.
1014590075Sobrien
10146169689Skan@item -mauto-incdec
10147169689Skan@opindex mauto-incdec
10148169689SkanEnable the use of 68HC12 pre and post auto-increment and auto-decrement
10149169689Skanaddressing modes.
1015090075Sobrien
10151169689Skan@item -minmax
10152169689Skan@itemx -nominmax
10153169689Skan@opindex minmax
10154169689Skan@opindex mnominmax
10155169689SkanEnable the use of 68HC12 min and max instructions.
1015690075Sobrien
10157169689Skan@item -mlong-calls
10158169689Skan@itemx -mno-long-calls
10159169689Skan@opindex mlong-calls
10160169689Skan@opindex mno-long-calls
10161169689SkanTreat all calls as being far away (near).  If calls are assumed to be
10162169689Skanfar away, the compiler will use the @code{call} instruction to
10163169689Skancall a function and the @code{rtc} instruction for returning.
1016490075Sobrien
10165169689Skan@item -mshort
10166169689Skan@opindex mshort
10167169689SkanConsider type @code{int} to be 16 bits wide, like @code{short int}.
1016890075Sobrien
10169169689Skan@item -msoft-reg-count=@var{count}
10170169689Skan@opindex msoft-reg-count
10171169689SkanSpecify the number of pseudo-soft registers which are used for the
10172169689Skancode generation.  The maximum number is 32.  Using more pseudo-soft
10173169689Skanregister may or may not result in better code depending on the program.
10174169689SkanThe default is 4 for 68HC11 and 2 for 68HC12.
1017590075Sobrien
1017690075Sobrien@end table
1017790075Sobrien
1017890075Sobrien@node MCore Options
1017990075Sobrien@subsection MCore Options
1018090075Sobrien@cindex MCore options
1018190075Sobrien
1018290075SobrienThese are the @samp{-m} options defined for the Motorola M*Core
1018390075Sobrienprocessors.
1018490075Sobrien
1018590075Sobrien@table @gcctabopt
1018690075Sobrien
1018790075Sobrien@item -mhardlit
1018890075Sobrien@itemx -mno-hardlit
1018990075Sobrien@opindex mhardlit
1019090075Sobrien@opindex mno-hardlit
1019190075SobrienInline constants into the code stream if it can be done in two
1019290075Sobrieninstructions or less.
1019390075Sobrien
1019490075Sobrien@item -mdiv
1019590075Sobrien@itemx -mno-div
1019690075Sobrien@opindex mdiv
1019790075Sobrien@opindex mno-div
1019890075SobrienUse the divide instruction.  (Enabled by default).
1019990075Sobrien
1020090075Sobrien@item -mrelax-immediate
1020190075Sobrien@itemx -mno-relax-immediate
1020290075Sobrien@opindex mrelax-immediate
1020390075Sobrien@opindex mno-relax-immediate
1020490075SobrienAllow arbitrary sized immediates in bit operations.
1020590075Sobrien
1020690075Sobrien@item -mwide-bitfields
1020790075Sobrien@itemx -mno-wide-bitfields
1020890075Sobrien@opindex mwide-bitfields
1020990075Sobrien@opindex mno-wide-bitfields
1021090075SobrienAlways treat bit-fields as int-sized.
1021190075Sobrien
1021290075Sobrien@item -m4byte-functions
1021390075Sobrien@itemx -mno-4byte-functions
1021490075Sobrien@opindex m4byte-functions
1021590075Sobrien@opindex mno-4byte-functions
1021690075SobrienForce all functions to be aligned to a four byte boundary.
1021790075Sobrien
1021890075Sobrien@item -mcallgraph-data
1021990075Sobrien@itemx -mno-callgraph-data
1022090075Sobrien@opindex mcallgraph-data
1022190075Sobrien@opindex mno-callgraph-data
1022290075SobrienEmit callgraph information.
1022390075Sobrien
1022490075Sobrien@item -mslow-bytes
1022590075Sobrien@itemx -mno-slow-bytes
1022690075Sobrien@opindex mslow-bytes
1022790075Sobrien@opindex mno-slow-bytes
1022890075SobrienPrefer word access when reading byte quantities.
1022990075Sobrien
1023090075Sobrien@item -mlittle-endian
1023190075Sobrien@itemx -mbig-endian
1023290075Sobrien@opindex mlittle-endian
1023390075Sobrien@opindex mbig-endian
1023490075SobrienGenerate code for a little endian target.
1023590075Sobrien
1023690075Sobrien@item -m210
1023790075Sobrien@itemx -m340
1023890075Sobrien@opindex m210
1023990075Sobrien@opindex m340
1024090075SobrienGenerate code for the 210 processor.
1024190075Sobrien@end table
1024290075Sobrien
10243169689Skan@node MIPS Options
10244169689Skan@subsection MIPS Options
10245169689Skan@cindex MIPS options
1024690075Sobrien
1024790075Sobrien@table @gcctabopt
1024890075Sobrien
10249169689Skan@item -EB
10250169689Skan@opindex EB
10251169689SkanGenerate big-endian code.
1025290075Sobrien
10253169689Skan@item -EL
10254169689Skan@opindex EL
10255169689SkanGenerate little-endian code.  This is the default for @samp{mips*el-*-*}
10256169689Skanconfigurations.
1025790075Sobrien
10258169689Skan@item -march=@var{arch}
10259169689Skan@opindex march
10260169689SkanGenerate code that will run on @var{arch}, which can be the name of a
10261169689Skangeneric MIPS ISA, or the name of a particular processor.
10262169689SkanThe ISA names are:
10263169689Skan@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
10264169689Skan@samp{mips32}, @samp{mips32r2}, and @samp{mips64}.
10265169689SkanThe processor names are:
10266169689Skan@samp{4kc}, @samp{4km}, @samp{4kp},
10267169689Skan@samp{5kc}, @samp{5kf},
10268169689Skan@samp{20kc},
10269169689Skan@samp{24k}, @samp{24kc}, @samp{24kf}, @samp{24kx},
10270169689Skan@samp{m4k},
10271169689Skan@samp{orion},
10272169689Skan@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
10273169689Skan@samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000},
10274169689Skan@samp{rm7000}, @samp{rm9000},
10275169689Skan@samp{sb1},
10276169689Skan@samp{sr71000},
10277169689Skan@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
10278169689Skan@samp{vr5000}, @samp{vr5400} and @samp{vr5500}.
10279169689SkanThe special value @samp{from-abi} selects the
10280169689Skanmost compatible architecture for the selected ABI (that is,
10281169689Skan@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
1028290075Sobrien
10283169689SkanIn processor names, a final @samp{000} can be abbreviated as @samp{k}
10284169689Skan(for example, @samp{-march=r2k}).  Prefixes are optional, and
10285169689Skan@samp{vr} may be written @samp{r}.
1028690075Sobrien
10287169689SkanGCC defines two macros based on the value of this option.  The first
10288169689Skanis @samp{_MIPS_ARCH}, which gives the name of target architecture, as
10289169689Skana string.  The second has the form @samp{_MIPS_ARCH_@var{foo}},
10290169689Skanwhere @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
10291169689SkanFor example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
10292169689Skanto @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
1029390075Sobrien
10294169689SkanNote that the @samp{_MIPS_ARCH} macro uses the processor names given
10295169689Skanabove.  In other words, it will have the full prefix and will not
10296169689Skanabbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
10297169689Skanthe macro names the resolved architecture (either @samp{"mips1"} or
10298169689Skan@samp{"mips3"}).  It names the default architecture when no
10299169689Skan@option{-march} option is given.
1030090075Sobrien
10301169689Skan@item -mtune=@var{arch}
10302169689Skan@opindex mtune
10303169689SkanOptimize for @var{arch}.  Among other things, this option controls
10304169689Skanthe way instructions are scheduled, and the perceived cost of arithmetic
10305169689Skanoperations.  The list of @var{arch} values is the same as for
10306169689Skan@option{-march}.
1030790075Sobrien
10308169689SkanWhen this option is not used, GCC will optimize for the processor
10309169689Skanspecified by @option{-march}.  By using @option{-march} and
10310169689Skan@option{-mtune} together, it is possible to generate code that will
10311169689Skanrun on a family of processors, but optimize the code for one
10312169689Skanparticular member of that family.
1031390075Sobrien
10314169689Skan@samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
10315169689Skan@samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
10316169689Skan@samp{-march} ones described above.
1031790075Sobrien
10318169689Skan@item -mips1
10319169689Skan@opindex mips1
10320169689SkanEquivalent to @samp{-march=mips1}.
1032190075Sobrien
10322169689Skan@item -mips2
10323169689Skan@opindex mips2
10324169689SkanEquivalent to @samp{-march=mips2}.
1032590075Sobrien
10326169689Skan@item -mips3
10327169689Skan@opindex mips3
10328169689SkanEquivalent to @samp{-march=mips3}.
1032990075Sobrien
10330169689Skan@item -mips4
10331169689Skan@opindex mips4
10332169689SkanEquivalent to @samp{-march=mips4}.
10333117395Skan
10334169689Skan@item -mips32
10335169689Skan@opindex mips32
10336169689SkanEquivalent to @samp{-march=mips32}.
10337117395Skan
10338169689Skan@item -mips32r2
10339169689Skan@opindex mips32r2
10340169689SkanEquivalent to @samp{-march=mips32r2}.
10341146895Skan
10342169689Skan@item -mips64
10343169689Skan@opindex mips64
10344169689SkanEquivalent to @samp{-march=mips64}.
10345146895Skan
10346169689Skan@item -mips16
10347169689Skan@itemx -mno-mips16
10348169689Skan@opindex mips16
10349169689Skan@opindex mno-mips16
10350169689SkanGenerate (do not generate) MIPS16 code.  If GCC is targetting a
10351169689SkanMIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE@.
1035290075Sobrien
10353169689Skan@item -mabi=32
10354169689Skan@itemx -mabi=o64
10355169689Skan@itemx -mabi=n32
10356169689Skan@itemx -mabi=64
10357169689Skan@itemx -mabi=eabi
10358169689Skan@opindex mabi=32
10359169689Skan@opindex mabi=o64
10360169689Skan@opindex mabi=n32
10361169689Skan@opindex mabi=64
10362169689Skan@opindex mabi=eabi
10363169689SkanGenerate code for the given ABI@.
10364146895Skan
10365169689SkanNote that the EABI has a 32-bit and a 64-bit variant.  GCC normally
10366169689Skangenerates 64-bit code when you select a 64-bit architecture, but you
10367169689Skancan use @option{-mgp32} to get 32-bit code instead.
10368132718Skan
10369169689SkanFor information about the O64 ABI, see
10370169689Skan@w{@uref{http://gcc.gnu.org/projects/mipso64-abi.html}}.
10371146895Skan
10372169689Skan@item -mabicalls
10373169689Skan@itemx -mno-abicalls
10374169689Skan@opindex mabicalls
10375169689Skan@opindex mno-abicalls
10376169689SkanGenerate (do not generate) code that is suitable for SVR4-style
10377169689Skandynamic objects.  @option{-mabicalls} is the default for SVR4-based
10378169689Skansystems.
10379146895Skan
10380169689Skan@item -mshared
10381169689Skan@itemx -mno-shared
10382169689SkanGenerate (do not generate) code that is fully position-independent,
10383169689Skanand that can therefore be linked into shared libraries.  This option
10384169689Skanonly affects @option{-mabicalls}.
10385146895Skan
10386169689SkanAll @option{-mabicalls} code has traditionally been position-independent,
10387169689Skanregardless of options like @option{-fPIC} and @option{-fpic}.  However,
10388169689Skanas an extension, the GNU toolchain allows executables to use absolute
10389169689Skanaccesses for locally-binding symbols.  It can also use shorter GP
10390169689Skaninitialization sequences and generate direct calls to locally-defined
10391169689Skanfunctions.  This mode is selected by @option{-mno-shared}.
10392146895Skan
10393169689Skan@option{-mno-shared} depends on binutils 2.16 or higher and generates
10394169689Skanobjects that can only be linked by the GNU linker.  However, the option
10395169689Skandoes not affect the ABI of the final executable; it only affects the ABI
10396169689Skanof relocatable objects.  Using @option{-mno-shared} will generally make
10397169689Skanexecutables both smaller and quicker.
1039890075Sobrien
10399169689Skan@option{-mshared} is the default.
1040090075Sobrien
10401169689Skan@item -mxgot
10402169689Skan@itemx -mno-xgot
10403169689Skan@opindex mxgot
10404169689Skan@opindex mno-xgot
10405169689SkanLift (do not lift) the usual restrictions on the size of the global
10406169689Skanoffset table.
1040790075Sobrien
10408169689SkanGCC normally uses a single instruction to load values from the GOT@.
10409169689SkanWhile this is relatively efficient, it will only work if the GOT
10410169689Skanis smaller than about 64k.  Anything larger will cause the linker
10411169689Skanto report an error such as:
1041290075Sobrien
10413169689Skan@cindex relocation truncated to fit (MIPS)
10414169689Skan@smallexample
10415169689Skanrelocation truncated to fit: R_MIPS_GOT16 foobar
10416169689Skan@end smallexample
1041790075Sobrien
10418169689SkanIf this happens, you should recompile your code with @option{-mxgot}.
10419169689SkanIt should then work with very large GOTs, although it will also be
10420169689Skanless efficient, since it will take three instructions to fetch the
10421169689Skanvalue of a global symbol.
1042290075Sobrien
10423169689SkanNote that some linkers can create multiple GOTs.  If you have such a
10424169689Skanlinker, you should only need to use @option{-mxgot} when a single object
10425169689Skanfile accesses more than 64k's worth of GOT entries.  Very few do.
1042690075Sobrien
10427169689SkanThese options have no effect unless GCC is generating position
10428169689Skanindependent code.
1042990075Sobrien
10430169689Skan@item -mgp32
10431169689Skan@opindex mgp32
10432169689SkanAssume that general-purpose registers are 32 bits wide.
1043390075Sobrien
10434169689Skan@item -mgp64
10435169689Skan@opindex mgp64
10436169689SkanAssume that general-purpose registers are 64 bits wide.
1043790075Sobrien
10438169689Skan@item -mfp32
10439169689Skan@opindex mfp32
10440169689SkanAssume that floating-point registers are 32 bits wide.
1044190075Sobrien
10442169689Skan@item -mfp64
10443169689Skan@opindex mfp64
10444169689SkanAssume that floating-point registers are 64 bits wide.
10445169689Skan
1044690075Sobrien@item -mhard-float
1044790075Sobrien@opindex mhard-float
10448169689SkanUse floating-point coprocessor instructions.
10449169689Skan
10450169689Skan@item -msoft-float
1045190075Sobrien@opindex msoft-float
10452169689SkanDo not use floating-point coprocessor instructions.  Implement
10453169689Skanfloating-point calculations using library calls instead.
1045490075Sobrien
10455169689Skan@item -msingle-float
10456169689Skan@opindex msingle-float
10457169689SkanAssume that the floating-point coprocessor only supports single-precision
10458169689Skanoperations.
1045990075Sobrien
10460169689Skan@itemx -mdouble-float
10461169689Skan@opindex mdouble-float
10462169689SkanAssume that the floating-point coprocessor supports double-precision
10463169689Skanoperations.  This is the default.
1046490075Sobrien
10465169689Skan@itemx -mdsp
10466169689Skan@itemx -mno-dsp
10467169689Skan@opindex mdsp
10468169689Skan@opindex mno-dsp
10469169689SkanUse (do not use) the MIPS DSP ASE.  @xref{MIPS DSP Built-in Functions}.
1047090075Sobrien
10471169689Skan@itemx -mpaired-single
10472169689Skan@itemx -mno-paired-single
10473169689Skan@opindex mpaired-single
10474169689Skan@opindex mno-paired-single
10475169689SkanUse (do not use) paired-single floating-point instructions.
10476169689Skan@xref{MIPS Paired-Single Support}.  This option can only be used
10477169689Skanwhen generating 64-bit code and requires hardware floating-point
10478169689Skansupport to be enabled.
10479132718Skan
10480169689Skan@itemx -mips3d
10481169689Skan@itemx -mno-mips3d
10482169689Skan@opindex mips3d
10483169689Skan@opindex mno-mips3d
10484169689SkanUse (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
10485169689SkanThe option @option{-mips3d} implies @option{-mpaired-single}.
1048690075Sobrien
10487169689Skan@item -mlong64
10488169689Skan@opindex mlong64
10489169689SkanForce @code{long} types to be 64 bits wide.  See @option{-mlong32} for
10490169689Skanan explanation of the default and the way that the pointer size is
10491169689Skandetermined.
1049290075Sobrien
10493169689Skan@item -mlong32
10494169689Skan@opindex mlong32
10495169689SkanForce @code{long}, @code{int}, and pointer types to be 32 bits wide.
10496132718Skan
10497169689SkanThe default size of @code{int}s, @code{long}s and pointers depends on
10498169689Skanthe ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
10499169689Skanuses 64-bit @code{long}s, as does the 64-bit EABI; the others use
10500169689Skan32-bit @code{long}s.  Pointers are the same size as @code{long}s,
10501169689Skanor the same size as integer registers, whichever is smaller.
10502132718Skan
10503169689Skan@item -msym32
10504169689Skan@itemx -mno-sym32
10505169689Skan@opindex msym32
10506169689Skan@opindex mno-sym32
10507169689SkanAssume (do not assume) that all symbols have 32-bit values, regardless
10508169689Skanof the selected ABI@.  This option is useful in combination with
10509169689Skan@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
10510169689Skanto generate shorter and faster references to symbolic addresses.
1051190075Sobrien
10512169689Skan@item -G @var{num}
10513169689Skan@opindex G
10514169689Skan@cindex smaller data references (MIPS)
10515169689Skan@cindex gp-relative references (MIPS)
10516169689SkanPut global and static items less than or equal to @var{num} bytes into
10517169689Skanthe small data or bss section instead of the normal data or bss section.
10518169689SkanThis allows the data to be accessed using a single instruction.
1051990075Sobrien
10520169689SkanAll modules should be compiled with the same @option{-G @var{num}}
10521169689Skanvalue.
1052290075Sobrien
10523169689Skan@item -membedded-data
10524169689Skan@itemx -mno-embedded-data
10525169689Skan@opindex membedded-data
10526169689Skan@opindex mno-embedded-data
10527169689SkanAllocate variables to the read-only data section first if possible, then
10528169689Skannext in the small data section if possible, otherwise in data.  This gives
10529169689Skanslightly slower code than the default, but reduces the amount of RAM required
10530169689Skanwhen executing, and thus may be preferred for some embedded systems.
1053190075Sobrien
10532169689Skan@item -muninit-const-in-rodata
10533169689Skan@itemx -mno-uninit-const-in-rodata
10534169689Skan@opindex muninit-const-in-rodata
10535169689Skan@opindex mno-uninit-const-in-rodata
10536169689SkanPut uninitialized @code{const} variables in the read-only data section.
10537169689SkanThis option is only meaningful in conjunction with @option{-membedded-data}.
1053890075Sobrien
10539169689Skan@item -msplit-addresses
10540169689Skan@itemx -mno-split-addresses
10541169689Skan@opindex msplit-addresses
10542169689Skan@opindex mno-split-addresses
10543169689SkanEnable (disable) use of the @code{%hi()} and @code{%lo()} assembler
10544169689Skanrelocation operators.  This option has been superseded by
10545169689Skan@option{-mexplicit-relocs} but is retained for backwards compatibility.
1054690075Sobrien
10547169689Skan@item -mexplicit-relocs
10548169689Skan@itemx -mno-explicit-relocs
10549169689Skan@opindex mexplicit-relocs
10550169689Skan@opindex mno-explicit-relocs
10551169689SkanUse (do not use) assembler relocation operators when dealing with symbolic
10552169689Skanaddresses.  The alternative, selected by @option{-mno-explicit-relocs},
10553169689Skanis to use assembler macros instead.
1055490075Sobrien
10555169689Skan@option{-mexplicit-relocs} is the default if GCC was configured
10556169689Skanto use an assembler that supports relocation operators.
1055790075Sobrien
10558169689Skan@item -mcheck-zero-division
10559169689Skan@itemx -mno-check-zero-division
10560169689Skan@opindex mcheck-zero-division
10561169689Skan@opindex mno-check-zero-division
10562169689SkanTrap (do not trap) on integer division by zero.  The default is
10563169689Skan@option{-mcheck-zero-division}.
10564132718Skan
10565169689Skan@item -mdivide-traps
10566169689Skan@itemx -mdivide-breaks
10567169689Skan@opindex mdivide-traps
10568169689Skan@opindex mdivide-breaks
10569169689SkanMIPS systems check for division by zero by generating either a
10570169689Skanconditional trap or a break instruction.  Using traps results in
10571169689Skansmaller code, but is only supported on MIPS II and later.  Also, some
10572169689Skanversions of the Linux kernel have a bug that prevents trap from
10573169689Skangenerating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
10574169689Skanallow conditional traps on architectures that support them and
10575169689Skan@option{-mdivide-breaks} to force the use of breaks.
1057690075Sobrien
10577169689SkanThe default is usually @option{-mdivide-traps}, but this can be
10578169689Skanoverridden at configure time using @option{--with-divide=breaks}.
10579169689SkanDivide-by-zero checks can be completely disabled using
10580169689Skan@option{-mno-check-zero-division}.
1058190075Sobrien
10582169689Skan@item -mmemcpy
10583169689Skan@itemx -mno-memcpy
10584169689Skan@opindex mmemcpy
10585169689Skan@opindex mno-memcpy
10586169689SkanForce (do not force) the use of @code{memcpy()} for non-trivial block
10587169689Skanmoves.  The default is @option{-mno-memcpy}, which allows GCC to inline
10588169689Skanmost constant-sized copies.
1058990075Sobrien
10590169689Skan@item -mlong-calls
10591169689Skan@itemx -mno-long-calls
10592169689Skan@opindex mlong-calls
10593169689Skan@opindex mno-long-calls
10594169689SkanDisable (do not disable) use of the @code{jal} instruction.  Calling
10595169689Skanfunctions using @code{jal} is more efficient but requires the caller
10596169689Skanand callee to be in the same 256 megabyte segment.
1059790075Sobrien
10598169689SkanThis option has no effect on abicalls code.  The default is
10599169689Skan@option{-mno-long-calls}.
1060090075Sobrien
10601169689Skan@item -mmad
10602169689Skan@itemx -mno-mad
10603169689Skan@opindex mmad
10604169689Skan@opindex mno-mad
10605169689SkanEnable (disable) use of the @code{mad}, @code{madu} and @code{mul}
10606169689Skaninstructions, as provided by the R4650 ISA@.
1060790075Sobrien
10608169689Skan@item -mfused-madd
10609169689Skan@itemx -mno-fused-madd
10610169689Skan@opindex mfused-madd
10611169689Skan@opindex mno-fused-madd
10612169689SkanEnable (disable) use of the floating point multiply-accumulate
10613169689Skaninstructions, when they are available.  The default is
10614169689Skan@option{-mfused-madd}.
1061590075Sobrien
10616169689SkanWhen multiply-accumulate instructions are used, the intermediate
10617169689Skanproduct is calculated to infinite precision and is not subject to
10618169689Skanthe FCSR Flush to Zero bit.  This may be undesirable in some
10619169689Skancircumstances.
1062090075Sobrien
10621169689Skan@item -nocpp
10622169689Skan@opindex nocpp
10623169689SkanTell the MIPS assembler to not run its preprocessor over user
10624169689Skanassembler files (with a @samp{.s} suffix) when assembling them.
1062590075Sobrien
10626169689Skan@item -mfix-r4000
10627169689Skan@itemx -mno-fix-r4000
10628169689Skan@opindex mfix-r4000
10629169689Skan@opindex mno-fix-r4000
10630169689SkanWork around certain R4000 CPU errata:
10631169689Skan@itemize @minus
10632169689Skan@item
10633169689SkanA double-word or a variable shift may give an incorrect result if executed
10634169689Skanimmediately after starting an integer division.
10635169689Skan@item
10636169689SkanA double-word or a variable shift may give an incorrect result if executed
10637169689Skanwhile an integer multiplication is in progress.
10638169689Skan@item
10639169689SkanAn integer division may give an incorrect result if started in a delay slot
10640169689Skanof a taken branch or a jump.
10641169689Skan@end itemize
1064290075Sobrien
10643169689Skan@item -mfix-r4400
10644169689Skan@itemx -mno-fix-r4400
10645169689Skan@opindex mfix-r4400
10646169689Skan@opindex mno-fix-r4400
10647169689SkanWork around certain R4400 CPU errata:
10648169689Skan@itemize @minus
10649169689Skan@item
10650169689SkanA double-word or a variable shift may give an incorrect result if executed
10651169689Skanimmediately after starting an integer division.
10652169689Skan@end itemize
1065390075Sobrien
10654169689Skan@item -mfix-vr4120
10655169689Skan@itemx -mno-fix-vr4120
10656169689Skan@opindex mfix-vr4120
10657169689SkanWork around certain VR4120 errata:
10658169689Skan@itemize @minus
10659169689Skan@item
10660169689Skan@code{dmultu} does not always produce the correct result.
10661169689Skan@item
10662169689Skan@code{div} and @code{ddiv} do not always produce the correct result if one
10663169689Skanof the operands is negative.
10664169689Skan@end itemize
10665169689SkanThe workarounds for the division errata rely on special functions in
10666169689Skan@file{libgcc.a}.  At present, these functions are only provided by
10667169689Skanthe @code{mips64vr*-elf} configurations.
1066890075Sobrien
10669169689SkanOther VR4120 errata require a nop to be inserted between certain pairs of
10670169689Skaninstructions.  These errata are handled by the assembler, not by GCC itself.
10671169689Skan
10672169689Skan@item -mfix-vr4130
10673169689Skan@opindex mfix-vr4130
10674169689SkanWork around the VR4130 @code{mflo}/@code{mfhi} errata.  The
10675169689Skanworkarounds are implemented by the assembler rather than by GCC,
10676169689Skanalthough GCC will avoid using @code{mflo} and @code{mfhi} if the
10677169689SkanVR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
10678169689Skaninstructions are available instead.
10679169689Skan
10680169689Skan@item -mfix-sb1
10681169689Skan@itemx -mno-fix-sb1
10682169689Skan@opindex mfix-sb1
10683169689SkanWork around certain SB-1 CPU core errata.
10684169689Skan(This flag currently works around the SB-1 revision 2
10685169689Skan``F1'' and ``F2'' floating point errata.)
10686169689Skan
10687169689Skan@item -mflush-func=@var{func}
10688169689Skan@itemx -mno-flush-func
10689169689Skan@opindex mflush-func
10690169689SkanSpecifies the function to call to flush the I and D caches, or to not
10691169689Skancall any such function.  If called, the function must take the same
10692169689Skanarguments as the common @code{_flush_func()}, that is, the address of the
10693169689Skanmemory range for which the cache is being flushed, the size of the
10694169689Skanmemory range, and the number 3 (to flush both caches).  The default
10695169689Skandepends on the target GCC was configured for, but commonly is either
10696169689Skan@samp{_flush_func} or @samp{__cpu_flush}.
10697169689Skan
10698169689Skan@item -mbranch-likely
10699169689Skan@itemx -mno-branch-likely
10700169689Skan@opindex mbranch-likely
10701169689Skan@opindex mno-branch-likely
10702169689SkanEnable or disable use of Branch Likely instructions, regardless of the
10703169689Skandefault for the selected architecture.  By default, Branch Likely
10704169689Skaninstructions may be generated if they are supported by the selected
10705169689Skanarchitecture.  An exception is for the MIPS32 and MIPS64 architectures
10706169689Skanand processors which implement those architectures; for those, Branch
10707169689SkanLikely instructions will not be generated by default because the MIPS32
10708169689Skanand MIPS64 architectures specifically deprecate their use.
10709169689Skan
10710169689Skan@item -mfp-exceptions
10711169689Skan@itemx -mno-fp-exceptions
10712169689Skan@opindex mfp-exceptions
10713169689SkanSpecifies whether FP exceptions are enabled.  This affects how we schedule
10714169689SkanFP instructions for some processors.  The default is that FP exceptions are
10715169689Skanenabled.
10716169689Skan
10717169689SkanFor instance, on the SB-1, if FP exceptions are disabled, and we are emitting
10718169689Skan64-bit code, then we can use both FP pipes.  Otherwise, we can only use one
10719169689SkanFP pipe.
10720169689Skan
10721169689Skan@item -mvr4130-align
10722169689Skan@itemx -mno-vr4130-align
10723169689Skan@opindex mvr4130-align
10724169689SkanThe VR4130 pipeline is two-way superscalar, but can only issue two
10725169689Skaninstructions together if the first one is 8-byte aligned.  When this
10726169689Skanoption is enabled, GCC will align pairs of instructions that it
10727169689Skanthinks should execute in parallel.
10728169689Skan
10729169689SkanThis option only has an effect when optimizing for the VR4130.
10730169689SkanIt normally makes code faster, but at the expense of making it bigger.
10731169689SkanIt is enabled by default at optimization level @option{-O3}.
1073290075Sobrien@end table
1073390075Sobrien
1073490075Sobrien@node MMIX Options
1073590075Sobrien@subsection MMIX Options
1073690075Sobrien@cindex MMIX Options
1073790075Sobrien
1073890075SobrienThese options are defined for the MMIX:
1073990075Sobrien
1074090075Sobrien@table @gcctabopt
1074190075Sobrien@item -mlibfuncs
1074290075Sobrien@itemx -mno-libfuncs
1074390075Sobrien@opindex mlibfuncs
1074490075Sobrien@opindex mno-libfuncs
1074590075SobrienSpecify that intrinsic library functions are being compiled, passing all
1074690075Sobrienvalues in registers, no matter the size.
1074790075Sobrien
1074890075Sobrien@item -mepsilon
1074990075Sobrien@itemx -mno-epsilon
1075090075Sobrien@opindex mepsilon
1075190075Sobrien@opindex mno-epsilon
1075290075SobrienGenerate floating-point comparison instructions that compare with respect
1075390075Sobriento the @code{rE} epsilon register.
1075490075Sobrien
1075590075Sobrien@item -mabi=mmixware
1075690075Sobrien@itemx -mabi=gnu
1075790075Sobrien@opindex mabi-mmixware
1075890075Sobrien@opindex mabi=gnu
1075990075SobrienGenerate code that passes function parameters and return values that (in
1076090075Sobrienthe called function) are seen as registers @code{$0} and up, as opposed to
1076190075Sobrienthe GNU ABI which uses global registers @code{$231} and up.
1076290075Sobrien
1076390075Sobrien@item -mzero-extend
1076490075Sobrien@itemx -mno-zero-extend
1076590075Sobrien@opindex mzero-extend
1076690075Sobrien@opindex mno-zero-extend
1076790075SobrienWhen reading data from memory in sizes shorter than 64 bits, use (do not
1076890075Sobrienuse) zero-extending load instructions by default, rather than
1076990075Sobriensign-extending ones.
1077090075Sobrien
1077190075Sobrien@item -mknuthdiv
1077290075Sobrien@itemx -mno-knuthdiv
1077390075Sobrien@opindex mknuthdiv
1077490075Sobrien@opindex mno-knuthdiv
1077590075SobrienMake the result of a division yielding a remainder have the same sign as
1077690075Sobrienthe divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
1077790075Sobrienremainder follows the sign of the dividend.  Both methods are
1077890075Sobrienarithmetically valid, the latter being almost exclusively used.
1077990075Sobrien
1078090075Sobrien@item -mtoplevel-symbols
1078190075Sobrien@itemx -mno-toplevel-symbols
1078290075Sobrien@opindex mtoplevel-symbols
1078390075Sobrien@opindex mno-toplevel-symbols
1078490075SobrienPrepend (do not prepend) a @samp{:} to all global symbols, so the assembly
1078590075Sobriencode can be used with the @code{PREFIX} assembly directive.
1078690075Sobrien
1078790075Sobrien@item -melf
1078890075Sobrien@opindex melf
1078990075SobrienGenerate an executable in the ELF format, rather than the default
1079090075Sobrien@samp{mmo} format used by the @command{mmix} simulator.
1079190075Sobrien
1079290075Sobrien@item -mbranch-predict
1079390075Sobrien@itemx -mno-branch-predict
1079490075Sobrien@opindex mbranch-predict
1079590075Sobrien@opindex mno-branch-predict
1079690075SobrienUse (do not use) the probable-branch instructions, when static branch
1079790075Sobrienprediction indicates a probable branch.
1079896263Sobrien
1079996263Sobrien@item -mbase-addresses
1080096263Sobrien@itemx -mno-base-addresses
1080196263Sobrien@opindex mbase-addresses
1080296263Sobrien@opindex mno-base-addresses
1080396263SobrienGenerate (do not generate) code that uses @emph{base addresses}.  Using a
1080496263Sobrienbase address automatically generates a request (handled by the assembler
1080596263Sobrienand the linker) for a constant to be set up in a global register.  The
1080696263Sobrienregister is used for one or more base address requests within the range 0
1080796263Sobriento 255 from the value held in the register.  The generally leads to short
1080896263Sobrienand fast code, but the number of different data items that can be
1080996263Sobrienaddressed is limited.  This means that a program that uses lots of static
1081096263Sobriendata may require @option{-mno-base-addresses}.
10811117395Skan
10812117395Skan@item -msingle-exit
10813117395Skan@itemx -mno-single-exit
10814117395Skan@opindex msingle-exit
10815117395Skan@opindex mno-single-exit
10816117395SkanForce (do not force) generated code to have a single exit point in each
10817117395Skanfunction.
1081890075Sobrien@end table
1081990075Sobrien
10820169689Skan@node MN10300 Options
10821169689Skan@subsection MN10300 Options
10822169689Skan@cindex MN10300 options
10823169689Skan
10824169689SkanThese @option{-m} options are defined for Matsushita MN10300 architectures:
10825169689Skan
10826169689Skan@table @gcctabopt
10827169689Skan@item -mmult-bug
10828169689Skan@opindex mmult-bug
10829169689SkanGenerate code to avoid bugs in the multiply instructions for the MN10300
10830169689Skanprocessors.  This is the default.
10831169689Skan
10832169689Skan@item -mno-mult-bug
10833169689Skan@opindex mno-mult-bug
10834169689SkanDo not generate code to avoid bugs in the multiply instructions for the
10835169689SkanMN10300 processors.
10836169689Skan
10837169689Skan@item -mam33
10838169689Skan@opindex mam33
10839169689SkanGenerate code which uses features specific to the AM33 processor.
10840169689Skan
10841169689Skan@item -mno-am33
10842169689Skan@opindex mno-am33
10843169689SkanDo not generate code which uses features specific to the AM33 processor.  This
10844169689Skanis the default.
10845169689Skan
10846169689Skan@item -mreturn-pointer-on-d0
10847169689Skan@opindex mreturn-pointer-on-d0
10848169689SkanWhen generating a function which returns a pointer, return the pointer
10849169689Skanin both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
10850169689Skanonly in a0, and attempts to call such functions without a prototype
10851169689Skanwould result in errors.  Note that this option is on by default; use
10852169689Skan@option{-mno-return-pointer-on-d0} to disable it.
10853169689Skan
10854169689Skan@item -mno-crt0
10855169689Skan@opindex mno-crt0
10856169689SkanDo not link in the C run-time initialization object file.
10857169689Skan
10858169689Skan@item -mrelax
10859169689Skan@opindex mrelax
10860169689SkanIndicate to the linker that it should perform a relaxation optimization pass
10861169689Skanto shorten branches, calls and absolute memory addresses.  This option only
10862169689Skanhas an effect when used on the command line for the final link step.
10863169689Skan
10864169689SkanThis option makes symbolic debugging impossible.
10865169689Skan@end table
10866169689Skan
10867169689Skan@node MT Options
10868169689Skan@subsection MT Options
10869169689Skan@cindex MT options
10870169689Skan
10871169689SkanThese @option{-m} options are defined for Morpho MT architectures:
10872169689Skan
10873169689Skan@table @gcctabopt
10874169689Skan
10875169689Skan@item -march=@var{cpu-type}
10876169689Skan@opindex march
10877169689SkanGenerate code that will run on @var{cpu-type}, which is the name of a system
10878169689Skanrepresenting a certain processor type.  Possible values for
10879169689Skan@var{cpu-type} are @samp{ms1-64-001}, @samp{ms1-16-002},
10880169689Skan@samp{ms1-16-003} and @samp{ms2}.
10881169689Skan
10882169689SkanWhen this option is not used, the default is @option{-march=ms1-16-002}.
10883169689Skan
10884169689Skan@item -mbacc
10885169689Skan@opindex mbacc
10886169689SkanUse byte loads and stores when generating code.
10887169689Skan
10888169689Skan@item -mno-bacc
10889169689Skan@opindex mno-bacc
10890169689SkanDo not use byte loads and stores when generating code.
10891169689Skan
10892169689Skan@item -msim
10893169689Skan@opindex msim
10894169689SkanUse simulator runtime
10895169689Skan
10896169689Skan@item -mno-crt0
10897169689Skan@opindex mno-crt0
10898169689SkanDo not link in the C run-time initialization object file
10899169689Skan@file{crti.o}.  Other run-time initialization and termination files
10900169689Skansuch as @file{startup.o} and @file{exit.o} are still included on the
10901169689Skanlinker command line.
10902169689Skan
10903169689Skan@end table
10904169689Skan
1090590075Sobrien@node PDP-11 Options
1090690075Sobrien@subsection PDP-11 Options
1090790075Sobrien@cindex PDP-11 Options
1090890075Sobrien
1090990075SobrienThese options are defined for the PDP-11:
1091090075Sobrien
1091190075Sobrien@table @gcctabopt
1091290075Sobrien@item -mfpu
1091390075Sobrien@opindex mfpu
1091490075SobrienUse hardware FPP floating point.  This is the default.  (FIS floating
1091590075Sobrienpoint on the PDP-11/40 is not supported.)
1091690075Sobrien
1091790075Sobrien@item -msoft-float
1091890075Sobrien@opindex msoft-float
1091990075SobrienDo not use hardware floating point.
1092090075Sobrien
1092190075Sobrien@item -mac0
1092290075Sobrien@opindex mac0
1092390075SobrienReturn floating-point results in ac0 (fr0 in Unix assembler syntax).
1092490075Sobrien
1092590075Sobrien@item -mno-ac0
1092690075Sobrien@opindex mno-ac0
1092790075SobrienReturn floating-point results in memory.  This is the default.
1092890075Sobrien
1092990075Sobrien@item -m40
1093090075Sobrien@opindex m40
1093190075SobrienGenerate code for a PDP-11/40.
1093290075Sobrien
1093390075Sobrien@item -m45
1093490075Sobrien@opindex m45
1093590075SobrienGenerate code for a PDP-11/45.  This is the default.
1093690075Sobrien
1093790075Sobrien@item -m10
1093890075Sobrien@opindex m10
1093990075SobrienGenerate code for a PDP-11/10.
1094090075Sobrien
1094190075Sobrien@item -mbcopy-builtin
1094290075Sobrien@opindex bcopy-builtin
10943169689SkanUse inline @code{movmemhi} patterns for copying memory.  This is the
1094490075Sobriendefault.
1094590075Sobrien
1094690075Sobrien@item -mbcopy
1094790075Sobrien@opindex mbcopy
10948169689SkanDo not use inline @code{movmemhi} patterns for copying memory.
1094990075Sobrien
1095090075Sobrien@item -mint16
1095190075Sobrien@itemx -mno-int32
1095290075Sobrien@opindex mint16
1095390075Sobrien@opindex mno-int32
1095490075SobrienUse 16-bit @code{int}.  This is the default.
1095590075Sobrien
1095690075Sobrien@item -mint32
1095790075Sobrien@itemx -mno-int16
1095890075Sobrien@opindex mint32
1095990075Sobrien@opindex mno-int16
1096090075SobrienUse 32-bit @code{int}.
1096190075Sobrien
1096290075Sobrien@item -mfloat64
1096390075Sobrien@itemx -mno-float32
1096490075Sobrien@opindex mfloat64
1096590075Sobrien@opindex mno-float32
1096690075SobrienUse 64-bit @code{float}.  This is the default.
1096790075Sobrien
1096890075Sobrien@item -mfloat32
10969132718Skan@itemx -mno-float64
1097090075Sobrien@opindex mfloat32
1097190075Sobrien@opindex mno-float64
1097290075SobrienUse 32-bit @code{float}.
1097390075Sobrien
1097490075Sobrien@item -mabshi
1097590075Sobrien@opindex mabshi
1097690075SobrienUse @code{abshi2} pattern.  This is the default.
1097790075Sobrien
1097890075Sobrien@item -mno-abshi
1097990075Sobrien@opindex mno-abshi
1098090075SobrienDo not use @code{abshi2} pattern.
1098190075Sobrien
1098290075Sobrien@item -mbranch-expensive
1098390075Sobrien@opindex mbranch-expensive
1098490075SobrienPretend that branches are expensive.  This is for experimenting with
1098590075Sobriencode generation only.
1098690075Sobrien
1098790075Sobrien@item -mbranch-cheap
1098890075Sobrien@opindex mbranch-cheap
1098990075SobrienDo not pretend that branches are expensive.  This is the default.
1099090075Sobrien
1099190075Sobrien@item -msplit
1099290075Sobrien@opindex msplit
10993169689SkanGenerate code for a system with split I&D@.
1099490075Sobrien
1099590075Sobrien@item -mno-split
1099690075Sobrien@opindex mno-split
10997169689SkanGenerate code for a system without split I&D@.  This is the default.
1099890075Sobrien
1099990075Sobrien@item -munix-asm
1100090075Sobrien@opindex munix-asm
1100190075SobrienUse Unix assembler syntax.  This is the default when configured for
1100290075Sobrien@samp{pdp11-*-bsd}.
1100390075Sobrien
1100490075Sobrien@item -mdec-asm
1100590075Sobrien@opindex mdec-asm
1100690075SobrienUse DEC assembler syntax.  This is the default when configured for any
1100790075SobrienPDP-11 target other than @samp{pdp11-*-bsd}.
1100890075Sobrien@end table
1100990075Sobrien
11010169689Skan@node PowerPC Options
11011169689Skan@subsection PowerPC Options
11012169689Skan@cindex PowerPC options
1101390075Sobrien
11014169689SkanThese are listed under @xref{RS/6000 and PowerPC Options}.
1101590075Sobrien
11016169689Skan@node RS/6000 and PowerPC Options
11017169689Skan@subsection IBM RS/6000 and PowerPC Options
11018169689Skan@cindex RS/6000 and PowerPC Options
11019169689Skan@cindex IBM RS/6000 and PowerPC Options
11020169689Skan
11021169689SkanThese @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
1102290075Sobrien@table @gcctabopt
11023169689Skan@item -mpower
11024169689Skan@itemx -mno-power
11025169689Skan@itemx -mpower2
11026169689Skan@itemx -mno-power2
11027169689Skan@itemx -mpowerpc
11028169689Skan@itemx -mno-powerpc
11029169689Skan@itemx -mpowerpc-gpopt
11030169689Skan@itemx -mno-powerpc-gpopt
11031169689Skan@itemx -mpowerpc-gfxopt
11032169689Skan@itemx -mno-powerpc-gfxopt
11033169689Skan@itemx -mpowerpc64
11034169689Skan@itemx -mno-powerpc64
11035169689Skan@itemx -mmfcrf
11036169689Skan@itemx -mno-mfcrf
11037169689Skan@itemx -mpopcntb
11038169689Skan@itemx -mno-popcntb
11039169689Skan@itemx -mfprnd
11040169689Skan@itemx -mno-fprnd
11041169689Skan@opindex mpower
11042169689Skan@opindex mno-power
11043169689Skan@opindex mpower2
11044169689Skan@opindex mno-power2
11045169689Skan@opindex mpowerpc
11046169689Skan@opindex mno-powerpc
11047169689Skan@opindex mpowerpc-gpopt
11048169689Skan@opindex mno-powerpc-gpopt
11049169689Skan@opindex mpowerpc-gfxopt
11050169689Skan@opindex mno-powerpc-gfxopt
11051169689Skan@opindex mpowerpc64
11052169689Skan@opindex mno-powerpc64
11053169689Skan@opindex mmfcrf
11054169689Skan@opindex mno-mfcrf
11055169689Skan@opindex mpopcntb
11056169689Skan@opindex mno-popcntb
11057169689Skan@opindex mfprnd
11058169689Skan@opindex mno-fprnd
11059169689SkanGCC supports two related instruction set architectures for the
11060169689SkanRS/6000 and PowerPC@.  The @dfn{POWER} instruction set are those
11061169689Skaninstructions supported by the @samp{rios} chip set used in the original
11062169689SkanRS/6000 systems and the @dfn{PowerPC} instruction set is the
11063169689Skanarchitecture of the Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and
11064169689Skanthe IBM 4xx, 6xx, and follow-on microprocessors.
11065169689Skan
11066169689SkanNeither architecture is a subset of the other.  However there is a
11067169689Skanlarge common subset of instructions supported by both.  An MQ
11068169689Skanregister is included in processors supporting the POWER architecture.
11069169689Skan
11070169689SkanYou use these options to specify which instructions are available on the
11071169689Skanprocessor you are using.  The default value of these options is
11072169689Skandetermined when configuring GCC@.  Specifying the
11073169689Skan@option{-mcpu=@var{cpu_type}} overrides the specification of these
11074169689Skanoptions.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
11075169689Skanrather than the options listed above.
11076169689Skan
11077169689SkanThe @option{-mpower} option allows GCC to generate instructions that
11078169689Skanare found only in the POWER architecture and to use the MQ register.
11079169689SkanSpecifying @option{-mpower2} implies @option{-power} and also allows GCC
11080169689Skanto generate instructions that are present in the POWER2 architecture but
11081169689Skannot the original POWER architecture.
11082169689Skan
11083169689SkanThe @option{-mpowerpc} option allows GCC to generate instructions that
11084169689Skanare found only in the 32-bit subset of the PowerPC architecture.
11085169689SkanSpecifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
11086169689SkanGCC to use the optional PowerPC architecture instructions in the
11087169689SkanGeneral Purpose group, including floating-point square root.  Specifying
11088169689Skan@option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
11089169689Skanuse the optional PowerPC architecture instructions in the Graphics
11090169689Skangroup, including floating-point select.
11091169689Skan
11092169689SkanThe @option{-mmfcrf} option allows GCC to generate the move from
11093169689Skancondition register field instruction implemented on the POWER4
11094169689Skanprocessor and other processors that support the PowerPC V2.01
11095169689Skanarchitecture.
11096169689SkanThe @option{-mpopcntb} option allows GCC to generate the popcount and
11097169689Skandouble precision FP reciprocal estimate instruction implemented on the
11098169689SkanPOWER5 processor and other processors that support the PowerPC V2.02
11099169689Skanarchitecture.
11100169689SkanThe @option{-mfprnd} option allows GCC to generate the FP round to
11101169689Skaninteger instructions implemented on the POWER5+ processor and other
11102169689Skanprocessors that support the PowerPC V2.03 architecture.
11103169689Skan
11104169689SkanThe @option{-mpowerpc64} option allows GCC to generate the additional
11105169689Skan64-bit instructions that are found in the full PowerPC64 architecture
11106169689Skanand to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
11107169689Skan@option{-mno-powerpc64}.
11108169689Skan
11109169689SkanIf you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
11110169689Skanwill use only the instructions in the common subset of both
11111169689Skanarchitectures plus some special AIX common-mode calls, and will not use
11112169689Skanthe MQ register.  Specifying both @option{-mpower} and @option{-mpowerpc}
11113169689Skanpermits GCC to use any instruction from either architecture and to
11114169689Skanallow use of the MQ register; specify this for the Motorola MPC601.
11115169689Skan
11116169689Skan@item -mnew-mnemonics
11117169689Skan@itemx -mold-mnemonics
11118169689Skan@opindex mnew-mnemonics
11119169689Skan@opindex mold-mnemonics
11120169689SkanSelect which mnemonics to use in the generated assembler code.  With
11121169689Skan@option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
11122169689Skanthe PowerPC architecture.  With @option{-mold-mnemonics} it uses the
11123169689Skanassembler mnemonics defined for the POWER architecture.  Instructions
11124169689Skandefined in only one architecture have only one mnemonic; GCC uses that
11125169689Skanmnemonic irrespective of which of these options is specified.
11126169689Skan
11127169689SkanGCC defaults to the mnemonics appropriate for the architecture in
11128169689Skanuse.  Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
11129169689Skanvalue of these option.  Unless you are building a cross-compiler, you
11130169689Skanshould normally not specify either @option{-mnew-mnemonics} or
11131169689Skan@option{-mold-mnemonics}, but should instead accept the default.
11132169689Skan
11133169689Skan@item -mcpu=@var{cpu_type}
11134169689Skan@opindex mcpu
11135169689SkanSet architecture type, register usage, choice of mnemonics, and
11136169689Skaninstruction scheduling parameters for machine type @var{cpu_type}.
11137169689SkanSupported values for @var{cpu_type} are @samp{401}, @samp{403},
11138169689Skan@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{505},
11139169689Skan@samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604},
11140169689Skan@samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400},
11141169689Skan@samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
11142169689Skan@samp{860}, @samp{970}, @samp{8540}, @samp{ec603e}, @samp{G3},
11143169689Skan@samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3},
11144169689Skan@samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6},
11145169689Skan@samp{common}, @samp{powerpc}, @samp{powerpc64},
11146169689Skan@samp{rios}, @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}.
11147169689Skan
11148169689Skan@option{-mcpu=common} selects a completely generic processor.  Code
11149169689Skangenerated under this option will run on any POWER or PowerPC processor.
11150169689SkanGCC will use only the instructions in the common subset of both
11151169689Skanarchitectures, and will not use the MQ register.  GCC assumes a generic
11152169689Skanprocessor model for scheduling purposes.
11153169689Skan
11154169689Skan@option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
11155169689Skan@option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
11156169689SkanPowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
11157169689Skantypes, with an appropriate, generic processor model assumed for
11158169689Skanscheduling purposes.
11159169689Skan
11160169689SkanThe other options specify a specific processor.  Code generated under
11161169689Skanthose options will run best on that processor, and may not run at all on
11162169689Skanothers.
11163169689Skan
11164169689SkanThe @option{-mcpu} options automatically enable or disable the
11165169689Skanfollowing options: @option{-maltivec}, @option{-mfprnd},
11166169689Skan@option{-mhard-float}, @option{-mmfcrf}, @option{-mmultiple},
11167169689Skan@option{-mnew-mnemonics}, @option{-mpopcntb}, @option{-mpower},
11168169689Skan@option{-mpower2}, @option{-mpowerpc64}, @option{-mpowerpc-gpopt},
11169169689Skan@option{-mpowerpc-gfxopt}, @option{-mstring}, @option{-mmulhw}, @option{-mdlmzb}.
11170169689SkanThe particular options
11171169689Skanset for any particular CPU will vary between compiler versions,
11172169689Skandepending on what setting seems to produce optimal code for that CPU;
11173169689Skanit doesn't necessarily reflect the actual hardware's capabilities.  If
11174169689Skanyou wish to set an individual option to a particular value, you may
11175169689Skanspecify it after the @option{-mcpu} option, like @samp{-mcpu=970
11176169689Skan-mno-altivec}.
11177169689Skan
11178169689SkanOn AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
11179169689Skannot enabled or disabled by the @option{-mcpu} option at present because
11180169689SkanAIX does not have full support for these options.  You may still
11181169689Skanenable or disable them individually if you're sure it'll work in your
11182169689Skanenvironment.
11183169689Skan
11184169689Skan@item -mtune=@var{cpu_type}
11185169689Skan@opindex mtune
11186169689SkanSet the instruction scheduling parameters for machine type
11187169689Skan@var{cpu_type}, but do not set the architecture type, register usage, or
11188169689Skanchoice of mnemonics, as @option{-mcpu=@var{cpu_type}} would.  The same
11189169689Skanvalues for @var{cpu_type} are used for @option{-mtune} as for
11190169689Skan@option{-mcpu}.  If both are specified, the code generated will use the
11191169689Skanarchitecture, registers, and mnemonics set by @option{-mcpu}, but the
11192169689Skanscheduling parameters set by @option{-mtune}.
11193169689Skan
11194169689Skan@item -mswdiv
11195169689Skan@itemx -mno-swdiv
11196169689Skan@opindex mswdiv
11197169689Skan@opindex mno-swdiv
11198169689SkanGenerate code to compute division as reciprocal estimate and iterative
11199169689Skanrefinement, creating opportunities for increased throughput.  This
11200169689Skanfeature requires: optional PowerPC Graphics instruction set for single
11201169689Skanprecision and FRE instruction for double precision, assuming divides
11202169689Skancannot generate user-visible traps, and the domain values not include
11203169689SkanInfinities, denormals or zero denominator.
11204169689Skan
11205169689Skan@item -maltivec
11206169689Skan@itemx -mno-altivec
11207169689Skan@opindex maltivec
11208169689Skan@opindex mno-altivec
11209169689SkanGenerate code that uses (does not use) AltiVec instructions, and also
11210169689Skanenable the use of built-in functions that allow more direct access to
11211169689Skanthe AltiVec instruction set.  You may also need to set
11212169689Skan@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
11213169689Skanenhancements.
11214169689Skan
11215169689Skan@item -mvrsave
11216169689Skan@item -mno-vrsave
11217169689Skan@opindex mvrsave
11218169689Skan@opindex mno-vrsave
11219169689SkanGenerate VRSAVE instructions when generating AltiVec code.
11220169689Skan
11221169689Skan@item -msecure-plt
11222169689Skan@opindex msecure-plt
11223169689SkanGenerate code that allows ld and ld.so to build executables and shared
11224169689Skanlibraries with non-exec .plt and .got sections.  This is a PowerPC
11225169689Skan32-bit SYSV ABI option.
11226169689Skan
11227169689Skan@item -mbss-plt
11228169689Skan@opindex mbss-plt
11229169689SkanGenerate code that uses a BSS .plt section that ld.so fills in, and
11230169689Skanrequires .plt and .got sections that are both writable and executable.
11231169689SkanThis is a PowerPC 32-bit SYSV ABI option.
11232169689Skan
11233169689Skan@item -misel
11234169689Skan@itemx -mno-isel
11235169689Skan@opindex misel
11236169689Skan@opindex mno-isel
11237169689SkanThis switch enables or disables the generation of ISEL instructions.
11238169689Skan
11239169689Skan@item -misel=@var{yes/no}
11240169689SkanThis switch has been deprecated.  Use @option{-misel} and
11241169689Skan@option{-mno-isel} instead.
11242169689Skan
11243169689Skan@item -mspe
11244169689Skan@itemx -mno-spe
11245169689Skan@opindex mspe
11246169689Skan@opindex mno-spe
11247169689SkanThis switch enables or disables the generation of SPE simd
11248169689Skaninstructions.
11249169689Skan
11250169689Skan@item -mspe=@var{yes/no}
11251169689SkanThis option has been deprecated.  Use @option{-mspe} and
11252169689Skan@option{-mno-spe} instead.
11253169689Skan
11254169689Skan@item -mfloat-gprs=@var{yes/single/double/no}
11255169689Skan@itemx -mfloat-gprs
11256169689Skan@opindex mfloat-gprs
11257169689SkanThis switch enables or disables the generation of floating point
11258169689Skanoperations on the general purpose registers for architectures that
11259169689Skansupport it.
11260169689Skan
11261169689SkanThe argument @var{yes} or @var{single} enables the use of
11262169689Skansingle-precision floating point operations.
11263169689Skan
11264169689SkanThe argument @var{double} enables the use of single and
11265169689Skandouble-precision floating point operations.
11266169689Skan
11267169689SkanThe argument @var{no} disables floating point operations on the
11268169689Skangeneral purpose registers.
11269169689Skan
11270169689SkanThis option is currently only available on the MPC854x.
11271169689Skan
11272169689Skan@item -m32
11273169689Skan@itemx -m64
11274169689Skan@opindex m32
11275169689Skan@opindex m64
11276169689SkanGenerate code for 32-bit or 64-bit environments of Darwin and SVR4
11277169689Skantargets (including GNU/Linux).  The 32-bit environment sets int, long
11278169689Skanand pointer to 32 bits and generates code that runs on any PowerPC
11279169689Skanvariant.  The 64-bit environment sets int to 32 bits and long and
11280169689Skanpointer to 64 bits, and generates code for PowerPC64, as for
11281169689Skan@option{-mpowerpc64}.
11282169689Skan
11283169689Skan@item -mfull-toc
11284169689Skan@itemx -mno-fp-in-toc
11285169689Skan@itemx -mno-sum-in-toc
11286169689Skan@itemx -mminimal-toc
11287169689Skan@opindex mfull-toc
11288169689Skan@opindex mno-fp-in-toc
11289169689Skan@opindex mno-sum-in-toc
11290169689Skan@opindex mminimal-toc
11291169689SkanModify generation of the TOC (Table Of Contents), which is created for
11292169689Skanevery executable file.  The @option{-mfull-toc} option is selected by
11293169689Skandefault.  In that case, GCC will allocate at least one TOC entry for
11294169689Skaneach unique non-automatic variable reference in your program.  GCC
11295169689Skanwill also place floating-point constants in the TOC@.  However, only
11296169689Skan16,384 entries are available in the TOC@.
11297169689Skan
11298169689SkanIf you receive a linker error message that saying you have overflowed
11299169689Skanthe available TOC space, you can reduce the amount of TOC space used
11300169689Skanwith the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
11301169689Skan@option{-mno-fp-in-toc} prevents GCC from putting floating-point
11302169689Skanconstants in the TOC and @option{-mno-sum-in-toc} forces GCC to
11303169689Skangenerate code to calculate the sum of an address and a constant at
11304169689Skanrun-time instead of putting that sum into the TOC@.  You may specify one
11305169689Skanor both of these options.  Each causes GCC to produce very slightly
11306169689Skanslower and larger code at the expense of conserving TOC space.
11307169689Skan
11308169689SkanIf you still run out of space in the TOC even when you specify both of
11309169689Skanthese options, specify @option{-mminimal-toc} instead.  This option causes
11310169689SkanGCC to make only one TOC entry for every file.  When you specify this
11311169689Skanoption, GCC will produce code that is slower and larger but which
11312169689Skanuses extremely little TOC space.  You may wish to use this option
11313169689Skanonly on files that contain less frequently executed code.
11314169689Skan
11315169689Skan@item -maix64
11316169689Skan@itemx -maix32
11317169689Skan@opindex maix64
11318169689Skan@opindex maix32
11319169689SkanEnable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
11320169689Skan@code{long} type, and the infrastructure needed to support them.
11321169689SkanSpecifying @option{-maix64} implies @option{-mpowerpc64} and
11322169689Skan@option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
11323169689Skanimplies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
11324169689Skan
11325169689Skan@item -mxl-compat
11326169689Skan@itemx -mno-xl-compat
11327169689Skan@opindex mxl-compat
11328169689Skan@opindex mno-xl-compat
11329169689SkanProduce code that conforms more closely to IBM XL compiler semantics
11330169689Skanwhen using AIX-compatible ABI.  Pass floating-point arguments to
11331169689Skanprototyped functions beyond the register save area (RSA) on the stack
11332169689Skanin addition to argument FPRs.  Do not assume that most significant
11333169689Skandouble in 128-bit long double value is properly rounded when comparing
11334169689Skanvalues and converting to double.  Use XL symbol names for long double
11335169689Skansupport routines.
11336169689Skan
11337169689SkanThe AIX calling convention was extended but not initially documented to
11338169689Skanhandle an obscure K&R C case of calling a function that takes the
11339169689Skanaddress of its arguments with fewer arguments than declared.  IBM XL
11340169689Skancompilers access floating point arguments which do not fit in the
11341169689SkanRSA from the stack when a subroutine is compiled without
11342169689Skanoptimization.  Because always storing floating-point arguments on the
11343169689Skanstack is inefficient and rarely needed, this option is not enabled by
11344169689Skandefault and only is necessary when calling subroutines compiled by IBM
11345169689SkanXL compilers without optimization.
11346169689Skan
11347169689Skan@item -mpe
11348169689Skan@opindex mpe
11349169689SkanSupport @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
11350169689Skanapplication written to use message passing with special startup code to
11351169689Skanenable the application to run.  The system must have PE installed in the
11352169689Skanstandard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
11353169689Skanmust be overridden with the @option{-specs=} option to specify the
11354169689Skanappropriate directory location.  The Parallel Environment does not
11355169689Skansupport threads, so the @option{-mpe} option and the @option{-pthread}
11356169689Skanoption are incompatible.
11357169689Skan
11358169689Skan@item -malign-natural
11359169689Skan@itemx -malign-power
11360169689Skan@opindex malign-natural
11361169689Skan@opindex malign-power
11362169689SkanOn AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
11363169689Skan@option{-malign-natural} overrides the ABI-defined alignment of larger
11364169689Skantypes, such as floating-point doubles, on their natural size-based boundary.
11365169689SkanThe option @option{-malign-power} instructs GCC to follow the ABI-specified
11366169689Skanalignment rules.  GCC defaults to the standard alignment defined in the ABI@.
11367169689Skan
11368169689SkanOn 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
11369169689Skanis not supported.
11370169689Skan
11371169689Skan@item -msoft-float
11372169689Skan@itemx -mhard-float
11373169689Skan@opindex msoft-float
11374169689Skan@opindex mhard-float
11375169689SkanGenerate code that does not use (uses) the floating-point register set.
11376169689SkanSoftware floating point emulation is provided if you use the
11377169689Skan@option{-msoft-float} option, and pass the option to GCC when linking.
11378169689Skan
11379169689Skan@item -mmultiple
11380169689Skan@itemx -mno-multiple
11381169689Skan@opindex mmultiple
11382169689Skan@opindex mno-multiple
11383169689SkanGenerate code that uses (does not use) the load multiple word
11384169689Skaninstructions and the store multiple word instructions.  These
11385169689Skaninstructions are generated by default on POWER systems, and not
11386169689Skangenerated on PowerPC systems.  Do not use @option{-mmultiple} on little
11387169689Skanendian PowerPC systems, since those instructions do not work when the
11388169689Skanprocessor is in little endian mode.  The exceptions are PPC740 and
11389169689SkanPPC750 which permit the instructions usage in little endian mode.
11390169689Skan
11391169689Skan@item -mstring
11392169689Skan@itemx -mno-string
11393169689Skan@opindex mstring
11394169689Skan@opindex mno-string
11395169689SkanGenerate code that uses (does not use) the load string instructions
11396169689Skanand the store string word instructions to save multiple registers and
11397169689Skando small block moves.  These instructions are generated by default on
11398169689SkanPOWER systems, and not generated on PowerPC systems.  Do not use
11399169689Skan@option{-mstring} on little endian PowerPC systems, since those
11400169689Skaninstructions do not work when the processor is in little endian mode.
11401169689SkanThe exceptions are PPC740 and PPC750 which permit the instructions
11402169689Skanusage in little endian mode.
11403169689Skan
11404169689Skan@item -mupdate
11405169689Skan@itemx -mno-update
11406169689Skan@opindex mupdate
11407169689Skan@opindex mno-update
11408169689SkanGenerate code that uses (does not use) the load or store instructions
11409169689Skanthat update the base register to the address of the calculated memory
11410169689Skanlocation.  These instructions are generated by default.  If you use
11411169689Skan@option{-mno-update}, there is a small window between the time that the
11412169689Skanstack pointer is updated and the address of the previous frame is
11413169689Skanstored, which means code that walks the stack frame across interrupts or
11414169689Skansignals may get corrupted data.
11415169689Skan
11416169689Skan@item -mfused-madd
11417169689Skan@itemx -mno-fused-madd
11418169689Skan@opindex mfused-madd
11419169689Skan@opindex mno-fused-madd
11420169689SkanGenerate code that uses (does not use) the floating point multiply and
11421169689Skanaccumulate instructions.  These instructions are generated by default if
11422169689Skanhardware floating is used.
11423169689Skan
11424169689Skan@item -mmulhw
11425169689Skan@itemx -mno-mulhw
11426169689Skan@opindex mmulhw
11427169689Skan@opindex mno-mulhw
11428169689SkanGenerate code that uses (does not use) the half-word multiply and
11429169689Skanmultiply-accumulate instructions on the IBM 405 and 440 processors.
11430169689SkanThese instructions are generated by default when targetting those
11431169689Skanprocessors.
11432169689Skan
11433169689Skan@item -mdlmzb
11434169689Skan@itemx -mno-dlmzb
11435169689Skan@opindex mdlmzb
11436169689Skan@opindex mno-dlmzb
11437169689SkanGenerate code that uses (does not use) the string-search @samp{dlmzb}
11438169689Skaninstruction on the IBM 405 and 440 processors.  This instruction is
11439169689Skangenerated by default when targetting those processors.
11440169689Skan
11441169689Skan@item -mno-bit-align
11442169689Skan@itemx -mbit-align
11443169689Skan@opindex mno-bit-align
11444169689Skan@opindex mbit-align
11445169689SkanOn System V.4 and embedded PowerPC systems do not (do) force structures
11446169689Skanand unions that contain bit-fields to be aligned to the base type of the
11447169689Skanbit-field.
11448169689Skan
11449169689SkanFor example, by default a structure containing nothing but 8
11450169689Skan@code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
11451169689Skanboundary and have a size of 4 bytes.  By using @option{-mno-bit-align},
11452169689Skanthe structure would be aligned to a 1 byte boundary and be one byte in
11453169689Skansize.
11454169689Skan
11455169689Skan@item -mno-strict-align
11456169689Skan@itemx -mstrict-align
11457169689Skan@opindex mno-strict-align
11458169689Skan@opindex mstrict-align
11459169689SkanOn System V.4 and embedded PowerPC systems do not (do) assume that
11460169689Skanunaligned memory references will be handled by the system.
11461169689Skan
11462169689Skan@item -mrelocatable
11463169689Skan@itemx -mno-relocatable
11464169689Skan@opindex mrelocatable
11465169689Skan@opindex mno-relocatable
11466169689SkanOn embedded PowerPC systems generate code that allows (does not allow)
11467169689Skanthe program to be relocated to a different address at runtime.  If you
11468169689Skanuse @option{-mrelocatable} on any module, all objects linked together must
11469169689Skanbe compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
11470169689Skan
11471169689Skan@item -mrelocatable-lib
11472169689Skan@itemx -mno-relocatable-lib
11473169689Skan@opindex mrelocatable-lib
11474169689Skan@opindex mno-relocatable-lib
11475169689SkanOn embedded PowerPC systems generate code that allows (does not allow)
11476169689Skanthe program to be relocated to a different address at runtime.  Modules
11477169689Skancompiled with @option{-mrelocatable-lib} can be linked with either modules
11478169689Skancompiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
11479169689Skanwith modules compiled with the @option{-mrelocatable} options.
11480169689Skan
11481169689Skan@item -mno-toc
11482169689Skan@itemx -mtoc
11483169689Skan@opindex mno-toc
11484169689Skan@opindex mtoc
11485169689SkanOn System V.4 and embedded PowerPC systems do not (do) assume that
11486169689Skanregister 2 contains a pointer to a global area pointing to the addresses
11487169689Skanused in the program.
11488169689Skan
11489169689Skan@item -mlittle
11490169689Skan@itemx -mlittle-endian
11491169689Skan@opindex mlittle
11492169689Skan@opindex mlittle-endian
11493169689SkanOn System V.4 and embedded PowerPC systems compile code for the
11494169689Skanprocessor in little endian mode.  The @option{-mlittle-endian} option is
11495169689Skanthe same as @option{-mlittle}.
11496169689Skan
11497169689Skan@item -mbig
11498169689Skan@itemx -mbig-endian
11499169689Skan@opindex mbig
11500169689Skan@opindex mbig-endian
11501169689SkanOn System V.4 and embedded PowerPC systems compile code for the
11502169689Skanprocessor in big endian mode.  The @option{-mbig-endian} option is
11503169689Skanthe same as @option{-mbig}.
11504169689Skan
11505169689Skan@item -mdynamic-no-pic
11506169689Skan@opindex mdynamic-no-pic
11507169689SkanOn Darwin and Mac OS X systems, compile code so that it is not
11508169689Skanrelocatable, but that its external references are relocatable.  The
11509169689Skanresulting code is suitable for applications, but not shared
11510169689Skanlibraries.
11511169689Skan
11512169689Skan@item -mprioritize-restricted-insns=@var{priority}
11513169689Skan@opindex mprioritize-restricted-insns
11514169689SkanThis option controls the priority that is assigned to
11515169689Skandispatch-slot restricted instructions during the second scheduling
11516169689Skanpass.  The argument @var{priority} takes the value @var{0/1/2} to assign
11517169689Skan@var{no/highest/second-highest} priority to dispatch slot restricted
11518169689Skaninstructions.
11519169689Skan
11520169689Skan@item -msched-costly-dep=@var{dependence_type}
11521169689Skan@opindex msched-costly-dep
11522169689SkanThis option controls which dependences are considered costly
11523169689Skanby the target during instruction scheduling.  The argument
11524169689Skan@var{dependence_type} takes one of the following values:
11525169689Skan@var{no}: no dependence is costly,
11526169689Skan@var{all}: all dependences are costly,
11527169689Skan@var{true_store_to_load}: a true dependence from store to load is costly,
11528169689Skan@var{store_to_load}: any dependence from store to load is costly,
11529169689Skan@var{number}: any dependence which latency >= @var{number} is costly.
11530169689Skan
11531169689Skan@item -minsert-sched-nops=@var{scheme}
11532169689Skan@opindex minsert-sched-nops
11533169689SkanThis option controls which nop insertion scheme will be used during
11534169689Skanthe second scheduling pass.  The argument @var{scheme} takes one of the
11535169689Skanfollowing values:
11536169689Skan@var{no}: Don't insert nops.
11537169689Skan@var{pad}: Pad with nops any dispatch group which has vacant issue slots,
11538169689Skanaccording to the scheduler's grouping.
11539169689Skan@var{regroup_exact}: Insert nops to force costly dependent insns into
11540169689Skanseparate groups.  Insert exactly as many nops as needed to force an insn
11541169689Skanto a new group, according to the estimated processor grouping.
11542169689Skan@var{number}: Insert nops to force costly dependent insns into
11543169689Skanseparate groups.  Insert @var{number} nops to force an insn to a new group.
11544169689Skan
11545169689Skan@item -mcall-sysv
11546169689Skan@opindex mcall-sysv
11547169689SkanOn System V.4 and embedded PowerPC systems compile code using calling
11548169689Skanconventions that adheres to the March 1995 draft of the System V
11549169689SkanApplication Binary Interface, PowerPC processor supplement.  This is the
11550169689Skandefault unless you configured GCC using @samp{powerpc-*-eabiaix}.
11551169689Skan
11552169689Skan@item -mcall-sysv-eabi
11553169689Skan@opindex mcall-sysv-eabi
11554169689SkanSpecify both @option{-mcall-sysv} and @option{-meabi} options.
11555169689Skan
11556169689Skan@item -mcall-sysv-noeabi
11557169689Skan@opindex mcall-sysv-noeabi
11558169689SkanSpecify both @option{-mcall-sysv} and @option{-mno-eabi} options.
11559169689Skan
11560169689Skan@item -mcall-solaris
11561169689Skan@opindex mcall-solaris
11562169689SkanOn System V.4 and embedded PowerPC systems compile code for the Solaris
11563169689Skanoperating system.
11564169689Skan
11565169689Skan@item -mcall-linux
11566169689Skan@opindex mcall-linux
11567169689SkanOn System V.4 and embedded PowerPC systems compile code for the
11568169689SkanLinux-based GNU system.
11569169689Skan
11570169689Skan@item -mcall-gnu
11571169689Skan@opindex mcall-gnu
11572169689SkanOn System V.4 and embedded PowerPC systems compile code for the
11573169689SkanHurd-based GNU system.
11574169689Skan
11575169689Skan@item -mcall-netbsd
11576169689Skan@opindex mcall-netbsd
11577169689SkanOn System V.4 and embedded PowerPC systems compile code for the
11578169689SkanNetBSD operating system.
11579169689Skan
11580169689Skan@item -maix-struct-return
11581169689Skan@opindex maix-struct-return
11582169689SkanReturn all structures in memory (as specified by the AIX ABI)@.
11583169689Skan
11584169689Skan@item -msvr4-struct-return
11585169689Skan@opindex msvr4-struct-return
11586169689SkanReturn structures smaller than 8 bytes in registers (as specified by the
11587169689SkanSVR4 ABI)@.
11588169689Skan
11589169689Skan@item -mabi=@var{abi-type}
11590169689Skan@opindex mabi
11591169689SkanExtend the current ABI with a particular extension, or remove such extension.
11592169689SkanValid values are @var{altivec}, @var{no-altivec}, @var{spe},
11593169689Skan@var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@.
11594169689Skan
11595169689Skan@item -mabi=spe
11596169689Skan@opindex mabi=spe
11597169689SkanExtend the current ABI with SPE ABI extensions.  This does not change
11598169689Skanthe default ABI, instead it adds the SPE ABI extensions to the current
11599169689SkanABI@.
11600169689Skan
11601169689Skan@item -mabi=no-spe
11602169689Skan@opindex mabi=no-spe
11603169689SkanDisable Booke SPE ABI extensions for the current ABI@.
11604169689Skan
11605169689Skan@item -mabi=ibmlongdouble
11606169689Skan@opindex mabi=ibmlongdouble
11607169689SkanChange the current ABI to use IBM extended precision long double.
11608169689SkanThis is a PowerPC 32-bit SYSV ABI option.
11609169689Skan
11610169689Skan@item -mabi=ieeelongdouble
11611169689Skan@opindex mabi=ieeelongdouble
11612169689SkanChange the current ABI to use IEEE extended precision long double.
11613169689SkanThis is a PowerPC 32-bit Linux ABI option.
11614169689Skan
11615169689Skan@item -mprototype
11616169689Skan@itemx -mno-prototype
11617169689Skan@opindex mprototype
11618169689Skan@opindex mno-prototype
11619169689SkanOn System V.4 and embedded PowerPC systems assume that all calls to
11620169689Skanvariable argument functions are properly prototyped.  Otherwise, the
11621169689Skancompiler must insert an instruction before every non prototyped call to
11622169689Skanset or clear bit 6 of the condition code register (@var{CR}) to
11623169689Skanindicate whether floating point values were passed in the floating point
11624169689Skanregisters in case the function takes a variable arguments.  With
11625169689Skan@option{-mprototype}, only calls to prototyped variable argument functions
11626169689Skanwill set or clear the bit.
11627169689Skan
1162890075Sobrien@item -msim
1162990075Sobrien@opindex msim
11630169689SkanOn embedded PowerPC systems, assume that the startup module is called
11631169689Skan@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
11632169689Skan@file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}.
11633169689Skanconfigurations.
1163490075Sobrien
11635169689Skan@item -mmvme
11636169689Skan@opindex mmvme
11637169689SkanOn embedded PowerPC systems, assume that the startup module is called
11638169689Skan@file{crt0.o} and the standard C libraries are @file{libmvme.a} and
11639169689Skan@file{libc.a}.
11640117395Skan
11641169689Skan@item -mads
11642169689Skan@opindex mads
11643169689SkanOn embedded PowerPC systems, assume that the startup module is called
11644169689Skan@file{crt0.o} and the standard C libraries are @file{libads.a} and
11645169689Skan@file{libc.a}.
11646117395Skan
11647169689Skan@item -myellowknife
11648169689Skan@opindex myellowknife
11649169689SkanOn embedded PowerPC systems, assume that the startup module is called
11650169689Skan@file{crt0.o} and the standard C libraries are @file{libyk.a} and
11651169689Skan@file{libc.a}.
11652117395Skan
11653169689Skan@item -mvxworks
11654169689Skan@opindex mvxworks
11655169689SkanOn System V.4 and embedded PowerPC systems, specify that you are
11656169689Skancompiling for a VxWorks system.
11657117395Skan
11658169689Skan@item -mwindiss
11659169689Skan@opindex mwindiss
11660169689SkanSpecify that you are compiling for the WindISS simulation environment.
11661117395Skan
11662169689Skan@item -memb
11663169689Skan@opindex memb
11664169689SkanOn embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
11665169689Skanheader to indicate that @samp{eabi} extended relocations are used.
11666117395Skan
11667169689Skan@item -meabi
11668169689Skan@itemx -mno-eabi
11669169689Skan@opindex meabi
11670169689Skan@opindex mno-eabi
11671169689SkanOn System V.4 and embedded PowerPC systems do (do not) adhere to the
11672169689SkanEmbedded Applications Binary Interface (eabi) which is a set of
11673169689Skanmodifications to the System V.4 specifications.  Selecting @option{-meabi}
11674169689Skanmeans that the stack is aligned to an 8 byte boundary, a function
11675169689Skan@code{__eabi} is called to from @code{main} to set up the eabi
11676169689Skanenvironment, and the @option{-msdata} option can use both @code{r2} and
11677169689Skan@code{r13} to point to two separate small data areas.  Selecting
11678169689Skan@option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
11679169689Skando not call an initialization function from @code{main}, and the
11680169689Skan@option{-msdata} option will only use @code{r13} to point to a single
11681169689Skansmall data area.  The @option{-meabi} option is on by default if you
11682169689Skanconfigured GCC using one of the @samp{powerpc*-*-eabi*} options.
11683117395Skan
11684169689Skan@item -msdata=eabi
11685169689Skan@opindex msdata=eabi
11686169689SkanOn System V.4 and embedded PowerPC systems, put small initialized
11687169689Skan@code{const} global and static data in the @samp{.sdata2} section, which
11688169689Skanis pointed to by register @code{r2}.  Put small initialized
11689169689Skannon-@code{const} global and static data in the @samp{.sdata} section,
11690169689Skanwhich is pointed to by register @code{r13}.  Put small uninitialized
11691169689Skanglobal and static data in the @samp{.sbss} section, which is adjacent to
11692169689Skanthe @samp{.sdata} section.  The @option{-msdata=eabi} option is
11693169689Skanincompatible with the @option{-mrelocatable} option.  The
11694169689Skan@option{-msdata=eabi} option also sets the @option{-memb} option.
11695117395Skan
11696169689Skan@item -msdata=sysv
11697169689Skan@opindex msdata=sysv
11698169689SkanOn System V.4 and embedded PowerPC systems, put small global and static
11699169689Skandata in the @samp{.sdata} section, which is pointed to by register
11700169689Skan@code{r13}.  Put small uninitialized global and static data in the
11701169689Skan@samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
11702169689SkanThe @option{-msdata=sysv} option is incompatible with the
11703169689Skan@option{-mrelocatable} option.
11704117395Skan
11705169689Skan@item -msdata=default
11706169689Skan@itemx -msdata
11707169689Skan@opindex msdata=default
11708169689Skan@opindex msdata
11709169689SkanOn System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
11710169689Skancompile code the same as @option{-msdata=eabi}, otherwise compile code the
11711169689Skansame as @option{-msdata=sysv}.
11712169689Skan
11713169689Skan@item -msdata-data
11714169689Skan@opindex msdata-data
11715169689SkanOn System V.4 and embedded PowerPC systems, put small global
11716169689Skandata in the @samp{.sdata} section.  Put small uninitialized global
11717169689Skandata in the @samp{.sbss} section.  Do not use register @code{r13}
11718169689Skanto address small data however.  This is the default behavior unless
11719169689Skanother @option{-msdata} options are used.
11720169689Skan
11721169689Skan@item -msdata=none
11722169689Skan@itemx -mno-sdata
11723169689Skan@opindex msdata=none
11724169689Skan@opindex mno-sdata
11725169689SkanOn embedded PowerPC systems, put all initialized global and static data
11726169689Skanin the @samp{.data} section, and all uninitialized data in the
11727169689Skan@samp{.bss} section.
11728169689Skan
11729169689Skan@item -G @var{num}
11730169689Skan@opindex G
11731169689Skan@cindex smaller data references (PowerPC)
11732169689Skan@cindex .sdata/.sdata2 references (PowerPC)
11733169689SkanOn embedded PowerPC systems, put global and static items less than or
11734169689Skanequal to @var{num} bytes into the small data or bss sections instead of
11735169689Skanthe normal data or bss section.  By default, @var{num} is 8.  The
11736169689Skan@option{-G @var{num}} switch is also passed to the linker.
11737169689SkanAll modules should be compiled with the same @option{-G @var{num}} value.
11738169689Skan
11739169689Skan@item -mregnames
11740169689Skan@itemx -mno-regnames
11741169689Skan@opindex mregnames
11742169689Skan@opindex mno-regnames
11743169689SkanOn System V.4 and embedded PowerPC systems do (do not) emit register
11744169689Skannames in the assembly language output using symbolic forms.
11745169689Skan
11746169689Skan@item -mlongcall
11747169689Skan@itemx -mno-longcall
11748169689Skan@opindex mlongcall
11749169689Skan@opindex mno-longcall
11750169689SkanBy default assume that all calls are far away so that a longer more
11751169689Skanexpensive calling sequence is required.  This is required for calls
11752169689Skanfurther than 32 megabytes (33,554,432 bytes) from the current location.
11753169689SkanA short call will be generated if the compiler knows
11754169689Skanthe call cannot be that far away.  This setting can be overridden by
11755169689Skanthe @code{shortcall} function attribute, or by @code{#pragma
11756169689Skanlongcall(0)}.
11757169689Skan
11758169689SkanSome linkers are capable of detecting out-of-range calls and generating
11759169689Skanglue code on the fly.  On these systems, long calls are unnecessary and
11760169689Skangenerate slower code.  As of this writing, the AIX linker can do this,
11761169689Skanas can the GNU linker for PowerPC/64.  It is planned to add this feature
11762169689Skanto the GNU linker for 32-bit PowerPC systems as well.
11763169689Skan
11764169689SkanOn Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr
11765169689Skancallee, L42'', plus a ``branch island'' (glue code).  The two target
11766169689Skanaddresses represent the callee and the ``branch island''.  The
11767169689SkanDarwin/PPC linker will prefer the first address and generate a ``bl
11768169689Skancallee'' if the PPC ``bl'' instruction will reach the callee directly;
11769169689Skanotherwise, the linker will generate ``bl L42'' to call the ``branch
11770169689Skanisland''.  The ``branch island'' is appended to the body of the
11771169689Skancalling function; it computes the full 32-bit address of the callee
11772169689Skanand jumps to it.
11773169689Skan
11774169689SkanOn Mach-O (Darwin) systems, this option directs the compiler emit to
11775169689Skanthe glue for every direct call, and the Darwin linker decides whether
11776169689Skanto use or discard it.
11777169689Skan
11778169689SkanIn the future, we may cause GCC to ignore all longcall specifications
11779169689Skanwhen the linker is known to generate glue.
11780169689Skan
11781169689Skan@item -pthread
11782169689Skan@opindex pthread
11783169689SkanAdds support for multithreading with the @dfn{pthreads} library.
11784169689SkanThis option sets flags for both the preprocessor and linker.
11785169689Skan
11786169689Skan@end table
11787169689Skan
11788169689Skan@node S/390 and zSeries Options
11789169689Skan@subsection S/390 and zSeries Options
11790169689Skan@cindex S/390 and zSeries Options
11791169689Skan
11792169689SkanThese are the @samp{-m} options defined for the S/390 and zSeries architecture.
11793169689Skan
11794169689Skan@table @gcctabopt
11795117395Skan@item -mhard-float
11796169689Skan@itemx -msoft-float
11797117395Skan@opindex mhard-float
11798169689Skan@opindex msoft-float
11799169689SkanUse (do not use) the hardware floating-point instructions and registers
11800169689Skanfor floating-point operations.  When @option{-msoft-float} is specified,
11801169689Skanfunctions in @file{libgcc.a} will be used to perform floating-point
11802169689Skanoperations.  When @option{-mhard-float} is specified, the compiler
11803169689Skangenerates IEEE floating-point instructions.  This is the default.
11804117395Skan
11805169689Skan@item -mlong-double-64
11806169689Skan@itemx -mlong-double-128
11807169689Skan@opindex mlong-double-64
11808169689Skan@opindex mlong-double-128
11809169689SkanThese switches control the size of @code{long double} type. A size
11810169689Skanof 64bit makes the @code{long double} type equivalent to the @code{double}
11811169689Skantype. This is the default.
11812117395Skan
11813169689Skan@item -mbackchain
11814169689Skan@itemx -mno-backchain
11815169689Skan@opindex mbackchain
11816169689Skan@opindex mno-backchain
11817169689SkanStore (do not store) the address of the caller's frame as backchain pointer
11818169689Skaninto the callee's stack frame.
11819169689SkanA backchain may be needed to allow debugging using tools that do not understand
11820169689SkanDWARF-2 call frame information.
11821169689SkanWhen @option{-mno-packed-stack} is in effect, the backchain pointer is stored
11822169689Skanat the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
11823169689Skanthe backchain is placed into the topmost word of the 96/160 byte register
11824169689Skansave area.
11825117395Skan
11826169689SkanIn general, code compiled with @option{-mbackchain} is call-compatible with
11827169689Skancode compiled with @option{-mmo-backchain}; however, use of the backchain
11828169689Skanfor debugging purposes usually requires that the whole binary is built with
11829169689Skan@option{-mbackchain}.  Note that the combination of @option{-mbackchain},
11830169689Skan@option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
11831169689Skanto build a linux kernel use @option{-msoft-float}.
11832117395Skan
11833169689SkanThe default is to not maintain the backchain.
11834117395Skan
11835169689Skan@item -mpacked-stack
11836169689Skan@item -mno-packed-stack
11837169689Skan@opindex mpacked-stack
11838169689Skan@opindex mno-packed-stack
11839169689SkanUse (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
11840169689Skanspecified, the compiler uses the all fields of the 96/160 byte register save
11841169689Skanarea only for their default purpose; unused fields still take up stack space.
11842169689SkanWhen @option{-mpacked-stack} is specified, register save slots are densely
11843169689Skanpacked at the top of the register save area; unused space is reused for other
11844169689Skanpurposes, allowing for more efficient use of the available stack space.
11845169689SkanHowever, when @option{-mbackchain} is also in effect, the topmost word of
11846169689Skanthe save area is always used to store the backchain, and the return address
11847169689Skanregister is always saved two words below the backchain.
11848117395Skan
11849169689SkanAs long as the stack frame backchain is not used, code generated with
11850169689Skan@option{-mpacked-stack} is call-compatible with code generated with
11851169689Skan@option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
11852169689SkanS/390 or zSeries generated code that uses the stack frame backchain at run
11853169689Skantime, not just for debugging purposes.  Such code is not call-compatible
11854169689Skanwith code compiled with @option{-mpacked-stack}.  Also, note that the
11855169689Skancombination of @option{-mbackchain},
11856169689Skan@option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
11857169689Skanto build a linux kernel use @option{-msoft-float}.
11858117395Skan
11859169689SkanThe default is to not use the packed stack layout.
11860117395Skan
11861169689Skan@item -msmall-exec
11862169689Skan@itemx -mno-small-exec
11863169689Skan@opindex msmall-exec
11864169689Skan@opindex mno-small-exec
11865169689SkanGenerate (or do not generate) code using the @code{bras} instruction
11866169689Skanto do subroutine calls.
11867169689SkanThis only works reliably if the total executable size does not
11868169689Skanexceed 64k.  The default is to use the @code{basr} instruction instead,
11869169689Skanwhich does not have this limitation.
11870117395Skan
11871169689Skan@item -m64
11872169689Skan@itemx -m31
11873169689Skan@opindex m64
11874169689Skan@opindex m31
11875169689SkanWhen @option{-m31} is specified, generate code compliant to the
11876169689SkanGNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
11877169689Skancode compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
11878169689Skanparticular to generate 64-bit instructions.  For the @samp{s390}
11879169689Skantargets, the default is @option{-m31}, while the @samp{s390x}
11880169689Skantargets default to @option{-m64}.
11881117395Skan
11882169689Skan@item -mzarch
11883169689Skan@itemx -mesa
11884169689Skan@opindex mzarch
11885169689Skan@opindex mesa
11886169689SkanWhen @option{-mzarch} is specified, generate code using the
11887169689Skaninstructions available on z/Architecture.
11888169689SkanWhen @option{-mesa} is specified, generate code using the
11889169689Skaninstructions available on ESA/390.  Note that @option{-mesa} is
11890169689Skannot possible with @option{-m64}.
11891169689SkanWhen generating code compliant to the GNU/Linux for S/390 ABI,
11892169689Skanthe default is @option{-mesa}.  When generating code compliant
11893169689Skanto the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
11894117395Skan
11895169689Skan@item -mmvcle
11896169689Skan@itemx -mno-mvcle
11897169689Skan@opindex mmvcle
11898169689Skan@opindex mno-mvcle
11899169689SkanGenerate (or do not generate) code using the @code{mvcle} instruction
11900169689Skanto perform block moves.  When @option{-mno-mvcle} is specified,
11901169689Skanuse a @code{mvc} loop instead.  This is the default unless optimizing for
11902169689Skansize.
11903117395Skan
11904169689Skan@item -mdebug
11905169689Skan@itemx -mno-debug
11906169689Skan@opindex mdebug
11907169689Skan@opindex mno-debug
11908169689SkanPrint (or do not print) additional debug information when compiling.
11909169689SkanThe default is to not print debug information.
11910117395Skan
11911169689Skan@item -march=@var{cpu-type}
11912169689Skan@opindex march
11913169689SkanGenerate code that will run on @var{cpu-type}, which is the name of a system
11914169689Skanrepresenting a certain processor type.  Possible values for
11915169689Skan@var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}.
11916169689SkanWhen generating code using the instructions available on z/Architecture,
11917169689Skanthe default is @option{-march=z900}.  Otherwise, the default is
11918169689Skan@option{-march=g5}.
11919117395Skan
11920169689Skan@item -mtune=@var{cpu-type}
11921169689Skan@opindex mtune
11922169689SkanTune to @var{cpu-type} everything applicable about the generated code,
11923169689Skanexcept for the ABI and the set of available instructions.
11924169689SkanThe list of @var{cpu-type} values is the same as for @option{-march}.
11925169689SkanThe default is the value used for @option{-march}.
11926117395Skan
11927169689Skan@item -mtpf-trace
11928169689Skan@itemx -mno-tpf-trace
11929169689Skan@opindex mtpf-trace
11930169689Skan@opindex mno-tpf-trace
11931169689SkanGenerate code that adds (does not add) in TPF OS specific branches to trace
11932169689Skanroutines in the operating system.  This option is off by default, even
11933169689Skanwhen compiling for the TPF OS@.
11934117395Skan
11935169689Skan@item -mfused-madd
11936169689Skan@itemx -mno-fused-madd
11937169689Skan@opindex mfused-madd
11938169689Skan@opindex mno-fused-madd
11939169689SkanGenerate code that uses (does not use) the floating point multiply and
11940169689Skanaccumulate instructions.  These instructions are generated by default if
11941169689Skanhardware floating point is used.
11942117395Skan
11943169689Skan@item -mwarn-framesize=@var{framesize}
11944169689Skan@opindex mwarn-framesize
11945169689SkanEmit a warning if the current function exceeds the given frame size.  Because
11946169689Skanthis is a compile time check it doesn't need to be a real problem when the program
11947169689Skanruns.  It is intended to identify functions which most probably cause
11948169689Skana stack overflow.  It is useful to be used in an environment with limited stack
11949169689Skansize e.g.@: the linux kernel.
11950117395Skan
11951169689Skan@item -mwarn-dynamicstack
11952169689Skan@opindex mwarn-dynamicstack
11953169689SkanEmit a warning if the function calls alloca or uses dynamically
11954169689Skansized arrays.  This is generally a bad idea with a limited stack size.
11955117395Skan
11956169689Skan@item -mstack-guard=@var{stack-guard}
11957169689Skan@item -mstack-size=@var{stack-size}
11958169689Skan@opindex mstack-guard
11959169689Skan@opindex mstack-size
11960169689SkanThese arguments always have to be used in conjunction.  If they are present the s390
11961169689Skanback end emits additional instructions in the function prologue which trigger a trap
11962169689Skanif the stack size is @var{stack-guard} bytes above the @var{stack-size}
11963169689Skan(remember that the stack on s390 grows downward).  These options are intended to
11964169689Skanbe used to help debugging stack overflow problems.  The additionally emitted code
11965169689Skancauses only little overhead and hence can also be used in production like systems
11966169689Skanwithout greater performance degradation.  The given values have to be exact
11967169689Skanpowers of 2 and @var{stack-size} has to be greater than @var{stack-guard} without
11968169689Skanexceeding 64k.
11969169689SkanIn order to be efficient the extra code makes the assumption that the stack starts
11970169689Skanat an address aligned to the value given by @var{stack-size}.
11971169689Skan@end table
11972117395Skan
11973169689Skan@node Score Options
11974169689Skan@subsection Score Options
11975169689Skan@cindex Score Options
11976117395Skan
11977169689SkanThese options are defined for Score implementations:
11978117395Skan
11979169689Skan@table @gcctabopt
11980169689Skan@item -meb
11981169689Skan@opindex meb
11982169689SkanCompile code for big endian mode.  This is the default.
11983117395Skan
11984169689Skan@item -mel
11985169689Skan@opindex mel
11986169689SkanCompile code for little endian mode. 
11987117395Skan
11988169689Skan@item -mnhwloop
11989169689Skan@opindex mnhwloop
11990169689SkanDisable generate bcnz instruction.
11991117395Skan
11992169689Skan@item -muls
11993169689Skan@opindex muls
11994169689SkanEnable generate unaligned load and store instruction.
11995117395Skan
11996169689Skan@item -mmac
11997169689Skan@opindex mmac
11998169689SkanEnable the use of multiply-accumulate instructions. Disabled by default. 
11999117395Skan
12000169689Skan@item -mscore5
12001169689Skan@opindex mscore5
12002169689SkanSpecify the SCORE5 as the target architecture.
12003117395Skan
12004169689Skan@item -mscore5u
12005169689Skan@opindex mscore5u
12006169689SkanSpecify the SCORE5U of the target architecture.
12007117395Skan
12008169689Skan@item -mscore7
12009169689Skan@opindex mscore7
12010169689SkanSpecify the SCORE7 as the target architecture. This is the default.
12011117395Skan
12012169689Skan@item -mscore7d
12013169689Skan@opindex mscore7d
12014169689SkanSpecify the SCORE7D as the target architecture.
12015169689Skan@end table
12016117395Skan
12017169689Skan@node SH Options
12018169689Skan@subsection SH Options
12019117395Skan
12020169689SkanThese @samp{-m} options are defined for the SH implementations:
12021117395Skan
12022169689Skan@table @gcctabopt
12023169689Skan@item -m1
12024169689Skan@opindex m1
12025169689SkanGenerate code for the SH1.
12026117395Skan
12027169689Skan@item -m2
12028169689Skan@opindex m2
12029169689SkanGenerate code for the SH2.
12030117395Skan
12031169689Skan@item -m2e
12032169689SkanGenerate code for the SH2e.
12033117395Skan
12034169689Skan@item -m3
12035169689Skan@opindex m3
12036169689SkanGenerate code for the SH3.
12037117395Skan
12038169689Skan@item -m3e
12039169689Skan@opindex m3e
12040169689SkanGenerate code for the SH3e.
12041117395Skan
12042169689Skan@item -m4-nofpu
12043169689Skan@opindex m4-nofpu
12044169689SkanGenerate code for the SH4 without a floating-point unit.
12045117395Skan
12046169689Skan@item -m4-single-only
12047169689Skan@opindex m4-single-only
12048169689SkanGenerate code for the SH4 with a floating-point unit that only
12049169689Skansupports single-precision arithmetic.
12050117395Skan
12051169689Skan@item -m4-single
12052169689Skan@opindex m4-single
12053169689SkanGenerate code for the SH4 assuming the floating-point unit is in
12054169689Skansingle-precision mode by default.
12055117395Skan
12056169689Skan@item -m4
12057169689Skan@opindex m4
12058169689SkanGenerate code for the SH4.
12059117395Skan
12060169689Skan@item -m4a-nofpu
12061169689Skan@opindex m4a-nofpu
12062169689SkanGenerate code for the SH4al-dsp, or for a SH4a in such a way that the
12063169689Skanfloating-point unit is not used.
12064117395Skan
12065169689Skan@item -m4a-single-only
12066169689Skan@opindex m4a-single-only
12067169689SkanGenerate code for the SH4a, in such a way that no double-precision
12068169689Skanfloating point operations are used.
12069117395Skan
12070169689Skan@item -m4a-single
12071169689Skan@opindex m4a-single
12072169689SkanGenerate code for the SH4a assuming the floating-point unit is in
12073169689Skansingle-precision mode by default.
12074117395Skan
12075169689Skan@item -m4a
12076169689Skan@opindex m4a
12077169689SkanGenerate code for the SH4a.
12078117395Skan
12079169689Skan@item -m4al
12080169689Skan@opindex m4al
12081169689SkanSame as @option{-m4a-nofpu}, except that it implicitly passes
12082169689Skan@option{-dsp} to the assembler.  GCC doesn't generate any DSP
12083169689Skaninstructions at the moment.
12084117395Skan
12085169689Skan@item -mb
12086169689Skan@opindex mb
12087169689SkanCompile code for the processor in big endian mode.
12088117395Skan
12089169689Skan@item -ml
12090169689Skan@opindex ml
12091169689SkanCompile code for the processor in little endian mode.
12092117395Skan
12093169689Skan@item -mdalign
12094169689Skan@opindex mdalign
12095169689SkanAlign doubles at 64-bit boundaries.  Note that this changes the calling
12096169689Skanconventions, and thus some functions from the standard C library will
12097169689Skannot work unless you recompile it first with @option{-mdalign}.
12098117395Skan
12099169689Skan@item -mrelax
12100169689Skan@opindex mrelax
12101169689SkanShorten some address references at link time, when possible; uses the
12102169689Skanlinker option @option{-relax}.
12103117395Skan
12104169689Skan@item -mbigtable
12105169689Skan@opindex mbigtable
12106169689SkanUse 32-bit offsets in @code{switch} tables.  The default is to use
12107169689Skan16-bit offsets.
12108117395Skan
12109169689Skan@item -mfmovd
12110169689Skan@opindex mfmovd
12111169689SkanEnable the use of the instruction @code{fmovd}.
12112117395Skan
12113169689Skan@item -mhitachi
12114169689Skan@opindex mhitachi
12115169689SkanComply with the calling conventions defined by Renesas.
12116117395Skan
12117169689Skan@item -mrenesas
12118169689Skan@opindex mhitachi
12119169689SkanComply with the calling conventions defined by Renesas.
12120117395Skan
12121169689Skan@item -mno-renesas
12122169689Skan@opindex mhitachi
12123169689SkanComply with the calling conventions defined for GCC before the Renesas
12124169689Skanconventions were available.  This option is the default for all
12125169689Skantargets of the SH toolchain except for @samp{sh-symbianelf}.
12126117395Skan
12127169689Skan@item -mnomacsave
12128169689Skan@opindex mnomacsave
12129169689SkanMark the @code{MAC} register as call-clobbered, even if
12130169689Skan@option{-mhitachi} is given.
12131117395Skan
12132169689Skan@item -mieee
12133169689Skan@opindex mieee
12134169689SkanIncrease IEEE-compliance of floating-point code.
12135169689SkanAt the moment, this is equivalent to @option{-fno-finite-math-only}.
12136169689SkanWhen generating 16 bit SH opcodes, getting IEEE-conforming results for
12137169689Skancomparisons of NANs / infinities incurs extra overhead in every
12138169689Skanfloating point comparison, therefore the default is set to
12139169689Skan@option{-ffinite-math-only}.
12140117395Skan
12141169689Skan@item -misize
12142169689Skan@opindex misize
12143169689SkanDump instruction size and location in the assembly code.
12144117395Skan
12145169689Skan@item -mpadstruct
12146169689Skan@opindex mpadstruct
12147169689SkanThis option is deprecated.  It pads structures to multiple of 4 bytes,
12148169689Skanwhich is incompatible with the SH ABI@.
12149117395Skan
12150169689Skan@item -mspace
12151169689Skan@opindex mspace
12152169689SkanOptimize for space instead of speed.  Implied by @option{-Os}.
12153117395Skan
12154169689Skan@item -mprefergot
12155169689Skan@opindex mprefergot
12156169689SkanWhen generating position-independent code, emit function calls using
12157169689Skanthe Global Offset Table instead of the Procedure Linkage Table.
12158117395Skan
12159169689Skan@item -musermode
12160169689Skan@opindex musermode
12161169689SkanGenerate a library function call to invalidate instruction cache
12162169689Skanentries, after fixing up a trampoline.  This library function call
12163169689Skandoesn't assume it can write to the whole memory address space.  This
12164169689Skanis the default when the target is @code{sh-*-linux*}.
12165117395Skan
12166169689Skan@item -multcost=@var{number}
12167169689Skan@opindex multcost=@var{number}
12168169689SkanSet the cost to assume for a multiply insn.
12169117395Skan
12170169689Skan@item -mdiv=@var{strategy}
12171169689Skan@opindex mdiv=@var{strategy}
12172169689SkanSet the division strategy to use for SHmedia code.  @var{strategy} must be
12173169689Skanone of: call, call2, fp, inv, inv:minlat, inv20u, inv20l, inv:call,
12174169689Skaninv:call2, inv:fp .
12175169689Skan"fp" performs the operation in floating point.  This has a very high latency,
12176169689Skanbut needs only a few instructions, so it might be a good choice if
12177169689Skanyour code has enough easily exploitable ILP to allow the compiler to
12178169689Skanschedule the floating point instructions together with other instructions.
12179169689SkanDivision by zero causes a floating point exception.
12180169689Skan"inv" uses integer operations to calculate the inverse of the divisor,
12181169689Skanand then multiplies the dividend with the inverse.  This strategy allows
12182169689Skancse and hoisting of the inverse calculation.  Division by zero calculates
12183169689Skanan unspecified result, but does not trap.
12184169689Skan"inv:minlat" is a variant of "inv" where if no cse / hoisting opportunities
12185169689Skanhave been found, or if the entire operation has been hoisted to the same
12186169689Skanplace, the last stages of the inverse calculation are intertwined with the
12187169689Skanfinal multiply to reduce the overall latency, at the expense of using a few
12188169689Skanmore instructions, and thus offering fewer scheduling opportunities with
12189169689Skanother code.
12190169689Skan"call" calls a library function that usually implements the inv:minlat
12191169689Skanstrategy.
12192169689SkanThis gives high code density for m5-*media-nofpu compilations.
12193169689Skan"call2" uses a different entry point of the same library function, where it
12194169689Skanassumes that a pointer to a lookup table has already been set up, which
12195169689Skanexposes the pointer load to cse / code hoisting optimizations.
12196169689Skan"inv:call", "inv:call2" and "inv:fp" all use the "inv" algorithm for initial
12197169689Skancode generation, but if the code stays unoptimized, revert to the "call",
12198169689Skan"call2", or "fp" strategies, respectively.  Note that the
12199169689Skanpotentially-trapping side effect of division by zero is carried by a
12200169689Skanseparate instruction, so it is possible that all the integer instructions
12201169689Skanare hoisted out, but the marker for the side effect stays where it is.
12202169689SkanA recombination to fp operations or a call is not possible in that case.
12203169689Skan"inv20u" and "inv20l" are variants of the "inv:minlat" strategy.  In the case
12204169689Skanthat the inverse calculation was nor separated from the multiply, they speed
12205169689Skanup division where the dividend fits into 20 bits (plus sign where applicable),
12206169689Skanby inserting a test to skip a number of operations in this case; this test
12207169689Skanslows down the case of larger dividends.  inv20u assumes the case of a such
12208169689Skana small dividend to be unlikely, and inv20l assumes it to be likely.
12209117395Skan
12210169689Skan@item -mdivsi3_libfunc=@var{name}
12211169689Skan@opindex mdivsi3_libfunc=@var{name}
12212169689SkanSet the name of the library function used for 32 bit signed division to
12213169689Skan@var{name}.  This only affect the name used in the call and inv:call
12214169689Skandivision strategies, and the compiler will still expect the same
12215169689Skansets of input/output/clobbered registers as if this option was not present.
12216117395Skan
12217169689Skan@item -madjust-unroll
12218169689Skan@opindex madjust-unroll
12219169689SkanThrottle unrolling to avoid thrashing target registers.
12220169689SkanThis option only has an effect if the gcc code base supports the
12221169689SkanTARGET_ADJUST_UNROLL_MAX target hook.
12222117395Skan
12223169689Skan@item -mindexed-addressing
12224169689Skan@opindex mindexed-addressing
12225169689SkanEnable the use of the indexed addressing mode for SHmedia32/SHcompact.
12226169689SkanThis is only safe if the hardware and/or OS implement 32 bit wrap-around
12227169689Skansemantics for the indexed addressing mode.  The architecture allows the
12228169689Skanimplementation of processors with 64 bit MMU, which the OS could use to
12229169689Skanget 32 bit addressing, but since no current hardware implementation supports
12230169689Skanthis or any other way to make the indexed addressing mode safe to use in
12231169689Skanthe 32 bit ABI, the default is -mno-indexed-addressing.
12232117395Skan
12233169689Skan@item -mgettrcost=@var{number}
12234169689Skan@opindex mgettrcost=@var{number}
12235169689SkanSet the cost assumed for the gettr instruction to @var{number}.
12236169689SkanThe default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise.
12237117395Skan
12238169689Skan@item -mpt-fixed
12239169689Skan@opindex mpt-fixed
12240169689SkanAssume pt* instructions won't trap.  This will generally generate better
12241169689Skanscheduled code, but is unsafe on current hardware.  The current architecture
12242169689Skandefinition says that ptabs and ptrel trap when the target anded with 3 is 3.
12243169689SkanThis has the unintentional effect of making it unsafe to schedule ptabs /
12244169689Skanptrel before a branch, or hoist it out of a loop.  For example,
12245169689Skan__do_global_ctors, a part of libgcc that runs constructors at program
12246169689Skanstartup, calls functions in a list which is delimited by -1.  With the
12247169689Skan-mpt-fixed option, the ptabs will be done before testing against -1.
12248169689SkanThat means that all the constructors will be run a bit quicker, but when
12249169689Skanthe loop comes to the end of the list, the program crashes because ptabs
12250169689Skanloads -1 into a target register.  Since this option is unsafe for any
12251169689Skanhardware implementing the current architecture specification, the default
12252169689Skanis -mno-pt-fixed.  Unless the user specifies a specific cost with
12253169689Skan@option{-mgettrcost}, -mno-pt-fixed also implies @option{-mgettrcost=100};
12254169689Skanthis deters register allocation using target registers for storing
12255169689Skanordinary integers.
12256117395Skan
12257169689Skan@item -minvalid-symbols
12258169689Skan@opindex minvalid-symbols
12259169689SkanAssume symbols might be invalid.  Ordinary function symbols generated by
12260169689Skanthe compiler will always be valid to load with movi/shori/ptabs or
12261169689Skanmovi/shori/ptrel, but with assembler and/or linker tricks it is possible
12262169689Skanto generate symbols that will cause ptabs / ptrel to trap.
12263169689SkanThis option is only meaningful when @option{-mno-pt-fixed} is in effect.
12264169689SkanIt will then prevent cross-basic-block cse, hoisting and most scheduling
12265169689Skanof symbol loads.  The default is @option{-mno-invalid-symbols}.
12266169689Skan@end table
12267117395Skan
12268169689Skan@node SPARC Options
12269169689Skan@subsection SPARC Options
12270169689Skan@cindex SPARC options
12271117395Skan
12272169689SkanThese @samp{-m} options are supported on the SPARC:
12273117395Skan
12274169689Skan@table @gcctabopt
12275169689Skan@item -mno-app-regs
12276169689Skan@itemx -mapp-regs
12277169689Skan@opindex mno-app-regs
12278169689Skan@opindex mapp-regs
12279169689SkanSpecify @option{-mapp-regs} to generate output using the global registers
12280169689Skan2 through 4, which the SPARC SVR4 ABI reserves for applications.  This
12281169689Skanis the default.
12282117395Skan
12283169689SkanTo be fully SVR4 ABI compliant at the cost of some performance loss,
12284169689Skanspecify @option{-mno-app-regs}.  You should compile libraries and system
12285169689Skansoftware with this option.
12286169689Skan
12287169689Skan@item -mfpu
12288169689Skan@itemx -mhard-float
12289169689Skan@opindex mfpu
12290169689Skan@opindex mhard-float
12291169689SkanGenerate output containing floating point instructions.  This is the
12292169689Skandefault.
12293169689Skan
12294169689Skan@item -mno-fpu
12295169689Skan@itemx -msoft-float
12296169689Skan@opindex mno-fpu
12297169689Skan@opindex msoft-float
12298169689SkanGenerate output containing library calls for floating point.
12299169689Skan@strong{Warning:} the requisite libraries are not available for all SPARC
12300169689Skantargets.  Normally the facilities of the machine's usual C compiler are
12301169689Skanused, but this cannot be done directly in cross-compilation.  You must make
12302169689Skanyour own arrangements to provide suitable library functions for
12303169689Skancross-compilation.  The embedded targets @samp{sparc-*-aout} and
12304169689Skan@samp{sparclite-*-*} do provide software floating point support.
12305169689Skan
12306169689Skan@option{-msoft-float} changes the calling convention in the output file;
12307169689Skantherefore, it is only useful if you compile @emph{all} of a program with
12308169689Skanthis option.  In particular, you need to compile @file{libgcc.a}, the
12309169689Skanlibrary that comes with GCC, with @option{-msoft-float} in order for
12310169689Skanthis to work.
12311169689Skan
12312169689Skan@item -mhard-quad-float
12313169689Skan@opindex mhard-quad-float
12314169689SkanGenerate output containing quad-word (long double) floating point
12315169689Skaninstructions.
12316169689Skan
12317169689Skan@item -msoft-quad-float
12318169689Skan@opindex msoft-quad-float
12319169689SkanGenerate output containing library calls for quad-word (long double)
12320169689Skanfloating point instructions.  The functions called are those specified
12321169689Skanin the SPARC ABI@.  This is the default.
12322169689Skan
12323169689SkanAs of this writing, there are no SPARC implementations that have hardware
12324169689Skansupport for the quad-word floating point instructions.  They all invoke
12325169689Skana trap handler for one of these instructions, and then the trap handler
12326169689Skanemulates the effect of the instruction.  Because of the trap handler overhead,
12327169689Skanthis is much slower than calling the ABI library routines.  Thus the
12328169689Skan@option{-msoft-quad-float} option is the default.
12329169689Skan
12330169689Skan@item -mno-unaligned-doubles
12331169689Skan@itemx -munaligned-doubles
12332169689Skan@opindex mno-unaligned-doubles
12333169689Skan@opindex munaligned-doubles
12334169689SkanAssume that doubles have 8 byte alignment.  This is the default.
12335169689Skan
12336169689SkanWith @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
12337169689Skanalignment only if they are contained in another type, or if they have an
12338169689Skanabsolute address.  Otherwise, it assumes they have 4 byte alignment.
12339169689SkanSpecifying this option avoids some rare compatibility problems with code
12340169689Skangenerated by other compilers.  It is not the default because it results
12341169689Skanin a performance loss, especially for floating point code.
12342169689Skan
12343169689Skan@item -mno-faster-structs
12344169689Skan@itemx -mfaster-structs
12345169689Skan@opindex mno-faster-structs
12346169689Skan@opindex mfaster-structs
12347169689SkanWith @option{-mfaster-structs}, the compiler assumes that structures
12348169689Skanshould have 8 byte alignment.  This enables the use of pairs of
12349169689Skan@code{ldd} and @code{std} instructions for copies in structure
12350169689Skanassignment, in place of twice as many @code{ld} and @code{st} pairs.
12351169689SkanHowever, the use of this changed alignment directly violates the SPARC
12352169689SkanABI@.  Thus, it's intended only for use on targets where the developer
12353169689Skanacknowledges that their resulting code will not be directly in line with
12354169689Skanthe rules of the ABI@.
12355169689Skan
12356169689Skan@item -mimpure-text
12357169689Skan@opindex mimpure-text
12358169689Skan@option{-mimpure-text}, used in addition to @option{-shared}, tells
12359169689Skanthe compiler to not pass @option{-z text} to the linker when linking a
12360169689Skanshared object.  Using this option, you can link position-dependent
12361169689Skancode into a shared object.
12362169689Skan
12363169689Skan@option{-mimpure-text} suppresses the ``relocations remain against
12364169689Skanallocatable but non-writable sections'' linker error message.
12365169689SkanHowever, the necessary relocations will trigger copy-on-write, and the
12366169689Skanshared object is not actually shared across processes.  Instead of
12367169689Skanusing @option{-mimpure-text}, you should compile all source code with
12368169689Skan@option{-fpic} or @option{-fPIC}.
12369169689Skan
12370169689SkanThis option is only available on SunOS and Solaris.
12371169689Skan
12372169689Skan@item -mcpu=@var{cpu_type}
12373117395Skan@opindex mcpu
12374169689SkanSet the instruction set, register set, and instruction scheduling parameters
12375169689Skanfor machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
12376169689Skan@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
12377169689Skan@samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x},
12378169689Skan@samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc},
12379169689Skan@samp{ultrasparc3}, and @samp{niagara}.
12380117395Skan
12381169689SkanDefault instruction scheduling parameters are used for values that select
12382169689Skanan architecture and not an implementation.  These are @samp{v7}, @samp{v8},
12383169689Skan@samp{sparclite}, @samp{sparclet}, @samp{v9}.
12384117395Skan
12385169689SkanHere is a list of each supported architecture and their supported
12386169689Skanimplementations.
12387169689Skan
12388169689Skan@smallexample
12389169689Skan    v7:             cypress
12390169689Skan    v8:             supersparc, hypersparc
12391169689Skan    sparclite:      f930, f934, sparclite86x
12392169689Skan    sparclet:       tsc701
12393169689Skan    v9:             ultrasparc, ultrasparc3, niagara
12394169689Skan@end smallexample
12395169689Skan
12396169689SkanBy default (unless configured otherwise), GCC generates code for the V7
12397169689Skanvariant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
12398169689Skanadditionally optimizes it for the Cypress CY7C602 chip, as used in the
12399169689SkanSPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
12400169689SkanSPARCStation 1, 2, IPX etc.
12401169689Skan
12402169689SkanWith @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
12403169689Skanarchitecture.  The only difference from V7 code is that the compiler emits
12404169689Skanthe integer multiply and integer divide instructions which exist in SPARC-V8
12405169689Skanbut not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
12406169689Skanoptimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
12407169689Skan2000 series.
12408169689Skan
12409169689SkanWith @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
12410169689Skanthe SPARC architecture.  This adds the integer multiply, integer divide step
12411169689Skanand scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
12412169689SkanWith @option{-mcpu=f930}, the compiler additionally optimizes it for the
12413169689SkanFujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
12414169689Skan@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
12415169689SkanMB86934 chip, which is the more recent SPARClite with FPU@.
12416169689Skan
12417169689SkanWith @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
12418169689Skanthe SPARC architecture.  This adds the integer multiply, multiply/accumulate,
12419169689Skaninteger divide step and scan (@code{ffs}) instructions which exist in SPARClet
12420169689Skanbut not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
12421169689Skanoptimizes it for the TEMIC SPARClet chip.
12422169689Skan
12423169689SkanWith @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
12424169689Skanarchitecture.  This adds 64-bit integer and floating-point move instructions,
12425169689Skan3 additional floating-point condition code registers and conditional move
12426169689Skaninstructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
12427169689Skanoptimizes it for the Sun UltraSPARC I/II/IIi chips.  With
12428169689Skan@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
12429169689SkanSun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
12430169689Skan@option{-mcpu=niagara}, the compiler additionally optimizes it for
12431169689SkanSun UltraSPARC T1 chips.
12432169689Skan
12433169689Skan@item -mtune=@var{cpu_type}
12434169689Skan@opindex mtune
12435169689SkanSet the instruction scheduling parameters for machine type
12436169689Skan@var{cpu_type}, but do not set the instruction set or register set that the
12437169689Skanoption @option{-mcpu=@var{cpu_type}} would.
12438169689Skan
12439169689SkanThe same values for @option{-mcpu=@var{cpu_type}} can be used for
12440169689Skan@option{-mtune=@var{cpu_type}}, but the only useful values are those
12441169689Skanthat select a particular cpu implementation.  Those are @samp{cypress},
12442169689Skan@samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
12443169689Skan@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
12444169689Skan@samp{ultrasparc3}, and @samp{niagara}.
12445169689Skan
12446169689Skan@item -mv8plus
12447169689Skan@itemx -mno-v8plus
12448169689Skan@opindex mv8plus
12449169689Skan@opindex mno-v8plus
12450169689SkanWith @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
12451169689Skandifference from the V8 ABI is that the global and out registers are
12452169689Skanconsidered 64-bit wide.  This is enabled by default on Solaris in 32-bit
12453169689Skanmode for all SPARC-V9 processors.
12454169689Skan
12455169689Skan@item -mvis
12456169689Skan@itemx -mno-vis
12457169689Skan@opindex mvis
12458169689Skan@opindex mno-vis
12459169689SkanWith @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
12460169689SkanVisual Instruction Set extensions.  The default is @option{-mno-vis}.
12461117395Skan@end table
12462117395Skan
12463169689SkanThese @samp{-m} options are supported in addition to the above
12464169689Skanon SPARC-V9 processors in 64-bit environments:
12465169689Skan
12466169689Skan@table @gcctabopt
12467169689Skan@item -mlittle-endian
12468169689Skan@opindex mlittle-endian
12469169689SkanGenerate code for a processor running in little-endian mode.  It is only
12470169689Skanavailable for a few configurations and most notably not on Solaris and Linux.
12471169689Skan
12472169689Skan@item -m32
12473169689Skan@itemx -m64
12474169689Skan@opindex m32
12475169689Skan@opindex m64
12476169689SkanGenerate code for a 32-bit or 64-bit environment.
12477169689SkanThe 32-bit environment sets int, long and pointer to 32 bits.
12478169689SkanThe 64-bit environment sets int to 32 bits and long and pointer
12479169689Skanto 64 bits.
12480169689Skan
12481169689Skan@item -mcmodel=medlow
12482169689Skan@opindex mcmodel=medlow
12483169689SkanGenerate code for the Medium/Low code model: 64-bit addresses, programs
12484169689Skanmust be linked in the low 32 bits of memory.  Programs can be statically
12485169689Skanor dynamically linked.
12486169689Skan
12487169689Skan@item -mcmodel=medmid
12488169689Skan@opindex mcmodel=medmid
12489169689SkanGenerate code for the Medium/Middle code model: 64-bit addresses, programs
12490169689Skanmust be linked in the low 44 bits of memory, the text and data segments must
12491169689Skanbe less than 2GB in size and the data segment must be located within 2GB of
12492169689Skanthe text segment.
12493169689Skan
12494169689Skan@item -mcmodel=medany
12495169689Skan@opindex mcmodel=medany
12496169689SkanGenerate code for the Medium/Anywhere code model: 64-bit addresses, programs
12497169689Skanmay be linked anywhere in memory, the text and data segments must be less
12498169689Skanthan 2GB in size and the data segment must be located within 2GB of the
12499169689Skantext segment.
12500169689Skan
12501169689Skan@item -mcmodel=embmedany
12502169689Skan@opindex mcmodel=embmedany
12503169689SkanGenerate code for the Medium/Anywhere code model for embedded systems:
12504169689Skan64-bit addresses, the text and data segments must be less than 2GB in
12505169689Skansize, both starting anywhere in memory (determined at link time).  The
12506169689Skanglobal register %g4 points to the base of the data segment.  Programs
12507169689Skanare statically linked and PIC is not supported.
12508169689Skan
12509169689Skan@item -mstack-bias
12510169689Skan@itemx -mno-stack-bias
12511169689Skan@opindex mstack-bias
12512169689Skan@opindex mno-stack-bias
12513169689SkanWith @option{-mstack-bias}, GCC assumes that the stack pointer, and
12514169689Skanframe pointer if present, are offset by @minus{}2047 which must be added back
12515169689Skanwhen making stack frame references.  This is the default in 64-bit mode.
12516169689SkanOtherwise, assume no such offset is present.
12517169689Skan@end table
12518169689Skan
12519169689SkanThese switches are supported in addition to the above on Solaris:
12520169689Skan
12521169689Skan@table @gcctabopt
12522169689Skan@item -threads
12523169689Skan@opindex threads
12524169689SkanAdd support for multithreading using the Solaris threads library.  This
12525169689Skanoption sets flags for both the preprocessor and linker.  This option does
12526169689Skannot affect the thread safety of object code produced by the compiler or
12527169689Skanthat of libraries supplied with it.
12528169689Skan
12529169689Skan@item -pthreads
12530169689Skan@opindex pthreads
12531169689SkanAdd support for multithreading using the POSIX threads library.  This
12532169689Skanoption sets flags for both the preprocessor and linker.  This option does
12533169689Skannot affect the thread safety of object code produced  by the compiler or
12534169689Skanthat of libraries supplied with it.
12535169689Skan
12536169689Skan@item -pthread
12537169689Skan@opindex pthread
12538169689SkanThis is a synonym for @option{-pthreads}.
12539169689Skan@end table
12540169689Skan
12541169689Skan@node System V Options
12542169689Skan@subsection Options for System V
12543169689Skan
12544169689SkanThese additional options are available on System V Release 4 for
12545169689Skancompatibility with other compilers on those systems:
12546169689Skan
12547169689Skan@table @gcctabopt
12548169689Skan@item -G
12549169689Skan@opindex G
12550169689SkanCreate a shared object.
12551169689SkanIt is recommended that @option{-symbolic} or @option{-shared} be used instead.
12552169689Skan
12553169689Skan@item -Qy
12554169689Skan@opindex Qy
12555169689SkanIdentify the versions of each tool used by the compiler, in a
12556169689Skan@code{.ident} assembler directive in the output.
12557169689Skan
12558169689Skan@item -Qn
12559169689Skan@opindex Qn
12560169689SkanRefrain from adding @code{.ident} directives to the output file (this is
12561169689Skanthe default).
12562169689Skan
12563169689Skan@item -YP,@var{dirs}
12564169689Skan@opindex YP
12565169689SkanSearch the directories @var{dirs}, and no others, for libraries
12566169689Skanspecified with @option{-l}.
12567169689Skan
12568169689Skan@item -Ym,@var{dir}
12569169689Skan@opindex Ym
12570169689SkanLook in the directory @var{dir} to find the M4 preprocessor.
12571169689SkanThe assembler uses this option.
12572169689Skan@c This is supposed to go with a -Yd for predefined M4 macro files, but
12573169689Skan@c the generic assembler that comes with Solaris takes just -Ym.
12574169689Skan@end table
12575169689Skan
12576169689Skan@node TMS320C3x/C4x Options
12577169689Skan@subsection TMS320C3x/C4x Options
12578169689Skan@cindex TMS320C3x/C4x Options
12579169689Skan
12580169689SkanThese @samp{-m} options are defined for TMS320C3x/C4x implementations:
12581169689Skan
12582169689Skan@table @gcctabopt
12583169689Skan
12584169689Skan@item -mcpu=@var{cpu_type}
12585169689Skan@opindex mcpu
12586169689SkanSet the instruction set, register set, and instruction scheduling
12587169689Skanparameters for machine type @var{cpu_type}.  Supported values for
12588169689Skan@var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
12589169689Skan@samp{c44}.  The default is @samp{c40} to generate code for the
12590169689SkanTMS320C40.
12591169689Skan
12592169689Skan@item -mbig-memory
12593169689Skan@itemx -mbig
12594169689Skan@itemx -msmall-memory
12595169689Skan@itemx -msmall
12596169689Skan@opindex mbig-memory
12597169689Skan@opindex mbig
12598169689Skan@opindex msmall-memory
12599169689Skan@opindex msmall
12600169689SkanGenerates code for the big or small memory model.  The small memory
12601169689Skanmodel assumed that all data fits into one 64K word page.  At run-time
12602169689Skanthe data page (DP) register must be set to point to the 64K page
12603169689Skancontaining the .bss and .data program sections.  The big memory model is
12604169689Skanthe default and requires reloading of the DP register for every direct
12605169689Skanmemory access.
12606169689Skan
12607169689Skan@item -mbk
12608169689Skan@itemx -mno-bk
12609169689Skan@opindex mbk
12610169689Skan@opindex mno-bk
12611169689SkanAllow (disallow) allocation of general integer operands into the block
12612169689Skancount register BK@.
12613169689Skan
12614169689Skan@item -mdb
12615169689Skan@itemx -mno-db
12616169689Skan@opindex mdb
12617169689Skan@opindex mno-db
12618169689SkanEnable (disable) generation of code using decrement and branch,
12619169689SkanDBcond(D), instructions.  This is enabled by default for the C4x.  To be
12620169689Skanon the safe side, this is disabled for the C3x, since the maximum
12621169689Skaniteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than
12622169689Skan@math{2^{23}} times on the C3x?).  Note that GCC will try to reverse a loop so
12623169689Skanthat it can utilize the decrement and branch instruction, but will give
12624169689Skanup if there is more than one memory reference in the loop.  Thus a loop
12625169689Skanwhere the loop counter is decremented can generate slightly more
12626169689Skanefficient code, in cases where the RPTB instruction cannot be utilized.
12627169689Skan
12628169689Skan@item -mdp-isr-reload
12629169689Skan@itemx -mparanoid
12630169689Skan@opindex mdp-isr-reload
12631169689Skan@opindex mparanoid
12632169689SkanForce the DP register to be saved on entry to an interrupt service
12633169689Skanroutine (ISR), reloaded to point to the data section, and restored on
12634169689Skanexit from the ISR@.  This should not be required unless someone has
12635169689Skanviolated the small memory model by modifying the DP register, say within
12636169689Skanan object library.
12637169689Skan
12638169689Skan@item -mmpyi
12639169689Skan@itemx -mno-mpyi
12640169689Skan@opindex mmpyi
12641169689Skan@opindex mno-mpyi
12642169689SkanFor the C3x use the 24-bit MPYI instruction for integer multiplies
12643169689Skaninstead of a library call to guarantee 32-bit results.  Note that if one
12644169689Skanof the operands is a constant, then the multiplication will be performed
12645169689Skanusing shifts and adds.  If the @option{-mmpyi} option is not specified for the C3x,
12646169689Skanthen squaring operations are performed inline instead of a library call.
12647169689Skan
12648169689Skan@item -mfast-fix
12649169689Skan@itemx -mno-fast-fix
12650169689Skan@opindex mfast-fix
12651169689Skan@opindex mno-fast-fix
12652169689SkanThe C3x/C4x FIX instruction to convert a floating point value to an
12653169689Skaninteger value chooses the nearest integer less than or equal to the
12654169689Skanfloating point value rather than to the nearest integer.  Thus if the
12655169689Skanfloating point number is negative, the result will be incorrectly
12656169689Skantruncated an additional code is necessary to detect and correct this
12657169689Skancase.  This option can be used to disable generation of the additional
12658169689Skancode required to correct the result.
12659169689Skan
12660169689Skan@item -mrptb
12661169689Skan@itemx -mno-rptb
12662169689Skan@opindex mrptb
12663169689Skan@opindex mno-rptb
12664169689SkanEnable (disable) generation of repeat block sequences using the RPTB
12665169689Skaninstruction for zero overhead looping.  The RPTB construct is only used
12666169689Skanfor innermost loops that do not call functions or jump across the loop
12667169689Skanboundaries.  There is no advantage having nested RPTB loops due to the
12668169689Skanoverhead required to save and restore the RC, RS, and RE registers.
12669169689SkanThis is enabled by default with @option{-O2}.
12670169689Skan
12671169689Skan@item -mrpts=@var{count}
12672169689Skan@itemx -mno-rpts
12673169689Skan@opindex mrpts
12674169689Skan@opindex mno-rpts
12675169689SkanEnable (disable) the use of the single instruction repeat instruction
12676169689SkanRPTS@.  If a repeat block contains a single instruction, and the loop
12677169689Skancount can be guaranteed to be less than the value @var{count}, GCC will
12678169689Skanemit a RPTS instruction instead of a RPTB@.  If no value is specified,
12679169689Skanthen a RPTS will be emitted even if the loop count cannot be determined
12680169689Skanat compile time.  Note that the repeated instruction following RPTS does
12681169689Skannot have to be reloaded from memory each iteration, thus freeing up the
12682169689SkanCPU buses for operands.  However, since interrupts are blocked by this
12683169689Skaninstruction, it is disabled by default.
12684169689Skan
12685169689Skan@item -mloop-unsigned
12686169689Skan@itemx -mno-loop-unsigned
12687169689Skan@opindex mloop-unsigned
12688169689Skan@opindex mno-loop-unsigned
12689169689SkanThe maximum iteration count when using RPTS and RPTB (and DB on the C40)
12690169689Skanis @math{2^{31} + 1} since these instructions test if the iteration count is
12691169689Skannegative to terminate the loop.  If the iteration count is unsigned
12692169689Skanthere is a possibility than the @math{2^{31} + 1} maximum iteration count may be
12693169689Skanexceeded.  This switch allows an unsigned iteration count.
12694169689Skan
12695169689Skan@item -mti
12696169689Skan@opindex mti
12697169689SkanTry to emit an assembler syntax that the TI assembler (asm30) is happy
12698169689Skanwith.  This also enforces compatibility with the API employed by the TI
12699169689SkanC3x C compiler.  For example, long doubles are passed as structures
12700169689Skanrather than in floating point registers.
12701169689Skan
12702169689Skan@item -mregparm
12703169689Skan@itemx -mmemparm
12704169689Skan@opindex mregparm
12705169689Skan@opindex mmemparm
12706169689SkanGenerate code that uses registers (stack) for passing arguments to functions.
12707169689SkanBy default, arguments are passed in registers where possible rather
12708169689Skanthan by pushing arguments on to the stack.
12709169689Skan
12710169689Skan@item -mparallel-insns
12711169689Skan@itemx -mno-parallel-insns
12712169689Skan@opindex mparallel-insns
12713169689Skan@opindex mno-parallel-insns
12714169689SkanAllow the generation of parallel instructions.  This is enabled by
12715169689Skandefault with @option{-O2}.
12716169689Skan
12717169689Skan@item -mparallel-mpy
12718169689Skan@itemx -mno-parallel-mpy
12719169689Skan@opindex mparallel-mpy
12720169689Skan@opindex mno-parallel-mpy
12721169689SkanAllow the generation of MPY||ADD and MPY||SUB parallel instructions,
12722169689Skanprovided @option{-mparallel-insns} is also specified.  These instructions have
12723169689Skantight register constraints which can pessimize the code generation
12724169689Skanof large functions.
12725169689Skan
12726169689Skan@end table
12727169689Skan
12728169689Skan@node V850 Options
12729169689Skan@subsection V850 Options
12730169689Skan@cindex V850 Options
12731169689Skan
12732169689SkanThese @samp{-m} options are defined for V850 implementations:
12733169689Skan
12734169689Skan@table @gcctabopt
12735169689Skan@item -mlong-calls
12736169689Skan@itemx -mno-long-calls
12737169689Skan@opindex mlong-calls
12738169689Skan@opindex mno-long-calls
12739169689SkanTreat all calls as being far away (near).  If calls are assumed to be
12740169689Skanfar away, the compiler will always load the functions address up into a
12741169689Skanregister, and call indirect through the pointer.
12742169689Skan
12743169689Skan@item -mno-ep
12744169689Skan@itemx -mep
12745169689Skan@opindex mno-ep
12746169689Skan@opindex mep
12747169689SkanDo not optimize (do optimize) basic blocks that use the same index
12748169689Skanpointer 4 or more times to copy pointer into the @code{ep} register, and
12749169689Skanuse the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
12750169689Skanoption is on by default if you optimize.
12751169689Skan
12752169689Skan@item -mno-prolog-function
12753169689Skan@itemx -mprolog-function
12754169689Skan@opindex mno-prolog-function
12755169689Skan@opindex mprolog-function
12756169689SkanDo not use (do use) external functions to save and restore registers
12757169689Skanat the prologue and epilogue of a function.  The external functions
12758169689Skanare slower, but use less code space if more than one function saves
12759169689Skanthe same number of registers.  The @option{-mprolog-function} option
12760169689Skanis on by default if you optimize.
12761169689Skan
12762169689Skan@item -mspace
12763169689Skan@opindex mspace
12764169689SkanTry to make the code as small as possible.  At present, this just turns
12765169689Skanon the @option{-mep} and @option{-mprolog-function} options.
12766169689Skan
12767169689Skan@item -mtda=@var{n}
12768169689Skan@opindex mtda
12769169689SkanPut static or global variables whose size is @var{n} bytes or less into
12770169689Skanthe tiny data area that register @code{ep} points to.  The tiny data
12771169689Skanarea can hold up to 256 bytes in total (128 bytes for byte references).
12772169689Skan
12773169689Skan@item -msda=@var{n}
12774169689Skan@opindex msda
12775169689SkanPut static or global variables whose size is @var{n} bytes or less into
12776169689Skanthe small data area that register @code{gp} points to.  The small data
12777169689Skanarea can hold up to 64 kilobytes.
12778169689Skan
12779169689Skan@item -mzda=@var{n}
12780169689Skan@opindex mzda
12781169689SkanPut static or global variables whose size is @var{n} bytes or less into
12782169689Skanthe first 32 kilobytes of memory.
12783169689Skan
12784169689Skan@item -mv850
12785169689Skan@opindex mv850
12786169689SkanSpecify that the target processor is the V850.
12787169689Skan
12788169689Skan@item -mbig-switch
12789169689Skan@opindex mbig-switch
12790169689SkanGenerate code suitable for big switch tables.  Use this option only if
12791169689Skanthe assembler/linker complain about out of range branches within a switch
12792169689Skantable.
12793169689Skan
12794169689Skan@item -mapp-regs
12795169689Skan@opindex mapp-regs
12796169689SkanThis option will cause r2 and r5 to be used in the code generated by
12797169689Skanthe compiler.  This setting is the default.
12798169689Skan
12799169689Skan@item -mno-app-regs
12800169689Skan@opindex mno-app-regs
12801169689SkanThis option will cause r2 and r5 to be treated as fixed registers.
12802169689Skan
12803169689Skan@item -mv850e1
12804169689Skan@opindex mv850e1
12805169689SkanSpecify that the target processor is the V850E1.  The preprocessor
12806169689Skanconstants @samp{__v850e1__} and @samp{__v850e__} will be defined if
12807169689Skanthis option is used.
12808169689Skan
12809169689Skan@item -mv850e
12810169689Skan@opindex mv850e
12811169689SkanSpecify that the target processor is the V850E@.  The preprocessor
12812169689Skanconstant @samp{__v850e__} will be defined if this option is used.
12813169689Skan
12814169689SkanIf neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
12815169689Skanare defined then a default target processor will be chosen and the
12816169689Skanrelevant @samp{__v850*__} preprocessor constant will be defined.
12817169689Skan
12818169689SkanThe preprocessor constants @samp{__v850} and @samp{__v851__} are always
12819169689Skandefined, regardless of which processor variant is the target.
12820169689Skan
12821169689Skan@item -mdisable-callt
12822169689Skan@opindex mdisable-callt
12823169689SkanThis option will suppress generation of the CALLT instruction for the
12824169689Skanv850e and v850e1 flavors of the v850 architecture.  The default is
12825169689Skan@option{-mno-disable-callt} which allows the CALLT instruction to be used.
12826169689Skan
12827169689Skan@end table
12828169689Skan
12829169689Skan@node VAX Options
12830169689Skan@subsection VAX Options
12831169689Skan@cindex VAX options
12832169689Skan
12833169689SkanThese @samp{-m} options are defined for the VAX:
12834169689Skan
12835169689Skan@table @gcctabopt
12836169689Skan@item -munix
12837169689Skan@opindex munix
12838169689SkanDo not output certain jump instructions (@code{aobleq} and so on)
12839169689Skanthat the Unix assembler for the VAX cannot handle across long
12840169689Skanranges.
12841169689Skan
12842169689Skan@item -mgnu
12843169689Skan@opindex mgnu
12844169689SkanDo output those jump instructions, on the assumption that you
12845169689Skanwill assemble with the GNU assembler.
12846169689Skan
12847169689Skan@item -mg
12848169689Skan@opindex mg
12849169689SkanOutput code for g-format floating point numbers instead of d-format.
12850169689Skan@end table
12851169689Skan
12852169689Skan@node x86-64 Options
12853169689Skan@subsection x86-64 Options
12854169689Skan@cindex x86-64 options
12855169689Skan
12856169689SkanThese are listed under @xref{i386 and x86-64 Options}.
12857169689Skan
12858169689Skan@node Xstormy16 Options
12859169689Skan@subsection Xstormy16 Options
12860169689Skan@cindex Xstormy16 Options
12861169689Skan
12862169689SkanThese options are defined for Xstormy16:
12863169689Skan
12864169689Skan@table @gcctabopt
12865169689Skan@item -msim
12866169689Skan@opindex msim
12867169689SkanChoose startup files and linker script suitable for the simulator.
12868169689Skan@end table
12869169689Skan
1287090075Sobrien@node Xtensa Options
1287190075Sobrien@subsection Xtensa Options
1287290075Sobrien@cindex Xtensa Options
1287390075Sobrien
12874132718SkanThese options are supported for Xtensa targets:
1287590075Sobrien
1287690075Sobrien@table @gcctabopt
12877132718Skan@item -mconst16
12878132718Skan@itemx -mno-const16
12879132718Skan@opindex mconst16
12880132718Skan@opindex mno-const16
12881132718SkanEnable or disable use of @code{CONST16} instructions for loading
12882132718Skanconstant values.  The @code{CONST16} instruction is currently not a
12883132718Skanstandard option from Tensilica.  When enabled, @code{CONST16}
12884132718Skaninstructions are always used in place of the standard @code{L32R}
12885132718Skaninstructions.  The use of @code{CONST16} is enabled by default only if
12886132718Skanthe @code{L32R} instruction is not available.
1288790075Sobrien
1288890075Sobrien@item -mfused-madd
1288990075Sobrien@itemx -mno-fused-madd
1289090075Sobrien@opindex mfused-madd
1289190075Sobrien@opindex mno-fused-madd
1289290075SobrienEnable or disable use of fused multiply/add and multiply/subtract
1289390075Sobrieninstructions in the floating-point option.  This has no effect if the
1289490075Sobrienfloating-point option is not also enabled.  Disabling fused multiply/add
1289590075Sobrienand multiply/subtract instructions forces the compiler to use separate
1289690075Sobrieninstructions for the multiply and add/subtract operations.  This may be
1289790075Sobriendesirable in some cases where strict IEEE 754-compliant results are
1289890075Sobrienrequired: the fused multiply add/subtract instructions do not round the
1289990075Sobrienintermediate result, thereby producing results with @emph{more} bits of
1290090075Sobrienprecision than specified by the IEEE standard.  Disabling fused multiply
1290190075Sobrienadd/subtract instructions also ensures that the program output is not
1290290075Sobriensensitive to the compiler's ability to combine multiply and add/subtract
1290390075Sobrienoperations.
1290490075Sobrien
1290590075Sobrien@item -mtext-section-literals
1290690075Sobrien@itemx -mno-text-section-literals
1290790075Sobrien@opindex mtext-section-literals
1290890075Sobrien@opindex mno-text-section-literals
1290990075SobrienControl the treatment of literal pools.  The default is
1291090075Sobrien@option{-mno-text-section-literals}, which places literals in a separate
1291190075Sobriensection in the output file.  This allows the literal pool to be placed
1291290075Sobrienin a data RAM/ROM, and it also allows the linker to combine literal
1291390075Sobrienpools from separate object files to remove redundant literals and
1291490075Sobrienimprove code size.  With @option{-mtext-section-literals}, the literals
1291590075Sobrienare interspersed in the text section in order to keep them as close as
1291690075Sobrienpossible to their references.  This may be necessary for large assembly
1291790075Sobrienfiles.
1291890075Sobrien
1291990075Sobrien@item -mtarget-align
1292090075Sobrien@itemx -mno-target-align
1292190075Sobrien@opindex mtarget-align
1292290075Sobrien@opindex mno-target-align
1292390075SobrienWhen this option is enabled, GCC instructs the assembler to
1292490075Sobrienautomatically align instructions to reduce branch penalties at the
1292590075Sobrienexpense of some code density.  The assembler attempts to widen density
1292690075Sobrieninstructions to align branch targets and the instructions following call
1292790075Sobrieninstructions.  If there are not enough preceding safe density
1292890075Sobrieninstructions to align a target, no widening will be performed.  The
1292990075Sobriendefault is @option{-mtarget-align}.  These options do not affect the
1293090075Sobrientreatment of auto-aligned instructions like @code{LOOP}, which the
1293190075Sobrienassembler will always align, either by widening density instructions or
1293290075Sobrienby inserting no-op instructions.
1293390075Sobrien
1293490075Sobrien@item -mlongcalls
1293590075Sobrien@itemx -mno-longcalls
1293690075Sobrien@opindex mlongcalls
1293790075Sobrien@opindex mno-longcalls
1293890075SobrienWhen this option is enabled, GCC instructs the assembler to translate
1293990075Sobriendirect calls to indirect calls unless it can determine that the target
1294090075Sobrienof a direct call is in the range allowed by the call instruction.  This
1294190075Sobrientranslation typically occurs for calls to functions in other source
1294290075Sobrienfiles.  Specifically, the assembler translates a direct @code{CALL}
1294390075Sobrieninstruction into an @code{L32R} followed by a @code{CALLX} instruction.
1294490075SobrienThe default is @option{-mno-longcalls}.  This option should be used in
1294590075Sobrienprograms where the call target can potentially be out of range.  This
1294690075Sobrienoption is implemented in the assembler, not the compiler, so the
1294790075Sobrienassembly code generated by GCC will still show direct call
1294890075Sobrieninstructions---look at the disassembled object code to see the actual
1294990075Sobrieninstructions.  Note that the assembler will use an indirect call for
1295090075Sobrienevery cross-file call, not just those that really will be out of range.
1295190075Sobrien@end table
1295290075Sobrien
12953169689Skan@node zSeries Options
12954169689Skan@subsection zSeries Options
12955169689Skan@cindex zSeries options
12956169689Skan
12957169689SkanThese are listed under @xref{S/390 and zSeries Options}.
12958169689Skan
1295990075Sobrien@node Code Gen Options
1296090075Sobrien@section Options for Code Generation Conventions
1296190075Sobrien@cindex code generation conventions
1296290075Sobrien@cindex options, code generation
1296390075Sobrien@cindex run-time options
1296490075Sobrien
1296590075SobrienThese machine-independent options control the interface conventions
1296690075Sobrienused in code generation.
1296790075Sobrien
1296890075SobrienMost of them have both positive and negative forms; the negative form
1296990075Sobrienof @option{-ffoo} would be @option{-fno-foo}.  In the table below, only
1297090075Sobrienone of the forms is listed---the one which is not the default.  You
1297190075Sobriencan figure out the other form by either removing @samp{no-} or adding
1297290075Sobrienit.
1297390075Sobrien
1297490075Sobrien@table @gcctabopt
12975117395Skan@item -fbounds-check
12976117395Skan@opindex fbounds-check
12977117395SkanFor front-ends that support it, generate additional code to check that
12978117395Skanindices used to access arrays are within the declared range.  This is
12979169689Skancurrently only supported by the Java and Fortran front-ends, where
12980117395Skanthis option defaults to true and false respectively.
12981117395Skan
12982117395Skan@item -ftrapv
12983117395Skan@opindex ftrapv
12984117395SkanThis option generates traps for signed overflow on addition, subtraction,
12985117395Skanmultiplication operations.
12986117395Skan
12987132718Skan@item -fwrapv
12988132718Skan@opindex fwrapv
12989132718SkanThis option instructs the compiler to assume that signed arithmetic
12990132718Skanoverflow of addition, subtraction and multiplication wraps around
12991132718Skanusing twos-complement representation.  This flag enables some optimizations
12992169689Skanand disables others.  This option is enabled by default for the Java
12993132718Skanfront-end, as required by the Java language specification.
12994132718Skan
1299590075Sobrien@item -fexceptions
1299690075Sobrien@opindex fexceptions
1299790075SobrienEnable exception handling.  Generates extra code needed to propagate
1299890075Sobrienexceptions.  For some targets, this implies GCC will generate frame
1299990075Sobrienunwind information for all functions, which can produce significant data
1300090075Sobriensize overhead, although it does not affect execution.  If you do not
1300190075Sobrienspecify this option, GCC will enable it by default for languages like
1300290075SobrienC++ which normally require exception handling, and disable it for
1300390075Sobrienlanguages like C that do not normally require it.  However, you may need
1300490075Sobriento enable this option when compiling C code that needs to interoperate
1300590075Sobrienproperly with exception handlers written in C++.  You may also wish to
1300690075Sobriendisable this option if you are compiling older C++ programs that don't
1300790075Sobrienuse exception handling.
1300890075Sobrien
1300990075Sobrien@item -fnon-call-exceptions
1301090075Sobrien@opindex fnon-call-exceptions
1301190075SobrienGenerate code that allows trapping instructions to throw exceptions.
1301290075SobrienNote that this requires platform-specific runtime support that does
1301390075Sobriennot exist everywhere.  Moreover, it only allows @emph{trapping}
1301490075Sobrieninstructions to throw exceptions, i.e.@: memory references or floating
1301590075Sobrienpoint instructions.  It does not allow exceptions to be thrown from
1301690075Sobrienarbitrary signal handlers such as @code{SIGALRM}.
1301790075Sobrien
1301890075Sobrien@item -funwind-tables
1301990075Sobrien@opindex funwind-tables
1302090075SobrienSimilar to @option{-fexceptions}, except that it will just generate any needed
1302190075Sobrienstatic data, but will not affect the generated code in any other way.
1302290075SobrienYou will normally not enable this option; instead, a language processor
1302390075Sobrienthat needs this handling would enable it on your behalf.
1302490075Sobrien
1302590075Sobrien@item -fasynchronous-unwind-tables
13026169689Skan@opindex fasynchronous-unwind-tables
1302790075SobrienGenerate unwind table in dwarf2 format, if supported by target machine.  The
1302890075Sobrientable is exact at each instruction boundary, so it can be used for stack
1302990075Sobrienunwinding from asynchronous events (such as debugger or garbage collector).
1303090075Sobrien
1303190075Sobrien@item -fpcc-struct-return
1303290075Sobrien@opindex fpcc-struct-return
1303390075SobrienReturn ``short'' @code{struct} and @code{union} values in memory like
1303490075Sobrienlonger ones, rather than in registers.  This convention is less
1303590075Sobrienefficient, but it has the advantage of allowing intercallability between
13036103445SkanGCC-compiled files and files compiled with other compilers, particularly
13037103445Skanthe Portable C Compiler (pcc).
1303890075Sobrien
1303990075SobrienThe precise convention for returning structures in memory depends
1304090075Sobrienon the target configuration macros.
1304190075Sobrien
1304290075SobrienShort structures and unions are those whose size and alignment match
1304390075Sobrienthat of some integer type.
1304490075Sobrien
13045103445Skan@strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13046103445Skanswitch is not binary compatible with code compiled with the
13047103445Skan@option{-freg-struct-return} switch.
13048103445SkanUse it to conform to a non-default application binary interface.
13049103445Skan
1305090075Sobrien@item -freg-struct-return
1305190075Sobrien@opindex freg-struct-return
1305290075SobrienReturn @code{struct} and @code{union} values in registers when possible.
1305390075SobrienThis is more efficient for small structures than
1305490075Sobrien@option{-fpcc-struct-return}.
1305590075Sobrien
1305690075SobrienIf you specify neither @option{-fpcc-struct-return} nor
1305790075Sobrien@option{-freg-struct-return}, GCC defaults to whichever convention is
1305890075Sobrienstandard for the target.  If there is no standard convention, GCC
1305990075Sobriendefaults to @option{-fpcc-struct-return}, except on targets where GCC is
1306090075Sobrienthe principal compiler.  In those cases, we can choose the standard, and
1306190075Sobrienwe chose the more efficient register return alternative.
1306290075Sobrien
13063103445Skan@strong{Warning:} code compiled with the @option{-freg-struct-return}
13064103445Skanswitch is not binary compatible with code compiled with the
13065103445Skan@option{-fpcc-struct-return} switch.
13066103445SkanUse it to conform to a non-default application binary interface.
13067103445Skan
1306890075Sobrien@item -fshort-enums
1306990075Sobrien@opindex fshort-enums
1307090075SobrienAllocate to an @code{enum} type only as many bytes as it needs for the
1307190075Sobriendeclared range of possible values.  Specifically, the @code{enum} type
1307290075Sobrienwill be equivalent to the smallest integer type which has enough room.
1307390075Sobrien
13074103445Skan@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13075103445Skancode that is not binary compatible with code generated without that switch.
13076103445SkanUse it to conform to a non-default application binary interface.
13077103445Skan
1307890075Sobrien@item -fshort-double
1307990075Sobrien@opindex fshort-double
1308090075SobrienUse the same size for @code{double} as for @code{float}.
1308190075Sobrien
13082103445Skan@strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
13083103445Skancode that is not binary compatible with code generated without that switch.
13084103445SkanUse it to conform to a non-default application binary interface.
13085103445Skan
13086103445Skan@item -fshort-wchar
13087103445Skan@opindex fshort-wchar
13088103445SkanOverride the underlying type for @samp{wchar_t} to be @samp{short
13089103445Skanunsigned int} instead of the default for the target.  This option is
13090103445Skanuseful for building programs to run under WINE@.
13091103445Skan
13092103445Skan@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13093103445Skancode that is not binary compatible with code generated without that switch.
13094103445SkanUse it to conform to a non-default application binary interface.
13095103445Skan
1309690075Sobrien@item -fno-common
1309790075Sobrien@opindex fno-common
1309890075SobrienIn C, allocate even uninitialized global variables in the data section of the
1309990075Sobrienobject file, rather than generating them as common blocks.  This has the
1310090075Sobrieneffect that if the same variable is declared (without @code{extern}) in
1310190075Sobrientwo different compilations, you will get an error when you link them.
1310290075SobrienThe only reason this might be useful is if you wish to verify that the
1310390075Sobrienprogram will work on other systems which always work this way.
1310490075Sobrien
1310590075Sobrien@item -fno-ident
1310690075Sobrien@opindex fno-ident
1310790075SobrienIgnore the @samp{#ident} directive.
1310890075Sobrien
1310990075Sobrien@item -finhibit-size-directive
1311090075Sobrien@opindex finhibit-size-directive
1311190075SobrienDon't output a @code{.size} assembler directive, or anything else that
1311290075Sobrienwould cause trouble if the function is split in the middle, and the
1311390075Sobrientwo halves are placed at locations far apart in memory.  This option is
1311490075Sobrienused when compiling @file{crtstuff.c}; you should not need to use it
1311590075Sobrienfor anything else.
1311690075Sobrien
1311790075Sobrien@item -fverbose-asm
1311890075Sobrien@opindex fverbose-asm
1311990075SobrienPut extra commentary information in the generated assembly code to
1312090075Sobrienmake it more readable.  This option is generally only of use to those
1312190075Sobrienwho actually need to read the generated assembly code (perhaps while
1312290075Sobriendebugging the compiler itself).
1312390075Sobrien
1312490075Sobrien@option{-fno-verbose-asm}, the default, causes the
1312590075Sobrienextra information to be omitted and is useful when comparing two assembler
1312690075Sobrienfiles.
1312790075Sobrien
1312890075Sobrien@item -fpic
1312990075Sobrien@opindex fpic
1313090075Sobrien@cindex global offset table
1313190075Sobrien@cindex PIC
1313290075SobrienGenerate position-independent code (PIC) suitable for use in a shared
1313390075Sobrienlibrary, if supported for the target machine.  Such code accesses all
1313490075Sobrienconstant addresses through a global offset table (GOT)@.  The dynamic
1313590075Sobrienloader resolves the GOT entries when the program starts (the dynamic
1313690075Sobrienloader is not part of GCC; it is part of the operating system).  If
1313790075Sobrienthe GOT size for the linked executable exceeds a machine-specific
1313890075Sobrienmaximum size, you get an error message from the linker indicating that
1313990075Sobrien@option{-fpic} does not work; in that case, recompile with @option{-fPIC}
13140132718Skaninstead.  (These maximums are 8k on the SPARC and 32k
1314190075Sobrienon the m68k and RS/6000.  The 386 has no such limit.)
1314290075Sobrien
1314390075SobrienPosition-independent code requires special support, and therefore works
1314490075Sobrienonly on certain machines.  For the 386, GCC supports PIC for System V
1314590075Sobrienbut not for the Sun 386i.  Code generated for the IBM RS/6000 is always
1314690075Sobrienposition-independent.
1314790075Sobrien
13148169689SkanWhen this flag is set, the macros @code{__pic__} and @code{__PIC__}
13149169689Skanare defined to 1.
13150169689Skan
1315190075Sobrien@item -fPIC
1315290075Sobrien@opindex fPIC
1315390075SobrienIf supported for the target machine, emit position-independent code,
1315490075Sobriensuitable for dynamic linking and avoiding any limit on the size of the
13155169689Skanglobal offset table.  This option makes a difference on the m68k,
13156169689SkanPowerPC and SPARC@.
1315790075Sobrien
1315890075SobrienPosition-independent code requires special support, and therefore works
1315990075Sobrienonly on certain machines.
1316090075Sobrien
13161169689SkanWhen this flag is set, the macros @code{__pic__} and @code{__PIC__}
13162169689Skanare defined to 2.
13163169689Skan
13164132718Skan@item -fpie
13165132718Skan@itemx -fPIE
13166132718Skan@opindex fpie
13167132718Skan@opindex fPIE
13168132718SkanThese options are similar to @option{-fpic} and @option{-fPIC}, but
13169132718Skangenerated position independent code can be only linked into executables.
13170132718SkanUsually these options are used when @option{-pie} GCC option will be
13171132718Skanused during linking.
13172132718Skan
13173169689Skan@item -fno-jump-tables
13174169689Skan@opindex fno-jump-tables
13175169689SkanDo not use jump tables for switch statements even where it would be
13176169689Skanmore efficient than other code generation strategies.  This option is
13177169689Skanof use in conjunction with @option{-fpic} or @option{-fPIC} for
13178169689Skanbuilding code which forms part of a dynamic linker and cannot
13179169689Skanreference the address of a jump table.  On some targets, jump tables
13180169689Skando not require a GOT and this option is not needed.
13181169689Skan
1318290075Sobrien@item -ffixed-@var{reg}
1318390075Sobrien@opindex ffixed
1318490075SobrienTreat the register named @var{reg} as a fixed register; generated code
1318590075Sobrienshould never refer to it (except perhaps as a stack pointer, frame
1318690075Sobrienpointer or in some other fixed role).
1318790075Sobrien
1318890075Sobrien@var{reg} must be the name of a register.  The register names accepted
1318990075Sobrienare machine-specific and are defined in the @code{REGISTER_NAMES}
1319090075Sobrienmacro in the machine description macro file.
1319190075Sobrien
1319290075SobrienThis flag does not have a negative form, because it specifies a
1319390075Sobrienthree-way choice.
1319490075Sobrien
1319590075Sobrien@item -fcall-used-@var{reg}
1319690075Sobrien@opindex fcall-used
1319790075SobrienTreat the register named @var{reg} as an allocable register that is
1319890075Sobrienclobbered by function calls.  It may be allocated for temporaries or
1319990075Sobrienvariables that do not live across a call.  Functions compiled this way
1320090075Sobrienwill not save and restore the register @var{reg}.
1320190075Sobrien
1320290075SobrienIt is an error to used this flag with the frame pointer or stack pointer.
1320390075SobrienUse of this flag for other registers that have fixed pervasive roles in
1320490075Sobrienthe machine's execution model will produce disastrous results.
1320590075Sobrien
1320690075SobrienThis flag does not have a negative form, because it specifies a
1320790075Sobrienthree-way choice.
1320890075Sobrien
1320990075Sobrien@item -fcall-saved-@var{reg}
1321090075Sobrien@opindex fcall-saved
1321190075SobrienTreat the register named @var{reg} as an allocable register saved by
1321290075Sobrienfunctions.  It may be allocated even for temporaries or variables that
1321390075Sobrienlive across a call.  Functions compiled this way will save and restore
1321490075Sobrienthe register @var{reg} if they use it.
1321590075Sobrien
1321690075SobrienIt is an error to used this flag with the frame pointer or stack pointer.
1321790075SobrienUse of this flag for other registers that have fixed pervasive roles in
1321890075Sobrienthe machine's execution model will produce disastrous results.
1321990075Sobrien
1322090075SobrienA different sort of disaster will result from the use of this flag for
1322190075Sobriena register in which function values may be returned.
1322290075Sobrien
1322390075SobrienThis flag does not have a negative form, because it specifies a
1322490075Sobrienthree-way choice.
1322590075Sobrien
13226169689Skan@item -fpack-struct[=@var{n}]
1322790075Sobrien@opindex fpack-struct
13228169689SkanWithout a value specified, pack all structure members together without
13229169689Skanholes.  When a value is specified (which must be a small power of two), pack
13230169689Skanstructure members according to this value, representing the maximum
13231169689Skanalignment (that is, objects with default alignment requirements larger than
13232169689Skanthis will be output potentially unaligned at the next fitting location.
1323390075Sobrien
13234103445Skan@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
13235103445Skancode that is not binary compatible with code generated without that switch.
13236117395SkanAdditionally, it makes the code suboptimal.
13237103445SkanUse it to conform to a non-default application binary interface.
13238103445Skan
1323990075Sobrien@item -finstrument-functions
1324090075Sobrien@opindex finstrument-functions
1324190075SobrienGenerate instrumentation calls for entry and exit to functions.  Just
1324290075Sobrienafter function entry and just before function exit, the following
1324390075Sobrienprofiling functions will be called with the address of the current
1324490075Sobrienfunction and its call site.  (On some platforms,
1324590075Sobrien@code{__builtin_return_address} does not work beyond the current
1324690075Sobrienfunction, so the call site information may not be available to the
1324790075Sobrienprofiling functions otherwise.)
1324890075Sobrien
13249132718Skan@smallexample
1325090075Sobrienvoid __cyg_profile_func_enter (void *this_fn,
1325190075Sobrien                               void *call_site);
1325290075Sobrienvoid __cyg_profile_func_exit  (void *this_fn,
1325390075Sobrien                               void *call_site);
13254132718Skan@end smallexample
1325590075Sobrien
1325690075SobrienThe first argument is the address of the start of the current function,
1325790075Sobrienwhich may be looked up exactly in the symbol table.
1325890075Sobrien
13259169689SkanThis instrumentation is also done for functions expanded inline in other
13260169689Skanfunctions.  The profiling calls will indicate where, conceptually, the
13261169689Skaninline function is entered and exited.  This means that addressable
13262169689Skanversions of such functions must be available.  If all your uses of a
13263169689Skanfunction are expanded inline, this may mean an additional expansion of
13264169689Skancode size.  If you use @samp{extern inline} in your C code, an
13265169689Skanaddressable version of such functions must be provided.  (This is
13266169689Skannormally the case anyways, but if you get lucky and the optimizer always
13267169689Skanexpands the functions inline, you might have gotten away without
13268169689Skanproviding static copies.)
1326990075Sobrien
1327090075SobrienA function may be given the attribute @code{no_instrument_function}, in
1327190075Sobrienwhich case this instrumentation will not be done.  This can be used, for
1327290075Sobrienexample, for the profiling functions listed above, high-priority
1327390075Sobrieninterrupt routines, and any functions from which the profiling functions
1327490075Sobriencannot safely be called (perhaps signal handlers, if the profiling
1327590075Sobrienroutines generate output or allocate memory).
1327690075Sobrien
1327790075Sobrien@item -fstack-check
1327890075Sobrien@opindex fstack-check
1327990075SobrienGenerate code to verify that you do not go beyond the boundary of the
1328090075Sobrienstack.  You should specify this flag if you are running in an
1328190075Sobrienenvironment with multiple threads, but only rarely need to specify it in
1328290075Sobriena single-threaded environment since stack overflow is automatically
1328390075Sobriendetected on nearly all systems if there is only one stack.
1328490075Sobrien
1328590075SobrienNote that this switch does not actually cause checking to be done; the
1328690075Sobrienoperating system must do that.  The switch causes generation of code
1328790075Sobriento ensure that the operating system sees the stack being extended.
1328890075Sobrien
1328990075Sobrien@item -fstack-limit-register=@var{reg}
1329090075Sobrien@itemx -fstack-limit-symbol=@var{sym}
1329190075Sobrien@itemx -fno-stack-limit
1329290075Sobrien@opindex fstack-limit-register
1329390075Sobrien@opindex fstack-limit-symbol
1329490075Sobrien@opindex fno-stack-limit
1329590075SobrienGenerate code to ensure that the stack does not grow beyond a certain value,
1329690075Sobrieneither the value of a register or the address of a symbol.  If the stack
1329790075Sobrienwould grow beyond the value, a signal is raised.  For most targets,
1329890075Sobrienthe signal is raised before the stack overruns the boundary, so
1329990075Sobrienit is possible to catch the signal without taking special precautions.
1330090075Sobrien
1330190075SobrienFor instance, if the stack starts at absolute address @samp{0x80000000}
1330290075Sobrienand grows downwards, you can use the flags
1330390075Sobrien@option{-fstack-limit-symbol=__stack_limit} and
1330490075Sobrien@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
1330590075Sobrienof 128KB@.  Note that this may only work with the GNU linker.
1330690075Sobrien
1330790075Sobrien@cindex aliasing of parameters
1330890075Sobrien@cindex parameters, aliased
1330990075Sobrien@item -fargument-alias
1331090075Sobrien@itemx -fargument-noalias
1331190075Sobrien@itemx -fargument-noalias-global
13312169689Skan@itemx -fargument-noalias-anything
1331390075Sobrien@opindex fargument-alias
1331490075Sobrien@opindex fargument-noalias
1331590075Sobrien@opindex fargument-noalias-global
13316169689Skan@opindex fargument-noalias-anything
1331790075SobrienSpecify the possible relationships among parameters and between
1331890075Sobrienparameters and global data.
1331990075Sobrien
1332090075Sobrien@option{-fargument-alias} specifies that arguments (parameters) may
1332190075Sobrienalias each other and may alias global storage.@*
1332290075Sobrien@option{-fargument-noalias} specifies that arguments do not alias
1332390075Sobrieneach other, but may alias global storage.@*
1332490075Sobrien@option{-fargument-noalias-global} specifies that arguments do not
1332590075Sobrienalias each other and do not alias global storage.
13326169689Skan@option{-fargument-noalias-anything} specifies that arguments do not
13327169689Skanalias any other storage.
1332890075Sobrien
1332990075SobrienEach language will automatically use whatever option is required by
1333090075Sobrienthe language standard.  You should not need to use these options yourself.
1333190075Sobrien
1333290075Sobrien@item -fleading-underscore
1333390075Sobrien@opindex fleading-underscore
1333490075SobrienThis option and its counterpart, @option{-fno-leading-underscore}, forcibly
1333590075Sobrienchange the way C symbols are represented in the object file.  One use
1333690075Sobrienis to help link with legacy assembly code.
1333790075Sobrien
13338103445Skan@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
13339103445Skangenerate code that is not binary compatible with code generated without that
13340103445Skanswitch.  Use it to conform to a non-default application binary interface.
13341103445SkanNot all targets provide complete support for this switch.
13342117395Skan
13343117395Skan@item -ftls-model=@var{model}
13344117395SkanAlter the thread-local storage model to be used (@pxref{Thread-Local}).
13345117395SkanThe @var{model} argument should be one of @code{global-dynamic},
13346117395Skan@code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
13347117395Skan
13348117395SkanThe default without @option{-fpic} is @code{initial-exec}; with
13349117395Skan@option{-fpic} the default is @code{global-dynamic}.
13350169689Skan
13351169689Skan@item -fvisibility=@var{default|internal|hidden|protected}
13352169689Skan@opindex fvisibility
13353169689SkanSet the default ELF image symbol visibility to the specified option---all
13354169689Skansymbols will be marked with this unless overridden within the code.
13355169689SkanUsing this feature can very substantially improve linking and
13356169689Skanload times of shared object libraries, produce more optimized
13357169689Skancode, provide near-perfect API export and prevent symbol clashes.
13358169689SkanIt is @strong{strongly} recommended that you use this in any shared objects
13359169689Skanyou distribute.
13360169689Skan
13361169689SkanDespite the nomenclature, @code{default} always means public ie;
13362169689Skanavailable to be linked against from outside the shared object.
13363169689Skan@code{protected} and @code{internal} are pretty useless in real-world
13364169689Skanusage so the only other commonly used option will be @code{hidden}.
13365169689SkanThe default if @option{-fvisibility} isn't specified is
13366169689Skan@code{default}, i.e., make every
13367169689Skansymbol public---this causes the same behavior as previous versions of
13368169689SkanGCC@.
13369169689Skan
13370169689SkanA good explanation of the benefits offered by ensuring ELF
13371169689Skansymbols have the correct visibility is given by ``How To Write
13372169689SkanShared Libraries'' by Ulrich Drepper (which can be found at
13373169689Skan@w{@uref{http://people.redhat.com/~drepper/}})---however a superior
13374169689Skansolution made possible by this option to marking things hidden when
13375169689Skanthe default is public is to make the default hidden and mark things
13376169689Skanpublic.  This is the norm with DLL's on Windows and with @option{-fvisibility=hidden}
13377169689Skanand @code{__attribute__ ((visibility("default")))} instead of
13378169689Skan@code{__declspec(dllexport)} you get almost identical semantics with
13379169689Skanidentical syntax.  This is a great boon to those working with
13380169689Skancross-platform projects.
13381169689Skan
13382169689SkanFor those adding visibility support to existing code, you may find
13383169689Skan@samp{#pragma GCC visibility} of use.  This works by you enclosing
13384169689Skanthe declarations you wish to set visibility for with (for example)
13385169689Skan@samp{#pragma GCC visibility push(hidden)} and
13386169689Skan@samp{#pragma GCC visibility pop}.
13387169689SkanBear in mind that symbol visibility should be viewed @strong{as
13388169689Skanpart of the API interface contract} and thus all new code should
13389169689Skanalways specify visibility when it is not the default ie; declarations
13390169689Skanonly for use within the local DSO should @strong{always} be marked explicitly
13391169689Skanas hidden as so to avoid PLT indirection overheads---making this
13392169689Skanabundantly clear also aids readability and self-documentation of the code.
13393169689SkanNote that due to ISO C++ specification requirements, operator new and
13394169689Skanoperator delete must always be of default visibility.
13395169689Skan
13396169689SkanBe aware that headers from outside your project, in particular system
13397169689Skanheaders and headers from any other library you use, may not be
13398169689Skanexpecting to be compiled with visibility other than the default.  You
13399169689Skanmay need to explicitly say @samp{#pragma GCC visibility push(default)}
13400169689Skanbefore including any such headers.
13401169689Skan
13402169689Skan@samp{extern} declarations are not affected by @samp{-fvisibility}, so
13403169689Skana lot of code can be recompiled with @samp{-fvisibility=hidden} with
13404169689Skanno modifications.  However, this means that calls to @samp{extern}
13405169689Skanfunctions with no explicit visibility will use the PLT, so it is more
13406169689Skaneffective to use @samp{__attribute ((visibility))} and/or
13407169689Skan@samp{#pragma GCC visibility} to tell the compiler which @samp{extern}
13408169689Skandeclarations should be treated as hidden.
13409169689Skan
13410169689SkanNote that @samp{-fvisibility} does affect C++ vague linkage
13411169689Skanentities. This means that, for instance, an exception class that will
13412169689Skanbe thrown between DSOs must be explicitly marked with default
13413169689Skanvisibility so that the @samp{type_info} nodes will be unified between
13414169689Skanthe DSOs.
13415169689Skan
13416169689SkanAn overview of these techniques, their benefits and how to use them
13417169689Skanis at @w{@uref{http://gcc.gnu.org/wiki/Visibility}}.
13418169689Skan
1341990075Sobrien@end table
1342090075Sobrien
1342190075Sobrien@c man end
1342290075Sobrien
1342390075Sobrien@node Environment Variables
1342490075Sobrien@section Environment Variables Affecting GCC
1342590075Sobrien@cindex environment variables
1342690075Sobrien
1342790075Sobrien@c man begin ENVIRONMENT
1342890075SobrienThis section describes several environment variables that affect how GCC
1342990075Sobrienoperates.  Some of them work by specifying directories or prefixes to use
1343090075Sobrienwhen searching for various kinds of files.  Some are used to specify other
1343190075Sobrienaspects of the compilation environment.
1343290075Sobrien
1343390075SobrienNote that you can also specify places to search using options such as
1343490075Sobrien@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
1343590075Sobrientake precedence over places specified using environment variables, which
1343690075Sobrienin turn take precedence over those specified by the configuration of GCC@.
1343790075Sobrien@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
1343890075SobrienGNU Compiler Collection (GCC) Internals}.
1343990075Sobrien
1344090075Sobrien@table @env
1344190075Sobrien@item LANG
1344290075Sobrien@itemx LC_CTYPE
1344390075Sobrien@c @itemx LC_COLLATE
1344490075Sobrien@itemx LC_MESSAGES
1344590075Sobrien@c @itemx LC_MONETARY
1344690075Sobrien@c @itemx LC_NUMERIC
1344790075Sobrien@c @itemx LC_TIME
1344890075Sobrien@itemx LC_ALL
1344990075Sobrien@findex LANG
1345090075Sobrien@findex LC_CTYPE
1345190075Sobrien@c @findex LC_COLLATE
1345290075Sobrien@findex LC_MESSAGES
1345390075Sobrien@c @findex LC_MONETARY
1345490075Sobrien@c @findex LC_NUMERIC
1345590075Sobrien@c @findex LC_TIME
1345690075Sobrien@findex LC_ALL
1345790075Sobrien@cindex locale
1345890075SobrienThese environment variables control the way that GCC uses
1345990075Sobrienlocalization information that allow GCC to work with different
1346090075Sobriennational conventions.  GCC inspects the locale categories
1346190075Sobrien@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
1346290075Sobrienso.  These locale categories can be set to any value supported by your
13463146895Skaninstallation.  A typical value is @samp{en_GB.UTF-8} for English in the United
13464146895SkanKingdom encoded in UTF-8.
1346590075Sobrien
1346690075SobrienThe @env{LC_CTYPE} environment variable specifies character
1346790075Sobrienclassification.  GCC uses it to determine the character boundaries in
1346890075Sobriena string; this is needed for some multibyte encodings that contain quote
1346990075Sobrienand escape characters that would otherwise be interpreted as a string
1347090075Sobrienend or escape.
1347190075Sobrien
1347290075SobrienThe @env{LC_MESSAGES} environment variable specifies the language to
1347390075Sobrienuse in diagnostic messages.
1347490075Sobrien
1347590075SobrienIf the @env{LC_ALL} environment variable is set, it overrides the value
1347690075Sobrienof @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
1347790075Sobrienand @env{LC_MESSAGES} default to the value of the @env{LANG}
1347890075Sobrienenvironment variable.  If none of these variables are set, GCC
1347990075Sobriendefaults to traditional C English behavior.
1348090075Sobrien
1348190075Sobrien@item TMPDIR
1348290075Sobrien@findex TMPDIR
1348390075SobrienIf @env{TMPDIR} is set, it specifies the directory to use for temporary
1348490075Sobrienfiles.  GCC uses temporary files to hold the output of one stage of
1348590075Sobriencompilation which is to be used as input to the next stage: for example,
1348690075Sobrienthe output of the preprocessor, which is the input to the compiler
1348790075Sobrienproper.
1348890075Sobrien
1348990075Sobrien@item GCC_EXEC_PREFIX
1349090075Sobrien@findex GCC_EXEC_PREFIX
1349190075SobrienIf @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
1349290075Sobriennames of the subprograms executed by the compiler.  No slash is added
1349390075Sobrienwhen this prefix is combined with the name of a subprogram, but you can
1349490075Sobrienspecify a prefix that ends with a slash if you wish.
1349590075Sobrien
1349690075SobrienIf @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
1349790075Sobrienan appropriate prefix to use based on the pathname it was invoked with.
1349890075Sobrien
1349990075SobrienIf GCC cannot find the subprogram using the specified prefix, it
1350090075Sobrientries looking in the usual places for the subprogram.
1350190075Sobrien
1350290075SobrienThe default value of @env{GCC_EXEC_PREFIX} is
13503132718Skan@file{@var{prefix}/lib/gcc/} where @var{prefix} is the value
1350490075Sobrienof @code{prefix} when you ran the @file{configure} script.
1350590075Sobrien
1350690075SobrienOther prefixes specified with @option{-B} take precedence over this prefix.
1350790075Sobrien
1350890075SobrienThis prefix is also used for finding files such as @file{crt0.o} that are
1350990075Sobrienused for linking.
1351090075Sobrien
1351190075SobrienIn addition, the prefix is used in an unusual way in finding the
1351290075Sobriendirectories to search for header files.  For each of the standard
13513132718Skandirectories whose name normally begins with @samp{/usr/local/lib/gcc}
1351490075Sobrien(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
1351590075Sobrienreplacing that beginning with the specified prefix to produce an
1351690075Sobrienalternate directory name.  Thus, with @option{-Bfoo/}, GCC will search
1351790075Sobrien@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
1351890075SobrienThese alternate directories are searched first; the standard directories
1351990075Sobriencome next.
1352090075Sobrien
1352190075Sobrien@item COMPILER_PATH
1352290075Sobrien@findex COMPILER_PATH
1352390075SobrienThe value of @env{COMPILER_PATH} is a colon-separated list of
1352490075Sobriendirectories, much like @env{PATH}.  GCC tries the directories thus
1352590075Sobrienspecified when searching for subprograms, if it can't find the
1352690075Sobriensubprograms using @env{GCC_EXEC_PREFIX}.
1352790075Sobrien
1352890075Sobrien@item LIBRARY_PATH
1352990075Sobrien@findex LIBRARY_PATH
1353090075SobrienThe value of @env{LIBRARY_PATH} is a colon-separated list of
1353190075Sobriendirectories, much like @env{PATH}.  When configured as a native compiler,
1353290075SobrienGCC tries the directories thus specified when searching for special
1353390075Sobrienlinker files, if it can't find them using @env{GCC_EXEC_PREFIX}.  Linking
1353490075Sobrienusing GCC also uses these directories when searching for ordinary
1353590075Sobrienlibraries for the @option{-l} option (but directories specified with
1353690075Sobrien@option{-L} come first).
1353790075Sobrien
1353890075Sobrien@item LANG
1353990075Sobrien@findex LANG
1354090075Sobrien@cindex locale definition
1354190075SobrienThis variable is used to pass locale information to the compiler.  One way in
1354290075Sobrienwhich this information is used is to determine the character set to be used
1354390075Sobrienwhen character literals, string literals and comments are parsed in C and C++.
1354490075SobrienWhen the compiler is configured to allow multibyte characters,
1354590075Sobrienthe following values for @env{LANG} are recognized:
1354690075Sobrien
1354790075Sobrien@table @samp
1354890075Sobrien@item C-JIS
1354990075SobrienRecognize JIS characters.
1355090075Sobrien@item C-SJIS
1355190075SobrienRecognize SJIS characters.
1355290075Sobrien@item C-EUCJP
1355390075SobrienRecognize EUCJP characters.
1355490075Sobrien@end table
1355590075Sobrien
1355690075SobrienIf @env{LANG} is not defined, or if it has some other value, then the
1355790075Sobriencompiler will use mblen and mbtowc as defined by the default locale to
1355890075Sobrienrecognize and translate multibyte characters.
1355990075Sobrien@end table
1356090075Sobrien
1356196263Sobrien@noindent
1356296263SobrienSome additional environments variables affect the behavior of the
1356396263Sobrienpreprocessor.
1356496263Sobrien
1356596263Sobrien@include cppenv.texi
1356696263Sobrien
1356790075Sobrien@c man end
1356890075Sobrien
13569132718Skan@node Precompiled Headers
13570132718Skan@section Using Precompiled Headers
13571132718Skan@cindex precompiled headers
13572132718Skan@cindex speed of compilation
13573132718Skan
13574132718SkanOften large projects have many header files that are included in every
13575132718Skansource file.  The time the compiler takes to process these header files
13576132718Skanover and over again can account for nearly all of the time required to
13577132718Skanbuild the project.  To make builds faster, GCC allows users to
13578132718Skan`precompile' a header file; then, if builds can use the precompiled
13579132718Skanheader file they will be much faster.
13580132718Skan
13581132718SkanTo create a precompiled header file, simply compile it as you would any
13582132718Skanother file, if necessary using the @option{-x} option to make the driver
13583132718Skantreat it as a C or C++ header file.  You will probably want to use a
13584132718Skantool like @command{make} to keep the precompiled header up-to-date when
13585132718Skanthe headers it contains change.
13586132718Skan
13587132718SkanA precompiled header file will be searched for when @code{#include} is
13588132718Skanseen in the compilation.  As it searches for the included file
13589132718Skan(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
13590132718Skancompiler looks for a precompiled header in each directory just before it
13591132718Skanlooks for the include file in that directory.  The name searched for is
13592132718Skanthe name specified in the @code{#include} with @samp{.gch} appended.  If
13593132718Skanthe precompiled header file can't be used, it is ignored.
13594132718Skan
13595132718SkanFor instance, if you have @code{#include "all.h"}, and you have
13596132718Skan@file{all.h.gch} in the same directory as @file{all.h}, then the
13597132718Skanprecompiled header file will be used if possible, and the original
13598132718Skanheader will be used otherwise.
13599132718Skan
13600132718SkanAlternatively, you might decide to put the precompiled header file in a
13601132718Skandirectory and use @option{-I} to ensure that directory is searched
13602132718Skanbefore (or instead of) the directory containing the original header.
13603132718SkanThen, if you want to check that the precompiled header file is always
13604132718Skanused, you can put a file of the same name as the original header in this
13605132718Skandirectory containing an @code{#error} command.
13606132718Skan
13607132718SkanThis also works with @option{-include}.  So yet another way to use
13608132718Skanprecompiled headers, good for projects not designed with precompiled
13609132718Skanheader files in mind, is to simply take most of the header files used by
13610132718Skana project, include them from another header file, precompile that header
13611132718Skanfile, and @option{-include} the precompiled header.  If the header files
13612132718Skanhave guards against multiple inclusion, they will be skipped because
13613132718Skanthey've already been included (in the precompiled header).
13614132718Skan
13615132718SkanIf you need to precompile the same header file for different
13616132718Skanlanguages, targets, or compiler options, you can instead make a
13617132718Skan@emph{directory} named like @file{all.h.gch}, and put each precompiled
13618169689Skanheader in the directory, perhaps using @option{-o}.  It doesn't matter
13619169689Skanwhat you call the files in the directory, every precompiled header in
13620169689Skanthe directory will be considered.  The first precompiled header
13621169689Skanencountered in the directory that is valid for this compilation will
13622169689Skanbe used; they're searched in no particular order.
13623132718Skan
13624132718SkanThere are many other possibilities, limited only by your imagination,
13625132718Skangood sense, and the constraints of your build system.
13626132718Skan
13627132718SkanA precompiled header file can be used only when these conditions apply:
13628132718Skan
13629132718Skan@itemize
13630132718Skan@item
13631132718SkanOnly one precompiled header can be used in a particular compilation.
13632169689Skan
13633132718Skan@item
13634132718SkanA precompiled header can't be used once the first C token is seen.  You
13635132718Skancan have preprocessor directives before a precompiled header; you can
13636132718Skaneven include a precompiled header from inside another header, so long as
13637132718Skanthere are no C tokens before the @code{#include}.
13638169689Skan
13639132718Skan@item
13640132718SkanThe precompiled header file must be produced for the same language as
13641132718Skanthe current compilation.  You can't use a C precompiled header for a C++
13642132718Skancompilation.
13643169689Skan
13644132718Skan@item
13645169689SkanThe precompiled header file must have been produced by the same compiler
13646169689Skanbinary as the current compilation is using.
13647169689Skan
13648132718Skan@item
13649169689SkanAny macros defined before the precompiled header is included must
13650169689Skaneither be defined in the same way as when the precompiled header was
13651169689Skangenerated, or must not affect the precompiled header, which usually
13652169689Skanmeans that they don't appear in the precompiled header at all.
13653169689Skan
13654169689SkanThe @option{-D} option is one way to define a macro before a
13655169689Skanprecompiled header is included; using a @code{#define} can also do it.
13656169689SkanThere are also some options that define macros implicitly, like
13657169689Skan@option{-O} and @option{-Wdeprecated}; the same rule applies to macros
13658169689Skandefined this way.
13659169689Skan
13660169689Skan@item If debugging information is output when using the precompiled
13661169689Skanheader, using @option{-g} or similar, the same kind of debugging information
13662169689Skanmust have been output when building the precompiled header.  However,
13663169689Skana precompiled header built using @option{-g} can be used in a compilation
13664169689Skanwhen no debugging information is being output.
13665169689Skan
13666169689Skan@item The same @option{-m} options must generally be used when building
13667169689Skanand using the precompiled header.  @xref{Submodel Options},
13668169689Skanfor any cases where this rule is relaxed.
13669169689Skan
13670169689Skan@item Each of the following options must be the same when building and using
13671169689Skanthe precompiled header:
13672169689Skan
13673169689Skan@gccoptlist{-fexceptions -funit-at-a-time}
13674169689Skan
13675132718Skan@item
13676169689SkanSome other command-line options starting with @option{-f},
13677169689Skan@option{-p}, or @option{-O} must be defined in the same way as when
13678169689Skanthe precompiled header was generated.  At present, it's not clear
13679169689Skanwhich options are safe to change and which are not; the safest choice
13680169689Skanis to use exactly the same options when generating and using the
13681169689Skanprecompiled header.  The following are known to be safe:
13682169689Skan
13683169689Skan@gccoptlist{-fmessage-length= -fpreprocessed
13684169689Skan-fsched-interblock -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous
13685169689Skan-fsched-verbose=<number> -fschedule-insns -fvisibility=
13686169689Skan-pedantic-errors}
13687169689Skan
13688132718Skan@end itemize
13689132718Skan
13690169689SkanFor all of these except the last, the compiler will automatically
13691169689Skanignore the precompiled header if the conditions aren't met.  If you
13692169689Skanfind an option combination that doesn't work and doesn't cause the
13693169689Skanprecompiled header to be ignored, please consider filing a bug report,
13694169689Skansee @ref{Bugs}.
13695132718Skan
13696169689SkanIf you do use differing options when generating and using the
13697169689Skanprecompiled header, the actual behavior will be a mixture of the
13698169689Skanbehavior for the options.  For instance, if you use @option{-g} to
13699169689Skangenerate the precompiled header but not when using it, you may or may
13700169689Skannot get debugging information for routines in the precompiled header.
13701169689Skan
1370290075Sobrien@node Running Protoize
1370390075Sobrien@section Running Protoize
1370490075Sobrien
1370590075SobrienThe program @code{protoize} is an optional part of GCC@.  You can use
1370690075Sobrienit to add prototypes to a program, thus converting the program to ISO
1370790075SobrienC in one respect.  The companion program @code{unprotoize} does the
1370890075Sobrienreverse: it removes argument types from any prototypes that are found.
1370990075Sobrien
1371090075SobrienWhen you run these programs, you must specify a set of source files as
1371190075Sobriencommand line arguments.  The conversion programs start out by compiling
1371290075Sobrienthese files to see what functions they define.  The information gathered
1371390075Sobrienabout a file @var{foo} is saved in a file named @file{@var{foo}.X}.
1371490075Sobrien
1371590075SobrienAfter scanning comes actual conversion.  The specified files are all
1371690075Sobrieneligible to be converted; any files they include (whether sources or
1371790075Sobrienjust headers) are eligible as well.
1371890075Sobrien
1371990075SobrienBut not all the eligible files are converted.  By default,
1372090075Sobrien@code{protoize} and @code{unprotoize} convert only source and header
1372190075Sobrienfiles in the current directory.  You can specify additional directories
1372290075Sobrienwhose files should be converted with the @option{-d @var{directory}}
1372390075Sobrienoption.  You can also specify particular files to exclude with the
1372490075Sobrien@option{-x @var{file}} option.  A file is converted if it is eligible, its
1372590075Sobriendirectory name matches one of the specified directory names, and its
1372690075Sobrienname within the directory has not been excluded.
1372790075Sobrien
1372890075SobrienBasic conversion with @code{protoize} consists of rewriting most
1372990075Sobrienfunction definitions and function declarations to specify the types of
1373090075Sobrienthe arguments.  The only ones not rewritten are those for varargs
1373190075Sobrienfunctions.
1373290075Sobrien
1373390075Sobrien@code{protoize} optionally inserts prototype declarations at the
1373490075Sobrienbeginning of the source file, to make them available for any calls that
1373590075Sobrienprecede the function's definition.  Or it can insert prototype
1373690075Sobriendeclarations with block scope in the blocks where undeclared functions
1373790075Sobrienare called.
1373890075Sobrien
1373990075SobrienBasic conversion with @code{unprotoize} consists of rewriting most
1374090075Sobrienfunction declarations to remove any argument types, and rewriting
1374190075Sobrienfunction definitions to the old-style pre-ISO form.
1374290075Sobrien
1374390075SobrienBoth conversion programs print a warning for any function declaration or
1374490075Sobriendefinition that they can't convert.  You can suppress these warnings
1374590075Sobrienwith @option{-q}.
1374690075Sobrien
1374790075SobrienThe output from @code{protoize} or @code{unprotoize} replaces the
1374890075Sobrienoriginal source file.  The original file is renamed to a name ending
1374990075Sobrienwith @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
1375090075Sobrienwithout the original @samp{.c} suffix).  If the @samp{.save} (@samp{.sav}
1375190075Sobrienfor DOS) file already exists, then the source file is simply discarded.
1375290075Sobrien
1375390075Sobrien@code{protoize} and @code{unprotoize} both depend on GCC itself to
1375490075Sobrienscan the program and collect information about the functions it uses.
1375590075SobrienSo neither of these programs will work until GCC is installed.
1375690075Sobrien
1375790075SobrienHere is a table of the options you can use with @code{protoize} and
1375890075Sobrien@code{unprotoize}.  Each option works with both programs unless
1375990075Sobrienotherwise stated.
1376090075Sobrien
1376190075Sobrien@table @code
1376290075Sobrien@item -B @var{directory}
1376390075SobrienLook for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
1376490075Sobrienusual directory (normally @file{/usr/local/lib}).  This file contains
1376590075Sobrienprototype information about standard system functions.  This option
1376690075Sobrienapplies only to @code{protoize}.
1376790075Sobrien
1376890075Sobrien@item -c @var{compilation-options}
13769117395SkanUse @var{compilation-options} as the options when running @command{gcc} to
1377090075Sobrienproduce the @samp{.X} files.  The special option @option{-aux-info} is
13771117395Skanalways passed in addition, to tell @command{gcc} to write a @samp{.X} file.
1377290075Sobrien
1377390075SobrienNote that the compilation options must be given as a single argument to
1377490075Sobrien@code{protoize} or @code{unprotoize}.  If you want to specify several
13775117395Skan@command{gcc} options, you must quote the entire set of compilation options
1377690075Sobriento make them a single word in the shell.
1377790075Sobrien
13778117395SkanThere are certain @command{gcc} arguments that you cannot use, because they
1377990075Sobrienwould produce the wrong kind of output.  These include @option{-g},
1378090075Sobrien@option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
1378190075Sobrienthe @var{compilation-options}, they are ignored.
1378290075Sobrien
1378390075Sobrien@item -C
1378490075SobrienRename files to end in @samp{.C} (@samp{.cc} for DOS-based file
1378590075Sobriensystems) instead of @samp{.c}.  This is convenient if you are converting
1378690075Sobriena C program to C++.  This option applies only to @code{protoize}.
1378790075Sobrien
1378890075Sobrien@item -g
1378990075SobrienAdd explicit global declarations.  This means inserting explicit
1379090075Sobriendeclarations at the beginning of each source file for each function
1379190075Sobrienthat is called in the file and was not declared.  These declarations
1379290075Sobrienprecede the first function definition that contains a call to an
1379390075Sobrienundeclared function.  This option applies only to @code{protoize}.
1379490075Sobrien
1379590075Sobrien@item -i @var{string}
1379690075SobrienIndent old-style parameter declarations with the string @var{string}.
1379790075SobrienThis option applies only to @code{protoize}.
1379890075Sobrien
1379990075Sobrien@code{unprotoize} converts prototyped function definitions to old-style
1380090075Sobrienfunction definitions, where the arguments are declared between the
1380190075Sobrienargument list and the initial @samp{@{}.  By default, @code{unprotoize}
1380290075Sobrienuses five spaces as the indentation.  If you want to indent with just
1380390075Sobrienone space instead, use @option{-i " "}.
1380490075Sobrien
1380590075Sobrien@item -k
1380690075SobrienKeep the @samp{.X} files.  Normally, they are deleted after conversion
1380790075Sobrienis finished.
1380890075Sobrien
1380990075Sobrien@item -l
1381090075SobrienAdd explicit local declarations.  @code{protoize} with @option{-l} inserts
1381190075Sobriena prototype declaration for each function in each block which calls the
1381290075Sobrienfunction without any declaration.  This option applies only to
1381390075Sobrien@code{protoize}.
1381490075Sobrien
1381590075Sobrien@item -n
1381690075SobrienMake no real changes.  This mode just prints information about the conversions
1381790075Sobrienthat would have been done without @option{-n}.
1381890075Sobrien
1381990075Sobrien@item -N
1382090075SobrienMake no @samp{.save} files.  The original files are simply deleted.
1382190075SobrienUse this option with caution.
1382290075Sobrien
1382390075Sobrien@item -p @var{program}
1382490075SobrienUse the program @var{program} as the compiler.  Normally, the name
1382590075Sobrien@file{gcc} is used.
1382690075Sobrien
1382790075Sobrien@item -q
1382890075SobrienWork quietly.  Most warnings are suppressed.
1382990075Sobrien
1383090075Sobrien@item -v
13831117395SkanPrint the version number, just like @option{-v} for @command{gcc}.
1383290075Sobrien@end table
1383390075Sobrien
1383490075SobrienIf you need special compiler options to compile one of your program's
1383590075Sobriensource files, then you should generate that file's @samp{.X} file
13836117395Skanspecially, by running @command{gcc} on that source file with the
1383790075Sobrienappropriate options and the option @option{-aux-info}.  Then run
1383890075Sobrien@code{protoize} on the entire set of files.  @code{protoize} will use
1383990075Sobrienthe existing @samp{.X} file because it is newer than the source file.
1384090075SobrienFor example:
1384190075Sobrien
13842132718Skan@smallexample
1384390075Sobriengcc -Dfoo=bar file1.c -aux-info file1.X
1384490075Sobrienprotoize *.c
13845132718Skan@end smallexample
1384690075Sobrien
1384790075Sobrien@noindent
1384890075SobrienYou need to include the special files along with the rest in the
1384990075Sobrien@code{protoize} command, even though their @samp{.X} files already
1385090075Sobrienexist, because otherwise they won't get converted.
1385190075Sobrien
1385290075Sobrien@xref{Protoize Caveats}, for more information on how to use
1385390075Sobrien@code{protoize} successfully.
13854