xref: /openbsd-src/gnu/usr.bin/gcc/gcc/doc/invoke.texi (revision d5df9646f8b77083fb7011310e886fd8d6555f32)
1@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2@c 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
3@c This is part of the GCC manual.
4@c For copying conditions, see the file gcc.texi.
5
6@ignore
7@c man begin COPYRIGHT
8Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
91998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
10
11Permission is granted to copy, distribute and/or modify this document
12under the terms of the GNU Free Documentation License, Version 1.2 or
13any later version published by the Free Software Foundation; with the
14Invariant Sections being ``GNU General Public License'' and ``Funding
15Free Software'', the Front-Cover texts being (a) (see below), and with
16the Back-Cover Texts being (b) (see below).  A copy of the license is
17included in the gfdl(7) man page.
18
19(a) The FSF's Front-Cover Text is:
20
21     A GNU Manual
22
23(b) The FSF's Back-Cover Text is:
24
25     You have freedom to copy and modify this GNU Manual, like GNU
26     software.  Copies published by the Free Software Foundation raise
27     funds for GNU development.
28@c man end
29@c Set file name and title for the man page.
30@setfilename gcc
31@settitle GNU project C and C++ compiler
32@c man begin SYNOPSIS
33gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
34    [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
35    [@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
36    [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
37    [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
38    [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
39    [@option{-o} @var{outfile}] @var{infile}@dots{}
40
41Only the most useful options are listed here; see below for the
42remainder.  @samp{g++} accepts mostly the same options as @samp{gcc}.
43@c man end
44@c man begin SEEALSO
45gpl(7), gfdl(7), fsf-funding(7),
46cpp(1), gcov(1), g77(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
47and the Info entries for @file{gcc}, @file{cpp}, @file{g77}, @file{as},
48@file{ld}, @file{binutils} and @file{gdb}.
49@c man end
50@c man begin BUGS
51For instructions on reporting bugs, see
52@w{@uref{http://gcc.gnu.org/bugs.html}}.  Use of the @command{gccbug}
53script to report bugs is recommended.
54@c man end
55@c man begin AUTHOR
56See the Info entry for @command{gcc}, or
57@w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
58for contributors to GCC@.
59@c man end
60@end ignore
61
62@node Invoking GCC
63@chapter GCC Command Options
64@cindex GCC command options
65@cindex command options
66@cindex options, GCC command
67
68@c man begin DESCRIPTION
69When you invoke GCC, it normally does preprocessing, compilation,
70assembly and linking.  The ``overall options'' allow you to stop this
71process at an intermediate stage.  For example, the @option{-c} option
72says not to run the linker.  Then the output consists of object files
73output by the assembler.
74
75Other options are passed on to one stage of processing.  Some options
76control the preprocessor and others the compiler itself.  Yet other
77options control the assembler and linker; most of these are not
78documented here, since you rarely need to use any of them.
79
80@cindex C compilation options
81Most of the command line options that you can use with GCC are useful
82for C programs; when an option is only useful with another language
83(usually C++), the explanation says so explicitly.  If the description
84for a particular option does not mention a source language, you can use
85that option with all supported languages.
86
87@cindex C++ compilation options
88@xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
89options for compiling C++ programs.
90
91@cindex grouping options
92@cindex options, grouping
93The @command{gcc} program accepts options and file names as operands.  Many
94options have multi-letter names; therefore multiple single-letter options
95may @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d
96-r}}.
97
98@cindex order of options
99@cindex options, order
100You can mix options and other arguments.  For the most part, the order
101you use doesn't matter.  Order does matter when you use several options
102of the same kind; for example, if you specify @option{-L} more than once,
103the directories are searched in the order specified.
104
105Many options have long names starting with @samp{-f} or with
106@samp{-W}---for example, @option{-fforce-mem},
107@option{-fstrength-reduce}, @option{-Wformat} and so on.  Most of
108these have both positive and negative forms; the negative form of
109@option{-ffoo} would be @option{-fno-foo}.  This manual documents
110only one of these two forms, whichever one is not the default.
111
112@c man end
113
114@xref{Option Index}, for an index to GCC's options.
115
116@menu
117* Option Summary::	Brief list of all options, without explanations.
118* Overall Options::     Controlling the kind of output:
119                        an executable, object files, assembler files,
120                        or preprocessed source.
121* Invoking G++::	Compiling C++ programs.
122* C Dialect Options::   Controlling the variant of C language compiled.
123* C++ Dialect Options:: Variations on C++.
124* Objective-C Dialect Options:: Variations on Objective-C.
125* Language Independent Options:: Controlling how diagnostics should be
126                        formatted.
127* Warning Options::     How picky should the compiler be?
128* Debugging Options::   Symbol tables, measurements, and debugging dumps.
129* Optimize Options::    How much optimization?
130* Preprocessor Options:: Controlling header files and macro definitions.
131                         Also, getting dependency information for Make.
132* Assembler Options::   Passing options to the assembler.
133* Link Options::        Specifying libraries and so on.
134* Directory Options::   Where to find header files and libraries.
135                        Where to find the compiler executable files.
136* Spec Files::          How to pass switches to sub-processes.
137* Target Options::      Running a cross-compiler, or an old version of GCC.
138* Submodel Options::    Specifying minor hardware or convention variations,
139                        such as 68010 vs 68020.
140* Code Gen Options::    Specifying conventions for function calls, data layout
141                        and register usage.
142* Environment Variables:: Env vars that affect GCC.
143* Running Protoize::    Automatically adding or removing function prototypes.
144@end menu
145
146@c man begin OPTIONS
147
148@node Option Summary
149@section Option Summary
150
151Here is a summary of all the options, grouped by type.  Explanations are
152in the following sections.
153
154@table @emph
155@item Overall Options
156@xref{Overall Options,,Options Controlling the Kind of Output}.
157@gccoptlist{-c  -S  -E  -o @var{file}  -pipe  -pass-exit-codes  @gol
158-x @var{language}  -v  -###  --help  --target-help  --version}
159
160@item C Language Options
161@xref{C Dialect Options,,Options Controlling C Dialect}.
162@gccoptlist{-ansi  -std=@var{standard}  -aux-info @var{filename} @gol
163-fno-asm  -fno-builtin  -fno-builtin-@var{function} @gol
164-fhosted  -ffreestanding  -fms-extensions @gol
165-trigraphs  -no-integrated-cpp  -traditional  -traditional-cpp @gol
166-fallow-single-precision  -fcond-mismatch @gol
167-fsigned-bitfields  -fsigned-char @gol
168-funsigned-bitfields  -funsigned-char @gol
169-fwritable-strings}
170
171@item C++ Language Options
172@xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
173@gccoptlist{-fabi-version=@var{n}  -fno-access-control  -fcheck-new @gol
174-fconserve-space  -fno-const-strings  -fdollars-in-identifiers @gol
175-fno-elide-constructors @gol
176-fno-enforce-eh-specs  -fexternal-templates @gol
177-falt-external-templates @gol
178-ffor-scope  -fno-for-scope  -fno-gnu-keywords @gol
179-fno-implicit-templates @gol
180-fno-implicit-inline-templates @gol
181-fno-implement-inlines  -fms-extensions @gol
182-fno-nonansi-builtins  -fno-operator-names @gol
183-fno-optional-diags  -fpermissive @gol
184-frepo  -fno-rtti  -fstats  -ftemplate-depth-@var{n} @gol
185-fuse-cxa-atexit  -fvtable-gc  -fno-weak  -nostdinc++ @gol
186-fno-default-inline  -Wabi  -Wctor-dtor-privacy @gol
187-Wnon-virtual-dtor  -Wreorder @gol
188-Weffc++  -Wno-deprecated @gol
189-Wno-non-template-friend  -Wold-style-cast @gol
190-Woverloaded-virtual  -Wno-pmf-conversions @gol
191-Wsign-promo}
192
193@item Objective-C Language Options
194@xref{Objective-C Dialect Options,,Options Controlling Objective-C Dialect}.
195@gccoptlist{-fconstant-string-class=@var{class-name} @gol
196-fgnu-runtime  -fnext-runtime  -gen-decls @gol
197-Wno-protocol  -Wselector  -Wundeclared-selector}
198
199@item Language Independent Options
200@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
201@gccoptlist{-fmessage-length=@var{n} @gol
202-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}}
203
204@item Warning Options
205@xref{Warning Options,,Options to Request or Suppress Warnings}.
206@gccoptlist{-fsyntax-only  -pedantic  -pedantic-errors @gol
207-w  -W  -Wall  -Waggregate-return @gol
208-Wcast-align  -Wcast-qual  -Wchar-subscripts  -Wcomment @gol
209-Wconversion  -Wno-deprecated-declarations @gol
210-Wdisabled-optimization  -Wno-div-by-zero  -Werror @gol
211-Wfloat-equal  -Wformat  -Wformat=2 @gol
212-Wformat-nonliteral  -Wformat-security @gol
213-Wimplicit  -Wimplicit-int  @gol
214-Wimplicit-function-declaration @gol
215-Werror-implicit-function-declaration @gol
216-Wimport  -Winline  -Wno-endif-labels @gol
217-Wlarger-than-@var{len}  -Wlong-long @gol
218-Wmain  -Wmissing-braces @gol
219-Wmissing-format-attribute  -Wmissing-noreturn @gol
220-Wno-multichar  -Wno-format-extra-args  -Wno-format-y2k @gol
221-Wno-import  -Wnonnull  -Wpacked  -Wpadded @gol
222-Wparentheses  -Wpointer-arith  -Wredundant-decls @gol
223-Wreturn-type  -Wsequence-point  -Wshadow @gol
224-Wsign-compare  -Wstack-protector  -Wstrict-aliasing @gol
225-Wswitch  -Wswitch-default  -Wswitch-enum @gol
226-Wsystem-headers  -Wtrigraphs  -Wundef  -Wuninitialized @gol
227-Wunknown-pragmas  -Wunreachable-code @gol
228-Wunused  -Wunused-function  -Wunused-label  -Wunused-parameter @gol
229-Wunused-value  -Wunused-variable  -Wwrite-strings}
230
231@item C-only Warning Options
232@gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
233-Wmissing-prototypes  -Wnested-externs @gol
234-Wstrict-prototypes  -Wtraditional}
235
236@item Debugging Options
237@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
238@gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
239-fdump-unnumbered  -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
240-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
241-fdump-tree-original@r{[}-@var{n}@r{]}  @gol
242-fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
243-fdump-tree-inlined@r{[}-@var{n}@r{]} @gol
244-feliminate-dwarf2-dups  -fmem-report @gol
245-fprofile-arcs  -frandom-seed=@var{n} @gol
246-fsched-verbose=@var{n} -ftest-coverage  -ftime-report @gol
247-g  -g@var{level}  -gcoff  -gdwarf  -gdwarf-1  -gdwarf-1+  -gdwarf-2 @gol
248-ggdb  -gstabs  -gstabs+  -gvms  -gxcoff  -gxcoff+ @gol
249-p  -pg  -print-file-name=@var{library}  -print-libgcc-file-name @gol
250-print-multi-directory  -print-multi-lib @gol
251-print-prog-name=@var{program}  -print-search-dirs  -Q @gol
252-save-temps  -time}
253
254@item Optimization Options
255@xref{Optimize Options,,Options that Control Optimization}.
256@gccoptlist{-falign-functions=@var{n}  -falign-jumps=@var{n} @gol
257-falign-labels=@var{n}  -falign-loops=@var{n}  @gol
258-fbranch-probabilities  -fcaller-saves  -fcprop-registers @gol
259-fcse-follow-jumps  -fcse-skip-blocks  -fdata-sections @gol
260-fdelayed-branch  -fdelete-null-pointer-checks @gol
261-fexpensive-optimizations  -ffast-math  -ffloat-store @gol
262-fforce-addr  -fforce-mem  -ffunction-sections @gol
263-fgcse  -fgcse-lm  -fgcse-sm  -floop-optimize  -fcrossjumping @gol
264-fif-conversion  -fif-conversion2 @gol
265-finline-functions  -finline-limit=@var{n}  -fkeep-inline-functions @gol
266-fkeep-static-consts  -fmerge-constants  -fmerge-all-constants @gol
267-fmove-all-movables  -fnew-ra  -fno-branch-count-reg @gol
268-fno-default-inline  -fno-defer-pop @gol
269-fno-function-cse  -fno-guess-branch-probability @gol
270-fno-inline  -fno-math-errno  -fno-peephole  -fno-peephole2 @gol
271-funsafe-math-optimizations  -ffinite-math-only @gol
272-fno-trapping-math  -fno-zero-initialized-in-bss @gol
273-fomit-frame-pointer  -foptimize-register-move @gol
274-foptimize-sibling-calls  -fprefetch-loop-arrays @gol
275-freduce-all-givs  -fregmove  -frename-registers @gol
276-freorder-blocks  -freorder-functions @gol
277-frerun-cse-after-loop  -frerun-loop-opt @gol
278-fschedule-insns  -fschedule-insns2 @gol
279-fno-sched-interblock  -fno-sched-spec  -fsched-spec-load @gol
280-fsched-spec-load-dangerous  -fsignaling-nans @gol
281-fsingle-precision-constant  -fssa  -fssa-ccp  -fssa-dce @gol
282-fstack-protector  -fstack-protector-all  -fstack-protector-strong @gol
283-fstrength-reduce  -fstrict-aliasing  -ftracer  -fthread-jumps @gol
284-funroll-all-loops  -funroll-loops  @gol
285--param @var{name}=@var{value} @gol
286-O  -O0  -O1  -O2  -O3  -Os}
287
288@item Preprocessor Options
289@xref{Preprocessor Options,,Options Controlling the Preprocessor}.
290@gccoptlist{-$  -A@var{question}=@var{answer} @gol
291-A-@var{question}@r{[}=@var{answer}@r{]} @gol
292-C  -dD  -dI  -dM  -dN @gol
293-D@var{macro}@r{[}=@var{defn}@r{]}  -E  -H @gol
294-idirafter @var{dir} @gol
295-include @var{file}  -imacros @var{file} @gol
296-iprefix @var{file}  -iwithprefix @var{dir} @gol
297-iwithprefixbefore @var{dir}  -isystem @var{dir} @gol
298-M  -MM  -MF  -MG  -MP  -MQ  -MT  -nostdinc  -P  -remap @gol
299-trigraphs  -undef  -U@var{macro}  -Wp,@var{option}}
300
301@item Assembler Option
302@xref{Assembler Options,,Passing Options to the Assembler}.
303@gccoptlist{-Wa,@var{option}}
304
305@item Linker Options
306@xref{Link Options,,Options for Linking}.
307@gccoptlist{@var{object-file-name}  -l@var{library} @gol
308-nostartfiles  -nodefaultlibs  -nostdlib -pie @gol
309-s  -static  -static-libgcc  -shared  -shared-libgcc  -symbolic @gol
310-Wl,@var{option}  -Xlinker @var{option} @gol
311-u @var{symbol}}
312
313@item Directory Options
314@xref{Directory Options,,Options for Directory Search}.
315@gccoptlist{-B@var{prefix}  -I@var{dir}  -I-  -L@var{dir}  -specs=@var{file}}
316
317@item Target Options
318@c I wrote this xref this way to avoid overfull hbox. -- rms
319@xref{Target Options}.
320@gccoptlist{-V @var{version}  -b @var{machine}}
321
322@item Machine Dependent Options
323@xref{Submodel Options,,Hardware Models and Configurations}.
324
325@emph{M680x0 Options}
326@gccoptlist{-m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
327-m68060  -mcpu32  -m5200  -m68881  -mbitfield  -mc68000  -mc68020   @gol
328-mfpa  -mnobitfield  -mrtd  -mshort  -msoft-float  -mpcrel @gol
329-malign-int  -mstrict-align}
330
331@emph{M68hc1x Options}
332@gccoptlist{-m6811  -m6812  -m68hc11  -m68hc12  -m68hcs12 @gol
333-mauto-incdec  -minmax  -mlong-calls  -mshort @gol
334-msoft-reg-count=@var{count}}
335
336@emph{VAX Options}
337@gccoptlist{-mg  -mgnu  -munix}
338
339@emph{SPARC Options}
340@gccoptlist{-mcpu=@var{cpu-type} @gol
341-mtune=@var{cpu-type} @gol
342-mcmodel=@var{code-model} @gol
343-m32  -m64 @gol
344-mapp-regs  -mbroken-saverestore  -mcypress @gol
345-mfaster-structs  -mflat @gol
346-mfpu  -mhard-float  -mhard-quad-float @gol
347-mimpure-text  -mlittle-endian  -mlive-g0  -mno-app-regs @gol
348-mno-faster-structs  -mno-flat  -mno-fpu @gol
349-mno-impure-text  -mno-stack-bias  -mno-unaligned-doubles @gol
350-msoft-float  -msoft-quad-float  -msparclite  -mstack-bias @gol
351-msupersparc  -munaligned-doubles  -mv8
352-threads -pthreads}
353
354@emph{ARM Options}
355@gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
356-mapcs-26  -mapcs-32 @gol
357-mapcs-stack-check  -mno-apcs-stack-check @gol
358-mapcs-float  -mno-apcs-float @gol
359-mapcs-reentrant  -mno-apcs-reentrant @gol
360-msched-prolog  -mno-sched-prolog @gol
361-mlittle-endian  -mbig-endian  -mwords-little-endian @gol
362-malignment-traps  -mno-alignment-traps @gol
363-msoft-float  -mhard-float  -mfpe @gol
364-mthumb-interwork  -mno-thumb-interwork @gol
365-mcpu=@var{name}  -march=@var{name}  -mfpe=@var{name}  @gol
366-mstructure-size-boundary=@var{n} @gol
367-mabort-on-noreturn @gol
368-mlong-calls  -mno-long-calls @gol
369-msingle-pic-base  -mno-single-pic-base @gol
370-mpic-register=@var{reg} @gol
371-mnop-fun-dllimport @gol
372-mpoke-function-name @gol
373-mthumb  -marm @gol
374-mtpcs-frame  -mtpcs-leaf-frame @gol
375-mcaller-super-interworking  -mcallee-super-interworking}
376
377@emph{MN10200 Options}
378@gccoptlist{-mrelax}
379
380@emph{MN10300 Options}
381@gccoptlist{-mmult-bug  -mno-mult-bug @gol
382-mam33  -mno-am33 @gol
383-mno-crt0  -mrelax}
384
385@emph{M32R/D Options}
386@gccoptlist{-m32rx  -m32r  -mcode-model=@var{model-type} @gol
387-msdata=@var{sdata-type}  -G @var{num}}
388
389@emph{M88K Options}
390@gccoptlist{-m88000  -m88100  -m88110 @gol
391-mcheck-zero-division  -mno-check-zero-division @gol
392-muse-div-instruction @gol
393-mserialize-volatile  -mno-serialize-volatile @gol
394-mhandle-large-shift  -mtrap-large-shift}
395
396@emph{RS/6000 and PowerPC Options}
397@gccoptlist{-mcpu=@var{cpu-type} @gol
398-mtune=@var{cpu-type} @gol
399-mpower  -mno-power  -mpower2  -mno-power2 @gol
400-mpowerpc  -mpowerpc64  -mno-powerpc @gol
401-maltivec  -mno-altivec @gol
402-mpowerpc-gpopt  -mno-powerpc-gpopt @gol
403-mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
404-mnew-mnemonics  -mold-mnemonics @gol
405-mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
406-m64  -m32  -mxl-call  -mno-xl-call  -mpe @gol
407-msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
408-mstring  -mno-string  -mupdate  -mno-update @gol
409-mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
410-mstrict-align  -mno-strict-align  -mrelocatable @gol
411-mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
412-mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
413-mcall-aix  -mcall-sysv  -mcall-netbsd @gol
414-maix-struct-return  -msvr4-struct-return @gol
415-mabi=altivec  -mabi=no-altivec @gol
416-mabi=spe  -mabi=no-spe @gol
417-misel=yes  -misel=no @gol
418-mprototype  -mno-prototype @gol
419-msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
420-msdata=@var{opt}  -mvxworks  -mwindiss  -G @var{num}  -pthread}
421
422@emph{Darwin Options}
423@gccoptlist{
424-all_load -allowable_client -arch -arch_errors_fatal @gol
425-arch_only -bind_at_load -bundle -bundle_loader @gol
426-client_name -compatibility_version -current_version @gol
427-dependency-file -dylib_file -dylinker_install_name @gol
428-dynamic -dynamiclib -exported_symbols_list @gol
429-filelist -flat_namespace -force_cpusubtype_ALL @gol
430-force_flat_namespace -headerpad_max_install_names @gol
431-image_base -init -install_name -keep_private_externs @gol
432-multi_module -multiply_defined -multiply_defined_unused @gol
433-noall_load -nomultidefs -noprebind -noseglinkedit @gol
434-pagezero_size -prebind -prebind_all_twolevel_modules @gol
435-private_bundle -read_only_relocs -sectalign @gol
436-sectobjectsymbols -whyload -seg1addr @gol
437-sectcreate -sectobjectsymbols -sectorder @gol
438-seg_addr_table -seg_addr_table_filename -seglinkedit @gol
439-segprot -segs_read_only_addr -segs_read_write_addr @gol
440-single_module -static -sub_library -sub_umbrella @gol
441-twolevel_namespace -umbrella -undefined @gol
442-unexported_symbols_list -weak_reference_mismatches -whatsloaded}
443
444@emph{RT Options}
445@gccoptlist{-mcall-lib-mul  -mfp-arg-in-fpregs  -mfp-arg-in-gregs @gol
446-mfull-fp-blocks  -mhc-struct-return  -min-line-mul @gol
447-mminimum-fp-blocks  -mnohc-struct-return}
448
449@emph{MIPS Options}
450@gccoptlist{-mabicalls  -march=@var{cpu-type}  -mtune=@var{cpu=type} @gol
451-mcpu=@var{cpu-type}  -membedded-data  -muninit-const-in-rodata @gol
452-membedded-pic  -mfp32  -mfp64  -mfused-madd  -mno-fused-madd @gol
453-mgas  -mgp32  -mgp64 @gol
454-mgpopt  -mhalf-pic  -mhard-float  -mint64  -mips1 @gol
455-mips2  -mips3  -mips4  -mlong64  -mlong32  -mlong-calls  -mmemcpy @gol
456-mmips-as  -mmips-tfile  -mno-abicalls @gol
457-mno-embedded-data  -mno-uninit-const-in-rodata @gol
458-mno-embedded-pic  -mno-gpopt  -mno-long-calls @gol
459-mno-memcpy  -mno-mips-tfile  -mno-rnames  -mno-stats @gol
460-mrnames  -msoft-float @gol
461-m4650  -msingle-float  -mmad @gol
462-mstats  -EL  -EB  -G @var{num}  -nocpp @gol
463-mabi=32  -mabi=n32  -mabi=64  -mabi=eabi @gol
464-mfix7000  -mno-crt0  -mflush-func=@var{func}  -mno-flush-func @gol
465-mbranch-likely  -mno-branch-likely}
466
467@emph{i386 and x86-64 Options}
468@gccoptlist{-mcpu=@var{cpu-type}  -march=@var{cpu-type}  @gol
469-mfpmath=@var{unit}  -masm=@var{dialect}  -mno-fancy-math-387 @gol
470-mno-fp-ret-in-387  -msoft-float  -msvr3-shlib @gol
471-mno-wide-multiply  -mrtd  -malign-double @gol
472-mpreferred-stack-boundary=@var{num} @gol
473-mmmx  -msse  -msse2 -msse3 -m3dnow @gol
474-mthreads  -mno-align-stringops  -minline-all-stringops @gol
475-mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
476-m96bit-long-double  -mregparm=@var{num}  -momit-leaf-frame-pointer @gol
477-mno-red-zone@gol
478-mcmodel=@var{code-model} @gol
479-m32  -m64}
480
481@emph{HPPA Options}
482@gccoptlist{-march=@var{architecture-type} @gol
483-mbig-switch  -mdisable-fpregs  -mdisable-indexing @gol
484-mfast-indirect-calls  -mgas  -mgnu-ld  -mhp-ld @gol
485-mjump-in-delay  -mlinker-opt  -mlong-calls @gol
486-mlong-load-store  -mno-big-switch  -mno-disable-fpregs @gol
487-mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
488-mno-jump-in-delay  -mno-long-load-store @gol
489-mno-portable-runtime  -mno-soft-float @gol
490-mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
491-mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
492-mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
493-nolibdld  -static  -threads}
494
495@emph{Intel 960 Options}
496@gccoptlist{-m@var{cpu-type}  -masm-compat  -mclean-linkage @gol
497-mcode-align  -mcomplex-addr  -mleaf-procedures @gol
498-mic-compat  -mic2.0-compat  -mic3.0-compat @gol
499-mintel-asm  -mno-clean-linkage  -mno-code-align @gol
500-mno-complex-addr  -mno-leaf-procedures @gol
501-mno-old-align  -mno-strict-align  -mno-tail-call @gol
502-mnumerics  -mold-align  -msoft-float  -mstrict-align @gol
503-mtail-call}
504
505@emph{DEC Alpha Options}
506@gccoptlist{-mno-fp-regs  -msoft-float  -malpha-as  -mgas @gol
507-mieee  -mieee-with-inexact  -mieee-conformant @gol
508-mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
509-mtrap-precision=@var{mode}  -mbuild-constants @gol
510-mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
511-mbwx  -mmax  -mfix  -mcix @gol
512-mfloat-vax  -mfloat-ieee @gol
513-mexplicit-relocs  -msmall-data  -mlarge-data @gol
514-mmemory-latency=@var{time}}
515
516@emph{DEC Alpha/VMS Options}
517@gccoptlist{-mvms-return-codes}
518
519@emph{H8/300 Options}
520@gccoptlist{-mrelax  -mh  -ms  -mn  -mint32  -malign-300}
521
522@emph{SH Options}
523@gccoptlist{-m1  -m2  -m3  -m3e @gol
524-m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
525-m5-64media  -m5-64media-nofpu @gol
526-m5-32media  -m5-32media-nofpu @gol
527-m5-compact  -m5-compact-nofpu @gol
528-mb  -ml  -mdalign  -mrelax @gol
529-mbigtable  -mfmovd  -mhitachi  -mnomacsave @gol
530-mieee  -misize  -mpadstruct  -mspace @gol
531-mprefergot  -musermode}
532
533@emph{System V Options}
534@gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
535
536@emph{ARC Options}
537@gccoptlist{-EB  -EL @gol
538-mmangle-cpu  -mcpu=@var{cpu}  -mtext=@var{text-section} @gol
539-mdata=@var{data-section}  -mrodata=@var{readonly-data-section}}
540
541@emph{TMS320C3x/C4x Options}
542@gccoptlist{-mcpu=@var{cpu}  -mbig  -msmall  -mregparm  -mmemparm @gol
543-mfast-fix  -mmpyi  -mbk  -mti  -mdp-isr-reload @gol
544-mrpts=@var{count}  -mrptb  -mdb  -mloop-unsigned @gol
545-mparallel-insns  -mparallel-mpy  -mpreserve-float}
546
547@emph{V850 Options}
548@gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
549-mprolog-function  -mno-prolog-function  -mspace @gol
550-mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
551-mapp-regs  -mno-app-regs @gol
552-mdisable-callt  -mno-disable-callt @gol
553-mv850e @gol
554-mv850  -mbig-switch}
555
556@emph{NS32K Options}
557@gccoptlist{-m32032  -m32332  -m32532  -m32081  -m32381 @gol
558-mmult-add  -mnomult-add  -msoft-float  -mrtd  -mnortd @gol
559-mregparam  -mnoregparam  -msb  -mnosb @gol
560-mbitfield  -mnobitfield  -mhimem  -mnohimem}
561
562@emph{AVR Options}
563@gccoptlist{-mmcu=@var{mcu}  -msize  -minit-stack=@var{n}  -mno-interrupts @gol
564-mcall-prologues  -mno-tablejump  -mtiny-stack}
565
566@emph{MCore Options}
567@gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
568-mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
569-m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
570-mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
571-mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
572
573@emph{MMIX Options}
574@gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
575-mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
576-melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
577-mno-base-addresses  -msingle-exit  -mno-single-exit}
578
579@emph{IA-64 Options}
580@gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
581-mvolatile-asm-stop  -mb-step  -mregister-names  -mno-sdata @gol
582-mconstant-gp  -mauto-pic  -minline-float-divide-min-latency @gol
583-minline-float-divide-max-throughput @gol
584-minline-int-divide-min-latency @gol
585-minline-int-divide-max-throughput  -mno-dwarf2-asm @gol
586-mfixed-range=@var{register-range}}
587
588@emph{D30V Options}
589@gccoptlist{-mextmem  -mextmemory  -monchip  -mno-asm-optimize @gol
590-masm-optimize  -mbranch-cost=@var{n}  -mcond-exec=@var{n}}
591
592@emph{S/390 and zSeries Options}
593@gccoptlist{-mhard-float  -msoft-float  -mbackchain  -mno-backchain @gol
594-msmall-exec  -mno-small-exec  -mmvcle  -mno-mvcle @gol
595-m64  -m31  -mdebug  -mno-debug}
596
597@emph{CRIS Options}
598@gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}  -mtune=@var{cpu} @gol
599-mmax-stack-frame=@var{n}  -melinux-stacksize=@var{n} @gol
600-metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
601-mstack-align  -mdata-align  -mconst-align @gol
602-m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue  -mno-gotplt @gol
603-melf  -maout  -melinux  -mlinux  -sim  -sim2 @gol
604-mmul-bug-workaround  -mno-mul-bug-workaround}
605
606@emph{PDP-11 Options}
607@gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
608-mbcopy  -mbcopy-builtin  -mint32  -mno-int16 @gol
609-mint16  -mno-int32  -mfloat32  -mno-float64 @gol
610-mfloat64  -mno-float32  -mabshi  -mno-abshi @gol
611-mbranch-expensive  -mbranch-cheap @gol
612-msplit  -mno-split  -munix-asm  -mdec-asm}
613
614@emph{Xstormy16 Options}
615@gccoptlist{-msim}
616
617@emph{Xtensa Options}
618@gccoptlist{-mbig-endian  -mlittle-endian @gol
619-mdensity  -mno-density @gol
620-mmac16  -mno-mac16 @gol
621-mmul16  -mno-mul16 @gol
622-mmul32  -mno-mul32 @gol
623-mnsa  -mno-nsa @gol
624-mminmax  -mno-minmax @gol
625-msext  -mno-sext @gol
626-mbooleans  -mno-booleans @gol
627-mhard-float  -msoft-float @gol
628-mfused-madd  -mno-fused-madd @gol
629-mserialize-volatile  -mno-serialize-volatile @gol
630-mtext-section-literals  -mno-text-section-literals @gol
631-mtarget-align  -mno-target-align @gol
632-mlongcalls  -mno-longcalls}
633
634@emph{FRV Options}
635@gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
636-mhard-float  -msoft-float  -malloc-cc  -mfixed-cc @gol
637-mdword  -mno-dword  -mdouble  -mno-double @gol
638-mmedia  -mno-media  -mmuladd  -mno-muladd  -mlibrary-pic @gol
639-macc-4  -macc-8  -mpack  -mno-pack  -mno-eflags @gol
640-mcond-move  -mno-cond-move -mscc  -mno-scc  @gol
641-mcond-exec  -mno-cond-exec  -mvliw-branch  -mno-vliw-branch @gol
642-mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
643-mno-nested-cond-exec  -mtomcat-stats @gol
644-mcpu=@var{cpu}}
645
646
647
648@item Code Generation Options
649@xref{Code Gen Options,,Options for Code Generation Conventions}.
650@gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
651-ffixed-@var{reg}  -fexceptions @gol
652-fnon-call-exceptions  -funwind-tables @gol
653-fasynchronous-unwind-tables @gol
654-finhibit-size-directive  -finstrument-functions @gol
655-fno-common  -fno-ident  -fno-gnu-linker @gol
656-fpcc-struct-return  -fpic  -fPIC -fpie -fPIE @gol
657-freg-struct-return  -fshared-data  -fshort-enums @gol
658-fshort-double  -fshort-wchar  -fvolatile @gol
659-fvolatile-global  -fvolatile-static @gol
660-fverbose-asm  -fpack-struct  -fstack-check @gol
661-fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
662-fargument-alias  -fargument-noalias @gol
663-fargument-noalias-global  -fleading-underscore @gol
664-ftls-model=@var{model} @gol
665-ftrapv  -fbounds-check}
666@end table
667
668@menu
669* Overall Options::     Controlling the kind of output:
670                        an executable, object files, assembler files,
671                        or preprocessed source.
672* C Dialect Options::   Controlling the variant of C language compiled.
673* C++ Dialect Options:: Variations on C++.
674* Objective-C Dialect Options:: Variations on Objective-C.
675* Language Independent Options:: Controlling how diagnostics should be
676                        formatted.
677* Warning Options::     How picky should the compiler be?
678* Debugging Options::   Symbol tables, measurements, and debugging dumps.
679* Optimize Options::    How much optimization?
680* Preprocessor Options:: Controlling header files and macro definitions.
681                         Also, getting dependency information for Make.
682* Assembler Options::   Passing options to the assembler.
683* Link Options::        Specifying libraries and so on.
684* Directory Options::   Where to find header files and libraries.
685                        Where to find the compiler executable files.
686* Spec Files::          How to pass switches to sub-processes.
687* Target Options::      Running a cross-compiler, or an old version of GCC.
688@end menu
689
690@node Overall Options
691@section Options Controlling the Kind of Output
692
693Compilation can involve up to four stages: preprocessing, compilation
694proper, assembly and linking, always in that order.  The first three
695stages apply to an individual source file, and end by producing an
696object file; linking combines all the object files (those newly
697compiled, and those specified as input) into an executable file.
698
699@cindex file name suffix
700For any given input file, the file name suffix determines what kind of
701compilation is done:
702
703@table @gcctabopt
704@item @var{file}.c
705C source code which must be preprocessed.
706
707@item @var{file}.i
708C source code which should not be preprocessed.
709
710@item @var{file}.ii
711C++ source code which should not be preprocessed.
712
713@item @var{file}.m
714Objective-C source code.  Note that you must link with the library
715@file{libobjc.a} to make an Objective-C program work.
716
717@item @var{file}.mi
718Objective-C source code which should not be preprocessed.
719
720@item @var{file}.h
721C header file (not to be compiled or linked).
722
723@item @var{file}.cc
724@itemx @var{file}.cp
725@itemx @var{file}.cxx
726@itemx @var{file}.cpp
727@itemx @var{file}.c++
728@itemx @var{file}.C
729C++ source code which must be preprocessed.  Note that in @samp{.cxx},
730the last two letters must both be literally @samp{x}.  Likewise,
731@samp{.C} refers to a literal capital C@.
732
733@item @var{file}.f
734@itemx @var{file}.for
735@itemx @var{file}.FOR
736Fortran source code which should not be preprocessed.
737
738@item @var{file}.F
739@itemx @var{file}.fpp
740@itemx @var{file}.FPP
741Fortran source code which must be preprocessed (with the traditional
742preprocessor).
743
744@item @var{file}.r
745Fortran source code which must be preprocessed with a RATFOR
746preprocessor (not included with GCC)@.
747
748@xref{Overall Options,,Options Controlling the Kind of Output, g77,
749Using and Porting GNU Fortran}, for more details of the handling of
750Fortran input files.
751
752@c FIXME: Descriptions of Java file types.
753@c @var{file}.java
754@c @var{file}.class
755@c @var{file}.zip
756@c @var{file}.jar
757
758@item @var{file}.ads
759Ada source code file which contains a library unit declaration (a
760declaration of a package, subprogram, or generic, or a generic
761instantiation), or a library unit renaming declaration (a package,
762generic, or subprogram renaming declaration).  Such files are also
763called @dfn{specs}.
764
765@itemx @var{file}.adb
766Ada source code file containing a library unit body (a subprogram or
767package body).  Such files are also called @dfn{bodies}.
768
769@c GCC also knows about some suffixes for languages not yet included:
770@c Pascal:
771@c @var{file}.p
772@c @var{file}.pas
773
774@item @var{file}.s
775Assembler code.
776
777@item @var{file}.S
778Assembler code which must be preprocessed.
779
780@item @var{other}
781An object file to be fed straight into linking.
782Any file name with no recognized suffix is treated this way.
783@end table
784
785@opindex x
786You can specify the input language explicitly with the @option{-x} option:
787
788@table @gcctabopt
789@item -x @var{language}
790Specify explicitly the @var{language} for the following input files
791(rather than letting the compiler choose a default based on the file
792name suffix).  This option applies to all following input files until
793the next @option{-x} option.  Possible values for @var{language} are:
794@example
795c  c-header  cpp-output
796c++  c++-cpp-output
797objective-c  objc-cpp-output
798assembler  assembler-with-cpp
799ada
800f77  f77-cpp-input  ratfor
801java
802treelang
803@end example
804
805@item -x none
806Turn off any specification of a language, so that subsequent files are
807handled according to their file name suffixes (as they are if @option{-x}
808has not been used at all).
809
810@item -pass-exit-codes
811@opindex pass-exit-codes
812Normally the @command{gcc} program will exit with the code of 1 if any
813phase of the compiler returns a non-success return code.  If you specify
814@option{-pass-exit-codes}, the @command{gcc} program will instead return with
815numerically highest error produced by any phase that returned an error
816indication.
817@end table
818
819If you only want some of the stages of compilation, you can use
820@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
821one of the options @option{-c}, @option{-S}, or @option{-E} to say where
822@command{gcc} is to stop.  Note that some combinations (for example,
823@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
824
825@table @gcctabopt
826@item -c
827@opindex c
828Compile or assemble the source files, but do not link.  The linking
829stage simply is not done.  The ultimate output is in the form of an
830object file for each source file.
831
832By default, the object file name for a source file is made by replacing
833the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
834
835Unrecognized input files, not requiring compilation or assembly, are
836ignored.
837
838@item -S
839@opindex S
840Stop after the stage of compilation proper; do not assemble.  The output
841is in the form of an assembler code file for each non-assembler input
842file specified.
843
844By default, the assembler file name for a source file is made by
845replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
846
847Input files that don't require compilation are ignored.
848
849@item -E
850@opindex E
851Stop after the preprocessing stage; do not run the compiler proper.  The
852output is in the form of preprocessed source code, which is sent to the
853standard output.
854
855Input files which don't require preprocessing are ignored.
856
857@cindex output file option
858@item -o @var{file}
859@opindex o
860Place output in file @var{file}.  This applies regardless to whatever
861sort of output is being produced, whether it be an executable file,
862an object file, an assembler file or preprocessed C code.
863
864Since only one output file can be specified, it does not make sense to
865use @option{-o} when compiling more than one input file, unless you are
866producing an executable file as output.
867
868If @option{-o} is not specified, the default is to put an executable file
869in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in
870@file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and
871all preprocessed C source on standard output.
872
873@item -v
874@opindex v
875Print (on standard error output) the commands executed to run the stages
876of compilation.  Also print the version number of the compiler driver
877program and of the preprocessor and the compiler proper.
878
879@item -###
880@opindex ###
881Like @option{-v} except the commands are not executed and all command
882arguments are quoted.  This is useful for shell scripts to capture the
883driver-generated command lines.
884
885@item -pipe
886@opindex pipe
887Use pipes rather than temporary files for communication between the
888various stages of compilation.  This fails to work on some systems where
889the assembler is unable to read from a pipe; but the GNU assembler has
890no trouble.
891
892@item --help
893@opindex help
894Print (on the standard output) a description of the command line options
895understood by @command{gcc}.  If the @option{-v} option is also specified
896then @option{--help} will also be passed on to the various processes
897invoked by @command{gcc}, so that they can display the command line options
898they accept.  If the @option{-W} option is also specified then command
899line options which have no documentation associated with them will also
900be displayed.
901
902@item --target-help
903@opindex target-help
904Print (on the standard output) a description of target specific command
905line options for each tool.
906
907@item --version
908@opindex version
909Display the version number and copyrights of the invoked GCC.
910@end table
911
912@node Invoking G++
913@section Compiling C++ Programs
914
915@cindex suffixes for C++ source
916@cindex C++ source file suffixes
917C++ source files conventionally use one of the suffixes @samp{.C},
918@samp{.cc}, @samp{.cpp}, @samp{.c++}, @samp{.cp}, or @samp{.cxx};
919preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
920files with these names and compiles them as C++ programs even if you
921call the compiler the same way as for compiling C programs (usually with
922the name @command{gcc}).
923
924@findex g++
925@findex c++
926However, C++ programs often require class libraries as well as a
927compiler that understands the C++ language---and under some
928circumstances, you might want to compile programs from standard input,
929or otherwise without a suffix that flags them as C++ programs.
930@command{g++} is a program that calls GCC with the default language
931set to C++, and automatically specifies linking against the C++
932library.  On many systems, @command{g++} is also
933installed with the name @command{c++}.
934
935@cindex invoking @command{g++}
936When you compile C++ programs, you may specify many of the same
937command-line options that you use for compiling programs in any
938language; or command-line options meaningful for C and related
939languages; or options that are meaningful only for C++ programs.
940@xref{C Dialect Options,,Options Controlling C Dialect}, for
941explanations of options for languages related to C@.
942@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
943explanations of options that are meaningful only for C++ programs.
944
945@node C Dialect Options
946@section Options Controlling C Dialect
947@cindex dialect options
948@cindex language dialect options
949@cindex options, dialect
950
951The following options control the dialect of C (or languages derived
952from C, such as C++ and Objective-C) that the compiler accepts:
953
954@table @gcctabopt
955@cindex ANSI support
956@cindex ISO support
957@item -ansi
958@opindex ansi
959In C mode, support all ISO C90 programs.  In C++ mode,
960remove GNU extensions that conflict with ISO C++.
961
962This turns off certain features of GCC that are incompatible with ISO
963C90 (when compiling C code), or of standard C++ (when compiling C++ code),
964such as the @code{asm} and @code{typeof} keywords, and
965predefined macros such as @code{unix} and @code{vax} that identify the
966type of system you are using.  It also enables the undesirable and
967rarely used ISO trigraph feature.  For the C compiler,
968it disables recognition of C++ style @samp{//} comments as well as
969the @code{inline} keyword.
970
971The alternate keywords @code{__asm__}, @code{__extension__},
972@code{__inline__} and @code{__typeof__} continue to work despite
973@option{-ansi}.  You would not want to use them in an ISO C program, of
974course, but it is useful to put them in header files that might be included
975in compilations done with @option{-ansi}.  Alternate predefined macros
976such as @code{__unix__} and @code{__vax__} are also available, with or
977without @option{-ansi}.
978
979The @option{-ansi} option does not cause non-ISO programs to be
980rejected gratuitously.  For that, @option{-pedantic} is required in
981addition to @option{-ansi}.  @xref{Warning Options}.
982
983The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
984option is used.  Some header files may notice this macro and refrain
985from declaring certain functions or defining certain macros that the
986ISO standard doesn't call for; this is to avoid interfering with any
987programs that might use these names for other things.
988
989Functions which would normally be built in but do not have semantics
990defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
991functions with @option{-ansi} is used.  @xref{Other Builtins,,Other
992built-in functions provided by GCC}, for details of the functions
993affected.
994
995@item -std=
996@opindex std
997Determine the language standard.  This option is currently only
998supported when compiling C or C++.  A value for this option must be
999provided; possible values are
1000
1001@table @samp
1002@item c89
1003@itemx iso9899:1990
1004ISO C90 (same as @option{-ansi}).
1005
1006@item iso9899:199409
1007ISO C90 as modified in amendment 1.
1008
1009@item c99
1010@itemx c9x
1011@itemx iso9899:1999
1012@itemx iso9899:199x
1013ISO C99.  Note that this standard is not yet fully supported; see
1014@w{@uref{http://gcc.gnu.org/gcc-3.3/c99status.html}} for more information.  The
1015names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1016
1017@item gnu89
1018ISO C90 plus GNU extensions (including some C99 features).
1019
1020@item gnu99
1021@itemx gnu9x
1022Default, ISO C99 plus GNU extensions.
1023The name @samp{gnu9x} is deprecated.
1024
1025@item c++98
1026The 1998 ISO C++ standard plus amendments.
1027
1028@item gnu++98
1029The same as @option{-std=c++98} plus GNU extensions.  This is the
1030default for C++ code.
1031@end table
1032
1033Even when this option is not specified, you can still use some of the
1034features of newer standards in so far as they do not conflict with
1035previous C standards.  For example, you may use @code{__restrict__} even
1036when @option{-std=c99} is not specified.
1037
1038The @option{-std} options specifying some version of ISO C have the same
1039effects as @option{-ansi}, except that features that were not in ISO C90
1040but are in the specified version (for example, @samp{//} comments and
1041the @code{inline} keyword in ISO C99) are not disabled.
1042
1043@xref{Standards,,Language Standards Supported by GCC}, for details of
1044these standard versions.
1045
1046@item -aux-info @var{filename}
1047@opindex aux-info
1048Output to the given filename prototyped declarations for all functions
1049declared and/or defined in a translation unit, including those in header
1050files.  This option is silently ignored in any language other than C@.
1051
1052Besides declarations, the file indicates, in comments, the origin of
1053each declaration (source file and line), whether the declaration was
1054implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1055@samp{O} for old, respectively, in the first character after the line
1056number and the colon), and whether it came from a declaration or a
1057definition (@samp{C} or @samp{F}, respectively, in the following
1058character).  In the case of function definitions, a K&R-style list of
1059arguments followed by their declarations is also provided, inside
1060comments, after the declaration.
1061
1062@item -fno-asm
1063@opindex fno-asm
1064Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1065keyword, so that code can use these words as identifiers.  You can use
1066the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1067instead.  @option{-ansi} implies @option{-fno-asm}.
1068
1069In C++, this switch only affects the @code{typeof} keyword, since
1070@code{asm} and @code{inline} are standard keywords.  You may want to
1071use the @option{-fno-gnu-keywords} flag instead, which has the same
1072effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1073switch only affects the @code{asm} and @code{typeof} keywords, since
1074@code{inline} is a standard keyword in ISO C99.
1075
1076@item -fno-builtin
1077@itemx -fno-builtin-@var{function}
1078@opindex fno-builtin
1079@cindex built-in functions
1080Don't recognize built-in functions that do not begin with
1081@samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
1082functions provided by GCC}, for details of the functions affected,
1083including those which are not built-in functions when @option{-ansi} or
1084@option{-std} options for strict ISO C conformance are used because they
1085do not have an ISO standard meaning.
1086
1087GCC normally generates special code to handle certain built-in functions
1088more efficiently; for instance, calls to @code{alloca} may become single
1089instructions that adjust the stack directly, and calls to @code{memcpy}
1090may become inline copy loops.  The resulting code is often both smaller
1091and faster, but since the function calls no longer appear as such, you
1092cannot set a breakpoint on those calls, nor can you change the behavior
1093of the functions by linking with a different library.
1094
1095With the @option{-fno-builtin-@var{function}} option
1096only the built-in function @var{function} is
1097disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
1098function is named this is not built-in in this version of GCC, this
1099option is ignored.  There is no corresponding
1100@option{-fbuiltin-@var{function}} option; if you wish to enable
1101built-in functions selectively when using @option{-fno-builtin} or
1102@option{-ffreestanding}, you may define macros such as:
1103
1104@smallexample
1105#define abs(n)          __builtin_abs ((n))
1106#define strcpy(d, s)    __builtin_strcpy ((d), (s))
1107@end smallexample
1108
1109@item -fhosted
1110@opindex fhosted
1111@cindex hosted environment
1112
1113Assert that compilation takes place in a hosted environment.  This implies
1114@option{-fbuiltin}.  A hosted environment is one in which the
1115entire standard library is available, and in which @code{main} has a return
1116type of @code{int}.  Examples are nearly everything except a kernel.
1117This is equivalent to @option{-fno-freestanding}.
1118
1119@item -ffreestanding
1120@opindex ffreestanding
1121@cindex hosted environment
1122
1123Assert that compilation takes place in a freestanding environment.  This
1124implies @option{-fno-builtin}.  A freestanding environment
1125is one in which the standard library may not exist, and program startup may
1126not necessarily be at @code{main}.  The most obvious example is an OS kernel.
1127This is equivalent to @option{-fno-hosted}.
1128
1129@xref{Standards,,Language Standards Supported by GCC}, for details of
1130freestanding and hosted environments.
1131
1132@item -fms-extensions
1133@opindex fms-extensions
1134Accept some non-standard constructs used in Microsoft header files.
1135
1136@item -trigraphs
1137@opindex trigraphs
1138Support ISO C trigraphs.  The @option{-ansi} option (and @option{-std}
1139options for strict ISO C conformance) implies @option{-trigraphs}.
1140
1141@item -no-integrated-cpp
1142@opindex no-integrated-cpp
1143Performs a compilation in two passes: preprocessing and compiling.  This
1144option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1145@option{-B} option. The user supplied compilation step can then add in
1146an additional preprocessing step after normal preprocessing but before
1147compiling. The default is to use the integrated cpp (internal cpp)
1148
1149The semantics of this option will change if "cc1", "cc1plus", and
1150"cc1obj" are merged.
1151
1152@cindex traditional C language
1153@cindex C language, traditional
1154@item -traditional
1155@itemx -traditional-cpp
1156@opindex traditional-cpp
1157@opindex traditional
1158Formerly, these options caused GCC to attempt to emulate a pre-standard
1159C compiler.  They are now only supported with the @option{-E} switch.
1160The preprocessor continues to support a pre-standard mode.  See the GNU
1161CPP manual for details.
1162
1163@item -fcond-mismatch
1164@opindex fcond-mismatch
1165Allow conditional expressions with mismatched types in the second and
1166third arguments.  The value of such an expression is void.  This option
1167is not supported for C++.
1168
1169@item -funsigned-char
1170@opindex funsigned-char
1171Let the type @code{char} be unsigned, like @code{unsigned char}.
1172
1173Each kind of machine has a default for what @code{char} should
1174be.  It is either like @code{unsigned char} by default or like
1175@code{signed char} by default.
1176
1177Ideally, a portable program should always use @code{signed char} or
1178@code{unsigned char} when it depends on the signedness of an object.
1179But many programs have been written to use plain @code{char} and
1180expect it to be signed, or expect it to be unsigned, depending on the
1181machines they were written for.  This option, and its inverse, let you
1182make such a program work with the opposite default.
1183
1184The type @code{char} is always a distinct type from each of
1185@code{signed char} or @code{unsigned char}, even though its behavior
1186is always just like one of those two.
1187
1188@item -fsigned-char
1189@opindex fsigned-char
1190Let the type @code{char} be signed, like @code{signed char}.
1191
1192Note that this is equivalent to @option{-fno-unsigned-char}, which is
1193the negative form of @option{-funsigned-char}.  Likewise, the option
1194@option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1195
1196@item -fsigned-bitfields
1197@itemx -funsigned-bitfields
1198@itemx -fno-signed-bitfields
1199@itemx -fno-unsigned-bitfields
1200@opindex fsigned-bitfields
1201@opindex funsigned-bitfields
1202@opindex fno-signed-bitfields
1203@opindex fno-unsigned-bitfields
1204These options control whether a bit-field is signed or unsigned, when the
1205declaration does not use either @code{signed} or @code{unsigned}.  By
1206default, such a bit-field is signed, because this is consistent: the
1207basic integer types such as @code{int} are signed types.
1208
1209@item -fwritable-strings
1210@opindex fwritable-strings
1211Store string constants in the writable data segment and don't uniquize
1212them.  This is for compatibility with old programs which assume they can
1213write into string constants.
1214
1215Writing into string constants is a very bad idea; ``constants'' should
1216be constant.
1217@end table
1218
1219@node C++ Dialect Options
1220@section Options Controlling C++ Dialect
1221
1222@cindex compiler options, C++
1223@cindex C++ options, command line
1224@cindex options, C++
1225This section describes the command-line options that are only meaningful
1226for C++ programs; but you can also use most of the GNU compiler options
1227regardless of what language your program is in.  For example, you
1228might compile a file @code{firstClass.C} like this:
1229
1230@example
1231g++ -g -frepo -O -c firstClass.C
1232@end example
1233
1234@noindent
1235In this example, only @option{-frepo} is an option meant
1236only for C++ programs; you can use the other options with any
1237language supported by GCC@.
1238
1239Here is a list of options that are @emph{only} for compiling C++ programs:
1240
1241@table @gcctabopt
1242
1243@item -fabi-version=@var{n}
1244@opindex fabi-version
1245Use version @var{n} of the C++ ABI.  Version 1 is the version of the C++
1246ABI that first appeared in G++ 3.2.  Version 0 will always be the
1247version that conforms most closely to the C++ ABI specification.
1248Therefore, the ABI obtained using version 0 will change as ABI bugs are
1249fixed.
1250
1251The default is version 1.
1252
1253@item -fno-access-control
1254@opindex fno-access-control
1255Turn off all access checking.  This switch is mainly useful for working
1256around bugs in the access control code.
1257
1258@item -fcheck-new
1259@opindex fcheck-new
1260Check that the pointer returned by @code{operator new} is non-null
1261before attempting to modify the storage allocated.  This check is
1262normally unnecessary because the C++ standard specifies that
1263@code{operator new} will only return @code{0} if it is declared
1264@samp{throw()}, in which case the compiler will always check the
1265return value even without this option.  In all other cases, when
1266@code{operator new} has a non-empty exception specification, memory
1267exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
1268@samp{new (nothrow)}.
1269
1270@item -fconserve-space
1271@opindex fconserve-space
1272Put uninitialized or runtime-initialized global variables into the
1273common segment, as C does.  This saves space in the executable at the
1274cost of not diagnosing duplicate definitions.  If you compile with this
1275flag and your program mysteriously crashes after @code{main()} has
1276completed, you may have an object that is being destroyed twice because
1277two definitions were merged.
1278
1279This option is no longer useful on most targets, now that support has
1280been added for putting variables into BSS without making them common.
1281
1282@item -fno-const-strings
1283@opindex fno-const-strings
1284Give string constants type @code{char *} instead of type @code{const
1285char *}.  By default, G++ uses type @code{const char *} as required by
1286the standard.  Even if you use @option{-fno-const-strings}, you cannot
1287actually modify the value of a string constant, unless you also use
1288@option{-fwritable-strings}.
1289
1290This option might be removed in a future release of G++.  For maximum
1291portability, you should structure your code so that it works with
1292string constants that have type @code{const char *}.
1293
1294@item -fdollars-in-identifiers
1295@opindex fdollars-in-identifiers
1296Accept @samp{$} in identifiers.  You can also explicitly prohibit use of
1297@samp{$} with the option @option{-fno-dollars-in-identifiers}.  (GNU C allows
1298@samp{$} by default on most target systems, but there are a few exceptions.)
1299Traditional C allowed the character @samp{$} to form part of
1300identifiers.  However, ISO C and C++ forbid @samp{$} in identifiers.
1301
1302@item -fno-elide-constructors
1303@opindex fno-elide-constructors
1304The C++ standard allows an implementation to omit creating a temporary
1305which is only used to initialize another object of the same type.
1306Specifying this option disables that optimization, and forces G++ to
1307call the copy constructor in all cases.
1308
1309@item -fno-enforce-eh-specs
1310@opindex fno-enforce-eh-specs
1311Don't check for violation of exception specifications at runtime.  This
1312option violates the C++ standard, but may be useful for reducing code
1313size in production builds, much like defining @samp{NDEBUG}.  The compiler
1314will still optimize based on the exception specifications.
1315
1316@item -fexternal-templates
1317@opindex fexternal-templates
1318
1319Cause @samp{#pragma interface} and @samp{implementation} to apply to
1320template instantiation; template instances are emitted or not according
1321to the location of the template definition.  @xref{Template
1322Instantiation}, for more information.
1323
1324This option is deprecated.
1325
1326@item -falt-external-templates
1327@opindex falt-external-templates
1328Similar to @option{-fexternal-templates}, but template instances are
1329emitted or not according to the place where they are first instantiated.
1330@xref{Template Instantiation}, for more information.
1331
1332This option is deprecated.
1333
1334@item -ffor-scope
1335@itemx -fno-for-scope
1336@opindex ffor-scope
1337@opindex fno-for-scope
1338If @option{-ffor-scope} is specified, the scope of variables declared in
1339a @i{for-init-statement} is limited to the @samp{for} loop itself,
1340as specified by the C++ standard.
1341If @option{-fno-for-scope} is specified, the scope of variables declared in
1342a @i{for-init-statement} extends to the end of the enclosing scope,
1343as was the case in old versions of G++, and other (traditional)
1344implementations of C++.
1345
1346The default if neither flag is given to follow the standard,
1347but to allow and give a warning for old-style code that would
1348otherwise be invalid, or have different behavior.
1349
1350@item -fno-gnu-keywords
1351@opindex fno-gnu-keywords
1352Do not recognize @code{typeof} as a keyword, so that code can use this
1353word as an identifier.  You can use the keyword @code{__typeof__} instead.
1354@option{-ansi} implies @option{-fno-gnu-keywords}.
1355
1356@item -fno-implicit-templates
1357@opindex fno-implicit-templates
1358Never emit code for non-inline templates which are instantiated
1359implicitly (i.e.@: by use); only emit code for explicit instantiations.
1360@xref{Template Instantiation}, for more information.
1361
1362@item -fno-implicit-inline-templates
1363@opindex fno-implicit-inline-templates
1364Don't emit code for implicit instantiations of inline templates, either.
1365The default is to handle inlines differently so that compiles with and
1366without optimization will need the same set of explicit instantiations.
1367
1368@item -fno-implement-inlines
1369@opindex fno-implement-inlines
1370To save space, do not emit out-of-line copies of inline functions
1371controlled by @samp{#pragma implementation}.  This will cause linker
1372errors if these functions are not inlined everywhere they are called.
1373
1374@item -fms-extensions
1375@opindex fms-extensions
1376Disable pedantic warnings about constructs used in MFC, such as implicit
1377int and getting a pointer to member function via non-standard syntax.
1378
1379@item -fno-nonansi-builtins
1380@opindex fno-nonansi-builtins
1381Disable built-in declarations of functions that are not mandated by
1382ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
1383@code{index}, @code{bzero}, @code{conjf}, and other related functions.
1384
1385@item -fno-operator-names
1386@opindex fno-operator-names
1387Do not treat the operator name keywords @code{and}, @code{bitand},
1388@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1389synonyms as keywords.
1390
1391@item -fno-optional-diags
1392@opindex fno-optional-diags
1393Disable diagnostics that the standard says a compiler does not need to
1394issue.  Currently, the only such diagnostic issued by G++ is the one for
1395a name having multiple meanings within a class.
1396
1397@item -fpermissive
1398@opindex fpermissive
1399Downgrade some diagnostics about nonconformant code from errors to
1400warnings.  Thus, using @option{-fpermissive} will allow some
1401nonconforming code to compile.
1402
1403@item -frepo
1404@opindex frepo
1405Enable automatic template instantiation at link time.  This option also
1406implies @option{-fno-implicit-templates}.  @xref{Template
1407Instantiation}, for more information.
1408
1409@item -fno-rtti
1410@opindex fno-rtti
1411Disable generation of information about every class with virtual
1412functions for use by the C++ runtime type identification features
1413(@samp{dynamic_cast} and @samp{typeid}).  If you don't use those parts
1414of the language, you can save some space by using this flag.  Note that
1415exception handling uses the same information, but it will generate it as
1416needed.
1417
1418@item -fstats
1419@opindex fstats
1420Emit statistics about front-end processing at the end of the compilation.
1421This information is generally only useful to the G++ development team.
1422
1423@item -ftemplate-depth-@var{n}
1424@opindex ftemplate-depth
1425Set the maximum instantiation depth for template classes to @var{n}.
1426A limit on the template instantiation depth is needed to detect
1427endless recursions during template class instantiation.  ANSI/ISO C++
1428conforming programs must not rely on a maximum depth greater than 17.
1429
1430@item -fuse-cxa-atexit
1431@opindex fuse-cxa-atexit
1432Register destructors for objects with static storage duration with the
1433@code{__cxa_atexit} function rather than the @code{atexit} function.
1434This option is required for fully standards-compliant handling of static
1435destructors, but will only work if your C library supports
1436@code{__cxa_atexit}.
1437
1438@item -fvtable-gc
1439@opindex fvtable-gc
1440Emit special relocations for vtables and virtual function references
1441so that the linker can identify unused virtual functions and zero out
1442vtable slots that refer to them.  This is most useful with
1443@option{-ffunction-sections} and @option{-Wl,--gc-sections}, in order to
1444also discard the functions themselves.
1445
1446This optimization requires GNU as and GNU ld.  Not all systems support
1447this option.  @option{-Wl,--gc-sections} is ignored without @option{-static}.
1448
1449@item -fno-weak
1450@opindex fno-weak
1451Do not use weak symbol support, even if it is provided by the linker.
1452By default, G++ will use weak symbols if they are available.  This
1453option exists only for testing, and should not be used by end-users;
1454it will result in inferior code and has no benefits.  This option may
1455be removed in a future release of G++.
1456
1457@item -nostdinc++
1458@opindex nostdinc++
1459Do not search for header files in the standard directories specific to
1460C++, but do still search the other standard directories.  (This option
1461is used when building the C++ library.)
1462@end table
1463
1464In addition, these optimization, warning, and code generation options
1465have meanings only for C++ programs:
1466
1467@table @gcctabopt
1468@item -fno-default-inline
1469@opindex fno-default-inline
1470Do not assume @samp{inline} for functions defined inside a class scope.
1471@xref{Optimize Options,,Options That Control Optimization}.  Note that these
1472functions will have linkage like inline functions; they just won't be
1473inlined by default.
1474
1475@item -Wabi @r{(C++ only)}
1476@opindex Wabi
1477Warn when G++ generates code that is probably not compatible with the
1478vendor-neutral C++ ABI.  Although an effort has been made to warn about
1479all such cases, there are probably some cases that are not warned about,
1480even though G++ is generating incompatible code.  There may also be
1481cases where warnings are emitted even though the code that is generated
1482will be compatible.
1483
1484You should rewrite your code to avoid these warnings if you are
1485concerned about the fact that code generated by G++ may not be binary
1486compatible with code generated by other compilers.
1487
1488The known incompatibilities at this point include:
1489
1490@itemize @bullet
1491
1492@item
1493Incorrect handling of tail-padding for bit-fields.  G++ may attempt to
1494pack data into the same byte as a base class.  For example:
1495
1496@smallexample
1497struct A @{ virtual void f(); int f1 : 1; @};
1498struct B : public A @{ int f2 : 1; @};
1499@end smallexample
1500
1501@noindent
1502In this case, G++ will place @code{B::f2} into the same byte
1503as@code{A::f1}; other compilers will not.  You can avoid this problem
1504by explicitly padding @code{A} so that its size is a multiple of the
1505byte size on your platform; that will cause G++ and other compilers to
1506layout @code{B} identically.
1507
1508@item
1509Incorrect handling of tail-padding for virtual bases.  G++ does not use
1510tail padding when laying out virtual bases.  For example:
1511
1512@smallexample
1513struct A @{ virtual void f(); char c1; @};
1514struct B @{ B(); char c2; @};
1515struct C : public A, public virtual B @{@};
1516@end smallexample
1517
1518@noindent
1519In this case, G++ will not place @code{B} into the tail-padding for
1520@code{A}; other compilers will.  You can avoid this problem by
1521explicitly padding @code{A} so that its size is a multiple of its
1522alignment (ignoring virtual base classes); that will cause G++ and other
1523compilers to layout @code{C} identically.
1524
1525@item
1526Incorrect handling of bit-fields with declared widths greater than that
1527of their underlying types, when the bit-fields appear in a union.  For
1528example:
1529
1530@smallexample
1531union U @{ int i : 4096; @};
1532@end smallexample
1533
1534@noindent
1535Assuming that an @code{int} does not have 4096 bits, G++ will make the
1536union too small by the number of bits in an @code{int}.
1537
1538@item
1539Empty classes can be placed at incorrect offsets.  For example:
1540
1541@smallexample
1542struct A @{@};
1543
1544struct B @{
1545  A a;
1546  virtual void f ();
1547@};
1548
1549struct C : public B, public A @{@};
1550@end smallexample
1551
1552@noindent
1553G++ will place the @code{A} base class of @code{C} at a nonzero offset;
1554it should be placed at offset zero.  G++ mistakenly believes that the
1555@code{A} data member of @code{B} is already at offset zero.
1556
1557@item
1558Names of template functions whose types involve @code{typename} or
1559template template parameters can be mangled incorrectly.
1560
1561@smallexample
1562template <typename Q>
1563void f(typename Q::X) @{@}
1564
1565template <template <typename> class Q>
1566void f(typename Q<int>::X) @{@}
1567@end smallexample
1568
1569@noindent
1570Instantiations of these templates may be mangled incorrectly.
1571
1572@end itemize
1573
1574@item -Wctor-dtor-privacy @r{(C++ only)}
1575@opindex Wctor-dtor-privacy
1576Warn when a class seems unusable because all the constructors or
1577destructors in that class are private, and it has neither friends nor
1578public static member functions.  This warning is enabled by default.
1579
1580@item -Wnon-virtual-dtor @r{(C++ only)}
1581@opindex Wnon-virtual-dtor
1582Warn when a class appears to be polymorphic, thereby requiring a virtual
1583destructor, yet it declares a non-virtual one.
1584This warning is enabled by @option{-Wall}.
1585
1586@item -Wreorder @r{(C++ only)}
1587@opindex Wreorder
1588@cindex reordering, warning
1589@cindex warning for reordering of member initializers
1590Warn when the order of member initializers given in the code does not
1591match the order in which they must be executed.  For instance:
1592
1593@smallexample
1594struct A @{
1595  int i;
1596  int j;
1597  A(): j (0), i (1) @{ @}
1598@};
1599@end smallexample
1600
1601The compiler will rearrange the member initializers for @samp{i}
1602and @samp{j} to match the declaration order of the members, emitting
1603a warning to that effect.  This warning is enabled by @option{-Wall}.
1604@end table
1605
1606The following @option{-W@dots{}} options are not affected by @option{-Wall}.
1607
1608@table @gcctabopt
1609@item -Weffc++ @r{(C++ only)}
1610@opindex Weffc++
1611Warn about violations of the following style guidelines from Scott Meyers'
1612@cite{Effective C++} book:
1613
1614@itemize @bullet
1615@item
1616Item 11:  Define a copy constructor and an assignment operator for classes
1617with dynamically allocated memory.
1618
1619@item
1620Item 12:  Prefer initialization to assignment in constructors.
1621
1622@item
1623Item 14:  Make destructors virtual in base classes.
1624
1625@item
1626Item 15:  Have @code{operator=} return a reference to @code{*this}.
1627
1628@item
1629Item 23:  Don't try to return a reference when you must return an object.
1630
1631@end itemize
1632
1633Also warn about violations of the following style guidelines from
1634Scott Meyers' @cite{More Effective C++} book:
1635
1636@itemize @bullet
1637@item
1638Item 6:  Distinguish between prefix and postfix forms of increment and
1639decrement operators.
1640
1641@item
1642Item 7:  Never overload @code{&&}, @code{||}, or @code{,}.
1643
1644@end itemize
1645
1646When selecting this option, be aware that the standard library
1647headers do not obey all of these guidelines; use @samp{grep -v}
1648to filter out those warnings.
1649
1650@item -Wno-deprecated @r{(C++ only)}
1651@opindex Wno-deprecated
1652Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
1653
1654@item -Wno-non-template-friend @r{(C++ only)}
1655@opindex Wno-non-template-friend
1656Disable warnings when non-templatized friend functions are declared
1657within a template.  Since the advent of explicit template specification
1658support in G++, if the name of the friend is an unqualified-id (i.e.,
1659@samp{friend foo(int)}), the C++ language specification demands that the
1660friend declare or define an ordinary, nontemplate function.  (Section
166114.5.3).  Before G++ implemented explicit specification, unqualified-ids
1662could be interpreted as a particular specialization of a templatized
1663function.  Because this non-conforming behavior is no longer the default
1664behavior for G++, @option{-Wnon-template-friend} allows the compiler to
1665check existing code for potential trouble spots and is on by default.
1666This new compiler behavior can be turned off with
1667@option{-Wno-non-template-friend} which keeps the conformant compiler code
1668but disables the helpful warning.
1669
1670@item -Wold-style-cast @r{(C++ only)}
1671@opindex Wold-style-cast
1672Warn if an old-style (C-style) cast to a non-void type is used within
1673a C++ program.  The new-style casts (@samp{static_cast},
1674@samp{reinterpret_cast}, and @samp{const_cast}) are less vulnerable to
1675unintended effects and much easier to search for.
1676
1677@item -Woverloaded-virtual @r{(C++ only)}
1678@opindex Woverloaded-virtual
1679@cindex overloaded virtual fn, warning
1680@cindex warning for overloaded virtual fn
1681Warn when a function declaration hides virtual functions from a
1682base class.  For example, in:
1683
1684@smallexample
1685struct A @{
1686  virtual void f();
1687@};
1688
1689struct B: public A @{
1690  void f(int);
1691@};
1692@end smallexample
1693
1694the @code{A} class version of @code{f} is hidden in @code{B}, and code
1695like:
1696
1697@smallexample
1698B* b;
1699b->f();
1700@end smallexample
1701
1702will fail to compile.
1703
1704@item -Wno-pmf-conversions @r{(C++ only)}
1705@opindex Wno-pmf-conversions
1706Disable the diagnostic for converting a bound pointer to member function
1707to a plain pointer.
1708
1709@item -Wsign-promo @r{(C++ only)}
1710@opindex Wsign-promo
1711Warn when overload resolution chooses a promotion from unsigned or
1712enumeral type to a signed type, over a conversion to an unsigned type of
1713the same size.  Previous versions of G++ would try to preserve
1714unsignedness, but the standard mandates the current behavior.
1715@end table
1716
1717@node Objective-C Dialect Options
1718@section Options Controlling Objective-C Dialect
1719
1720@cindex compiler options, Objective-C
1721@cindex Objective-C options, command line
1722@cindex options, Objective-C
1723This section describes the command-line options that are only meaningful
1724for Objective-C programs, but you can also use most of the GNU compiler
1725options regardless of what language your program is in.  For example,
1726you might compile a file @code{some_class.m} like this:
1727
1728@example
1729gcc -g -fgnu-runtime -O -c some_class.m
1730@end example
1731
1732@noindent
1733In this example, @option{-fgnu-runtime} is an option meant only for
1734Objective-C programs; you can use the other options with any language
1735supported by GCC@.
1736
1737Here is a list of options that are @emph{only} for compiling Objective-C
1738programs:
1739
1740@table @gcctabopt
1741@item -fconstant-string-class=@var{class-name}
1742@opindex fconstant-string-class
1743Use @var{class-name} as the name of the class to instantiate for each
1744literal string specified with the syntax @code{@@"@dots{}"}.  The default
1745class name is @code{NXConstantString}.
1746
1747@item -fgnu-runtime
1748@opindex fgnu-runtime
1749Generate object code compatible with the standard GNU Objective-C
1750runtime.  This is the default for most types of systems.
1751
1752@item -fnext-runtime
1753@opindex fnext-runtime
1754Generate output compatible with the NeXT runtime.  This is the default
1755for NeXT-based systems, including Darwin and Mac OS X@.  The macro
1756@code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
1757used.
1758
1759@item -gen-decls
1760@opindex gen-decls
1761Dump interface declarations for all classes seen in the source file to a
1762file named @file{@var{sourcename}.decl}.
1763
1764@item -Wno-protocol
1765@opindex Wno-protocol
1766If a class is declared to implement a protocol, a warning is issued for
1767every method in the protocol that is not implemented by the class.  The
1768default behavior is to issue a warning for every method not explicitly
1769implemented in the class, even if a method implementation is inherited
1770from the superclass.  If you use the @code{-Wno-protocol} option, then
1771methods inherited from the superclass are considered to be implemented,
1772and no warning is issued for them.
1773
1774@item -Wselector
1775@opindex Wselector
1776Warn if multiple methods of different types for the same selector are
1777found during compilation.  The check is performed on the list of methods
1778in the final stage of compilation.  Additionally, a check is performed
1779for each selector appearing in a @code{@@selector(@dots{})}
1780expression, and a corresponding method for that selector has been found
1781during compilation.  Because these checks scan the method table only at
1782the end of compilation, these warnings are not produced if the final
1783stage of compilation is not reached, for example because an error is
1784found during compilation, or because the @code{-fsyntax-only} option is
1785being used.
1786
1787@item -Wundeclared-selector
1788@opindex Wundeclared-selector
1789Warn if a @code{@@selector(@dots{})} expression referring to an
1790undeclared selector is found.  A selector is considered undeclared if no
1791method with that name has been declared before the
1792@code{@@selector(@dots{})} expression, either explicitly in an
1793@code{@@interface} or @code{@@protocol} declaration, or implicitly in
1794an @code{@@implementation} section.  This option always performs its
1795checks as soon as a @code{@@selector(@dots{})} expression is found,
1796while @code{-Wselector} only performs its checks in the final stage of
1797compilation.  This also enforces the coding style convention
1798that methods and selectors must be declared before being used.
1799
1800@c not documented because only avail via -Wp
1801@c @item -print-objc-runtime-info
1802
1803@end table
1804
1805@node Language Independent Options
1806@section Options to Control Diagnostic Messages Formatting
1807@cindex options to control diagnostics formatting
1808@cindex diagnostic messages
1809@cindex message formatting
1810
1811Traditionally, diagnostic messages have been formatted irrespective of
1812the output device's aspect (e.g.@: its width, @dots{}).  The options described
1813below can be used to control the diagnostic messages formatting
1814algorithm, e.g.@: how many characters per line, how often source location
1815information should be reported.  Right now, only the C++ front end can
1816honor these options.  However it is expected, in the near future, that
1817the remaining front ends would be able to digest them correctly.
1818
1819@table @gcctabopt
1820@item -fmessage-length=@var{n}
1821@opindex fmessage-length
1822Try to format error messages so that they fit on lines of about @var{n}
1823characters.  The default is 72 characters for @command{g++} and 0 for the rest of
1824the front ends supported by GCC@.  If @var{n} is zero, then no
1825line-wrapping will be done; each error message will appear on a single
1826line.
1827
1828@opindex fdiagnostics-show-location
1829@item -fdiagnostics-show-location=once
1830Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
1831reporter to emit @emph{once} source location information; that is, in
1832case the message is too long to fit on a single physical line and has to
1833be wrapped, the source location won't be emitted (as prefix) again,
1834over and over, in subsequent continuation lines.  This is the default
1835behavior.
1836
1837@item -fdiagnostics-show-location=every-line
1838Only meaningful in line-wrapping mode.  Instructs the diagnostic
1839messages reporter to emit the same source location information (as
1840prefix) for physical lines that result from the process of breaking
1841a message which is too long to fit on a single line.
1842
1843@end table
1844
1845@node Warning Options
1846@section Options to Request or Suppress Warnings
1847@cindex options to control warnings
1848@cindex warning messages
1849@cindex messages, warning
1850@cindex suppressing warnings
1851
1852Warnings are diagnostic messages that report constructions which
1853are not inherently erroneous but which are risky or suggest there
1854may have been an error.
1855
1856You can request many specific warnings with options beginning @samp{-W},
1857for example @option{-Wimplicit} to request warnings on implicit
1858declarations.  Each of these specific warning options also has a
1859negative form beginning @samp{-Wno-} to turn off warnings;
1860for example, @option{-Wno-implicit}.  This manual lists only one of the
1861two forms, whichever is not the default.
1862
1863The following options control the amount and kinds of warnings produced
1864by GCC; for further, language-specific options also refer to
1865@ref{C++ Dialect Options} and @ref{Objective-C Dialect Options}.
1866
1867@table @gcctabopt
1868@cindex syntax checking
1869@item -fsyntax-only
1870@opindex fsyntax-only
1871Check the code for syntax errors, but don't do anything beyond that.
1872
1873@item -pedantic
1874@opindex pedantic
1875Issue all the warnings demanded by strict ISO C and ISO C++;
1876reject all programs that use forbidden extensions, and some other
1877programs that do not follow ISO C and ISO C++.  For ISO C, follows the
1878version of the ISO C standard specified by any @option{-std} option used.
1879
1880Valid ISO C and ISO C++ programs should compile properly with or without
1881this option (though a rare few will require @option{-ansi} or a
1882@option{-std} option specifying the required version of ISO C)@.  However,
1883without this option, certain GNU extensions and traditional C and C++
1884features are supported as well.  With this option, they are rejected.
1885
1886@option{-pedantic} does not cause warning messages for use of the
1887alternate keywords whose names begin and end with @samp{__}.  Pedantic
1888warnings are also disabled in the expression that follows
1889@code{__extension__}.  However, only system header files should use
1890these escape routes; application programs should avoid them.
1891@xref{Alternate Keywords}.
1892
1893Some users try to use @option{-pedantic} to check programs for strict ISO
1894C conformance.  They soon find that it does not do quite what they want:
1895it finds some non-ISO practices, but not all---only those for which
1896ISO C @emph{requires} a diagnostic, and some others for which
1897diagnostics have been added.
1898
1899A feature to report any failure to conform to ISO C might be useful in
1900some instances, but would require considerable additional work and would
1901be quite different from @option{-pedantic}.  We don't have plans to
1902support such a feature in the near future.
1903
1904Where the standard specified with @option{-std} represents a GNU
1905extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
1906corresponding @dfn{base standard}, the version of ISO C on which the GNU
1907extended dialect is based.  Warnings from @option{-pedantic} are given
1908where they are required by the base standard.  (It would not make sense
1909for such warnings to be given only for features not in the specified GNU
1910C dialect, since by definition the GNU dialects of C include all
1911features the compiler supports with the given option, and there would be
1912nothing to warn about.)
1913
1914@item -pedantic-errors
1915@opindex pedantic-errors
1916Like @option{-pedantic}, except that errors are produced rather than
1917warnings.
1918
1919@item -w
1920@opindex w
1921Inhibit all warning messages.
1922
1923@item -Wno-import
1924@opindex Wno-import
1925Inhibit warning messages about the use of @samp{#import}.
1926
1927@item -Wchar-subscripts
1928@opindex Wchar-subscripts
1929Warn if an array subscript has type @code{char}.  This is a common cause
1930of error, as programmers often forget that this type is signed on some
1931machines.
1932
1933@item -Wcomment
1934@opindex Wcomment
1935Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
1936comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
1937
1938@item -Wformat
1939@opindex Wformat
1940Check calls to @code{printf} and @code{scanf}, etc., to make sure that
1941the arguments supplied have types appropriate to the format string
1942specified, and that the conversions specified in the format string make
1943sense.  This includes standard functions, and others specified by format
1944attributes (@pxref{Function Attributes}), in the @code{printf},
1945@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
1946not in the C standard) families.
1947
1948The formats are checked against the format features supported by GNU
1949libc version 2.2.  These include all ISO C90 and C99 features, as well
1950as features from the Single Unix Specification and some BSD and GNU
1951extensions.  Other library implementations may not support all these
1952features; GCC does not support warning about features that go beyond a
1953particular library's limitations.  However, if @option{-pedantic} is used
1954with @option{-Wformat}, warnings will be given about format features not
1955in the selected standard version (but not for @code{strfmon} formats,
1956since those are not in any version of the C standard).  @xref{C Dialect
1957Options,,Options Controlling C Dialect}.
1958
1959Since @option{-Wformat} also checks for null format arguments for
1960several functions, @option{-Wformat} also implies @option{-Wnonnull}.
1961
1962@option{-Wformat} is included in @option{-Wall}.  For more control over some
1963aspects of format checking, the options @option{-Wno-format-y2k},
1964@option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
1965@option{-Wformat-nonliteral}, @option{-Wformat-security}, and
1966@option{-Wformat=2} are available, but are not included in @option{-Wall}.
1967
1968@item -Wno-format-y2k
1969@opindex Wno-format-y2k
1970If @option{-Wformat} is specified, do not warn about @code{strftime}
1971formats which may yield only a two-digit year.
1972
1973@item -Wno-format-extra-args
1974@opindex Wno-format-extra-args
1975If @option{-Wformat} is specified, do not warn about excess arguments to a
1976@code{printf} or @code{scanf} format function.  The C standard specifies
1977that such arguments are ignored.
1978
1979Where the unused arguments lie between used arguments that are
1980specified with @samp{$} operand number specifications, normally
1981warnings are still given, since the implementation could not know what
1982type to pass to @code{va_arg} to skip the unused arguments.  However,
1983in the case of @code{scanf} formats, this option will suppress the
1984warning if the unused arguments are all pointers, since the Single
1985Unix Specification says that such unused arguments are allowed.
1986
1987@item -Wno-format-zero-length
1988@opindex Wno-format-zero-length
1989If @option{-Wformat} is specified, do not warn about zero-length formats.
1990The C standard specifies that zero-length formats are allowed.
1991
1992@item -Wformat-nonliteral
1993@opindex Wformat-nonliteral
1994If @option{-Wformat} is specified, also warn if the format string is not a
1995string literal and so cannot be checked, unless the format function
1996takes its format arguments as a @code{va_list}.
1997
1998@item -Wformat-security
1999@opindex Wformat-security
2000If @option{-Wformat} is specified, also warn about uses of format
2001functions that represent possible security problems.  At present, this
2002warns about calls to @code{printf} and @code{scanf} functions where the
2003format string is not a string literal and there are no format arguments,
2004as in @code{printf (foo);}.  This may be a security hole if the format
2005string came from untrusted input and contains @samp{%n}.  (This is
2006currently a subset of what @option{-Wformat-nonliteral} warns about, but
2007in future warnings may be added to @option{-Wformat-security} that are not
2008included in @option{-Wformat-nonliteral}.)
2009
2010@item -Wformat=2
2011@opindex Wformat=2
2012Enable @option{-Wformat} plus format checks not included in
2013@option{-Wformat}.  Currently equivalent to @samp{-Wformat
2014-Wformat-nonliteral -Wformat-security}.
2015
2016@item -Wnonnull
2017@opindex Wnonnull
2018Warn about passing a null pointer for arguments marked as
2019requiring a non-null value by the @code{nonnull} function attribute.
2020
2021@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
2022can be disabled with the @option{-Wno-nonnull} option.
2023
2024@item -Wimplicit-int
2025@opindex Wimplicit-int
2026Warn when a declaration does not specify a type.
2027
2028@item -Wimplicit-function-declaration
2029@itemx -Werror-implicit-function-declaration
2030@opindex Wimplicit-function-declaration
2031@opindex Werror-implicit-function-declaration
2032Give a warning (or error) whenever a function is used before being
2033declared.
2034
2035@item -Wimplicit
2036@opindex Wimplicit
2037Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
2038
2039@item -Wmain
2040@opindex Wmain
2041Warn if the type of @samp{main} is suspicious.  @samp{main} should be a
2042function with external linkage, returning int, taking either zero
2043arguments, two, or three arguments of appropriate types.
2044
2045@item -Wmissing-braces
2046@opindex Wmissing-braces
2047Warn if an aggregate or union initializer is not fully bracketed.  In
2048the following example, the initializer for @samp{a} is not fully
2049bracketed, but that for @samp{b} is fully bracketed.
2050
2051@smallexample
2052int a[2][2] = @{ 0, 1, 2, 3 @};
2053int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
2054@end smallexample
2055
2056@item -Wparentheses
2057@opindex Wparentheses
2058Warn if parentheses are omitted in certain contexts, such
2059as when there is an assignment in a context where a truth value
2060is expected, or when operators are nested whose precedence people
2061often get confused about.
2062
2063Also warn about constructions where there may be confusion to which
2064@code{if} statement an @code{else} branch belongs.  Here is an example of
2065such a case:
2066
2067@smallexample
2068@group
2069@{
2070  if (a)
2071    if (b)
2072      foo ();
2073  else
2074    bar ();
2075@}
2076@end group
2077@end smallexample
2078
2079In C, every @code{else} branch belongs to the innermost possible @code{if}
2080statement, which in this example is @code{if (b)}.  This is often not
2081what the programmer expected, as illustrated in the above example by
2082indentation the programmer chose.  When there is the potential for this
2083confusion, GCC will issue a warning when this flag is specified.
2084To eliminate the warning, add explicit braces around the innermost
2085@code{if} statement so there is no way the @code{else} could belong to
2086the enclosing @code{if}.  The resulting code would look like this:
2087
2088@smallexample
2089@group
2090@{
2091  if (a)
2092    @{
2093      if (b)
2094        foo ();
2095      else
2096        bar ();
2097    @}
2098@}
2099@end group
2100@end smallexample
2101
2102@item -Wsequence-point
2103@opindex Wsequence-point
2104Warn about code that may have undefined semantics because of violations
2105of sequence point rules in the C standard.
2106
2107The C standard defines the order in which expressions in a C program are
2108evaluated in terms of @dfn{sequence points}, which represent a partial
2109ordering between the execution of parts of the program: those executed
2110before the sequence point, and those executed after it.  These occur
2111after the evaluation of a full expression (one which is not part of a
2112larger expression), after the evaluation of the first operand of a
2113@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
2114function is called (but after the evaluation of its arguments and the
2115expression denoting the called function), and in certain other places.
2116Other than as expressed by the sequence point rules, the order of
2117evaluation of subexpressions of an expression is not specified.  All
2118these rules describe only a partial order rather than a total order,
2119since, for example, if two functions are called within one expression
2120with no sequence point between them, the order in which the functions
2121are called is not specified.  However, the standards committee have
2122ruled that function calls do not overlap.
2123
2124It is not specified when between sequence points modifications to the
2125values of objects take effect.  Programs whose behavior depends on this
2126have undefined behavior; the C standard specifies that ``Between the
2127previous and next sequence point an object shall have its stored value
2128modified at most once by the evaluation of an expression.  Furthermore,
2129the prior value shall be read only to determine the value to be
2130stored.''.  If a program breaks these rules, the results on any
2131particular implementation are entirely unpredictable.
2132
2133Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
2134= b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
2135diagnosed by this option, and it may give an occasional false positive
2136result, but in general it has been found fairly effective at detecting
2137this sort of problem in programs.
2138
2139The present implementation of this option only works for C programs.  A
2140future implementation may also work for C++ programs.
2141
2142The C standard is worded confusingly, therefore there is some debate
2143over the precise meaning of the sequence point rules in subtle cases.
2144Links to discussions of the problem, including proposed formal
2145definitions, may be found on our readings page, at
2146@w{@uref{http://gcc.gnu.org/readings.html}}.
2147
2148@item -Wreturn-type
2149@opindex Wreturn-type
2150Warn whenever a function is defined with a return-type that defaults to
2151@code{int}.  Also warn about any @code{return} statement with no
2152return-value in a function whose return-type is not @code{void}.
2153
2154For C++, a function without return type always produces a diagnostic
2155message, even when @option{-Wno-return-type} is specified.  The only
2156exceptions are @samp{main} and functions defined in system headers.
2157
2158@item -Wswitch
2159@opindex Wswitch
2160Warn whenever a @code{switch} statement has an index of enumeral type
2161and lacks a @code{case} for one or more of the named codes of that
2162enumeration.  (The presence of a @code{default} label prevents this
2163warning.)  @code{case} labels outside the enumeration range also
2164provoke warnings when this option is used.
2165
2166@item -Wswitch-default
2167@opindex Wswitch-switch
2168Warn whenever a @code{switch} statement does not have a @code{default}
2169case.
2170
2171@item -Wswitch-enum
2172@opindex Wswitch-enum
2173Warn whenever a @code{switch} statement has an index of enumeral type
2174and lacks a @code{case} for one or more of the named codes of that
2175enumeration.  @code{case} labels outside the enumeration range also
2176provoke warnings when this option is used.
2177
2178@item -Wtrigraphs
2179@opindex Wtrigraphs
2180Warn if any trigraphs are encountered that might change the meaning of
2181the program (trigraphs within comments are not warned about).
2182
2183@item -Wunused-function
2184@opindex Wunused-function
2185Warn whenever a static function is declared but not defined or a
2186non\-inline static function is unused.
2187
2188@item -Wunused-label
2189@opindex Wunused-label
2190Warn whenever a label is declared but not used.
2191
2192To suppress this warning use the @samp{unused} attribute
2193(@pxref{Variable Attributes}).
2194
2195@item -Wunused-parameter
2196@opindex Wunused-parameter
2197Warn whenever a function parameter is unused aside from its declaration.
2198
2199To suppress this warning use the @samp{unused} attribute
2200(@pxref{Variable Attributes}).
2201
2202@item -Wunused-variable
2203@opindex Wunused-variable
2204Warn whenever a local variable or non-constant static variable is unused
2205aside from its declaration
2206
2207To suppress this warning use the @samp{unused} attribute
2208(@pxref{Variable Attributes}).
2209
2210@item -Wunused-value
2211@opindex Wunused-value
2212Warn whenever a statement computes a result that is explicitly not used.
2213
2214To suppress this warning cast the expression to @samp{void}.
2215
2216@item -Wunused
2217@opindex Wunused
2218All the above @option{-Wunused} options combined.
2219
2220In order to get a warning about an unused function parameter, you must
2221either specify @samp{-W -Wunused} or separately specify
2222@option{-Wunused-parameter}.
2223
2224@item -Wuninitialized
2225@opindex Wuninitialized
2226Warn if an automatic variable is used without first being initialized or
2227if a variable may be clobbered by a @code{setjmp} call.
2228
2229These warnings are possible only in optimizing compilation,
2230because they require data flow information that is computed only
2231when optimizing.  If you don't specify @option{-O}, you simply won't
2232get these warnings.
2233
2234These warnings occur only for variables that are candidates for
2235register allocation.  Therefore, they do not occur for a variable that
2236is declared @code{volatile}, or whose address is taken, or whose size
2237is other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
2238structures, unions or arrays, even when they are in registers.
2239
2240Note that there may be no warning about a variable that is used only
2241to compute a value that itself is never used, because such
2242computations may be deleted by data flow analysis before the warnings
2243are printed.
2244
2245These warnings are made optional because GCC is not smart
2246enough to see all the reasons why the code might be correct
2247despite appearing to have an error.  Here is one example of how
2248this can happen:
2249
2250@smallexample
2251@group
2252@{
2253  int x;
2254  switch (y)
2255    @{
2256    case 1: x = 1;
2257      break;
2258    case 2: x = 4;
2259      break;
2260    case 3: x = 5;
2261    @}
2262  foo (x);
2263@}
2264@end group
2265@end smallexample
2266
2267@noindent
2268If the value of @code{y} is always 1, 2 or 3, then @code{x} is
2269always initialized, but GCC doesn't know this.  Here is
2270another common case:
2271
2272@smallexample
2273@{
2274  int save_y;
2275  if (change_y) save_y = y, y = new_y;
2276  @dots{}
2277  if (change_y) y = save_y;
2278@}
2279@end smallexample
2280
2281@noindent
2282This has no bug because @code{save_y} is used only if it is set.
2283
2284@cindex @code{longjmp} warnings
2285This option also warns when a non-volatile automatic variable might be
2286changed by a call to @code{longjmp}.  These warnings as well are possible
2287only in optimizing compilation.
2288
2289The compiler sees only the calls to @code{setjmp}.  It cannot know
2290where @code{longjmp} will be called; in fact, a signal handler could
2291call it at any point in the code.  As a result, you may get a warning
2292even when there is in fact no problem because @code{longjmp} cannot
2293in fact be called at the place which would cause a problem.
2294
2295Some spurious warnings can be avoided if you declare all the functions
2296you use that never return as @code{noreturn}.  @xref{Function
2297Attributes}.
2298
2299@item -Wunknown-pragmas
2300@opindex Wunknown-pragmas
2301@cindex warning for unknown pragmas
2302@cindex unknown pragmas, warning
2303@cindex pragmas, warning of unknown
2304Warn when a #pragma directive is encountered which is not understood by
2305GCC@.  If this command line option is used, warnings will even be issued
2306for unknown pragmas in system header files.  This is not the case if
2307the warnings were only enabled by the @option{-Wall} command line option.
2308
2309@item -Wstrict-aliasing
2310@opindex Wstrict-aliasing
2311This option is only active when @option{-fstrict-aliasing} is active.
2312It warns about code which might break the strict aliasing rules that the
2313compiler is using for optimization. The warning does not catch all
2314cases, but does attempt to catch the more common pitfalls. It is
2315included in @option{-Wall}.
2316
2317@item -Wall
2318@opindex Wall
2319All of the above @samp{-W} options combined.  This enables all the
2320warnings about constructions that some users consider questionable, and
2321that are easy to avoid (or modify to prevent the warning), even in
2322conjunction with macros.  This also enables some language-specific
2323warnings described in @ref{C++ Dialect Options} and
2324@ref{Objective-C Dialect Options}.
2325@end table
2326
2327The following @option{-W@dots{}} options are not implied by @option{-Wall}.
2328Some of them warn about constructions that users generally do not
2329consider questionable, but which occasionally you might wish to check
2330for; others warn about constructions that are necessary or hard to avoid
2331in some cases, and there is no simple way to modify the code to suppress
2332the warning.
2333
2334@table @gcctabopt
2335@item -W
2336@opindex W
2337Print extra warning messages for these events:
2338
2339@itemize @bullet
2340@item
2341A function can return either with or without a value.  (Falling
2342off the end of the function body is considered returning without
2343a value.)  For example, this function would evoke such a
2344warning:
2345
2346@smallexample
2347@group
2348foo (a)
2349@{
2350  if (a > 0)
2351    return a;
2352@}
2353@end group
2354@end smallexample
2355
2356@item
2357An expression-statement or the left-hand side of a comma expression
2358contains no side effects.
2359To suppress the warning, cast the unused expression to void.
2360For example, an expression such as @samp{x[i,j]} will cause a warning,
2361but @samp{x[(void)i,j]} will not.
2362
2363@item
2364An unsigned value is compared against zero with @samp{<} or @samp{>=}.
2365
2366@item
2367A comparison like @samp{x<=y<=z} appears; this is equivalent to
2368@samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from
2369that of ordinary mathematical notation.
2370
2371@item
2372Storage-class specifiers like @code{static} are not the first things in
2373a declaration.  According to the C Standard, this usage is obsolescent.
2374
2375@item
2376The return type of a function has a type qualifier such as @code{const}.
2377Such a type qualifier has no effect, since the value returned by a
2378function is not an lvalue.  (But don't warn about the GNU extension of
2379@code{volatile void} return types.  That extension will be warned about
2380if @option{-pedantic} is specified.)
2381
2382@item
2383If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
2384arguments.
2385
2386@item
2387A comparison between signed and unsigned values could produce an
2388incorrect result when the signed value is converted to unsigned.
2389(But don't warn if @option{-Wno-sign-compare} is also specified.)
2390
2391@item
2392An aggregate has a partly bracketed initializer.
2393For example, the following code would evoke such a warning,
2394because braces are missing around the initializer for @code{x.h}:
2395
2396@smallexample
2397struct s @{ int f, g; @};
2398struct t @{ struct s h; int i; @};
2399struct t x = @{ 1, 2, 3 @};
2400@end smallexample
2401
2402@item
2403An aggregate has an initializer which does not initialize all members.
2404For example, the following code would cause such a warning, because
2405@code{x.h} would be implicitly initialized to zero:
2406
2407@smallexample
2408struct s @{ int f, g, h; @};
2409struct s x = @{ 3, 4 @};
2410@end smallexample
2411@end itemize
2412
2413@item -Wno-div-by-zero
2414@opindex Wno-div-by-zero
2415@opindex Wdiv-by-zero
2416Do not warn about compile-time integer division by zero.  Floating point
2417division by zero is not warned about, as it can be a legitimate way of
2418obtaining infinities and NaNs.
2419
2420@item -Wsystem-headers
2421@opindex Wsystem-headers
2422@cindex warnings from system headers
2423@cindex system headers, warnings from
2424Print warning messages for constructs found in system header files.
2425Warnings from system headers are normally suppressed, on the assumption
2426that they usually do not indicate real problems and would only make the
2427compiler output harder to read.  Using this command line option tells
2428GCC to emit warnings from system headers as if they occurred in user
2429code.  However, note that using @option{-Wall} in conjunction with this
2430option will @emph{not} warn about unknown pragmas in system
2431headers---for that, @option{-Wunknown-pragmas} must also be used.
2432
2433@item -Wfloat-equal
2434@opindex Wfloat-equal
2435Warn if floating point values are used in equality comparisons.
2436
2437The idea behind this is that sometimes it is convenient (for the
2438programmer) to consider floating-point values as approximations to
2439infinitely precise real numbers.  If you are doing this, then you need
2440to compute (by analyzing the code, or in some other way) the maximum or
2441likely maximum error that the computation introduces, and allow for it
2442when performing comparisons (and when producing output, but that's a
2443different problem).  In particular, instead of testing for equality, you
2444would check to see whether the two values have ranges that overlap; and
2445this is done with the relational operators, so equality comparisons are
2446probably mistaken.
2447
2448@item -Wtraditional @r{(C only)}
2449@opindex Wtraditional
2450Warn about certain constructs that behave differently in traditional and
2451ISO C@.  Also warn about ISO C constructs that have no traditional C
2452equivalent, and/or problematic constructs which should be avoided.
2453
2454@itemize @bullet
2455@item
2456Macro parameters that appear within string literals in the macro body.
2457In traditional C macro replacement takes place within string literals,
2458but does not in ISO C@.
2459
2460@item
2461In traditional C, some preprocessor directives did not exist.
2462Traditional preprocessors would only consider a line to be a directive
2463if the @samp{#} appeared in column 1 on the line.  Therefore
2464@option{-Wtraditional} warns about directives that traditional C
2465understands but would ignore because the @samp{#} does not appear as the
2466first character on the line.  It also suggests you hide directives like
2467@samp{#pragma} not understood by traditional C by indenting them.  Some
2468traditional implementations would not recognize @samp{#elif}, so it
2469suggests avoiding it altogether.
2470
2471@item
2472A function-like macro that appears without arguments.
2473
2474@item
2475The unary plus operator.
2476
2477@item
2478The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
2479constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
2480constants.)  Note, these suffixes appear in macros defined in the system
2481headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
2482Use of these macros in user code might normally lead to spurious
2483warnings, however gcc's integrated preprocessor has enough context to
2484avoid warning in these cases.
2485
2486@item
2487A function declared external in one block and then used after the end of
2488the block.
2489
2490@item
2491A @code{switch} statement has an operand of type @code{long}.
2492
2493@item
2494A non-@code{static} function declaration follows a @code{static} one.
2495This construct is not accepted by some traditional C compilers.
2496
2497@item
2498The ISO type of an integer constant has a different width or
2499signedness from its traditional type.  This warning is only issued if
2500the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
2501typically represent bit patterns, are not warned about.
2502
2503@item
2504Usage of ISO string concatenation is detected.
2505
2506@item
2507Initialization of automatic aggregates.
2508
2509@item
2510Identifier conflicts with labels.  Traditional C lacks a separate
2511namespace for labels.
2512
2513@item
2514Initialization of unions.  If the initializer is zero, the warning is
2515omitted.  This is done under the assumption that the zero initializer in
2516user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
2517initializer warnings and relies on default initialization to zero in the
2518traditional C case.
2519
2520@item
2521Conversions by prototypes between fixed/floating point values and vice
2522versa.  The absence of these prototypes when compiling with traditional
2523C would cause serious problems.  This is a subset of the possible
2524conversion warnings, for the full set use @option{-Wconversion}.
2525
2526@item
2527Use of ISO C style function definitions.  This warning intentionally is
2528@emph{not} issued for prototype declarations or variadic functions
2529because these ISO C features will appear in your code when using
2530libiberty's traditional C compatibility macros, @code{PARAMS} and
2531@code{VPARAMS}.  This warning is also bypassed for nested functions
2532because that feature is already a gcc extension and thus not relevant to
2533traditional C compatibility.
2534@end itemize
2535
2536@item -Wundef
2537@opindex Wundef
2538Warn if an undefined identifier is evaluated in an @samp{#if} directive.
2539
2540@item -Wendif-labels
2541@opindex Wendif-labels
2542Warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
2543
2544@item -Wshadow
2545@opindex Wshadow
2546Warn whenever a local variable shadows another local variable, parameter or
2547global variable or whenever a built-in function is shadowed.
2548
2549@item -Wlarger-than-@var{len}
2550@opindex Wlarger-than
2551Warn whenever an object of larger than @var{len} bytes is defined.
2552
2553@item -Wpointer-arith
2554@opindex Wpointer-arith
2555Warn about anything that depends on the ``size of'' a function type or
2556of @code{void}.  GNU C assigns these types a size of 1, for
2557convenience in calculations with @code{void *} pointers and pointers
2558to functions.
2559
2560@item -Wbad-function-cast @r{(C only)}
2561@opindex Wbad-function-cast
2562Warn whenever a function call is cast to a non-matching type.
2563For example, warn if @code{int malloc()} is cast to @code{anything *}.
2564
2565@item -Wcast-qual
2566@opindex Wcast-qual
2567Warn whenever a pointer is cast so as to remove a type qualifier from
2568the target type.  For example, warn if a @code{const char *} is cast
2569to an ordinary @code{char *}.
2570
2571@item -Wcast-align
2572@opindex Wcast-align
2573Warn whenever a pointer is cast such that the required alignment of the
2574target is increased.  For example, warn if a @code{char *} is cast to
2575an @code{int *} on machines where integers can only be accessed at
2576two- or four-byte boundaries.
2577
2578@item -Wwrite-strings
2579@opindex Wwrite-strings
2580When compiling C, give string constants the type @code{const
2581char[@var{length}]} so that
2582copying the address of one into a non-@code{const} @code{char *}
2583pointer will get a warning; when compiling C++, warn about the
2584deprecated conversion from string constants to @code{char *}.
2585These warnings will help you find at
2586compile time code that can try to write into a string constant, but
2587only if you have been very careful about using @code{const} in
2588declarations and prototypes.  Otherwise, it will just be a nuisance;
2589this is why we did not make @option{-Wall} request these warnings.
2590
2591@item -Wconversion
2592@opindex Wconversion
2593Warn if a prototype causes a type conversion that is different from what
2594would happen to the same argument in the absence of a prototype.  This
2595includes conversions of fixed point to floating and vice versa, and
2596conversions changing the width or signedness of a fixed point argument
2597except when the same as the default promotion.
2598
2599Also, warn if a negative integer constant expression is implicitly
2600converted to an unsigned type.  For example, warn about the assignment
2601@code{x = -1} if @code{x} is unsigned.  But do not warn about explicit
2602casts like @code{(unsigned) -1}.
2603
2604@item -Wsign-compare
2605@opindex Wsign-compare
2606@cindex warning for comparison of signed and unsigned values
2607@cindex comparison of signed and unsigned values, warning
2608@cindex signed and unsigned values, comparison warning
2609Warn when a comparison between signed and unsigned values could produce
2610an incorrect result when the signed value is converted to unsigned.
2611This warning is enabled by @option{-W}, and by @option{-Wall}
2612in C++ only.
2613
2614@item -Waggregate-return
2615@opindex Waggregate-return
2616Warn if any functions that return structures or unions are defined or
2617called.  (In languages where you can return an array, this also elicits
2618a warning.)
2619
2620@item -Wstrict-prototypes @r{(C only)}
2621@opindex Wstrict-prototypes
2622Warn if a function is declared or defined without specifying the
2623argument types.  (An old-style function definition is permitted without
2624a warning if preceded by a declaration which specifies the argument
2625types.)
2626
2627@item -Wmissing-prototypes @r{(C only)}
2628@opindex Wmissing-prototypes
2629Warn if a global function is defined without a previous prototype
2630declaration.  This warning is issued even if the definition itself
2631provides a prototype.  The aim is to detect global functions that fail
2632to be declared in header files.
2633
2634@item -Wmissing-declarations @r{(C only)}
2635@opindex Wmissing-declarations
2636Warn if a global function is defined without a previous declaration.
2637Do so even if the definition itself provides a prototype.
2638Use this option to detect global functions that are not declared in
2639header files.
2640
2641@item -Wmissing-noreturn
2642@opindex Wmissing-noreturn
2643Warn about functions which might be candidates for attribute @code{noreturn}.
2644Note these are only possible candidates, not absolute ones.  Care should
2645be taken to manually verify functions actually do not ever return before
2646adding the @code{noreturn} attribute, otherwise subtle code generation
2647bugs could be introduced.  You will not get a warning for @code{main} in
2648hosted C environments.
2649
2650@item -Wmissing-format-attribute
2651@opindex Wmissing-format-attribute
2652@opindex Wformat
2653If @option{-Wformat} is enabled, also warn about functions which might be
2654candidates for @code{format} attributes.  Note these are only possible
2655candidates, not absolute ones.  GCC will guess that @code{format}
2656attributes might be appropriate for any function that calls a function
2657like @code{vprintf} or @code{vscanf}, but this might not always be the
2658case, and some functions for which @code{format} attributes are
2659appropriate may not be detected.  This option has no effect unless
2660@option{-Wformat} is enabled (possibly by @option{-Wall}).
2661
2662@item -Wno-multichar
2663@opindex Wno-multichar
2664@opindex Wmultichar
2665Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
2666Usually they indicate a typo in the user's code, as they have
2667implementation-defined values, and should not be used in portable code.
2668
2669@item -Wno-deprecated-declarations
2670@opindex Wno-deprecated-declarations
2671Do not warn about uses of functions, variables, and types marked as
2672deprecated by using the @code{deprecated} attribute.
2673(@pxref{Function Attributes}, @pxref{Variable Attributes},
2674@pxref{Type Attributes}.)
2675
2676@item -Wpacked
2677@opindex Wpacked
2678Warn if a structure is given the packed attribute, but the packed
2679attribute has no effect on the layout or size of the structure.
2680Such structures may be mis-aligned for little benefit.  For
2681instance, in this code, the variable @code{f.x} in @code{struct bar}
2682will be misaligned even though @code{struct bar} does not itself
2683have the packed attribute:
2684
2685@smallexample
2686@group
2687struct foo @{
2688  int x;
2689  char a, b, c, d;
2690@} __attribute__((packed));
2691struct bar @{
2692  char z;
2693  struct foo f;
2694@};
2695@end group
2696@end smallexample
2697
2698@item -Wpadded
2699@opindex Wpadded
2700Warn if padding is included in a structure, either to align an element
2701of the structure or to align the whole structure.  Sometimes when this
2702happens it is possible to rearrange the fields of the structure to
2703reduce the padding and so make the structure smaller.
2704
2705@item -Wredundant-decls
2706@opindex Wredundant-decls
2707Warn if anything is declared more than once in the same scope, even in
2708cases where multiple declaration is valid and changes nothing.
2709
2710@item -Wnested-externs @r{(C only)}
2711@opindex Wnested-externs
2712Warn if an @code{extern} declaration is encountered within a function.
2713
2714@item -Wunreachable-code
2715@opindex Wunreachable-code
2716Warn if the compiler detects that code will never be executed.
2717
2718This option is intended to warn when the compiler detects that at
2719least a whole line of source code will never be executed, because
2720some condition is never satisfied or because it is after a
2721procedure that never returns.
2722
2723It is possible for this option to produce a warning even though there
2724are circumstances under which part of the affected line can be executed,
2725so care should be taken when removing apparently-unreachable code.
2726
2727For instance, when a function is inlined, a warning may mean that the
2728line is unreachable in only one inlined copy of the function.
2729
2730This option is not made part of @option{-Wall} because in a debugging
2731version of a program there is often substantial code which checks
2732correct functioning of the program and is, hopefully, unreachable
2733because the program does work.  Another common use of unreachable
2734code is to provide behavior which is selectable at compile-time.
2735
2736@item -Winline
2737@opindex Winline
2738Warn if a function can not be inlined and it was declared as inline.
2739Even with this option, the compiler will not warn about failures to
2740inline functions declared in system headers.
2741
2742The compiler uses a variety of heuristics to determine whether or not
2743to inline a function.  For example, the compiler takes into account
2744the size of the function being inlined and the the amount of inlining
2745that has already been done in the current function.  Therefore,
2746seemingly insignificant changes in the source program can cause the
2747warnings produced by @option{-Winline} to appear or disappear.
2748
2749@item -Wlong-long
2750@opindex Wlong-long
2751@opindex Wno-long-long
2752Warn if @samp{long long} type is used.  This is default.  To inhibit
2753the warning messages, use @option{-Wno-long-long}.  Flags
2754@option{-Wlong-long} and @option{-Wno-long-long} are taken into account
2755only when @option{-pedantic} flag is used.
2756
2757@item -Wdisabled-optimization
2758@opindex Wdisabled-optimization
2759Warn if a requested optimization pass is disabled.  This warning does
2760not generally indicate that there is anything wrong with your code; it
2761merely indicates that GCC's optimizers were unable to handle the code
2762effectively.  Often, the problem is that your code is too big or too
2763complex; GCC will refuse to optimize programs when the optimization
2764itself is likely to take inordinate amounts of time.
2765
2766@item -Werror
2767@opindex Werror
2768Make all warnings into errors.
2769
2770@item -Wstack-protector
2771@opindex Wstack-protector
2772This option is only active when @option{-fstack-protector} is active.  It
2773warns about functions that will not be protected against stack smashing.
2774@end table
2775
2776@node Debugging Options
2777@section Options for Debugging Your Program or GCC
2778@cindex options, debugging
2779@cindex debugging information options
2780
2781GCC has various special options that are used for debugging
2782either your program or GCC:
2783
2784@table @gcctabopt
2785@item -g
2786@opindex g
2787Produce debugging information in the operating system's native format
2788(stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
2789information.
2790
2791On most systems that use stabs format, @option{-g} enables use of extra
2792debugging information that only GDB can use; this extra information
2793makes debugging work better in GDB but will probably make other debuggers
2794crash or
2795refuse to read the program.  If you want to control for certain whether
2796to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
2797@option{-gxcoff+}, @option{-gxcoff}, @option{-gdwarf-1+}, @option{-gdwarf-1},
2798or @option{-gvms} (see below).
2799
2800Unlike most other C compilers, GCC allows you to use @option{-g} with
2801@option{-O}.  The shortcuts taken by optimized code may occasionally
2802produce surprising results: some variables you declared may not exist
2803at all; flow of control may briefly move where you did not expect it;
2804some statements may not be executed because they compute constant
2805results or their values were already at hand; some statements may
2806execute in different places because they were moved out of loops.
2807
2808Nevertheless it proves possible to debug optimized output.  This makes
2809it reasonable to use the optimizer for programs that might have bugs.
2810
2811The following options are useful when GCC is generated with the
2812capability for more than one debugging format.
2813
2814@item -ggdb
2815@opindex ggdb
2816Produce debugging information for use by GDB@.  This means to use the
2817most expressive format available (DWARF 2, stabs, or the native format
2818if neither of those are supported), including GDB extensions if at all
2819possible.
2820
2821@item -gstabs
2822@opindex gstabs
2823Produce debugging information in stabs format (if that is supported),
2824without GDB extensions.  This is the format used by DBX on most BSD
2825systems.  On MIPS, Alpha and System V Release 4 systems this option
2826produces stabs debugging output which is not understood by DBX or SDB@.
2827On System V Release 4 systems this option requires the GNU assembler.
2828
2829@item -gstabs+
2830@opindex gstabs+
2831Produce debugging information in stabs format (if that is supported),
2832using GNU extensions understood only by the GNU debugger (GDB)@.  The
2833use of these extensions is likely to make other debuggers crash or
2834refuse to read the program.
2835
2836@item -gcoff
2837@opindex gcoff
2838Produce debugging information in COFF format (if that is supported).
2839This is the format used by SDB on most System V systems prior to
2840System V Release 4.
2841
2842@item -gxcoff
2843@opindex gxcoff
2844Produce debugging information in XCOFF format (if that is supported).
2845This is the format used by the DBX debugger on IBM RS/6000 systems.
2846
2847@item -gxcoff+
2848@opindex gxcoff+
2849Produce debugging information in XCOFF format (if that is supported),
2850using GNU extensions understood only by the GNU debugger (GDB)@.  The
2851use of these extensions is likely to make other debuggers crash or
2852refuse to read the program, and may cause assemblers other than the GNU
2853assembler (GAS) to fail with an error.
2854
2855@item -gdwarf
2856@opindex gdwarf
2857Produce debugging information in DWARF version 1 format (if that is
2858supported).  This is the format used by SDB on most System V Release 4
2859systems.
2860
2861This option is deprecated.
2862
2863@item -gdwarf+
2864@opindex gdwarf+
2865Produce debugging information in DWARF version 1 format (if that is
2866supported), using GNU extensions understood only by the GNU debugger
2867(GDB)@.  The use of these extensions is likely to make other debuggers
2868crash or refuse to read the program.
2869
2870This option is deprecated.
2871
2872@item -gdwarf-2
2873@opindex gdwarf-2
2874Produce debugging information in DWARF version 2 format (if that is
2875supported).  This is the format used by DBX on IRIX 6.
2876
2877@item -gvms
2878@opindex gvms
2879Produce debugging information in VMS debug format (if that is
2880supported).  This is the format used by DEBUG on VMS systems.
2881
2882@item -g@var{level}
2883@itemx -ggdb@var{level}
2884@itemx -gstabs@var{level}
2885@itemx -gcoff@var{level}
2886@itemx -gxcoff@var{level}
2887@itemx -gvms@var{level}
2888Request debugging information and also use @var{level} to specify how
2889much information.  The default level is 2.
2890
2891Level 1 produces minimal information, enough for making backtraces in
2892parts of the program that you don't plan to debug.  This includes
2893descriptions of functions and external variables, but no information
2894about local variables and no line numbers.
2895
2896Level 3 includes extra information, such as all the macro definitions
2897present in the program.  Some debuggers support macro expansion when
2898you use @option{-g3}.
2899
2900Note that in order to avoid confusion between DWARF1 debug level 2,
2901and DWARF2, neither @option{-gdwarf} nor @option{-gdwarf-2} accept
2902a concatenated debug level.  Instead use an additional @option{-g@var{level}}
2903option to change the debug level for DWARF1 or DWARF2.
2904
2905@item -feliminate-dwarf2-dups
2906@opindex feliminate-dwarf2-dups
2907Compress DWARF2 debugging information by eliminating duplicated
2908information about each symbol.  This option only makes sense when
2909generating DWARF2 debugging information with @option{-gdwarf-2}.
2910
2911@cindex @command{prof}
2912@item -p
2913@opindex p
2914Generate extra code to write profile information suitable for the
2915analysis program @command{prof}.  You must use this option when compiling
2916the source files you want data about, and you must also use it when
2917linking.
2918
2919@cindex @command{gprof}
2920@item -pg
2921@opindex pg
2922Generate extra code to write profile information suitable for the
2923analysis program @command{gprof}.  You must use this option when compiling
2924the source files you want data about, and you must also use it when
2925linking.
2926
2927@item -Q
2928@opindex Q
2929Makes the compiler print out each function name as it is compiled, and
2930print some statistics about each pass when it finishes.
2931
2932@item -ftime-report
2933@opindex ftime-report
2934Makes the compiler print some statistics about the time consumed by each
2935pass when it finishes.
2936
2937@item -fmem-report
2938@opindex fmem-report
2939Makes the compiler print some statistics about permanent memory
2940allocation when it finishes.
2941
2942@item -fprofile-arcs
2943@opindex fprofile-arcs
2944Instrument @dfn{arcs} during compilation to generate coverage data or
2945for profile-directed block ordering.  During execution the program
2946records how many times each branch is executed and how many times it is
2947taken.  When the compiled program exits it saves this data to a file
2948called @file{@var{auxname}.da} for each source file.  @var{auxname} is
2949generated from the name of the output file, if explicitly specified and
2950it is not the final executable, otherwise it is the basename of the
2951source file. In both cases any suffix is removed (e.g.  @file{foo.da}
2952for input file @file{dir/foo.c}, or @file{dir/foo.da} for output file
2953specified as @option{-o dir/foo.o}).
2954
2955For profile-directed block ordering, compile the program with
2956@option{-fprofile-arcs} plus optimization and code generation options,
2957generate the arc profile information by running the program on a
2958selected workload, and then compile the program again with the same
2959optimization and code generation options plus
2960@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
2961Control Optimization}).
2962
2963The other use of @option{-fprofile-arcs} is for use with @command{gcov},
2964when it is used with the @option{-ftest-coverage} option.
2965
2966With @option{-fprofile-arcs}, for each function of your program GCC
2967creates a program flow graph, then finds a spanning tree for the graph.
2968Only arcs that are not on the spanning tree have to be instrumented: the
2969compiler adds code to count the number of times that these arcs are
2970executed.  When an arc is the only exit or only entrance to a block, the
2971instrumentation code can be added to the block; otherwise, a new basic
2972block must be created to hold the instrumentation code.
2973
2974@need 2000
2975@item -ftest-coverage
2976@opindex ftest-coverage
2977Create data files for the @command{gcov} code-coverage utility
2978(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}).  See
2979@option{-fprofile-arcs} option above for a description of @var{auxname}.
2980
2981@table @gcctabopt
2982@item @var{auxname}.bb
2983A mapping from basic blocks to line numbers, which @command{gcov} uses to
2984associate basic block execution counts with line numbers.
2985
2986@item @var{auxname}.bbg
2987A list of all arcs in the program flow graph.  This allows @command{gcov}
2988to reconstruct the program flow graph, so that it can compute all basic
2989block and arc execution counts from the information in the
2990@file{@var{auxname}.da} file.
2991@end table
2992
2993Use @option{-ftest-coverage} with @option{-fprofile-arcs}; the latter
2994option adds instrumentation to the program, which then writes
2995execution counts to another data file:
2996
2997@table @gcctabopt
2998@item @var{auxname}.da
2999Runtime arc execution counts, used in conjunction with the arc
3000information in the file @file{@var{auxname}.bbg}.
3001@end table
3002
3003Coverage data will map better to the source files if
3004@option{-ftest-coverage} is used without optimization.
3005
3006@item -d@var{letters}
3007@opindex d
3008Says to make debugging dumps during compilation at times specified by
3009@var{letters}.  This is used for debugging the compiler.  The file names
3010for most of the dumps are made by appending a pass number and a word to
3011the @var{dumpname}. @var{dumpname} is generated from the name of the
3012output file, if explicitly specified and it is not an executable,
3013otherwise it is the basename of the source file. In both cases any
3014suffix is removed (e.g.  @file{foo.00.rtl} or @file{foo.01.sibling}).
3015Here are the possible letters for use in @var{letters}, and their
3016meanings:
3017
3018@table @samp
3019@item A
3020@opindex dA
3021Annotate the assembler output with miscellaneous debugging information.
3022@item b
3023@opindex db
3024Dump after computing branch probabilities, to @file{@var{file}.14.bp}.
3025@item B
3026@opindex dB
3027Dump after block reordering, to @file{@var{file}.32.bbro}.
3028@item c
3029@opindex dc
3030Dump after instruction combination, to the file @file{@var{file}.19.combine}.
3031@item C
3032@opindex dC
3033Dump after the first if conversion, to the file @file{@var{file}.15.ce1}.
3034@item d
3035@opindex dd
3036Dump after delayed branch scheduling, to @file{@var{file}.34.dbr}.
3037@item D
3038@opindex dD
3039Dump all macro definitions, at the end of preprocessing, in addition to
3040normal output.
3041@item e
3042@opindex de
3043Dump after SSA optimizations, to @file{@var{file}.04.ssa} and
3044@file{@var{file}.07.ussa}.
3045@item E
3046@opindex dE
3047Dump after the second if conversion, to @file{@var{file}.29.ce3}.
3048@item f
3049@opindex df
3050Dump after control and data flow analysis, to @file{@var{file}.14.cfg}.
3051Also dump after life analysis, to @file{@var{file}.18.life}.
3052@item F
3053@opindex dF
3054Dump after purging @code{ADDRESSOF} codes, to @file{@var{file}.10.addressof}.
3055@item g
3056@opindex dg
3057Dump after global register allocation, to @file{@var{file}.24.greg}.
3058@item G
3059@opindex dG
3060Dump after GCSE, to @file{@var{file}.11.gcse}.
3061@item h
3062@opindex dh
3063Dump after finalization of EH handling code, to @file{@var{file}.02.eh}.
3064@item i
3065@opindex di
3066Dump after sibling call optimizations, to @file{@var{file}.01.sibling}.
3067@item j
3068@opindex dj
3069Dump after the first jump optimization, to @file{@var{file}.03.jump}.
3070@item k
3071@opindex dk
3072Dump after conversion from registers to stack, to @file{@var{file}.31.stack}.
3073@item l
3074@opindex dl
3075Dump after local register allocation, to @file{@var{file}.23.lreg}.
3076@item L
3077@opindex dL
3078Dump after loop optimization, to @file{@var{file}.12.loop}.
3079@item M
3080@opindex dM
3081Dump after performing the machine dependent reorganization pass, to
3082@file{@var{file}.33.mach}.
3083@item n
3084@opindex dn
3085Dump after register renumbering, to @file{@var{file}.28.rnreg}.
3086@item N
3087@opindex dN
3088Dump after the register move pass, to @file{@var{file}.21.regmove}.
3089@item o
3090@opindex do
3091Dump after post-reload optimizations, to @file{@var{file}.25.postreload}.
3092@item r
3093@opindex dr
3094Dump after RTL generation, to @file{@var{file}.00.rtl}.
3095@item R
3096@opindex dR
3097Dump after the second scheduling pass, to @file{@var{file}.30.sched2}.
3098@item s
3099@opindex ds
3100Dump after CSE (including the jump optimization that sometimes follows
3101CSE), to @file{@var{file}.09.cse}.
3102@item S
3103@opindex dS
3104Dump after the first scheduling pass, to @file{@var{file}.22.sched}.
3105@item t
3106@opindex dt
3107Dump after the second CSE pass (including the jump optimization that
3108sometimes follows CSE), to @file{@var{file}.17.cse2}.
3109@item T
3110@opindex dT
3111Dump after running tracer, to @file{@var{file}.16.tracer}.
3112@item u
3113@opindex du
3114Dump after null pointer elimination pass to @file{@var{file}.08.null}.
3115@item w
3116@opindex dw
3117Dump after the second flow pass, to @file{@var{file}.26.flow2}.
3118@item W
3119@opindex dW
3120Dump after SSA conditional constant propagation, to
3121@file{@var{file}.05.ssaccp}.
3122@item X
3123@opindex dX
3124Dump after SSA dead code elimination, to @file{@var{file}.06.ssadce}.
3125@item z
3126@opindex dz
3127Dump after the peephole pass, to @file{@var{file}.27.peephole2}.
3128@item a
3129@opindex da
3130Produce all the dumps listed above.
3131@item m
3132@opindex dm
3133Print statistics on memory usage, at the end of the run, to
3134standard error.
3135@item p
3136@opindex dp
3137Annotate the assembler output with a comment indicating which
3138pattern and alternative was used.  The length of each instruction is
3139also printed.
3140@item P
3141@opindex dP
3142Dump the RTL in the assembler output as a comment before each instruction.
3143Also turns on @option{-dp} annotation.
3144@item v
3145@opindex dv
3146For each of the other indicated dump files (except for
3147@file{@var{file}.00.rtl}), dump a representation of the control flow graph
3148suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
3149@item x
3150@opindex dx
3151Just generate RTL for a function instead of compiling it.  Usually used
3152with @samp{r}.
3153@item y
3154@opindex dy
3155Dump debugging information during parsing, to standard error.
3156@end table
3157
3158@item -fdump-unnumbered
3159@opindex fdump-unnumbered
3160When doing debugging dumps (see @option{-d} option above), suppress instruction
3161numbers and line number note output.  This makes it more feasible to
3162use diff on debugging dumps for compiler invocations with different
3163options, in particular with and without @option{-g}.
3164
3165@item -fdump-translation-unit @r{(C and C++ only)}
3166@itemx -fdump-translation-unit-@var{options} @r{(C and C++ only)}
3167@opindex fdump-translation-unit
3168Dump a representation of the tree structure for the entire translation
3169unit to a file.  The file name is made by appending @file{.tu} to the
3170source file name.  If the @samp{-@var{options}} form is used, @var{options}
3171controls the details of the dump as described for the
3172@option{-fdump-tree} options.
3173
3174@item -fdump-class-hierarchy @r{(C++ only)}
3175@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
3176@opindex fdump-class-hierarchy
3177Dump a representation of each class's hierarchy and virtual function
3178table layout to a file.  The file name is made by appending @file{.class}
3179to the source file name.  If the @samp{-@var{options}} form is used,
3180@var{options} controls the details of the dump as described for the
3181@option{-fdump-tree} options.
3182
3183@item -fdump-tree-@var{switch} @r{(C++ only)}
3184@itemx -fdump-tree-@var{switch}-@var{options} @r{(C++ only)}
3185@opindex fdump-tree
3186Control the dumping at various stages of processing the intermediate
3187language tree to a file.  The file name is generated by appending a switch
3188specific suffix to the source file name.  If the @samp{-@var{options}}
3189form is used, @var{options} is a list of @samp{-} separated options that
3190control the details of the dump. Not all options are applicable to all
3191dumps, those which are not meaningful will be ignored. The following
3192options are available
3193
3194@table @samp
3195@item address
3196Print the address of each node.  Usually this is not meaningful as it
3197changes according to the environment and source file. Its primary use
3198is for tying up a dump file with a debug environment.
3199@item slim
3200Inhibit dumping of members of a scope or body of a function merely
3201because that scope has been reached. Only dump such items when they
3202are directly reachable by some other path.
3203@item all
3204Turn on all options.
3205@end table
3206
3207The following tree dumps are possible:
3208@table @samp
3209@item original
3210Dump before any tree based optimization, to @file{@var{file}.original}.
3211@item optimized
3212Dump after all tree based optimization, to @file{@var{file}.optimized}.
3213@item inlined
3214Dump after function inlining, to @file{@var{file}.inlined}.
3215@end table
3216
3217@item -frandom-seed=@var{string}
3218@opindex frandom-string
3219This option provides a seed that GCC uses when it would otherwise use
3220random numbers.  At present, this is used to generate certain symbol names
3221that have to be different in every compiled file.
3222
3223The @var{string} should be different for every file you compile.
3224
3225@item -fsched-verbose=@var{n}
3226@opindex fsched-verbose
3227On targets that use instruction scheduling, this option controls the
3228amount of debugging output the scheduler prints.  This information is
3229written to standard error, unless @option{-dS} or @option{-dR} is
3230specified, in which case it is output to the usual dump
3231listing file, @file{.sched} or @file{.sched2} respectively.  However
3232for @var{n} greater than nine, the output is always printed to standard
3233error.
3234
3235For @var{n} greater than zero, @option{-fsched-verbose} outputs the
3236same information as @option{-dRS}.  For @var{n} greater than one, it
3237also output basic block probabilities, detailed ready list information
3238and unit/insn info.  For @var{n} greater than two, it includes RTL
3239at abort point, control-flow and regions info.  And for @var{n} over
3240four, @option{-fsched-verbose} also includes dependence info.
3241
3242@item -save-temps
3243@opindex save-temps
3244Store the usual ``temporary'' intermediate files permanently; place them
3245in the current directory and name them based on the source file.  Thus,
3246compiling @file{foo.c} with @samp{-c -save-temps} would produce files
3247@file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
3248preprocessed @file{foo.i} output file even though the compiler now
3249normally uses an integrated preprocessor.
3250
3251@item -time
3252@opindex time
3253Report the CPU time taken by each subprocess in the compilation
3254sequence.  For C source files, this is the compiler proper and assembler
3255(plus the linker if linking is done).  The output looks like this:
3256
3257@smallexample
3258# cc1 0.12 0.01
3259# as 0.00 0.01
3260@end smallexample
3261
3262The first number on each line is the ``user time,'' that is time spent
3263executing the program itself.  The second number is ``system time,''
3264time spent executing operating system routines on behalf of the program.
3265Both numbers are in seconds.
3266
3267@item -print-file-name=@var{library}
3268@opindex print-file-name
3269Print the full absolute name of the library file @var{library} that
3270would be used when linking---and don't do anything else.  With this
3271option, GCC does not compile or link anything; it just prints the
3272file name.
3273
3274@item -print-multi-directory
3275@opindex print-multi-directory
3276Print the directory name corresponding to the multilib selected by any
3277other switches present in the command line.  This directory is supposed
3278to exist in @env{GCC_EXEC_PREFIX}.
3279
3280@item -print-multi-lib
3281@opindex print-multi-lib
3282Print the mapping from multilib directory names to compiler switches
3283that enable them.  The directory name is separated from the switches by
3284@samp{;}, and each switch starts with an @samp{@@} instead of the
3285@samp{-}, without spaces between multiple switches.  This is supposed to
3286ease shell-processing.
3287
3288@item -print-prog-name=@var{program}
3289@opindex print-prog-name
3290Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
3291
3292@item -print-libgcc-file-name
3293@opindex print-libgcc-file-name
3294Same as @option{-print-file-name=libgcc.a}.
3295
3296This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
3297but you do want to link with @file{libgcc.a}.  You can do
3298
3299@example
3300gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
3301@end example
3302
3303@item -print-search-dirs
3304@opindex print-search-dirs
3305Print the name of the configured installation directory and a list of
3306program and library directories gcc will search---and don't do anything else.
3307
3308This is useful when gcc prints the error message
3309@samp{installation problem, cannot exec cpp0: No such file or directory}.
3310To resolve this you either need to put @file{cpp0} and the other compiler
3311components where gcc expects to find them, or you can set the environment
3312variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
3313Don't forget the trailing '/'.
3314@xref{Environment Variables}.
3315
3316@item -dumpmachine
3317@opindex dumpmachine
3318Print the compiler's target machine (for example,
3319@samp{i686-pc-linux-gnu})---and don't do anything else.
3320
3321@item -dumpversion
3322@opindex dumpversion
3323Print the compiler version (for example, @samp{3.0})---and don't do
3324anything else.
3325
3326@item -dumpspecs
3327@opindex dumpspecs
3328Print the compiler's built-in specs---and don't do anything else.  (This
3329is used when GCC itself is being built.)  @xref{Spec Files}.
3330@end table
3331
3332@node Optimize Options
3333@section Options That Control Optimization
3334@cindex optimize options
3335@cindex options, optimization
3336
3337These options control various sorts of optimizations.
3338
3339Without any optimization option, the compiler's goal is to reduce the
3340cost of compilation and to make debugging produce the expected
3341results.  Statements are independent: if you stop the program with a
3342breakpoint between statements, you can then assign a new value to any
3343variable or change the program counter to any other statement in the
3344function and get exactly the results you would expect from the source
3345code.
3346
3347Turning on optimization flags makes the compiler attempt to improve
3348the performance and/or code size at the expense of compilation time
3349and possibly the ability to debug the program.
3350
3351Not all optimizations are controlled directly by a flag.  Only
3352optimizations that have a flag are listed.
3353
3354@table @gcctabopt
3355@item -O
3356@itemx -O1
3357@opindex O
3358@opindex O1
3359Optimize.  Optimizing compilation takes somewhat more time, and a lot
3360more memory for a large function.
3361
3362With @option{-O}, the compiler tries to reduce code size and execution
3363time, without performing any optimizations that take a great deal of
3364compilation time.
3365
3366@option{-O} turns on the following optimization flags:
3367@gccoptlist{-fdefer-pop @gol
3368-fmerge-constants @gol
3369-fthread-jumps @gol
3370-floop-optimize @gol
3371-fcrossjumping @gol
3372-fif-conversion @gol
3373-fif-conversion2 @gol
3374-fdelayed-branch @gol
3375-fguess-branch-probability @gol
3376-fcprop-registers}
3377
3378@option{-O} also turns on @option{-fomit-frame-pointer} on machines
3379where doing so does not interfere with debugging.
3380
3381@item -O2
3382@opindex O2
3383Optimize even more.  GCC performs nearly all supported optimizations
3384that do not involve a space-speed tradeoff.  The compiler does not
3385perform loop unrolling or function inlining when you specify @option{-O2}.
3386As compared to @option{-O}, this option increases both compilation time
3387and the performance of the generated code.
3388
3389@option{-O2} turns on all optimization flags specified by @option{-O}.  It
3390also turns on the following optimization flags:
3391@gccoptlist{-fforce-mem @gol
3392-foptimize-sibling-calls @gol
3393-fstrength-reduce @gol
3394-fcse-follow-jumps  -fcse-skip-blocks @gol
3395-frerun-cse-after-loop  -frerun-loop-opt @gol
3396-fgcse   -fgcse-lm   -fgcse-sm @gol
3397-fdelete-null-pointer-checks @gol
3398-fexpensive-optimizations @gol
3399-fregmove @gol
3400-fschedule-insns  -fschedule-insns2 @gol
3401-fsched-interblock -fsched-spec @gol
3402-fcaller-saves @gol
3403-fpeephole2 @gol
3404-freorder-blocks  -freorder-functions @gol
3405-fstrict-aliasing @gol
3406-falign-functions  -falign-jumps @gol
3407-falign-loops  -falign-labels}
3408
3409Please note the warning under @option{-fgcse} about
3410invoking @option{-O2} on programs that use computed gotos.
3411
3412@item -O3
3413@opindex O3
3414Optimize yet more.  @option{-O3} turns on all optimizations specified by
3415@option{-O2} and also turns on the @option{-finline-functions} and
3416@option{-frename-registers} options.
3417
3418@item -O0
3419@opindex O0
3420Do not optimize.  This is the default.
3421
3422@item -Os
3423@opindex Os
3424Optimize for size.  @option{-Os} enables all @option{-O2} optimizations that
3425do not typically increase code size.  It also performs further
3426optimizations designed to reduce code size.
3427
3428@option{-Os} disables the following optimization flags:
3429@gccoptlist{-falign-functions  -falign-jumps  -falign-loops @gol
3430-falign-labels  -freorder-blocks  -fprefetch-loop-arrays}
3431
3432If you use multiple @option{-O} options, with or without level numbers,
3433the last such option is the one that is effective.
3434@end table
3435
3436Options of the form @option{-f@var{flag}} specify machine-independent
3437flags.  Most flags have both positive and negative forms; the negative
3438form of @option{-ffoo} would be @option{-fno-foo}.  In the table
3439below, only one of the forms is listed---the one you typically will
3440use.  You can figure out the other form by either removing @samp{no-}
3441or adding it.
3442
3443The following options control specific optimizations.  They are either
3444activated by @option{-O} options or are related to ones that are.  You
3445can use the following flags in the rare cases when ``fine-tuning'' of
3446optimizations to be performed is desired.
3447
3448@table @gcctabopt
3449@item -fno-default-inline
3450@opindex fno-default-inline
3451Do not make member functions inline by default merely because they are
3452defined inside the class scope (C++ only).  Otherwise, when you specify
3453@w{@option{-O}}, member functions defined inside class scope are compiled
3454inline by default; i.e., you don't need to add @samp{inline} in front of
3455the member function name.
3456
3457@item -fno-defer-pop
3458@opindex fno-defer-pop
3459Always pop the arguments to each function call as soon as that function
3460returns.  For machines which must pop arguments after a function call,
3461the compiler normally lets arguments accumulate on the stack for several
3462function calls and pops them all at once.
3463
3464Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3465
3466@item -fforce-mem
3467@opindex fforce-mem
3468Force memory operands to be copied into registers before doing
3469arithmetic on them.  This produces better code by making all memory
3470references potential common subexpressions.  When they are not common
3471subexpressions, instruction combination should eliminate the separate
3472register-load.
3473
3474Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3475
3476@item -fforce-addr
3477@opindex fforce-addr
3478Force memory address constants to be copied into registers before
3479doing arithmetic on them.  This may produce better code just as
3480@option{-fforce-mem} may.
3481
3482@item -fomit-frame-pointer
3483@opindex fomit-frame-pointer
3484Don't keep the frame pointer in a register for functions that
3485don't need one.  This avoids the instructions to save, set up and
3486restore frame pointers; it also makes an extra register available
3487in many functions.  @strong{It also makes debugging impossible on
3488some machines.}
3489
3490On some machines, such as the VAX, this flag has no effect, because
3491the standard calling sequence automatically handles the frame pointer
3492and nothing is saved by pretending it doesn't exist.  The
3493machine-description macro @code{FRAME_POINTER_REQUIRED} controls
3494whether a target machine supports this flag.  @xref{Registers,,Register
3495Usage, gccint, GNU Compiler Collection (GCC) Internals}.
3496
3497Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3498
3499@item -foptimize-sibling-calls
3500@opindex foptimize-sibling-calls
3501Optimize sibling and tail recursive calls.
3502
3503Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3504
3505@item -fno-inline
3506@opindex fno-inline
3507Don't pay attention to the @code{inline} keyword.  Normally this option
3508is used to keep the compiler from expanding any functions inline.
3509Note that if you are not optimizing, no functions can be expanded inline.
3510
3511@item -finline-functions
3512@opindex finline-functions
3513Integrate all simple functions into their callers.  The compiler
3514heuristically decides which functions are simple enough to be worth
3515integrating in this way.
3516
3517If all calls to a given function are integrated, and the function is
3518declared @code{static}, then the function is normally not output as
3519assembler code in its own right.
3520
3521Enabled at level @option{-O3}.
3522
3523@item -finline-limit=@var{n}
3524@opindex finline-limit
3525By default, gcc limits the size of functions that can be inlined.  This flag
3526allows the control of this limit for functions that are explicitly marked as
3527inline (i.e., marked with the inline keyword or defined within the class
3528definition in c++).  @var{n} is the size of functions that can be inlined in
3529number of pseudo instructions (not counting parameter handling).  The default
3530value of @var{n} is 600.
3531Increasing this value can result in more inlined code at
3532the cost of compilation time and memory consumption.  Decreasing usually makes
3533the compilation faster and less code will be inlined (which presumably
3534means slower programs).  This option is particularly useful for programs that
3535use inlining heavily such as those based on recursive templates with C++.
3536
3537Inlining is actually controlled by a number of parameters, which may be
3538specified individually by using @option{--param @var{name}=@var{value}}.
3539The @option{-finline-limit=@var{n}} option sets some of these parameters
3540as follows:
3541
3542@table @gcctabopt
3543 @item max-inline-insns
3544  is set to @var{n}.
3545 @item max-inline-insns-single
3546  is set to @var{n}/2.
3547 @item max-inline-insns-auto
3548  is set to @var{n}/2.
3549 @item min-inline-insns
3550  is set to 130 or @var{n}/4, whichever is smaller.
3551 @item max-inline-insns-rtl
3552  is set to @var{n}.
3553@end table
3554
3555Using @option{-finline-limit=600} thus results in the default settings
3556for these parameters.  See below for a documentation of the individual
3557parameters controlling inlining.
3558
3559@emph{Note:} pseudo instruction represents, in this particular context, an
3560abstract measurement of function's size.  In no way, it represents a count
3561of assembly instructions and as such its exact meaning might change from one
3562release to an another.
3563
3564@item -fkeep-inline-functions
3565@opindex fkeep-inline-functions
3566Even if all calls to a given function are integrated, and the function
3567is declared @code{static}, nevertheless output a separate run-time
3568callable version of the function.  This switch does not affect
3569@code{extern inline} functions.
3570
3571@item -fkeep-static-consts
3572@opindex fkeep-static-consts
3573Emit variables declared @code{static const} when optimization isn't turned
3574on, even if the variables aren't referenced.
3575
3576GCC enables this option by default.  If you want to force the compiler to
3577check if the variable was referenced, regardless of whether or not
3578optimization is turned on, use the @option{-fno-keep-static-consts} option.
3579
3580@item -fmerge-constants
3581Attempt to merge identical constants (string constants and floating point
3582constants) across compilation units.
3583
3584This option is the default for optimized compilation if the assembler and
3585linker support it.  Use @option{-fno-merge-constants} to inhibit this
3586behavior.
3587
3588Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3589
3590@item -fmerge-all-constants
3591Attempt to merge identical constants and identical variables.
3592
3593This option implies @option{-fmerge-constants}.  In addition to
3594@option{-fmerge-constants} this considers e.g. even constant initialized
3595arrays or initialized constant variables with integral or floating point
3596types.  Languages like C or C++ require each non-automatic variable to
3597have distinct location, so using this option will result in non-conforming
3598behavior.
3599
3600@item -fno-branch-count-reg
3601@opindex fno-branch-count-reg
3602Do not use ``decrement and branch'' instructions on a count register,
3603but instead generate a sequence of instructions that decrement a
3604register, compare it against zero, then branch based upon the result.
3605This option is only meaningful on architectures that support such
3606instructions, which include x86, PowerPC, IA-64 and S/390.
3607
3608The default is @option{-fbranch-count-reg}, enabled when
3609@option{-fstrength-reduce} is enabled.
3610
3611@item -fno-function-cse
3612@opindex fno-function-cse
3613Do not put function addresses in registers; make each instruction that
3614calls a constant function contain the function's address explicitly.
3615
3616This option results in less efficient code, but some strange hacks
3617that alter the assembler output may be confused by the optimizations
3618performed when this option is not used.
3619
3620The default is @option{-ffunction-cse}
3621
3622@item -fno-zero-initialized-in-bss
3623@opindex fno-zero-initialized-in-bss
3624If the target supports a BSS section, GCC by default puts variables that
3625are initialized to zero into BSS@.  This can save space in the resulting
3626code.
3627
3628This option turns off this behavior because some programs explicitly
3629rely on variables going to the data section.  E.g., so that the
3630resulting executable can find the beginning of that section and/or make
3631assumptions based on that.
3632
3633The default is @option{-fzero-initialized-in-bss}.
3634
3635@item -fstrength-reduce
3636@opindex fstrength-reduce
3637Perform the optimizations of loop strength reduction and
3638elimination of iteration variables.
3639
3640Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3641
3642@item -fthread-jumps
3643@opindex fthread-jumps
3644Perform optimizations where we check to see if a jump branches to a
3645location where another comparison subsumed by the first is found.  If
3646so, the first branch is redirected to either the destination of the
3647second branch or a point immediately following it, depending on whether
3648the condition is known to be true or false.
3649
3650Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3651
3652@item -fcse-follow-jumps
3653@opindex fcse-follow-jumps
3654In common subexpression elimination, scan through jump instructions
3655when the target of the jump is not reached by any other path.  For
3656example, when CSE encounters an @code{if} statement with an
3657@code{else} clause, CSE will follow the jump when the condition
3658tested is false.
3659
3660Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3661
3662@item -fcse-skip-blocks
3663@opindex fcse-skip-blocks
3664This is similar to @option{-fcse-follow-jumps}, but causes CSE to
3665follow jumps which conditionally skip over blocks.  When CSE
3666encounters a simple @code{if} statement with no else clause,
3667@option{-fcse-skip-blocks} causes CSE to follow the jump around the
3668body of the @code{if}.
3669
3670Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3671
3672@item -frerun-cse-after-loop
3673@opindex frerun-cse-after-loop
3674Re-run common subexpression elimination after loop optimizations has been
3675performed.
3676
3677Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3678
3679@item -frerun-loop-opt
3680@opindex frerun-loop-opt
3681Run the loop optimizer twice.
3682
3683Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3684
3685@item -fgcse
3686@opindex fgcse
3687Perform a global common subexpression elimination pass.
3688This pass also performs global constant and copy propagation.
3689
3690@emph{Note:} When compiling a program using computed gotos, a GCC
3691extension, you may get better runtime performance if you disable
3692the global common subexpression elimination pass by adding
3693@option{-fno-gcse} to the command line.
3694
3695Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3696
3697@item -fgcse-lm
3698@opindex fgcse-lm
3699When @option{-fgcse-lm} is enabled, global common subexpression elimination will
3700attempt to move loads which are only killed by stores into themselves.  This
3701allows a loop containing a load/store sequence to be changed to a load outside
3702the loop, and a copy/store within the loop.
3703
3704Enabled by default when gcse is enabled.
3705
3706@item -fgcse-sm
3707@opindex fgcse-sm
3708When @option{-fgcse-sm} is enabled, A store motion pass is run after global common
3709subexpression elimination.  This pass will attempt to move stores out of loops.
3710When used in conjunction with @option{-fgcse-lm}, loops containing a load/store sequence
3711can be changed to a load before the loop and a store after the loop.
3712
3713Enabled by default when gcse is enabled.
3714
3715@item -floop-optimize
3716@opindex floop-optimize
3717Perform loop optimizations: move constant expressions out of loops, simplify
3718exit test conditions and optionally do strength-reduction and loop unrolling as
3719well.
3720
3721Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3722
3723@item -fcrossjumping
3724@opindex crossjumping
3725Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The
3726resulting code may or may not perform better than without cross-jumping.
3727
3728Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3729
3730@item -fif-conversion
3731@opindex if-conversion
3732Attempt to transform conditional jumps into branch-less equivalents.  This
3733include use of conditional moves, min, max, set flags and abs instructions, and
3734some tricks doable by standard arithmetics.  The use of conditional execution
3735on chips where it is available is controlled by @code{if-conversion2}.
3736
3737Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3738
3739@item -fif-conversion2
3740@opindex if-conversion2
3741Use conditional execution (where available) to transform conditional jumps into
3742branch-less equivalents.
3743
3744Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3745
3746@item -fdelete-null-pointer-checks
3747@opindex fdelete-null-pointer-checks
3748Use global dataflow analysis to identify and eliminate useless checks
3749for null pointers.  The compiler assumes that dereferencing a null
3750pointer would have halted the program.  If a pointer is checked after
3751it has already been dereferenced, it cannot be null.
3752
3753In some environments, this assumption is not true, and programs can
3754safely dereference null pointers.  Use
3755@option{-fno-delete-null-pointer-checks} to disable this optimization
3756for programs which depend on that behavior.
3757
3758Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3759
3760@item -fexpensive-optimizations
3761@opindex fexpensive-optimizations
3762Perform a number of minor optimizations that are relatively expensive.
3763
3764Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3765
3766@item -foptimize-register-move
3767@itemx -fregmove
3768@opindex foptimize-register-move
3769@opindex fregmove
3770Attempt to reassign register numbers in move instructions and as
3771operands of other simple instructions in order to maximize the amount of
3772register tying.  This is especially helpful on machines with two-operand
3773instructions.
3774
3775Note @option{-fregmove} and @option{-foptimize-register-move} are the same
3776optimization.
3777
3778Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3779
3780@item -fdelayed-branch
3781@opindex fdelayed-branch
3782If supported for the target machine, attempt to reorder instructions
3783to exploit instruction slots available after delayed branch
3784instructions.
3785
3786Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3787
3788@item -fschedule-insns
3789@opindex fschedule-insns
3790If supported for the target machine, attempt to reorder instructions to
3791eliminate execution stalls due to required data being unavailable.  This
3792helps machines that have slow floating point or memory load instructions
3793by allowing other instructions to be issued until the result of the load
3794or floating point instruction is required.
3795
3796Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3797
3798@item -fschedule-insns2
3799@opindex fschedule-insns2
3800Similar to @option{-fschedule-insns}, but requests an additional pass of
3801instruction scheduling after register allocation has been done.  This is
3802especially useful on machines with a relatively small number of
3803registers and where memory load instructions take more than one cycle.
3804
3805Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3806
3807@item -fno-sched-interblock
3808@opindex fno-sched-interblock
3809Don't schedule instructions across basic blocks.  This is normally
3810enabled by default when scheduling before register allocation, i.e.@:
3811with @option{-fschedule-insns} or at @option{-O2} or higher.
3812
3813@item -fno-sched-spec
3814@opindex fno-sched-spec
3815Don't allow speculative motion of non-load instructions.  This is normally
3816enabled by default when scheduling before register allocation, i.e.@:
3817with @option{-fschedule-insns} or at @option{-O2} or higher.
3818
3819@item -fsched-spec-load
3820@opindex fsched-spec-load
3821Allow speculative motion of some load instructions.  This only makes
3822sense when scheduling before register allocation, i.e.@: with
3823@option{-fschedule-insns} or at @option{-O2} or higher.
3824
3825@item -fsched-spec-load-dangerous
3826@opindex fsched-spec-load-dangerous
3827Allow speculative motion of more load instructions.  This only makes
3828sense when scheduling before register allocation, i.e.@: with
3829@option{-fschedule-insns} or at @option{-O2} or higher.
3830
3831@item -fcaller-saves
3832@opindex fcaller-saves
3833Enable values to be allocated in registers that will be clobbered by
3834function calls, by emitting extra instructions to save and restore the
3835registers around such calls.  Such allocation is done only when it
3836seems to result in better code than would otherwise be produced.
3837
3838This option is always enabled by default on certain machines, usually
3839those which have no call-preserved registers to use instead.
3840
3841Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3842
3843@item -fmove-all-movables
3844@opindex fmove-all-movables
3845Forces all invariant computations in loops to be moved
3846outside the loop.
3847
3848@item -freduce-all-givs
3849@opindex freduce-all-givs
3850Forces all general-induction variables in loops to be
3851strength-reduced.
3852
3853@emph{Note:} When compiling programs written in Fortran,
3854@option{-fmove-all-movables} and @option{-freduce-all-givs} are enabled
3855by default when you use the optimizer.
3856
3857These options may generate better or worse code; results are highly
3858dependent on the structure of loops within the source code.
3859
3860These two options are intended to be removed someday, once
3861they have helped determine the efficacy of various
3862approaches to improving loop optimizations.
3863
3864Please let us (@w{@email{gcc@@gcc.gnu.org}} and @w{@email{fortran@@gnu.org}})
3865know how use of these options affects
3866the performance of your production code.
3867We're very interested in code that runs @emph{slower}
3868when these options are @emph{enabled}.
3869
3870@item -fno-peephole
3871@itemx -fno-peephole2
3872@opindex fno-peephole
3873@opindex fno-peephole2
3874Disable any machine-specific peephole optimizations.  The difference
3875between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
3876are implemented in the compiler; some targets use one, some use the
3877other, a few use both.
3878
3879@option{-fpeephole} is enabled by default.
3880@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3881
3882@item -fno-guess-branch-probability
3883@opindex fno-guess-branch-probability
3884Do not guess branch probabilities using a randomized model.
3885
3886Sometimes gcc will opt to use a randomized model to guess branch
3887probabilities, when none are available from either profiling feedback
3888(@option{-fprofile-arcs}) or @samp{__builtin_expect}.  This means that
3889different runs of the compiler on the same program may produce different
3890object code.
3891
3892In a hard real-time system, people don't want different runs of the
3893compiler to produce code that has different behavior; minimizing
3894non-determinism is of paramount import.  This switch allows users to
3895reduce non-determinism, possibly at the expense of inferior
3896optimization.
3897
3898The default is @option{-fguess-branch-probability} at levels
3899@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3900
3901@item -freorder-blocks
3902@opindex freorder-blocks
3903Reorder basic blocks in the compiled function in order to reduce number of
3904taken branches and improve code locality.
3905
3906Enabled at levels @option{-O2}, @option{-O3}.
3907
3908@item -freorder-functions
3909@opindex freorder-functions
3910Reorder basic blocks in the compiled function in order to reduce number of
3911taken branches and improve code locality. This is implemented by using special
3912subsections @code{text.hot} for most frequently executed functions and
3913@code{text.unlikely} for unlikely executed functions.  Reordering is done by
3914the linker so object file format must support named sections and linker must
3915place them in a reasonable way.
3916
3917Also profile feedback must be available in to make this option effective.  See
3918@option{-fprofile-arcs} for details.
3919
3920Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3921
3922@item -fstrict-aliasing
3923@opindex fstrict-aliasing
3924Allows the compiler to assume the strictest aliasing rules applicable to
3925the language being compiled.  For C (and C++), this activates
3926optimizations based on the type of expressions.  In particular, an
3927object of one type is assumed never to reside at the same address as an
3928object of a different type, unless the types are almost the same.  For
3929example, an @code{unsigned int} can alias an @code{int}, but not a
3930@code{void*} or a @code{double}.  A character type may alias any other
3931type.
3932
3933Pay special attention to code like this:
3934@example
3935union a_union @{
3936  int i;
3937  double d;
3938@};
3939
3940int f() @{
3941  a_union t;
3942  t.d = 3.0;
3943  return t.i;
3944@}
3945@end example
3946The practice of reading from a different union member than the one most
3947recently written to (called ``type-punning'') is common.  Even with
3948@option{-fstrict-aliasing}, type-punning is allowed, provided the memory
3949is accessed through the union type.  So, the code above will work as
3950expected.  However, this code might not:
3951@example
3952int f() @{
3953  a_union t;
3954  int* ip;
3955  t.d = 3.0;
3956  ip = &t.i;
3957  return *ip;
3958@}
3959@end example
3960
3961Every language that wishes to perform language-specific alias analysis
3962should define a function that computes, given an @code{tree}
3963node, an alias set for the node.  Nodes in different alias sets are not
3964allowed to alias.  For an example, see the C front-end function
3965@code{c_get_alias_set}.
3966
3967Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
3968
3969@item -falign-functions
3970@itemx -falign-functions=@var{n}
3971@opindex falign-functions
3972Align the start of functions to the next power-of-two greater than
3973@var{n}, skipping up to @var{n} bytes.  For instance,
3974@option{-falign-functions=32} aligns functions to the next 32-byte
3975boundary, but @option{-falign-functions=24} would align to the next
397632-byte boundary only if this can be done by skipping 23 bytes or less.
3977
3978@option{-fno-align-functions} and @option{-falign-functions=1} are
3979equivalent and mean that functions will not be aligned.
3980
3981Some assemblers only support this flag when @var{n} is a power of two;
3982in that case, it is rounded up.
3983
3984If @var{n} is not specified or is zero, use a machine-dependent default.
3985
3986Enabled at levels @option{-O2}, @option{-O3}.
3987
3988@item -falign-labels
3989@itemx -falign-labels=@var{n}
3990@opindex falign-labels
3991Align all branch targets to a power-of-two boundary, skipping up to
3992@var{n} bytes like @option{-falign-functions}.  This option can easily
3993make code slower, because it must insert dummy operations for when the
3994branch target is reached in the usual flow of the code.
3995
3996@option{-fno-align-labels} and @option{-falign-labels=1} are
3997equivalent and mean that labels will not be aligned.
3998
3999If @option{-falign-loops} or @option{-falign-jumps} are applicable and
4000are greater than this value, then their values are used instead.
4001
4002If @var{n} is not specified or is zero, use a machine-dependent default
4003which is very likely to be @samp{1}, meaning no alignment.
4004
4005Enabled at levels @option{-O2}, @option{-O3}.
4006
4007@item -falign-loops
4008@itemx -falign-loops=@var{n}
4009@opindex falign-loops
4010Align loops to a power-of-two boundary, skipping up to @var{n} bytes
4011like @option{-falign-functions}.  The hope is that the loop will be
4012executed many times, which will make up for any execution of the dummy
4013operations.
4014
4015@option{-fno-align-loops} and @option{-falign-loops=1} are
4016equivalent and mean that loops will not be aligned.
4017
4018If @var{n} is not specified or is zero, use a machine-dependent default.
4019
4020Enabled at levels @option{-O2}, @option{-O3}.
4021
4022@item -falign-jumps
4023@itemx -falign-jumps=@var{n}
4024@opindex falign-jumps
4025Align branch targets to a power-of-two boundary, for branch targets
4026where the targets can only be reached by jumping, skipping up to @var{n}
4027bytes like @option{-falign-functions}.  In this case, no dummy operations
4028need be executed.
4029
4030@option{-fno-align-jumps} and @option{-falign-jumps=1} are
4031equivalent and mean that loops will not be aligned.
4032
4033If @var{n} is not specified or is zero, use a machine-dependent default.
4034
4035Enabled at levels @option{-O2}, @option{-O3}.
4036
4037@item -frename-registers
4038@opindex frename-registers
4039Attempt to avoid false dependencies in scheduled code by making use
4040of registers left over after register allocation.  This optimization
4041will most benefit processors with lots of registers.  It can, however,
4042make debugging impossible, since variables will no longer stay in
4043a ``home register''.
4044
4045Enabled at levels @option{-O3}.
4046
4047@item -fno-cprop-registers
4048@opindex fno-cprop-registers
4049After register allocation and post-register allocation instruction splitting,
4050we perform a copy-propagation pass to try to reduce scheduling dependencies
4051and occasionally eliminate the copy.
4052
4053Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4054
4055@end table
4056
4057The following options control compiler behavior regarding floating
4058point arithmetic.  These options trade off between speed and
4059correctness.  All must be specifically enabled.
4060
4061@table @gcctabopt
4062@item -ffloat-store
4063@opindex ffloat-store
4064Do not store floating point variables in registers, and inhibit other
4065options that might change whether a floating point value is taken from a
4066register or memory.
4067
4068@cindex floating point precision
4069This option prevents undesirable excess precision on machines such as
4070the 68000 where the floating registers (of the 68881) keep more
4071precision than a @code{double} is supposed to have.  Similarly for the
4072x86 architecture.  For most programs, the excess precision does only
4073good, but a few programs rely on the precise definition of IEEE floating
4074point.  Use @option{-ffloat-store} for such programs, after modifying
4075them to store all pertinent intermediate computations into variables.
4076
4077@item -ffast-math
4078@opindex ffast-math
4079Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @*
4080@option{-fno-trapping-math}, @option{-ffinite-math-only} and @*
4081@option{-fno-signaling-nans}.
4082
4083This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
4084
4085This option should never be turned on by any @option{-O} option since
4086it can result in incorrect output for programs which depend on
4087an exact implementation of IEEE or ISO rules/specifications for
4088math functions.
4089
4090@item -fno-math-errno
4091@opindex fno-math-errno
4092Do not set ERRNO after calling math functions that are executed
4093with a single instruction, e.g., sqrt.  A program that relies on
4094IEEE exceptions for math error handling may want to use this flag
4095for speed while maintaining IEEE arithmetic compatibility.
4096
4097This option should never be turned on by any @option{-O} option since
4098it can result in incorrect output for programs which depend on
4099an exact implementation of IEEE or ISO rules/specifications for
4100math functions.
4101
4102The default is @option{-fmath-errno}.
4103
4104@item -funsafe-math-optimizations
4105@opindex funsafe-math-optimizations
4106Allow optimizations for floating-point arithmetic that (a) assume
4107that arguments and results are valid and (b) may violate IEEE or
4108ANSI standards.  When used at link-time, it may include libraries
4109or startup files that change the default FPU control word or other
4110similar optimizations.
4111
4112This option should never be turned on by any @option{-O} option since
4113it can result in incorrect output for programs which depend on
4114an exact implementation of IEEE or ISO rules/specifications for
4115math functions.
4116
4117The default is @option{-fno-unsafe-math-optimizations}.
4118
4119@item -ffinite-math-only
4120@opindex ffinite-math-only
4121Allow optimizations for floating-point arithmetic that assume
4122that arguments and results are not NaNs or +-Infs.
4123
4124This option should never be turned on by any @option{-O} option since
4125it can result in incorrect output for programs which depend on
4126an exact implementation of IEEE or ISO rules/specifications.
4127
4128The default is @option{-fno-finite-math-only}.
4129
4130@item -fno-trapping-math
4131@opindex fno-trapping-math
4132Compile code assuming that floating-point operations cannot generate
4133user-visible traps.  These traps include division by zero, overflow,
4134underflow, inexact result and invalid operation.  This option implies
4135@option{-fno-signaling-nans}.  Setting this option may allow faster
4136code if one relies on ``non-stop'' IEEE arithmetic, for example.
4137
4138This option should never be turned on by any @option{-O} option since
4139it can result in incorrect output for programs which depend on
4140an exact implementation of IEEE or ISO rules/specifications for
4141math functions.
4142
4143The default is @option{-ftrapping-math}.
4144
4145@item -fsignaling-nans
4146@opindex fsignaling-nans
4147Compile code assuming that IEEE signaling NaNs may generate user-visible
4148traps during floating-point operations.  Setting this option disables
4149optimizations that may change the number of exceptions visible with
4150signaling NaNs.  This option implies @option{-ftrapping-math}.
4151
4152This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
4153be defined.
4154
4155The default is @option{-fno-signaling-nans}.
4156
4157This option is experimental and does not currently guarantee to
4158disable all GCC optimizations that affect signaling NaN behavior.
4159
4160@item -fsingle-precision-constant
4161@opindex fsingle-precision-constant
4162Treat floating point constant as single precision constant instead of
4163implicitly converting it to double precision constant.
4164
4165
4166@end table
4167
4168The following options control optimizations that may improve
4169performance, but are not enabled by any @option{-O} options.  This
4170section includes experimental options that may produce broken code.
4171
4172@table @gcctabopt
4173@item -fbranch-probabilities
4174@opindex fbranch-probabilities
4175After running a program compiled with @option{-fprofile-arcs}
4176(@pxref{Debugging Options,, Options for Debugging Your Program or
4177@command{gcc}}), you can compile it a second time using
4178@option{-fbranch-probabilities}, to improve optimizations based on
4179the number of times each branch was taken.  When the program
4180compiled with @option{-fprofile-arcs} exits it saves arc execution
4181counts to a file called @file{@var{sourcename}.da} for each source
4182file  The information in this data file is very dependent on the
4183structure of the generated code, so you must use the same source code
4184and the same optimization options for both compilations.
4185
4186With @option{-fbranch-probabilities}, GCC puts a
4187@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
4188These can be used to improve optimization.  Currently, they are only
4189used in one place: in @file{reorg.c}, instead of guessing which path a
4190branch is mostly to take, the @samp{REG_BR_PROB} values are used to
4191exactly determine which path is taken more often.
4192
4193@item -fnew-ra
4194@opindex fnew-ra
4195Use a graph coloring register allocator.  Currently this option is meant
4196only for testing.  Users should not specify this option, since it is not
4197yet ready for production use.
4198
4199@item -ftracer
4200@opindex ftracer
4201Perform tail duplication to enlarge superblock size. This transformation
4202simplifies the control flow of the function allowing other optimizations to do
4203better job.
4204
4205@item -funroll-loops
4206@opindex funroll-loops
4207Unroll loops whose number of iterations can be determined at compile
4208time or upon entry to the loop.  @option{-funroll-loops} implies both
4209@option{-fstrength-reduce} and @option{-frerun-cse-after-loop}.  This
4210option makes code larger, and may or may not make it run faster.
4211
4212@item -funroll-all-loops
4213@opindex funroll-all-loops
4214Unroll all loops, even if their number of iterations is uncertain when
4215the loop is entered.  This usually makes programs run more slowly.
4216@option{-funroll-all-loops} implies the same options as
4217@option{-funroll-loops},
4218
4219@item -fprefetch-loop-arrays
4220@opindex fprefetch-loop-arrays
4221If supported by the target machine, generate instructions to prefetch
4222memory to improve the performance of loops that access large arrays.
4223
4224Disabled at level @option{-Os}.
4225
4226@item -ffunction-sections
4227@itemx -fdata-sections
4228@opindex ffunction-sections
4229@opindex fdata-sections
4230Place each function or data item into its own section in the output
4231file if the target supports arbitrary sections.  The name of the
4232function or the name of the data item determines the section's name
4233in the output file.
4234
4235Use these options on systems where the linker can perform optimizations
4236to improve locality of reference in the instruction space.  Most systems
4237using the ELF object format and SPARC processors running Solaris 2 have
4238linkers with such optimizations.  AIX may have these optimizations in
4239the future.
4240
4241Only use these options when there are significant benefits from doing
4242so.  When you specify these options, the assembler and linker will
4243create larger object and executable files and will also be slower.
4244You will not be able to use @code{gprof} on all systems if you
4245specify this option and you may have problems with debugging if
4246you specify both this option and @option{-g}.
4247
4248@item -fssa
4249@opindex fssa
4250Perform optimizations in static single assignment form.  Each function's
4251flow graph is translated into SSA form, optimizations are performed, and
4252the flow graph is translated back from SSA form.  Users should not
4253specify this option, since it is not yet ready for production use.
4254
4255@item -fssa-ccp
4256@opindex fssa-ccp
4257Perform Sparse Conditional Constant Propagation in SSA form.  Requires
4258@option{-fssa}.  Like @option{-fssa}, this is an experimental feature.
4259
4260@item -fssa-dce
4261@opindex fssa-dce
4262Perform aggressive dead-code elimination in SSA form.  Requires @option{-fssa}.
4263Like @option{-fssa}, this is an experimental feature.
4264
4265@item -fstack-protector
4266Emit extra code to check for buffer overflows, such as stack smashing
4267attacks.  This is done by adding a guard variable to functions with
4268vulnerable objects.  This includes functions with buffers larger
4269than 8 bytes.  The guards are initialized when a function is entered
4270and then checked when the function exits.  If a guard check fails,
4271an error message is printed and the program exits.
4272
4273@item -fstack-protector-all
4274Like @option{-fstack-protector} except that all functions are protected.
4275
4276@item -fstack-protector-strong
4277Like @option{-fstack-protector} but includes additional functions to
4278be protected --- those that have local array definitions, or have
4279references to local frame addresses.
4280
4281@item --param @var{name}=@var{value}
4282@opindex param
4283In some places, GCC uses various constants to control the amount of
4284optimization that is done.  For example, GCC will not inline functions
4285that contain more that a certain number of instructions.  You can
4286control some of these constants on the command-line using the
4287@option{--param} option.
4288
4289The names of specific parameters, and the meaning of the values, are
4290tied to the internals of the compiler, and are subject to change
4291without notice in future releases.
4292
4293In each case, the @var{value} is an integer.  The allowable choices for
4294@var{name} are given in the following table:
4295
4296@table @gcctabopt
4297@item max-crossjump-edges
4298The maximum number of incoming edges to consider for crossjumping.
4299The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
4300the number of edges incoming to each block.  Increasing values mean
4301more aggressive optimization, making the compile time increase with
4302probably small improvement in executable size.
4303
4304@item max-delay-slot-insn-search
4305The maximum number of instructions to consider when looking for an
4306instruction to fill a delay slot.  If more than this arbitrary number of
4307instructions is searched, the time savings from filling the delay slot
4308will be minimal so stop searching.  Increasing values mean more
4309aggressive optimization, making the compile time increase with probably
4310small improvement in executable run time.
4311
4312@item max-delay-slot-live-search
4313When trying to fill delay slots, the maximum number of instructions to
4314consider when searching for a block with valid live register
4315information.  Increasing this arbitrarily chosen value means more
4316aggressive optimization, increasing the compile time.  This parameter
4317should be removed when the delay slot code is rewritten to maintain the
4318control-flow graph.
4319
4320@item max-gcse-memory
4321The approximate maximum amount of memory that will be allocated in
4322order to perform the global common subexpression elimination
4323optimization.  If more memory than specified is required, the
4324optimization will not be done.
4325
4326@item max-gcse-passes
4327The maximum number of passes of GCSE to run.
4328
4329@item max-pending-list-length
4330The maximum number of pending dependencies scheduling will allow
4331before flushing the current state and starting over.  Large functions
4332with few branches or calls can create excessively large lists which
4333needlessly consume memory and resources.
4334
4335@item max-inline-insns-single
4336Several parameters control the tree inliner used in gcc.
4337This number sets the maximum number of instructions (counted in gcc's
4338internal representation) in a single function that the tree inliner
4339will consider for inlining.  This only affects functions declared
4340inline and methods implemented in a class declaration (C++).
4341The default value is 300.
4342
4343@item max-inline-insns-auto
4344When you use @option{-finline-functions} (included in @option{-O3}),
4345a lot of functions that would otherwise not be considered for inlining
4346by the compiler will be investigated.  To those functions, a different
4347(more restrictive) limit compared to functions declared inline can
4348be applied.
4349The default value is 300.
4350
4351@item max-inline-insns
4352The tree inliner does decrease the allowable size for single functions
4353to be inlined after we already inlined the number of instructions
4354given here by repeated inlining.  This number should be a factor of
4355two or more larger than the single function limit.
4356Higher numbers result in better runtime performance, but incur higher
4357compile-time resource (CPU time, memory) requirements and result in
4358larger binaries.  Very high values are not advisable, as too large
4359binaries may adversely affect runtime performance.
4360The default value is 600.
4361
4362@item max-inline-slope
4363After exceeding the maximum number of inlined instructions by repeated
4364inlining, a linear function is used to decrease the allowable size
4365for single functions.  The slope of that function is the negative
4366reciprocal of the number specified here.
4367The default value is 32.
4368
4369@item min-inline-insns
4370The repeated inlining is throttled more and more by the linear function
4371after exceeding the limit.  To avoid too much throttling, a minimum for
4372this function is specified here to allow repeated inlining for very small
4373functions even when a lot of repeated inlining already has been done.
4374The default value is 130.
4375
4376@item max-inline-insns-rtl
4377For languages that use the RTL inliner (this happens at a later stage
4378than tree inlining), you can set the maximum allowable size (counted
4379in RTL instructions) for the RTL inliner with this parameter.
4380The default value is 600.
4381
4382
4383@item max-unrolled-insns
4384The maximum number of instructions that a loop should have if that loop
4385is unrolled, and if the loop is unrolled, it determines how many times
4386the loop code is unrolled.
4387
4388@item hot-bb-count-fraction
4389Select fraction of the maximal count of repetitions of basic block in program
4390given basic block needs to have to be considered hot.
4391
4392@item hot-bb-frequency-fraction
4393Select fraction of the maximal frequency of executions of basic block in
4394function given basic block needs to have to be considered hot
4395
4396@item tracer-dynamic-coverage
4397@itemx tracer-dynamic-coverage-feedback
4398
4399This value is used to limit superblock formation once the given percentage of
4400executed instructions is covered.  This limits unnecessary code size
4401expansion.
4402
4403The @option{tracer-dynamic-coverage-feedback} is used only when profile
4404feedback is available.  The real profiles (as opposed to statically estimated
4405ones) are much less balanced allowing the threshold to be larger value.
4406
4407@item tracer-max-code-growth
4408Stop tail duplication once code growth has reached given percentage.  This is
4409rather hokey argument, as most of the duplicates will be eliminated later in
4410cross jumping, so it may be set to much higher values than is the desired code
4411growth.
4412
4413@item tracer-min-branch-ratio
4414
4415Stop reverse growth when the reverse probability of best edge is less than this
4416threshold (in percent).
4417
4418@item tracer-min-branch-ratio
4419@itemx tracer-min-branch-ratio-feedback
4420
4421Stop forward growth if the best edge do have probability lower than this
4422threshold.
4423
4424Similarly to @option{tracer-dynamic-coverage} two values are present, one for
4425compilation for profile feedback and one for compilation without.  The value
4426for compilation with profile feedback needs to be more conservative (higher) in
4427order to make tracer effective.
4428
4429@item ggc-min-expand
4430
4431GCC uses a garbage collector to manage its own memory allocation.  This
4432parameter specifies the minimum percentage by which the garbage
4433collector's heap should be allowed to expand between collections.
4434Tuning this may improve compilation speed; it has no effect on code
4435generation.
4436
4437The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
4438RAM >= 1GB.  If @code{getrlimit} is available, the notion of "RAM" is
4439the smallest of actual RAM, RLIMIT_RSS, RLIMIT_DATA and RLIMIT_AS.  If
4440GCC is not able to calculate RAM on a particular platform, the lower
4441bound of 30% is used.  Setting this parameter and
4442@option{ggc-min-heapsize} to zero causes a full collection to occur at
4443every opportunity.  This is extremely slow, but can be useful for
4444debugging.
4445
4446@item ggc-min-heapsize
4447
4448Minimum size of the garbage collector's heap before it begins bothering
4449to collect garbage.  The first collection occurs after the heap expands
4450by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
4451tuning this may improve compilation speed, and has no effect on code
4452generation.
4453
4454The default is RAM/8, with a lower bound of 4096 (four megabytes) and an
4455upper bound of 131072 (128 megabytes).  If @code{getrlimit} is
4456available, the notion of "RAM" is the smallest of actual RAM,
4457RLIMIT_RSS, RLIMIT_DATA and RLIMIT_AS.  If GCC is not able to calculate
4458RAM on a particular platform, the lower bound is used.  Setting this
4459parameter very large effectively disables garbage collection.  Setting
4460this parameter and @option{ggc-min-expand} to zero causes a full
4461collection to occur at every opportunity.
4462
4463@end table
4464@end table
4465
4466@node Preprocessor Options
4467@section Options Controlling the Preprocessor
4468@cindex preprocessor options
4469@cindex options, preprocessor
4470
4471These options control the C preprocessor, which is run on each C source
4472file before actual compilation.
4473
4474If you use the @option{-E} option, nothing is done except preprocessing.
4475Some of these options make sense only together with @option{-E} because
4476they cause the preprocessor output to be unsuitable for actual
4477compilation.
4478
4479@opindex Wp
4480You can use @option{-Wp,@var{option}} to bypass the compiler driver
4481and pass @var{option} directly through to the preprocessor.  If
4482@var{option} contains commas, it is split into multiple options at the
4483commas.  However, many options are modified, translated or interpreted
4484by the compiler driver before being passed to the preprocessor, and
4485@option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
4486interface is undocumented and subject to change, so whenever possible
4487you should avoid using @option{-Wp} and let the driver handle the
4488options instead.
4489
4490@include cppopts.texi
4491
4492@node Assembler Options
4493@section Passing Options to the Assembler
4494
4495@c prevent bad page break with this line
4496You can pass options to the assembler.
4497
4498@table @gcctabopt
4499@item -Wa,@var{option}
4500@opindex Wa
4501Pass @var{option} as an option to the assembler.  If @var{option}
4502contains commas, it is split into multiple options at the commas.
4503@end table
4504
4505@node Link Options
4506@section Options for Linking
4507@cindex link options
4508@cindex options, linking
4509
4510These options come into play when the compiler links object files into
4511an executable output file.  They are meaningless if the compiler is
4512not doing a link step.
4513
4514@table @gcctabopt
4515@cindex file names
4516@item @var{object-file-name}
4517A file name that does not end in a special recognized suffix is
4518considered to name an object file or library.  (Object files are
4519distinguished from libraries by the linker according to the file
4520contents.)  If linking is done, these object files are used as input
4521to the linker.
4522
4523@item -c
4524@itemx -S
4525@itemx -E
4526@opindex c
4527@opindex S
4528@opindex E
4529If any of these options is used, then the linker is not run, and
4530object file names should not be used as arguments.  @xref{Overall
4531Options}.
4532
4533@cindex Libraries
4534@item -l@var{library}
4535@itemx -l @var{library}
4536@opindex l
4537Search the library named @var{library} when linking.  (The second
4538alternative with the library as a separate argument is only for
4539POSIX compliance and is not recommended.)
4540
4541It makes a difference where in the command you write this option; the
4542linker searches and processes libraries and object files in the order they
4543are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
4544after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
4545to functions in @samp{z}, those functions may not be loaded.
4546
4547The linker searches a standard list of directories for the library,
4548which is actually a file named @file{lib@var{library}.a}.  The linker
4549then uses this file as if it had been specified precisely by name.
4550
4551The directories searched include several standard system directories
4552plus any that you specify with @option{-L}.
4553
4554Normally the files found this way are library files---archive files
4555whose members are object files.  The linker handles an archive file by
4556scanning through it for members which define symbols that have so far
4557been referenced but not defined.  But if the file that is found is an
4558ordinary object file, it is linked in the usual fashion.  The only
4559difference between using an @option{-l} option and specifying a file name
4560is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
4561and searches several directories.
4562
4563@item -lobjc
4564@opindex lobjc
4565You need this special case of the @option{-l} option in order to
4566link an Objective-C program.
4567
4568@item -nostartfiles
4569@opindex nostartfiles
4570Do not use the standard system startup files when linking.
4571The standard system libraries are used normally, unless @option{-nostdlib}
4572or @option{-nodefaultlibs} is used.
4573
4574@item -nodefaultlibs
4575@opindex nodefaultlibs
4576Do not use the standard system libraries when linking.
4577Only the libraries you specify will be passed to the linker.
4578The standard startup files are used normally, unless @option{-nostartfiles}
4579is used.  The compiler may generate calls to memcmp, memset, and memcpy
4580for System V (and ISO C) environments or to bcopy and bzero for
4581BSD environments.  These entries are usually resolved by entries in
4582libc.  These entry points should be supplied through some other
4583mechanism when this option is specified.
4584
4585@item -nostdlib
4586@opindex nostdlib
4587Do not use the standard system startup files or libraries when linking.
4588No startup files and only the libraries you specify will be passed to
4589the linker.  The compiler may generate calls to memcmp, memset, and memcpy
4590for System V (and ISO C) environments or to bcopy and bzero for
4591BSD environments.  These entries are usually resolved by entries in
4592libc.  These entry points should be supplied through some other
4593mechanism when this option is specified.
4594
4595@cindex @option{-lgcc}, use with @option{-nostdlib}
4596@cindex @option{-nostdlib} and unresolved references
4597@cindex unresolved references and @option{-nostdlib}
4598@cindex @option{-lgcc}, use with @option{-nodefaultlibs}
4599@cindex @option{-nodefaultlibs} and unresolved references
4600@cindex unresolved references and @option{-nodefaultlibs}
4601One of the standard libraries bypassed by @option{-nostdlib} and
4602@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
4603that GCC uses to overcome shortcomings of particular machines, or special
4604needs for some languages.
4605(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
4606Collection (GCC) Internals},
4607for more discussion of @file{libgcc.a}.)
4608In most cases, you need @file{libgcc.a} even when you want to avoid
4609other standard libraries.  In other words, when you specify @option{-nostdlib}
4610or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
4611This ensures that you have no unresolved references to internal GCC
4612library subroutines.  (For example, @samp{__main}, used to ensure C++
4613constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
4614GNU Compiler Collection (GCC) Internals}.)
4615
4616@item -pie
4617@opindex pie
4618Produce a position independent executable on targets which support it.
4619For predictable results, you must also specify the same set of options
4620that were used to generate code (@option{-fpie}, @option{-fPIE},
4621or model suboptions) when you specify this option.
4622
4623@item -s
4624@opindex s
4625Remove all symbol table and relocation information from the executable.
4626
4627@item -static
4628@opindex static
4629On systems that support dynamic linking, this prevents linking with the shared
4630libraries.  On other systems, this option has no effect.
4631
4632@item -shared
4633@opindex shared
4634Produce a shared object which can then be linked with other objects to
4635form an executable.  Not all systems support this option.  For predictable
4636results, you must also specify the same set of options that were used to
4637generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
4638when you specify this option.@footnote{On some systems, @samp{gcc -shared}
4639needs to build supplementary stub code for constructors to work.  On
4640multi-libbed systems, @samp{gcc -shared} must select the correct support
4641libraries to link against.  Failing to supply the correct flags may lead
4642to subtle defects.  Supplying them in cases where they are not necessary
4643is innocuous.}
4644
4645@item -shared-libgcc
4646@itemx -static-libgcc
4647@opindex shared-libgcc
4648@opindex static-libgcc
4649On systems that provide @file{libgcc} as a shared library, these options
4650force the use of either the shared or static version respectively.
4651If no shared version of @file{libgcc} was built when the compiler was
4652configured, these options have no effect.
4653
4654There are several situations in which an application should use the
4655shared @file{libgcc} instead of the static version.  The most common
4656of these is when the application wishes to throw and catch exceptions
4657across different shared libraries.  In that case, each of the libraries
4658as well as the application itself should use the shared @file{libgcc}.
4659
4660Therefore, the G++ and GCJ drivers automatically add
4661@option{-shared-libgcc} whenever you build a shared library or a main
4662executable, because C++ and Java programs typically use exceptions, so
4663this is the right thing to do.
4664
4665If, instead, you use the GCC driver to create shared libraries, you may
4666find that they will not always be linked with the shared @file{libgcc}.
4667If GCC finds, at its configuration time, that you have a GNU linker that
4668does not support option @option{--eh-frame-hdr}, it will link the shared
4669version of @file{libgcc} into shared libraries by default.  Otherwise,
4670it will take advantage of the linker and optimize away the linking with
4671the shared version of @file{libgcc}, linking with the static version of
4672libgcc by default.  This allows exceptions to propagate through such
4673shared libraries, without incurring relocation costs at library load
4674time.
4675
4676However, if a library or main executable is supposed to throw or catch
4677exceptions, you must link it using the G++ or GCJ driver, as appropriate
4678for the languages used in the program, or using the option
4679@option{-shared-libgcc}, such that it is linked with the shared
4680@file{libgcc}.
4681
4682@item -symbolic
4683@opindex symbolic
4684Bind references to global symbols when building a shared object.  Warn
4685about any unresolved references (unless overridden by the link editor
4686option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
4687this option.
4688
4689@item -Xlinker @var{option}
4690@opindex Xlinker
4691Pass @var{option} as an option to the linker.  You can use this to
4692supply system-specific linker options which GCC does not know how to
4693recognize.
4694
4695If you want to pass an option that takes an argument, you must use
4696@option{-Xlinker} twice, once for the option and once for the argument.
4697For example, to pass @option{-assert definitions}, you must write
4698@samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
4699@option{-Xlinker "-assert definitions"}, because this passes the entire
4700string as a single argument, which is not what the linker expects.
4701
4702@item -Wl,@var{option}
4703@opindex Wl
4704Pass @var{option} as an option to the linker.  If @var{option} contains
4705commas, it is split into multiple options at the commas.
4706
4707@item -u @var{symbol}
4708@opindex u
4709Pretend the symbol @var{symbol} is undefined, to force linking of
4710library modules to define it.  You can use @option{-u} multiple times with
4711different symbols to force loading of additional library modules.
4712@end table
4713
4714@node Directory Options
4715@section Options for Directory Search
4716@cindex directory options
4717@cindex options, directory search
4718@cindex search path
4719
4720These options specify directories to search for header files, for
4721libraries and for parts of the compiler:
4722
4723@table @gcctabopt
4724@item -I@var{dir}
4725@opindex I
4726Add the directory @var{dir} to the head of the list of directories to be
4727searched for header files.  This can be used to override a system header
4728file, substituting your own version, since these directories are
4729searched before the system header file directories.  However, you should
4730not use this option to add directories that contain vendor-supplied
4731system header files (use @option{-isystem} for that).  If you use more than
4732one @option{-I} option, the directories are scanned in left-to-right
4733order; the standard system directories come after.
4734
4735If a standard system include directory, or a directory specified with
4736@option{-isystem}, is also specified with @option{-I}, the @option{-I}
4737option will be ignored.  The directory will still be searched but as a
4738system directory at its normal position in the system include chain.
4739This is to ensure that GCC's procedure to fix buggy system headers and
4740the ordering for the include_next directive are not inadvertently changed.
4741If you really need to change the search order for system directories,
4742use the @option{-nostdinc} and/or @option{-isystem} options.
4743
4744@item -I-
4745@opindex I-
4746Any directories you specify with @option{-I} options before the @option{-I-}
4747option are searched only for the case of @samp{#include "@var{file}"};
4748they are not searched for @samp{#include <@var{file}>}.
4749
4750If additional directories are specified with @option{-I} options after
4751the @option{-I-}, these directories are searched for all @samp{#include}
4752directives.  (Ordinarily @emph{all} @option{-I} directories are used
4753this way.)
4754
4755In addition, the @option{-I-} option inhibits the use of the current
4756directory (where the current input file came from) as the first search
4757directory for @samp{#include "@var{file}"}.  There is no way to
4758override this effect of @option{-I-}.  With @option{-I.} you can specify
4759searching the directory which was current when the compiler was
4760invoked.  That is not exactly the same as what the preprocessor does
4761by default, but it is often satisfactory.
4762
4763@option{-I-} does not inhibit the use of the standard system directories
4764for header files.  Thus, @option{-I-} and @option{-nostdinc} are
4765independent.
4766
4767@item -L@var{dir}
4768@opindex L
4769Add directory @var{dir} to the list of directories to be searched
4770for @option{-l}.
4771
4772@item -B@var{prefix}
4773@opindex B
4774This option specifies where to find the executables, libraries,
4775include files, and data files of the compiler itself.
4776
4777The compiler driver program runs one or more of the subprograms
4778@file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
4779@var{prefix} as a prefix for each program it tries to run, both with and
4780without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
4781
4782For each subprogram to be run, the compiler driver first tries the
4783@option{-B} prefix, if any.  If that name is not found, or if @option{-B}
4784was not specified, the driver tries two standard prefixes, which are
4785@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc-lib/}.  If neither of
4786those results in a file name that is found, the unmodified program
4787name is searched for using the directories specified in your
4788@env{PATH} environment variable.
4789
4790The compiler will check to see if the path provided by the @option{-B}
4791refers to a directory, and if necessary it will add a directory
4792separator character at the end of the path.
4793
4794@option{-B} prefixes that effectively specify directory names also apply
4795to libraries in the linker, because the compiler translates these
4796options into @option{-L} options for the linker.  They also apply to
4797includes files in the preprocessor, because the compiler translates these
4798options into @option{-isystem} options for the preprocessor.  In this case,
4799the compiler appends @samp{include} to the prefix.
4800
4801The run-time support file @file{libgcc.a} can also be searched for using
4802the @option{-B} prefix, if needed.  If it is not found there, the two
4803standard prefixes above are tried, and that is all.  The file is left
4804out of the link if it is not found by those means.
4805
4806Another way to specify a prefix much like the @option{-B} prefix is to use
4807the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
4808Variables}.
4809
4810As a special kludge, if the path provided by @option{-B} is
4811@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
48129, then it will be replaced by @file{[dir/]include}.  This is to help
4813with boot-strapping the compiler.
4814
4815@item -specs=@var{file}
4816@opindex specs
4817Process @var{file} after the compiler reads in the standard @file{specs}
4818file, in order to override the defaults that the @file{gcc} driver
4819program uses when determining what switches to pass to @file{cc1},
4820@file{cc1plus}, @file{as}, @file{ld}, etc.  More than one
4821@option{-specs=@var{file}} can be specified on the command line, and they
4822are processed in order, from left to right.
4823@end table
4824
4825@c man end
4826
4827@node Spec Files
4828@section Specifying subprocesses and the switches to pass to them
4829@cindex Spec Files
4830
4831@command{gcc} is a driver program.  It performs its job by invoking a
4832sequence of other programs to do the work of compiling, assembling and
4833linking.  GCC interprets its command-line parameters and uses these to
4834deduce which programs it should invoke, and which command-line options
4835it ought to place on their command lines.  This behavior is controlled
4836by @dfn{spec strings}.  In most cases there is one spec string for each
4837program that GCC can invoke, but a few programs have multiple spec
4838strings to control their behavior.  The spec strings built into GCC can
4839be overridden by using the @option{-specs=} command-line switch to specify
4840a spec file.
4841
4842@dfn{Spec files} are plaintext files that are used to construct spec
4843strings.  They consist of a sequence of directives separated by blank
4844lines.  The type of directive is determined by the first non-whitespace
4845character on the line and it can be one of the following:
4846
4847@table @code
4848@item %@var{command}
4849Issues a @var{command} to the spec file processor.  The commands that can
4850appear here are:
4851
4852@table @code
4853@item %include <@var{file}>
4854@cindex %include
4855Search for @var{file} and insert its text at the current point in the
4856specs file.
4857
4858@item %include_noerr <@var{file}>
4859@cindex %include_noerr
4860Just like @samp{%include}, but do not generate an error message if the include
4861file cannot be found.
4862
4863@item %rename @var{old_name} @var{new_name}
4864@cindex %rename
4865Rename the spec string @var{old_name} to @var{new_name}.
4866
4867@end table
4868
4869@item *[@var{spec_name}]:
4870This tells the compiler to create, override or delete the named spec
4871string.  All lines after this directive up to the next directive or
4872blank line are considered to be the text for the spec string.  If this
4873results in an empty string then the spec will be deleted.  (Or, if the
4874spec did not exist, then nothing will happened.)  Otherwise, if the spec
4875does not currently exist a new spec will be created.  If the spec does
4876exist then its contents will be overridden by the text of this
4877directive, unless the first character of that text is the @samp{+}
4878character, in which case the text will be appended to the spec.
4879
4880@item [@var{suffix}]:
4881Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
4882and up to the next directive or blank line are considered to make up the
4883spec string for the indicated suffix.  When the compiler encounters an
4884input file with the named suffix, it will processes the spec string in
4885order to work out how to compile that file.  For example:
4886
4887@smallexample
4888.ZZ:
4889z-compile -input %i
4890@end smallexample
4891
4892This says that any input file whose name ends in @samp{.ZZ} should be
4893passed to the program @samp{z-compile}, which should be invoked with the
4894command-line switch @option{-input} and with the result of performing the
4895@samp{%i} substitution.  (See below.)
4896
4897As an alternative to providing a spec string, the text that follows a
4898suffix directive can be one of the following:
4899
4900@table @code
4901@item @@@var{language}
4902This says that the suffix is an alias for a known @var{language}.  This is
4903similar to using the @option{-x} command-line switch to GCC to specify a
4904language explicitly.  For example:
4905
4906@smallexample
4907.ZZ:
4908@@c++
4909@end smallexample
4910
4911Says that .ZZ files are, in fact, C++ source files.
4912
4913@item #@var{name}
4914This causes an error messages saying:
4915
4916@smallexample
4917@var{name} compiler not installed on this system.
4918@end smallexample
4919@end table
4920
4921GCC already has an extensive list of suffixes built into it.
4922This directive will add an entry to the end of the list of suffixes, but
4923since the list is searched from the end backwards, it is effectively
4924possible to override earlier entries using this technique.
4925
4926@end table
4927
4928GCC has the following spec strings built into it.  Spec files can
4929override these strings or create their own.  Note that individual
4930targets can also add their own spec strings to this list.
4931
4932@smallexample
4933asm          Options to pass to the assembler
4934asm_final    Options to pass to the assembler post-processor
4935cpp          Options to pass to the C preprocessor
4936cc1          Options to pass to the C compiler
4937cc1plus      Options to pass to the C++ compiler
4938endfile      Object files to include at the end of the link
4939link         Options to pass to the linker
4940lib          Libraries to include on the command line to the linker
4941libgcc       Decides which GCC support library to pass to the linker
4942linker       Sets the name of the linker
4943predefines   Defines to be passed to the C preprocessor
4944signed_char  Defines to pass to CPP to say whether @code{char} is signed
4945             by default
4946startfile    Object files to include at the start of the link
4947@end smallexample
4948
4949Here is a small example of a spec file:
4950
4951@smallexample
4952%rename lib                 old_lib
4953
4954*lib:
4955--start-group -lgcc -lc -leval1 --end-group %(old_lib)
4956@end smallexample
4957
4958This example renames the spec called @samp{lib} to @samp{old_lib} and
4959then overrides the previous definition of @samp{lib} with a new one.
4960The new definition adds in some extra command-line options before
4961including the text of the old definition.
4962
4963@dfn{Spec strings} are a list of command-line options to be passed to their
4964corresponding program.  In addition, the spec strings can contain
4965@samp{%}-prefixed sequences to substitute variable text or to
4966conditionally insert text into the command line.  Using these constructs
4967it is possible to generate quite complex command lines.
4968
4969Here is a table of all defined @samp{%}-sequences for spec
4970strings.  Note that spaces are not generated automatically around the
4971results of expanding these sequences.  Therefore you can concatenate them
4972together or combine them with constant text in a single argument.
4973
4974@table @code
4975@item %%
4976Substitute one @samp{%} into the program name or argument.
4977
4978@item %i
4979Substitute the name of the input file being processed.
4980
4981@item %b
4982Substitute the basename of the input file being processed.
4983This is the substring up to (and not including) the last period
4984and not including the directory.
4985
4986@item %B
4987This is the same as @samp{%b}, but include the file suffix (text after
4988the last period).
4989
4990@item %d
4991Marks the argument containing or following the @samp{%d} as a
4992temporary file name, so that that file will be deleted if GCC exits
4993successfully.  Unlike @samp{%g}, this contributes no text to the
4994argument.
4995
4996@item %g@var{suffix}
4997Substitute a file name that has suffix @var{suffix} and is chosen
4998once per compilation, and mark the argument in the same way as
4999@samp{%d}.  To reduce exposure to denial-of-service attacks, the file
5000name is now chosen in a way that is hard to predict even when previously
5001chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
5002might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
5003the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
5004treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
5005was simply substituted with a file name chosen once per compilation,
5006without regard to any appended suffix (which was therefore treated
5007just like ordinary text), making such attacks more likely to succeed.
5008
5009@item %u@var{suffix}
5010Like @samp{%g}, but generates a new temporary file name even if
5011@samp{%u@var{suffix}} was already seen.
5012
5013@item %U@var{suffix}
5014Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
5015new one if there is no such last file name.  In the absence of any
5016@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
5017the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
5018would involve the generation of two distinct file names, one
5019for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
5020simply substituted with a file name chosen for the previous @samp{%u},
5021without regard to any appended suffix.
5022
5023@item %j@var{suffix}
5024Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
5025writable, and if save-temps is off; otherwise, substitute the name
5026of a temporary file, just like @samp{%u}.  This temporary file is not
5027meant for communication between processes, but rather as a junk
5028disposal mechanism.
5029
5030@item %.@var{SUFFIX}
5031Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
5032when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
5033terminated by the next space or %.
5034
5035@item %w
5036Marks the argument containing or following the @samp{%w} as the
5037designated output file of this compilation.  This puts the argument
5038into the sequence of arguments that @samp{%o} will substitute later.
5039
5040@item %o
5041Substitutes the names of all the output files, with spaces
5042automatically placed around them.  You should write spaces
5043around the @samp{%o} as well or the results are undefined.
5044@samp{%o} is for use in the specs for running the linker.
5045Input files whose names have no recognized suffix are not compiled
5046at all, but they are included among the output files, so they will
5047be linked.
5048
5049@item %O
5050Substitutes the suffix for object files.  Note that this is
5051handled specially when it immediately follows @samp{%g, %u, or %U},
5052because of the need for those to form complete file names.  The
5053handling is such that @samp{%O} is treated exactly as if it had already
5054been substituted, except that @samp{%g, %u, and %U} do not currently
5055support additional @var{suffix} characters following @samp{%O} as they would
5056following, for example, @samp{.o}.
5057
5058@item %p
5059Substitutes the standard macro predefinitions for the
5060current target machine.  Use this when running @code{cpp}.
5061
5062@item %P
5063Like @samp{%p}, but puts @samp{__} before and after the name of each
5064predefined macro, except for macros that start with @samp{__} or with
5065@samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
5066C@.
5067
5068@item %I
5069Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
5070@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), and
5071@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
5072as necessary.
5073
5074@item %s
5075Current argument is the name of a library or startup file of some sort.
5076Search for that file in a standard list of directories and substitute
5077the full name found.
5078
5079@item %e@var{str}
5080Print @var{str} as an error message.  @var{str} is terminated by a newline.
5081Use this when inconsistent options are detected.
5082
5083@item %|
5084Output @samp{-} if the input for the current command is coming from a pipe.
5085
5086@item %(@var{name})
5087Substitute the contents of spec string @var{name} at this point.
5088
5089@item %[@var{name}]
5090Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
5091
5092@item %x@{@var{option}@}
5093Accumulate an option for @samp{%X}.
5094
5095@item %X
5096Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
5097spec string.
5098
5099@item %Y
5100Output the accumulated assembler options specified by @option{-Wa}.
5101
5102@item %Z
5103Output the accumulated preprocessor options specified by @option{-Wp}.
5104
5105@item %v1
5106Substitute the major version number of GCC@.
5107(For version 2.9.5, this is 2.)
5108
5109@item %v2
5110Substitute the minor version number of GCC@.
5111(For version 2.9.5, this is 9.)
5112
5113@item %v3
5114Substitute the patch level number of GCC@.
5115(For version 2.9.5, this is 5.)
5116
5117@item %a
5118Process the @code{asm} spec.  This is used to compute the
5119switches to be passed to the assembler.
5120
5121@item %A
5122Process the @code{asm_final} spec.  This is a spec string for
5123passing switches to an assembler post-processor, if such a program is
5124needed.
5125
5126@item %l
5127Process the @code{link} spec.  This is the spec for computing the
5128command line passed to the linker.  Typically it will make use of the
5129@samp{%L %G %S %D and %E} sequences.
5130
5131@item %D
5132Dump out a @option{-L} option for each directory that GCC believes might
5133contain startup files.  If the target supports multilibs then the
5134current multilib directory will be prepended to each of these paths.
5135
5136@item %M
5137Output the multilib directory with directory separators replaced with
5138@samp{_}.  If multilib directories are not set, or the multilib directory is
5139@file{.} then this option emits nothing.
5140
5141@item %L
5142Process the @code{lib} spec.  This is a spec string for deciding which
5143libraries should be included on the command line to the linker.
5144
5145@item %G
5146Process the @code{libgcc} spec.  This is a spec string for deciding
5147which GCC support library should be included on the command line to the linker.
5148
5149@item %S
5150Process the @code{startfile} spec.  This is a spec for deciding which
5151object files should be the first ones passed to the linker.  Typically
5152this might be a file named @file{crt0.o}.
5153
5154@item %E
5155Process the @code{endfile} spec.  This is a spec string that specifies
5156the last object files that will be passed to the linker.
5157
5158@item %C
5159Process the @code{cpp} spec.  This is used to construct the arguments
5160to be passed to the C preprocessor.
5161
5162@item %c
5163Process the @code{signed_char} spec.  This is intended to be used
5164to tell cpp whether a char is signed.  It typically has the definition:
5165@smallexample
5166%@{funsigned-char:-D__CHAR_UNSIGNED__@}
5167@end smallexample
5168
5169@item %1
5170Process the @code{cc1} spec.  This is used to construct the options to be
5171passed to the actual C compiler (@samp{cc1}).
5172
5173@item %2
5174Process the @code{cc1plus} spec.  This is used to construct the options to be
5175passed to the actual C++ compiler (@samp{cc1plus}).
5176
5177@item %*
5178Substitute the variable part of a matched option.  See below.
5179Note that each comma in the substituted string is replaced by
5180a single space.
5181
5182@item %:@var{function}(@var{args})
5183Call the named function @var{function}, passing it @var{args}.
5184@var{args} is first processed as a nested spec string, then split
5185into an argument vector in the usual fashion.  The function returns
5186a string which is processed as if it had appeared literally as part
5187of the current spec.
5188
5189The following built-in spec functions are provided:
5190
5191@table @code
5192@item @code{if-exists}
5193The @code{if-exists} spec function takes one argument, an absolute
5194pathname to a file.  If the file exists, @code{if-exists} returns the
5195pathname.  Here is a small example of its usage:
5196
5197@smallexample
5198*startfile:
5199crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
5200@end smallexample
5201
5202@item @code{if-exists-else}
5203The @code{if-exists-else} spec function is similar to the @code{if-exists}
5204spec function, except that it takes two arguments.  The first argument is
5205an absolute pathname to a file.  If the file exists, @code{if-exists-else}
5206returns the pathname.  If it does not exist, it returns the second argument.
5207This way, @code{if-exists-else} can be used to select one file or another,
5208based on the existence of the first.  Here is a small example of its usage:
5209
5210@smallexample
5211*startfile:
5212crt0%O%s %:if-exists(crti%O%s) \
5213%:if-exists-else(crtbeginT%O%s crtbegin%O%s)
5214@end smallexample
5215@end table
5216
5217@item %@{@code{S}@}
5218Substitutes the @code{-S} switch, if that switch was given to GCC@.
5219If that switch was not specified, this substitutes nothing.  Note that
5220the leading dash is omitted when specifying this option, and it is
5221automatically inserted if the substitution is performed.  Thus the spec
5222string @samp{%@{foo@}} would match the command-line option @option{-foo}
5223and would output the command line option @option{-foo}.
5224
5225@item %W@{@code{S}@}
5226Like %@{@code{S}@} but mark last argument supplied within as a file to be
5227deleted on failure.
5228
5229@item %@{@code{S}*@}
5230Substitutes all the switches specified to GCC whose names start
5231with @code{-S}, but which also take an argument.  This is used for
5232switches like @option{-o}, @option{-D}, @option{-I}, etc.
5233GCC considers @option{-o foo} as being
5234one switch whose names starts with @samp{o}.  %@{o*@} would substitute this
5235text, including the space.  Thus two arguments would be generated.
5236
5237@item %@{^@code{S}*@}
5238Like %@{@code{S}*@}, but don't put a blank between a switch and its
5239argument.  Thus %@{^o*@} would only generate one argument, not two.
5240
5241@item %@{@code{S}*&@code{T}*@}
5242Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
5243(the order of @code{S} and @code{T} in the spec is not significant).
5244There can be any number of ampersand-separated variables; for each the
5245wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
5246
5247@item %@{<@code{S}@}
5248Remove all occurrences of @code{-S} from the command line.  Note---this
5249command is position dependent.  @samp{%} commands in the spec string
5250before this option will see @code{-S}, @samp{%} commands in the spec
5251string after this option will not.
5252
5253@item %@{@code{S}*:@code{X}@}
5254Substitutes @code{X} if one or more switches whose names start with
5255@code{-S} are specified to GCC@.  Note that the tail part of the
5256@code{-S} option (i.e.@: the part matched by the @samp{*}) will be substituted
5257for each occurrence of @samp{%*} within @code{X}.
5258
5259@item %@{@code{S}:@code{X}@}
5260Substitutes @code{X}, but only if the @samp{-S} switch was given to GCC@.
5261
5262@item %@{!@code{S}:@code{X}@}
5263Substitutes @code{X}, but only if the @samp{-S} switch was @emph{not} given to GCC@.
5264
5265@item %@{|@code{S}:@code{X}@}
5266Like %@{@code{S}:@code{X}@}, but if no @code{S} switch, substitute @samp{-}.
5267
5268@item %@{|!@code{S}:@code{X}@}
5269Like %@{!@code{S}:@code{X}@}, but if there is an @code{S} switch, substitute @samp{-}.
5270
5271@item %@{.@code{S}:@code{X}@}
5272Substitutes @code{X}, but only if processing a file with suffix @code{S}.
5273
5274@item %@{!.@code{S}:@code{X}@}
5275Substitutes @code{X}, but only if @emph{not} processing a file with suffix @code{S}.
5276
5277@item %@{@code{S}|@code{P}:@code{X}@}
5278Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@.  This may be
5279combined with @samp{!} and @samp{.} sequences as well, although they
5280have a stronger binding than the @samp{|}.  For example a spec string
5281like this:
5282
5283@smallexample
5284%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
5285@end smallexample
5286
5287will output the following command-line options from the following input
5288command-line options:
5289
5290@smallexample
5291fred.c        -foo -baz
5292jim.d         -bar -boggle
5293-d fred.c     -foo -baz -boggle
5294-d jim.d      -bar -baz -boggle
5295@end smallexample
5296
5297@end table
5298
5299The conditional text @code{X} in a %@{@code{S}:@code{X}@} or
5300%@{!@code{S}:@code{X}@} construct may contain other nested @samp{%} constructs
5301or spaces, or even newlines.  They are processed as usual, as described
5302above.
5303
5304The @option{-O}, @option{-f}, @option{-m}, and @option{-W}
5305switches are handled specifically in these
5306constructs.  If another value of @option{-O} or the negated form of a @option{-f}, @option{-m}, or
5307@option{-W} switch is found later in the command line, the earlier switch
5308value is ignored, except with @{@code{S}*@} where @code{S} is just one
5309letter, which passes all matching options.
5310
5311The character @samp{|} at the beginning of the predicate text is used to indicate
5312that a command should be piped to the following command, but only if @option{-pipe}
5313is specified.
5314
5315It is built into GCC which switches take arguments and which do not.
5316(You might think it would be useful to generalize this to allow each
5317compiler's spec to say which switches take arguments.  But this cannot
5318be done in a consistent fashion.  GCC cannot even decide which input
5319files have been specified without knowing which switches take arguments,
5320and it must know which input files to compile in order to tell which
5321compilers to run).
5322
5323GCC also knows implicitly that arguments starting in @option{-l} are to be
5324treated as compiler output files, and passed to the linker in their
5325proper position among the other output files.
5326
5327@c man begin OPTIONS
5328
5329@node Target Options
5330@section Specifying Target Machine and Compiler Version
5331@cindex target options
5332@cindex cross compiling
5333@cindex specifying machine version
5334@cindex specifying compiler version and target machine
5335@cindex compiler version, specifying
5336@cindex target machine, specifying
5337
5338The usual way to run GCC is to run the executable called @file{gcc}, or
5339@file{<machine>-gcc} when cross-compiling, or
5340@file{<machine>-gcc-<version>} to run a version other than the one that
5341was installed last.  Sometimes this is inconvenient, so GCC provides
5342options that will switch to another cross-compiler or version.
5343
5344@table @gcctabopt
5345@item -b @var{machine}
5346@opindex b
5347The argument @var{machine} specifies the target machine for compilation.
5348
5349The value to use for @var{machine} is the same as was specified as the
5350machine type when configuring GCC as a cross-compiler.  For
5351example, if a cross-compiler was configured with @samp{configure
5352i386v}, meaning to compile for an 80386 running System V, then you
5353would specify @option{-b i386v} to run that cross compiler.
5354
5355@item -V @var{version}
5356@opindex V
5357The argument @var{version} specifies which version of GCC to run.
5358This is useful when multiple versions are installed.  For example,
5359@var{version} might be @samp{2.0}, meaning to run GCC version 2.0.
5360@end table
5361
5362The @option{-V} and @option{-b} options work by running the
5363@file{<machine>-gcc-<version>} executable, so there's no real reason to
5364use them if you can just run that directly.
5365
5366@node Submodel Options
5367@section Hardware Models and Configurations
5368@cindex submodel options
5369@cindex specifying hardware config
5370@cindex hardware models and configurations, specifying
5371@cindex machine dependent options
5372
5373Earlier we discussed the standard option @option{-b} which chooses among
5374different installed compilers for completely different target
5375machines, such as VAX vs.@: 68000 vs.@: 80386.
5376
5377In addition, each of these target machine types can have its own
5378special options, starting with @samp{-m}, to choose among various
5379hardware models or configurations---for example, 68010 vs 68020,
5380floating coprocessor or none.  A single installed version of the
5381compiler can compile for any model or configuration, according to the
5382options specified.
5383
5384Some configurations of the compiler also support additional special
5385options, usually for compatibility with other compilers on the same
5386platform.
5387
5388These options are defined by the macro @code{TARGET_SWITCHES} in the
5389machine description.  The default for the options is also defined by
5390that macro, which enables you to change the defaults.
5391
5392@menu
5393* M680x0 Options::
5394* M68hc1x Options::
5395* VAX Options::
5396* SPARC Options::
5397* ARM Options::
5398* MN10200 Options::
5399* MN10300 Options::
5400* M32R/D Options::
5401* M88K Options::
5402* RS/6000 and PowerPC Options::
5403* Darwin Options::
5404* RT Options::
5405* MIPS Options::
5406* i386 and x86-64 Options::
5407* HPPA Options::
5408* Intel 960 Options::
5409* DEC Alpha Options::
5410* DEC Alpha/VMS Options::
5411* H8/300 Options::
5412* SH Options::
5413* System V Options::
5414* TMS320C3x/C4x Options::
5415* V850 Options::
5416* ARC Options::
5417* NS32K Options::
5418* AVR Options::
5419* MCore Options::
5420* IA-64 Options::
5421* D30V Options::
5422* S/390 and zSeries Options::
5423* CRIS Options::
5424* MMIX Options::
5425* PDP-11 Options::
5426* Xstormy16 Options::
5427* Xtensa Options::
5428* FRV Options::
5429@end menu
5430
5431@node M680x0 Options
5432@subsection M680x0 Options
5433@cindex M680x0 options
5434
5435These are the @samp{-m} options defined for the 68000 series.  The default
5436values for these options depends on which style of 68000 was selected when
5437the compiler was configured; the defaults for the most common choices are
5438given below.
5439
5440@table @gcctabopt
5441@item -m68000
5442@itemx -mc68000
5443@opindex m68000
5444@opindex mc68000
5445Generate output for a 68000.  This is the default
5446when the compiler is configured for 68000-based systems.
5447
5448Use this option for microcontrollers with a 68000 or EC000 core,
5449including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
5450
5451@item -m68020
5452@itemx -mc68020
5453@opindex m68020
5454@opindex mc68020
5455Generate output for a 68020.  This is the default
5456when the compiler is configured for 68020-based systems.
5457
5458@item -m68881
5459@opindex m68881
5460Generate output containing 68881 instructions for floating point.
5461This is the default for most 68020 systems unless @option{--nfp} was
5462specified when the compiler was configured.
5463
5464@item -m68030
5465@opindex m68030
5466Generate output for a 68030.  This is the default when the compiler is
5467configured for 68030-based systems.
5468
5469@item -m68040
5470@opindex m68040
5471Generate output for a 68040.  This is the default when the compiler is
5472configured for 68040-based systems.
5473
5474This option inhibits the use of 68881/68882 instructions that have to be
5475emulated by software on the 68040.  Use this option if your 68040 does not
5476have code to emulate those instructions.
5477
5478@item -m68060
5479@opindex m68060
5480Generate output for a 68060.  This is the default when the compiler is
5481configured for 68060-based systems.
5482
5483This option inhibits the use of 68020 and 68881/68882 instructions that
5484have to be emulated by software on the 68060.  Use this option if your 68060
5485does not have code to emulate those instructions.
5486
5487@item -mcpu32
5488@opindex mcpu32
5489Generate output for a CPU32.  This is the default
5490when the compiler is configured for CPU32-based systems.
5491
5492Use this option for microcontrollers with a
5493CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
549468336, 68340, 68341, 68349 and 68360.
5495
5496@item -m5200
5497@opindex m5200
5498Generate output for a 520X ``coldfire'' family cpu.  This is the default
5499when the compiler is configured for 520X-based systems.
5500
5501Use this option for microcontroller with a 5200 core, including
5502the MCF5202, MCF5203, MCF5204 and MCF5202.
5503
5504
5505@item -m68020-40
5506@opindex m68020-40
5507Generate output for a 68040, without using any of the new instructions.
5508This results in code which can run relatively efficiently on either a
550968020/68881 or a 68030 or a 68040.  The generated code does use the
551068881 instructions that are emulated on the 68040.
5511
5512@item -m68020-60
5513@opindex m68020-60
5514Generate output for a 68060, without using any of the new instructions.
5515This results in code which can run relatively efficiently on either a
551668020/68881 or a 68030 or a 68040.  The generated code does use the
551768881 instructions that are emulated on the 68060.
5518
5519@item -mfpa
5520@opindex mfpa
5521Generate output containing Sun FPA instructions for floating point.
5522
5523@item -msoft-float
5524@opindex msoft-float
5525Generate output containing library calls for floating point.
5526@strong{Warning:} the requisite libraries are not available for all m68k
5527targets.  Normally the facilities of the machine's usual C compiler are
5528used, but this can't be done directly in cross-compilation.  You must
5529make your own arrangements to provide suitable library functions for
5530cross-compilation.  The embedded targets @samp{m68k-*-aout} and
5531@samp{m68k-*-coff} do provide software floating point support.
5532
5533@item -mshort
5534@opindex mshort
5535Consider type @code{int} to be 16 bits wide, like @code{short int}.
5536
5537@item -mnobitfield
5538@opindex mnobitfield
5539Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
5540and @option{-m5200} options imply @w{@option{-mnobitfield}}.
5541
5542@item -mbitfield
5543@opindex mbitfield
5544Do use the bit-field instructions.  The @option{-m68020} option implies
5545@option{-mbitfield}.  This is the default if you use a configuration
5546designed for a 68020.
5547
5548@item -mrtd
5549@opindex mrtd
5550Use a different function-calling convention, in which functions
5551that take a fixed number of arguments return with the @code{rtd}
5552instruction, which pops their arguments while returning.  This
5553saves one instruction in the caller since there is no need to pop
5554the arguments there.
5555
5556This calling convention is incompatible with the one normally
5557used on Unix, so you cannot use it if you need to call libraries
5558compiled with the Unix compiler.
5559
5560Also, you must provide function prototypes for all functions that
5561take variable numbers of arguments (including @code{printf});
5562otherwise incorrect code will be generated for calls to those
5563functions.
5564
5565In addition, seriously incorrect code will result if you call a
5566function with too many arguments.  (Normally, extra arguments are
5567harmlessly ignored.)
5568
5569The @code{rtd} instruction is supported by the 68010, 68020, 68030,
557068040, 68060 and CPU32 processors, but not by the 68000 or 5200.
5571
5572@item -malign-int
5573@itemx -mno-align-int
5574@opindex malign-int
5575@opindex mno-align-int
5576Control whether GCC aligns @code{int}, @code{long}, @code{long long},
5577@code{float}, @code{double}, and @code{long double} variables on a 32-bit
5578boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
5579Aligning variables on 32-bit boundaries produces code that runs somewhat
5580faster on processors with 32-bit busses at the expense of more memory.
5581
5582@strong{Warning:} if you use the @option{-malign-int} switch, GCC will
5583align structures containing the above types  differently than
5584most published application binary interface specifications for the m68k.
5585
5586@item -mpcrel
5587@opindex mpcrel
5588Use the pc-relative addressing mode of the 68000 directly, instead of
5589using a global offset table.  At present, this option implies @option{-fpic},
5590allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
5591not presently supported with @option{-mpcrel}, though this could be supported for
559268020 and higher processors.
5593
5594@item -mno-strict-align
5595@itemx -mstrict-align
5596@opindex mno-strict-align
5597@opindex mstrict-align
5598Do not (do) assume that unaligned memory references will be handled by
5599the system.
5600
5601@end table
5602
5603@node M68hc1x Options
5604@subsection M68hc1x Options
5605@cindex M68hc1x options
5606
5607These are the @samp{-m} options defined for the 68hc11 and 68hc12
5608microcontrollers.  The default values for these options depends on
5609which style of microcontroller was selected when the compiler was configured;
5610the defaults for the most common choices are given below.
5611
5612@table @gcctabopt
5613@item -m6811
5614@itemx -m68hc11
5615@opindex m6811
5616@opindex m68hc11
5617Generate output for a 68HC11.  This is the default
5618when the compiler is configured for 68HC11-based systems.
5619
5620@item -m6812
5621@itemx -m68hc12
5622@opindex m6812
5623@opindex m68hc12
5624Generate output for a 68HC12.  This is the default
5625when the compiler is configured for 68HC12-based systems.
5626
5627@item -m68S12
5628@itemx -m68hcs12
5629@opindex m68S12
5630@opindex m68hcs12
5631Generate output for a 68HCS12.
5632
5633@item -mauto-incdec
5634@opindex mauto-incdec
5635Enable the use of 68HC12 pre and post auto-increment and auto-decrement
5636addressing modes.
5637
5638@item -minmax
5639@itemx -nominmax
5640@opindex minmax
5641@opindex mnominmax
5642Enable the use of 68HC12 min and max instructions.
5643
5644@item -mlong-calls
5645@itemx -mno-long-calls
5646@opindex mlong-calls
5647@opindex mno-long-calls
5648Treat all calls as being far away (near).  If calls are assumed to be
5649far away, the compiler will use the @code{call} instruction to
5650call a function and the @code{rtc} instruction for returning.
5651
5652@item -mshort
5653@opindex mshort
5654Consider type @code{int} to be 16 bits wide, like @code{short int}.
5655
5656@item -msoft-reg-count=@var{count}
5657@opindex msoft-reg-count
5658Specify the number of pseudo-soft registers which are used for the
5659code generation.  The maximum number is 32.  Using more pseudo-soft
5660register may or may not result in better code depending on the program.
5661The default is 4 for 68HC11 and 2 for 68HC12.
5662
5663@end table
5664
5665@node VAX Options
5666@subsection VAX Options
5667@cindex VAX options
5668
5669These @samp{-m} options are defined for the VAX:
5670
5671@table @gcctabopt
5672@item -munix
5673@opindex munix
5674Do not output certain jump instructions (@code{aobleq} and so on)
5675that the Unix assembler for the VAX cannot handle across long
5676ranges.
5677
5678@item -mgnu
5679@opindex mgnu
5680Do output those jump instructions, on the assumption that you
5681will assemble with the GNU assembler.
5682
5683@item -mg
5684@opindex mg
5685Output code for g-format floating point numbers instead of d-format.
5686@end table
5687
5688@node SPARC Options
5689@subsection SPARC Options
5690@cindex SPARC options
5691
5692These @samp{-m} switches are supported on the SPARC:
5693
5694@table @gcctabopt
5695@item -mno-app-regs
5696@itemx -mapp-regs
5697@opindex mno-app-regs
5698@opindex mapp-regs
5699Specify @option{-mapp-regs} to generate output using the global registers
57002 through 4, which the SPARC SVR4 ABI reserves for applications.  This
5701is the default, except on Solaris.
5702
5703To be fully SVR4 ABI compliant at the cost of some performance loss,
5704specify @option{-mno-app-regs}.  You should compile libraries and system
5705software with this option.
5706
5707@item -mfpu
5708@itemx -mhard-float
5709@opindex mfpu
5710@opindex mhard-float
5711Generate output containing floating point instructions.  This is the
5712default.
5713
5714@item -mno-fpu
5715@itemx -msoft-float
5716@opindex mno-fpu
5717@opindex msoft-float
5718Generate output containing library calls for floating point.
5719@strong{Warning:} the requisite libraries are not available for all SPARC
5720targets.  Normally the facilities of the machine's usual C compiler are
5721used, but this cannot be done directly in cross-compilation.  You must make
5722your own arrangements to provide suitable library functions for
5723cross-compilation.  The embedded targets @samp{sparc-*-aout} and
5724@samp{sparclite-*-*} do provide software floating point support.
5725
5726@option{-msoft-float} changes the calling convention in the output file;
5727therefore, it is only useful if you compile @emph{all} of a program with
5728this option.  In particular, you need to compile @file{libgcc.a}, the
5729library that comes with GCC, with @option{-msoft-float} in order for
5730this to work.
5731
5732@item -mhard-quad-float
5733@opindex mhard-quad-float
5734Generate output containing quad-word (long double) floating point
5735instructions.
5736
5737@item -msoft-quad-float
5738@opindex msoft-quad-float
5739Generate output containing library calls for quad-word (long double)
5740floating point instructions.  The functions called are those specified
5741in the SPARC ABI@.  This is the default.
5742
5743As of this writing, there are no sparc implementations that have hardware
5744support for the quad-word floating point instructions.  They all invoke
5745a trap handler for one of these instructions, and then the trap handler
5746emulates the effect of the instruction.  Because of the trap handler overhead,
5747this is much slower than calling the ABI library routines.  Thus the
5748@option{-msoft-quad-float} option is the default.
5749
5750@item -mno-flat
5751@itemx -mflat
5752@opindex mno-flat
5753@opindex mflat
5754With @option{-mflat}, the compiler does not generate save/restore instructions
5755and will use a ``flat'' or single register window calling convention.
5756This model uses %i7 as the frame pointer and is compatible with the normal
5757register window model.  Code from either may be intermixed.
5758The local registers and the input registers (0--5) are still treated as
5759``call saved'' registers and will be saved on the stack as necessary.
5760
5761With @option{-mno-flat} (the default), the compiler emits save/restore
5762instructions (except for leaf functions) and is the normal mode of operation.
5763
5764@item -mno-unaligned-doubles
5765@itemx -munaligned-doubles
5766@opindex mno-unaligned-doubles
5767@opindex munaligned-doubles
5768Assume that doubles have 8 byte alignment.  This is the default.
5769
5770With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
5771alignment only if they are contained in another type, or if they have an
5772absolute address.  Otherwise, it assumes they have 4 byte alignment.
5773Specifying this option avoids some rare compatibility problems with code
5774generated by other compilers.  It is not the default because it results
5775in a performance loss, especially for floating point code.
5776
5777@item -mno-faster-structs
5778@itemx -mfaster-structs
5779@opindex mno-faster-structs
5780@opindex mfaster-structs
5781With @option{-mfaster-structs}, the compiler assumes that structures
5782should have 8 byte alignment.  This enables the use of pairs of
5783@code{ldd} and @code{std} instructions for copies in structure
5784assignment, in place of twice as many @code{ld} and @code{st} pairs.
5785However, the use of this changed alignment directly violates the SPARC
5786ABI@.  Thus, it's intended only for use on targets where the developer
5787acknowledges that their resulting code will not be directly in line with
5788the rules of the ABI@.
5789
5790@item -mimpure-text
5791@opindex mimpure-text
5792@option{-mimpure-text}, used in addition to @option{-shared}, tells
5793the compiler to not pass @option{-z text} to the linker when linking a
5794shared object.  Using this option, you can link position-dependent
5795code into a shared object.
5796
5797@option{-mimpure-text} suppresses the ``relocations remain against
5798allocatable but non-writable sections'' linker error message.
5799However, the necessary relocations will trigger copy-on-write, and the
5800shared object is not actually shared across processes.  Instead of
5801using @option{-mimpure-text}, you should compile all source code with
5802@option{-fpic} or @option{-fPIC}.
5803
5804This option is only available on SunOS and Solaris.
5805
5806@item -mv8
5807@itemx -msparclite
5808@opindex mv8
5809@opindex msparclite
5810These two options select variations on the SPARC architecture.
5811
5812By default (unless specifically configured for the Fujitsu SPARClite),
5813GCC generates code for the v7 variant of the SPARC architecture.
5814
5815@option{-mv8} will give you SPARC v8 code.  The only difference from v7
5816code is that the compiler emits the integer multiply and integer
5817divide instructions which exist in SPARC v8 but not in SPARC v7.
5818
5819@option{-msparclite} will give you SPARClite code.  This adds the integer
5820multiply, integer divide step and scan (@code{ffs}) instructions which
5821exist in SPARClite but not in SPARC v7.
5822
5823These options are deprecated and will be deleted in a future GCC release.
5824They have been replaced with @option{-mcpu=xxx}.
5825
5826@item -mcypress
5827@itemx -msupersparc
5828@opindex mcypress
5829@opindex msupersparc
5830These two options select the processor for which the code is optimized.
5831
5832With @option{-mcypress} (the default), the compiler optimizes code for the
5833Cypress CY7C602 chip, as used in the SPARCStation/SPARCServer 3xx series.
5834This is also appropriate for the older SPARCStation 1, 2, IPX etc.
5835
5836With @option{-msupersparc} the compiler optimizes code for the SuperSPARC cpu, as
5837used in the SPARCStation 10, 1000 and 2000 series.  This flag also enables use
5838of the full SPARC v8 instruction set.
5839
5840These options are deprecated and will be deleted in a future GCC release.
5841They have been replaced with @option{-mcpu=xxx}.
5842
5843@item -mcpu=@var{cpu_type}
5844@opindex mcpu
5845Set the instruction set, register set, and instruction scheduling parameters
5846for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
5847@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
5848@samp{hypersparc}, @samp{sparclite86x}, @samp{f930}, @samp{f934},
5849@samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc}, and
5850@samp{ultrasparc3}.
5851
5852Default instruction scheduling parameters are used for values that select
5853an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
5854@samp{sparclite}, @samp{sparclet}, @samp{v9}.
5855
5856Here is a list of each supported architecture and their supported
5857implementations.
5858
5859@smallexample
5860    v7:             cypress
5861    v8:             supersparc, hypersparc
5862    sparclite:      f930, f934, sparclite86x
5863    sparclet:       tsc701
5864    v9:             ultrasparc, ultrasparc3
5865@end smallexample
5866
5867@item -mtune=@var{cpu_type}
5868@opindex mtune
5869Set the instruction scheduling parameters for machine type
5870@var{cpu_type}, but do not set the instruction set or register set that the
5871option @option{-mcpu=@var{cpu_type}} would.
5872
5873The same values for @option{-mcpu=@var{cpu_type}} can be used for
5874@option{-mtune=@var{cpu_type}}, but the only useful values are those
5875that select a particular cpu implementation.  Those are @samp{cypress},
5876@samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
5877@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, and
5878@samp{ultrasparc3}.
5879
5880@end table
5881
5882These @samp{-m} switches are supported in addition to the above
5883on the SPARCLET processor.
5884
5885@table @gcctabopt
5886@item -mlittle-endian
5887@opindex mlittle-endian
5888Generate code for a processor running in little-endian mode.
5889
5890@item -mlive-g0
5891@opindex mlive-g0
5892Treat register @code{%g0} as a normal register.
5893GCC will continue to clobber it as necessary but will not assume
5894it always reads as 0.
5895
5896@item -mbroken-saverestore
5897@opindex mbroken-saverestore
5898Generate code that does not use non-trivial forms of the @code{save} and
5899@code{restore} instructions.  Early versions of the SPARCLET processor do
5900not correctly handle @code{save} and @code{restore} instructions used with
5901arguments.  They correctly handle them used without arguments.  A @code{save}
5902instruction used without arguments increments the current window pointer
5903but does not allocate a new stack frame.  It is assumed that the window
5904overflow trap handler will properly handle this case as will interrupt
5905handlers.
5906@end table
5907
5908These @samp{-m} switches are supported in addition to the above
5909on SPARC V9 processors in 64-bit environments.
5910
5911@table @gcctabopt
5912@item -mlittle-endian
5913@opindex mlittle-endian
5914Generate code for a processor running in little-endian mode. It is only
5915available for a few configurations and most notably not on Solaris.
5916
5917@item -m32
5918@itemx -m64
5919@opindex m32
5920@opindex m64
5921Generate code for a 32-bit or 64-bit environment.
5922The 32-bit environment sets int, long and pointer to 32 bits.
5923The 64-bit environment sets int to 32 bits and long and pointer
5924to 64 bits.
5925
5926@item -mcmodel=medlow
5927@opindex mcmodel=medlow
5928Generate code for the Medium/Low code model: the program must be linked
5929in the low 32 bits of the address space.  Pointers are 64 bits.
5930Programs can be statically or dynamically linked.
5931
5932@item -mcmodel=medmid
5933@opindex mcmodel=medmid
5934Generate code for the Medium/Middle code model: the program must be linked
5935in the low 44 bits of the address space, the text segment must be less than
59362G bytes, and data segment must be within 2G of the text segment.
5937Pointers are 64 bits.
5938
5939@item -mcmodel=medany
5940@opindex mcmodel=medany
5941Generate code for the Medium/Anywhere code model: the program may be linked
5942anywhere in the address space, the text segment must be less than
59432G bytes, and data segment must be within 2G of the text segment.
5944Pointers are 64 bits.
5945
5946@item -mcmodel=embmedany
5947@opindex mcmodel=embmedany
5948Generate code for the Medium/Anywhere code model for embedded systems:
5949assume a 32-bit text and a 32-bit data segment, both starting anywhere
5950(determined at link time).  Register %g4 points to the base of the
5951data segment.  Pointers are still 64 bits.
5952Programs are statically linked, PIC is not supported.
5953
5954@item -mstack-bias
5955@itemx -mno-stack-bias
5956@opindex mstack-bias
5957@opindex mno-stack-bias
5958With @option{-mstack-bias}, GCC assumes that the stack pointer, and
5959frame pointer if present, are offset by @minus{}2047 which must be added back
5960when making stack frame references.
5961Otherwise, assume no such offset is present.
5962@end table
5963
5964These switches are supported in addition to the above on Solaris:
5965
5966@table @gcctabopt
5967@item -threads
5968@opindex threads
5969Add support for multithreading using the Solaris threads library.  This
5970option sets flags for both the preprocessor and linker.  This option does
5971not affect the thread safety of object code produced by the compiler or
5972that of libraries supplied with it.
5973
5974@item -pthreads
5975@opindex pthreads
5976Add support for multithreading using the POSIX threads library.  This
5977option sets flags for both the preprocessor and linker.  This option does
5978not affect the thread safety of object code produced  by the compiler or
5979that of libraries supplied with it.
5980@end table
5981
5982@node ARM Options
5983@subsection ARM Options
5984@cindex ARM options
5985
5986These @samp{-m} options are defined for Advanced RISC Machines (ARM)
5987architectures:
5988
5989@table @gcctabopt
5990@item -mapcs-frame
5991@opindex mapcs-frame
5992Generate a stack frame that is compliant with the ARM Procedure Call
5993Standard for all functions, even if this is not strictly necessary for
5994correct execution of the code.  Specifying @option{-fomit-frame-pointer}
5995with this option will cause the stack frames not to be generated for
5996leaf functions.  The default is @option{-mno-apcs-frame}.
5997
5998@item -mapcs
5999@opindex mapcs
6000This is a synonym for @option{-mapcs-frame}.
6001
6002@item -mapcs-26
6003@opindex mapcs-26
6004Generate code for a processor running with a 26-bit program counter,
6005and conforming to the function calling standards for the APCS 26-bit
6006option.  This option replaces the @option{-m2} and @option{-m3} options
6007of previous releases of the compiler.
6008
6009@item -mapcs-32
6010@opindex mapcs-32
6011Generate code for a processor running with a 32-bit program counter,
6012and conforming to the function calling standards for the APCS 32-bit
6013option.  This option replaces the @option{-m6} option of previous releases
6014of the compiler.
6015
6016@ignore
6017@c not currently implemented
6018@item -mapcs-stack-check
6019@opindex mapcs-stack-check
6020Generate code to check the amount of stack space available upon entry to
6021every function (that actually uses some stack space).  If there is
6022insufficient space available then either the function
6023@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
6024called, depending upon the amount of stack space required.  The run time
6025system is required to provide these functions.  The default is
6026@option{-mno-apcs-stack-check}, since this produces smaller code.
6027
6028@c not currently implemented
6029@item -mapcs-float
6030@opindex mapcs-float
6031Pass floating point arguments using the float point registers.  This is
6032one of the variants of the APCS@.  This option is recommended if the
6033target hardware has a floating point unit or if a lot of floating point
6034arithmetic is going to be performed by the code.  The default is
6035@option{-mno-apcs-float}, since integer only code is slightly increased in
6036size if @option{-mapcs-float} is used.
6037
6038@c not currently implemented
6039@item -mapcs-reentrant
6040@opindex mapcs-reentrant
6041Generate reentrant, position independent code.  The default is
6042@option{-mno-apcs-reentrant}.
6043@end ignore
6044
6045@item -mthumb-interwork
6046@opindex mthumb-interwork
6047Generate code which supports calling between the ARM and Thumb
6048instruction sets.  Without this option the two instruction sets cannot
6049be reliably used inside one program.  The default is
6050@option{-mno-thumb-interwork}, since slightly larger code is generated
6051when @option{-mthumb-interwork} is specified.
6052
6053@item -mno-sched-prolog
6054@opindex mno-sched-prolog
6055Prevent the reordering of instructions in the function prolog, or the
6056merging of those instruction with the instructions in the function's
6057body.  This means that all functions will start with a recognizable set
6058of instructions (or in fact one of a choice from a small set of
6059different function prologues), and this information can be used to
6060locate the start if functions inside an executable piece of code.  The
6061default is @option{-msched-prolog}.
6062
6063@item -mhard-float
6064@opindex mhard-float
6065Generate output containing floating point instructions.  This is the
6066default.
6067
6068@item -msoft-float
6069@opindex msoft-float
6070Generate output containing library calls for floating point.
6071@strong{Warning:} the requisite libraries are not available for all ARM
6072targets.  Normally the facilities of the machine's usual C compiler are
6073used, but this cannot be done directly in cross-compilation.  You must make
6074your own arrangements to provide suitable library functions for
6075cross-compilation.
6076
6077@option{-msoft-float} changes the calling convention in the output file;
6078therefore, it is only useful if you compile @emph{all} of a program with
6079this option.  In particular, you need to compile @file{libgcc.a}, the
6080library that comes with GCC, with @option{-msoft-float} in order for
6081this to work.
6082
6083@item -mlittle-endian
6084@opindex mlittle-endian
6085Generate code for a processor running in little-endian mode.  This is
6086the default for all standard configurations.
6087
6088@item -mbig-endian
6089@opindex mbig-endian
6090Generate code for a processor running in big-endian mode; the default is
6091to compile code for a little-endian processor.
6092
6093@item -mwords-little-endian
6094@opindex mwords-little-endian
6095This option only applies when generating code for big-endian processors.
6096Generate code for a little-endian word order but a big-endian byte
6097order.  That is, a byte order of the form @samp{32107654}.  Note: this
6098option should only be used if you require compatibility with code for
6099big-endian ARM processors generated by versions of the compiler prior to
61002.8.
6101
6102@item -malignment-traps
6103@opindex malignment-traps
6104Generate code that will not trap if the MMU has alignment traps enabled.
6105On ARM architectures prior to ARMv4, there were no instructions to
6106access half-word objects stored in memory.  However, when reading from
6107memory a feature of the ARM architecture allows a word load to be used,
6108even if the address is unaligned, and the processor core will rotate the
6109data as it is being loaded.  This option tells the compiler that such
6110misaligned accesses will cause a MMU trap and that it should instead
6111synthesize the access as a series of byte accesses.  The compiler can
6112still use word accesses to load half-word data if it knows that the
6113address is aligned to a word boundary.
6114
6115This option is ignored when compiling for ARM architecture 4 or later,
6116since these processors have instructions to directly access half-word
6117objects in memory.
6118
6119@item -mno-alignment-traps
6120@opindex mno-alignment-traps
6121Generate code that assumes that the MMU will not trap unaligned
6122accesses.  This produces better code when the target instruction set
6123does not have half-word memory operations (i.e.@: implementations prior to
6124ARMv4).
6125
6126Note that you cannot use this option to access unaligned word objects,
6127since the processor will only fetch one 32-bit aligned object from
6128memory.
6129
6130The default setting for most targets is @option{-mno-alignment-traps}, since
6131this produces better code when there are no half-word memory
6132instructions available.
6133
6134@item -mshort-load-bytes
6135@itemx -mno-short-load-words
6136@opindex mshort-load-bytes
6137@opindex mno-short-load-words
6138These are deprecated aliases for @option{-malignment-traps}.
6139
6140@item -mno-short-load-bytes
6141@itemx -mshort-load-words
6142@opindex mno-short-load-bytes
6143@opindex mshort-load-words
6144This are deprecated aliases for @option{-mno-alignment-traps}.
6145
6146@item -mcpu=@var{name}
6147@opindex mcpu
6148This specifies the name of the target ARM processor.  GCC uses this name
6149to determine what kind of instructions it can emit when generating
6150assembly code.  Permissible names are: @samp{arm2}, @samp{arm250},
6151@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
6152@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
6153@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
6154@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
6155@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm8},
6156@samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
6157@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
6158@samp{arm920t}, @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi},
6159@samp{arm1020t}, @samp{xscale}.
6160
6161@itemx -mtune=@var{name}
6162@opindex mtune
6163This option is very similar to the @option{-mcpu=} option, except that
6164instead of specifying the actual target processor type, and hence
6165restricting which instructions can be used, it specifies that GCC should
6166tune the performance of the code as if the target were of the type
6167specified in this option, but still choosing the instructions that it
6168will generate based on the cpu specified by a @option{-mcpu=} option.
6169For some ARM implementations better performance can be obtained by using
6170this option.
6171
6172@item -march=@var{name}
6173@opindex march
6174This specifies the name of the target ARM architecture.  GCC uses this
6175name to determine what kind of instructions it can emit when generating
6176assembly code.  This option can be used in conjunction with or instead
6177of the @option{-mcpu=} option.  Permissible names are: @samp{armv2},
6178@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
6179@samp{armv5}, @samp{armv5t}, @samp{armv5te}.
6180
6181@item -mfpe=@var{number}
6182@itemx -mfp=@var{number}
6183@opindex mfpe
6184@opindex mfp
6185This specifies the version of the floating point emulation available on
6186the target.  Permissible values are 2 and 3.  @option{-mfp=} is a synonym
6187for @option{-mfpe=}, for compatibility with older versions of GCC@.
6188
6189@item -mstructure-size-boundary=@var{n}
6190@opindex mstructure-size-boundary
6191The size of all structures and unions will be rounded up to a multiple
6192of the number of bits set by this option.  Permissible values are 8 and
619332.  The default value varies for different toolchains.  For the COFF
6194targeted toolchain the default value is 8.  Specifying the larger number
6195can produce faster, more efficient code, but can also increase the size
6196of the program.  The two values are potentially incompatible.  Code
6197compiled with one value cannot necessarily expect to work with code or
6198libraries compiled with the other value, if they exchange information
6199using structures or unions.
6200
6201@item -mabort-on-noreturn
6202@opindex mabort-on-noreturn
6203Generate a call to the function @code{abort} at the end of a
6204@code{noreturn} function.  It will be executed if the function tries to
6205return.
6206
6207@item -mlong-calls
6208@itemx -mno-long-calls
6209@opindex mlong-calls
6210@opindex mno-long-calls
6211Tells the compiler to perform function calls by first loading the
6212address of the function into a register and then performing a subroutine
6213call on this register.  This switch is needed if the target function
6214will lie outside of the 64 megabyte addressing range of the offset based
6215version of subroutine call instruction.
6216
6217Even if this switch is enabled, not all function calls will be turned
6218into long calls.  The heuristic is that static functions, functions
6219which have the @samp{short-call} attribute, functions that are inside
6220the scope of a @samp{#pragma no_long_calls} directive and functions whose
6221definitions have already been compiled within the current compilation
6222unit, will not be turned into long calls.  The exception to this rule is
6223that weak function definitions, functions with the @samp{long-call}
6224attribute or the @samp{section} attribute, and functions that are within
6225the scope of a @samp{#pragma long_calls} directive, will always be
6226turned into long calls.
6227
6228This feature is not enabled by default.  Specifying
6229@option{-mno-long-calls} will restore the default behavior, as will
6230placing the function calls within the scope of a @samp{#pragma
6231long_calls_off} directive.  Note these switches have no effect on how
6232the compiler generates code to handle function calls via function
6233pointers.
6234
6235@item -mnop-fun-dllimport
6236@opindex mnop-fun-dllimport
6237Disable support for the @code{dllimport} attribute.
6238
6239@item -msingle-pic-base
6240@opindex msingle-pic-base
6241Treat the register used for PIC addressing as read-only, rather than
6242loading it in the prologue for each function.  The run-time system is
6243responsible for initializing this register with an appropriate value
6244before execution begins.
6245
6246@item -mpic-register=@var{reg}
6247@opindex mpic-register
6248Specify the register to be used for PIC addressing.  The default is R10
6249unless stack-checking is enabled, when R9 is used.
6250
6251@item -mpoke-function-name
6252@opindex mpoke-function-name
6253Write the name of each function into the text section, directly
6254preceding the function prologue.  The generated code is similar to this:
6255
6256@smallexample
6257     t0
6258         .ascii "arm_poke_function_name", 0
6259         .align
6260     t1
6261         .word 0xff000000 + (t1 - t0)
6262     arm_poke_function_name
6263         mov     ip, sp
6264         stmfd   sp!, @{fp, ip, lr, pc@}
6265         sub     fp, ip, #4
6266@end smallexample
6267
6268When performing a stack backtrace, code can inspect the value of
6269@code{pc} stored at @code{fp + 0}.  If the trace function then looks at
6270location @code{pc - 12} and the top 8 bits are set, then we know that
6271there is a function name embedded immediately preceding this location
6272and has length @code{((pc[-3]) & 0xff000000)}.
6273
6274@item -mthumb
6275@opindex mthumb
6276Generate code for the 16-bit Thumb instruction set.  The default is to
6277use the 32-bit ARM instruction set.
6278
6279@item -mtpcs-frame
6280@opindex mtpcs-frame
6281Generate a stack frame that is compliant with the Thumb Procedure Call
6282Standard for all non-leaf functions.  (A leaf function is one that does
6283not call any other functions.)  The default is @option{-mno-tpcs-frame}.
6284
6285@item -mtpcs-leaf-frame
6286@opindex mtpcs-leaf-frame
6287Generate a stack frame that is compliant with the Thumb Procedure Call
6288Standard for all leaf functions.  (A leaf function is one that does
6289not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
6290
6291@item -mcallee-super-interworking
6292@opindex mcallee-super-interworking
6293Gives all externally visible functions in the file being compiled an ARM
6294instruction set header which switches to Thumb mode before executing the
6295rest of the function.  This allows these functions to be called from
6296non-interworking code.
6297
6298@item -mcaller-super-interworking
6299@opindex mcaller-super-interworking
6300Allows calls via function pointers (including virtual functions) to
6301execute correctly regardless of whether the target code has been
6302compiled for interworking or not.  There is a small overhead in the cost
6303of executing a function pointer if this option is enabled.
6304
6305@end table
6306
6307@node MN10200 Options
6308@subsection MN10200 Options
6309@cindex MN10200 options
6310
6311These @option{-m} options are defined for Matsushita MN10200 architectures:
6312@table @gcctabopt
6313
6314@item -mrelax
6315@opindex mrelax
6316Indicate to the linker that it should perform a relaxation optimization pass
6317to shorten branches, calls and absolute memory addresses.  This option only
6318has an effect when used on the command line for the final link step.
6319
6320This option makes symbolic debugging impossible.
6321@end table
6322
6323@node MN10300 Options
6324@subsection MN10300 Options
6325@cindex MN10300 options
6326
6327These @option{-m} options are defined for Matsushita MN10300 architectures:
6328
6329@table @gcctabopt
6330@item -mmult-bug
6331@opindex mmult-bug
6332Generate code to avoid bugs in the multiply instructions for the MN10300
6333processors.  This is the default.
6334
6335@item -mno-mult-bug
6336@opindex mno-mult-bug
6337Do not generate code to avoid bugs in the multiply instructions for the
6338MN10300 processors.
6339
6340@item -mam33
6341@opindex mam33
6342Generate code which uses features specific to the AM33 processor.
6343
6344@item -mno-am33
6345@opindex mno-am33
6346Do not generate code which uses features specific to the AM33 processor.  This
6347is the default.
6348
6349@item -mno-crt0
6350@opindex mno-crt0
6351Do not link in the C run-time initialization object file.
6352
6353@item -mrelax
6354@opindex mrelax
6355Indicate to the linker that it should perform a relaxation optimization pass
6356to shorten branches, calls and absolute memory addresses.  This option only
6357has an effect when used on the command line for the final link step.
6358
6359This option makes symbolic debugging impossible.
6360@end table
6361
6362
6363@node M32R/D Options
6364@subsection M32R/D Options
6365@cindex M32R/D options
6366
6367These @option{-m} options are defined for Mitsubishi M32R/D architectures:
6368
6369@table @gcctabopt
6370@item -m32rx
6371@opindex m32rx
6372Generate code for the M32R/X@.
6373
6374@item -m32r
6375@opindex m32r
6376Generate code for the M32R@.  This is the default.
6377
6378@item -mcode-model=small
6379@opindex mcode-model=small
6380Assume all objects live in the lower 16MB of memory (so that their addresses
6381can be loaded with the @code{ld24} instruction), and assume all subroutines
6382are reachable with the @code{bl} instruction.
6383This is the default.
6384
6385The addressability of a particular object can be set with the
6386@code{model} attribute.
6387
6388@item -mcode-model=medium
6389@opindex mcode-model=medium
6390Assume objects may be anywhere in the 32-bit address space (the compiler
6391will generate @code{seth/add3} instructions to load their addresses), and
6392assume all subroutines are reachable with the @code{bl} instruction.
6393
6394@item -mcode-model=large
6395@opindex mcode-model=large
6396Assume objects may be anywhere in the 32-bit address space (the compiler
6397will generate @code{seth/add3} instructions to load their addresses), and
6398assume subroutines may not be reachable with the @code{bl} instruction
6399(the compiler will generate the much slower @code{seth/add3/jl}
6400instruction sequence).
6401
6402@item -msdata=none
6403@opindex msdata=none
6404Disable use of the small data area.  Variables will be put into
6405one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
6406@code{section} attribute has been specified).
6407This is the default.
6408
6409The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
6410Objects may be explicitly put in the small data area with the
6411@code{section} attribute using one of these sections.
6412
6413@item -msdata=sdata
6414@opindex msdata=sdata
6415Put small global and static data in the small data area, but do not
6416generate special code to reference them.
6417
6418@item -msdata=use
6419@opindex msdata=use
6420Put small global and static data in the small data area, and generate
6421special instructions to reference them.
6422
6423@item -G @var{num}
6424@opindex G
6425@cindex smaller data references
6426Put global and static objects less than or equal to @var{num} bytes
6427into the small data or bss sections instead of the normal data or bss
6428sections.  The default value of @var{num} is 8.
6429The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
6430for this option to have any effect.
6431
6432All modules should be compiled with the same @option{-G @var{num}} value.
6433Compiling with different values of @var{num} may or may not work; if it
6434doesn't the linker will give an error message---incorrect code will not be
6435generated.
6436
6437@end table
6438
6439@node M88K Options
6440@subsection M88K Options
6441@cindex M88k options
6442
6443These @samp{-m} options are defined for Motorola 88k architectures:
6444
6445@table @gcctabopt
6446@item -m88000
6447@opindex m88000
6448Generate code that works well on both the m88100 and the
6449m88110.
6450
6451@item -m88100
6452@opindex m88100
6453Generate code that works best for the m88100, but that also
6454runs on the m88110.
6455
6456@item -m88110
6457@opindex m88110
6458Generate code that works best for the m88110, and may not run
6459on the m88100.
6460
6461@item -mserialize-volatile
6462@opindex mserialize-volatile
6463@itemx -mno-serialize-volatile
6464@opindex mno-serialize-volatile
6465@cindex sequential consistency on 88k
6466Do, or don't, generate code to guarantee sequential consistency
6467of volatile memory references.  By default, consistency is
6468guaranteed.
6469
6470The order of memory references made by the MC88110 processor does
6471not always match the order of the instructions requesting those
6472references.  In particular, a load instruction may execute before
6473a preceding store instruction.  Such reordering violates
6474sequential consistency of volatile memory references, when there
6475are multiple processors.   When consistency must be guaranteed,
6476GCC generates special instructions, as needed, to force
6477execution in the proper order.
6478
6479The MC88100 processor does not reorder memory references and so
6480always provides sequential consistency.  However, by default, GCC
6481generates the special instructions to guarantee consistency
6482even when you use @option{-m88100}, so that the code may be run on an
6483MC88110 processor.  If you intend to run your code only on the
6484MC88100 processor, you may use @option{-mno-serialize-volatile}.
6485
6486The extra code generated to guarantee consistency may affect the
6487performance of your application.  If you know that you can safely
6488forgo this guarantee, you may use @option{-mno-serialize-volatile}.
6489
6490@item -mno-check-zero-division
6491@itemx -mcheck-zero-division
6492@opindex mno-check-zero-division
6493@opindex mcheck-zero-division
6494@cindex zero division on 88k
6495Do, or don't, generate code to guarantee that integer division by
6496zero will be detected.  By default, detection is guaranteed.
6497
6498Some models of the MC88100 processor fail to trap upon integer
6499division by zero under certain conditions.  By default, when
6500compiling code that might be run on such a processor, GCC
6501generates code that explicitly checks for zero-valued divisors
6502and traps with exception number 503 when one is detected.  Use of
6503@option{-mno-check-zero-division} suppresses such checking for code
6504generated to run on an MC88100 processor.
6505
6506GCC assumes that the MC88110 processor correctly detects all instances
6507of integer division by zero.  When @option{-m88110} is specified, no
6508explicit checks for zero-valued divisors are generated, and both
6509@option{-mcheck-zero-division} and @option{-mno-check-zero-division} are
6510ignored.
6511
6512@item -muse-div-instruction
6513@opindex muse-div-instruction
6514@cindex divide instruction, 88k
6515Use the div instruction for signed integer division on the
6516MC88100 processor.  By default, the div instruction is not used.
6517
6518On the MC88100 processor the signed integer division instruction
6519div) traps to the operating system on a negative operand.  The
6520operating system transparently completes the operation, but at a
6521large cost in execution time.  By default, when compiling code
6522that might be run on an MC88100 processor, GCC emulates signed
6523integer division using the unsigned integer division instruction
6524divu), thereby avoiding the large penalty of a trap to the
6525operating system.  Such emulation has its own, smaller, execution
6526cost in both time and space.  To the extent that your code's
6527important signed integer division operations are performed on two
6528nonnegative operands, it may be desirable to use the div
6529instruction directly.
6530
6531On the MC88110 processor the div instruction (also known as the
6532divs instruction) processes negative operands without trapping to
6533the operating system.  When @option{-m88110} is specified,
6534@option{-muse-div-instruction} is ignored, and the div instruction is used
6535for signed integer division.
6536
6537Note that the result of dividing @code{INT_MIN} by @minus{}1 is undefined.  In
6538particular, the behavior of such a division with and without
6539@option{-muse-div-instruction} may differ.
6540
6541@item -mtrap-large-shift
6542@itemx -mhandle-large-shift
6543@opindex mtrap-large-shift
6544@opindex mhandle-large-shift
6545@cindex bit shift overflow (88k)
6546@cindex large bit shifts (88k)
6547Include code to detect bit-shifts of more than 31 bits; respectively,
6548trap such shifts or emit code to handle them properly.  By default GCC
6549makes no special provision for large bit shifts.
6550@end table
6551
6552@c break page here to avoid unsightly interparagraph stretch.
6553@c -zw, 2001-8-17
6554@page
6555
6556@node RS/6000 and PowerPC Options
6557@subsection IBM RS/6000 and PowerPC Options
6558@cindex RS/6000 and PowerPC Options
6559@cindex IBM RS/6000 and PowerPC Options
6560
6561These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
6562@table @gcctabopt
6563@item -mpower
6564@itemx -mno-power
6565@itemx -mpower2
6566@itemx -mno-power2
6567@itemx -mpowerpc
6568@itemx -mno-powerpc
6569@itemx -mpowerpc-gpopt
6570@itemx -mno-powerpc-gpopt
6571@itemx -mpowerpc-gfxopt
6572@itemx -mno-powerpc-gfxopt
6573@itemx -mpowerpc64
6574@itemx -mno-powerpc64
6575@opindex mpower
6576@opindex mno-power
6577@opindex mpower2
6578@opindex mno-power2
6579@opindex mpowerpc
6580@opindex mno-powerpc
6581@opindex mpowerpc-gpopt
6582@opindex mno-powerpc-gpopt
6583@opindex mpowerpc-gfxopt
6584@opindex mno-powerpc-gfxopt
6585@opindex mpowerpc64
6586@opindex mno-powerpc64
6587GCC supports two related instruction set architectures for the
6588RS/6000 and PowerPC@.  The @dfn{POWER} instruction set are those
6589instructions supported by the @samp{rios} chip set used in the original
6590RS/6000 systems and the @dfn{PowerPC} instruction set is the
6591architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and
6592the IBM 4xx microprocessors.
6593
6594Neither architecture is a subset of the other.  However there is a
6595large common subset of instructions supported by both.  An MQ
6596register is included in processors supporting the POWER architecture.
6597
6598You use these options to specify which instructions are available on the
6599processor you are using.  The default value of these options is
6600determined when configuring GCC@.  Specifying the
6601@option{-mcpu=@var{cpu_type}} overrides the specification of these
6602options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
6603rather than the options listed above.
6604
6605The @option{-mpower} option allows GCC to generate instructions that
6606are found only in the POWER architecture and to use the MQ register.
6607Specifying @option{-mpower2} implies @option{-power} and also allows GCC
6608to generate instructions that are present in the POWER2 architecture but
6609not the original POWER architecture.
6610
6611The @option{-mpowerpc} option allows GCC to generate instructions that
6612are found only in the 32-bit subset of the PowerPC architecture.
6613Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
6614GCC to use the optional PowerPC architecture instructions in the
6615General Purpose group, including floating-point square root.  Specifying
6616@option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
6617use the optional PowerPC architecture instructions in the Graphics
6618group, including floating-point select.
6619
6620The @option{-mpowerpc64} option allows GCC to generate the additional
662164-bit instructions that are found in the full PowerPC64 architecture
6622and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
6623@option{-mno-powerpc64}.
6624
6625If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
6626will use only the instructions in the common subset of both
6627architectures plus some special AIX common-mode calls, and will not use
6628the MQ register.  Specifying both @option{-mpower} and @option{-mpowerpc}
6629permits GCC to use any instruction from either architecture and to
6630allow use of the MQ register; specify this for the Motorola MPC601.
6631
6632@item -mnew-mnemonics
6633@itemx -mold-mnemonics
6634@opindex mnew-mnemonics
6635@opindex mold-mnemonics
6636Select which mnemonics to use in the generated assembler code.  With
6637@option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
6638the PowerPC architecture.  With @option{-mold-mnemonics} it uses the
6639assembler mnemonics defined for the POWER architecture.  Instructions
6640defined in only one architecture have only one mnemonic; GCC uses that
6641mnemonic irrespective of which of these options is specified.
6642
6643GCC defaults to the mnemonics appropriate for the architecture in
6644use.  Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
6645value of these option.  Unless you are building a cross-compiler, you
6646should normally not specify either @option{-mnew-mnemonics} or
6647@option{-mold-mnemonics}, but should instead accept the default.
6648
6649@item -mcpu=@var{cpu_type}
6650@opindex mcpu
6651Set architecture type, register usage, choice of mnemonics, and
6652instruction scheduling parameters for machine type @var{cpu_type}.
6653Supported values for @var{cpu_type} are @samp{rios}, @samp{rios1},
6654@samp{rsc}, @samp{rios2}, @samp{rs64a}, @samp{601}, @samp{602},
6655@samp{603}, @samp{603e}, @samp{604}, @samp{604e}, @samp{620},
6656@samp{630}, @samp{740}, @samp{7400}, @samp{7450}, @samp{750},
6657@samp{power}, @samp{power2}, @samp{powerpc}, @samp{403}, @samp{505},
6658@samp{801}, @samp{821}, @samp{823}, and @samp{860} and @samp{common}.
6659
6660@option{-mcpu=common} selects a completely generic processor.  Code
6661generated under this option will run on any POWER or PowerPC processor.
6662GCC will use only the instructions in the common subset of both
6663architectures, and will not use the MQ register.  GCC assumes a generic
6664processor model for scheduling purposes.
6665
6666@option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
6667@option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
6668PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
6669types, with an appropriate, generic processor model assumed for
6670scheduling purposes.
6671
6672The other options specify a specific processor.  Code generated under
6673those options will run best on that processor, and may not run at all on
6674others.
6675
6676The @option{-mcpu} options automatically enable or disable other
6677@option{-m} options as follows:
6678
6679@table @samp
6680@item common
6681@option{-mno-power}, @option{-mno-powerpc}
6682
6683@item power
6684@itemx power2
6685@itemx rios1
6686@itemx rios2
6687@itemx rsc
6688@option{-mpower}, @option{-mno-powerpc}, @option{-mno-new-mnemonics}
6689
6690@item powerpc
6691@itemx rs64a
6692@itemx 602
6693@itemx 603
6694@itemx 603e
6695@itemx 604
6696@itemx 620
6697@itemx 630
6698@itemx 740
6699@itemx 7400
6700@itemx 7450
6701@itemx 750
6702@itemx 505
6703@option{-mno-power}, @option{-mpowerpc}, @option{-mnew-mnemonics}
6704
6705@item 601
6706@option{-mpower}, @option{-mpowerpc}, @option{-mnew-mnemonics}
6707
6708@item 403
6709@itemx 821
6710@itemx 860
6711@option{-mno-power}, @option{-mpowerpc}, @option{-mnew-mnemonics}, @option{-msoft-float}
6712@end table
6713
6714@item -mtune=@var{cpu_type}
6715@opindex mtune
6716Set the instruction scheduling parameters for machine type
6717@var{cpu_type}, but do not set the architecture type, register usage, or
6718choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would.  The same
6719values for @var{cpu_type} are used for @option{-mtune} as for
6720@option{-mcpu}.  If both are specified, the code generated will use the
6721architecture, registers, and mnemonics set by @option{-mcpu}, but the
6722scheduling parameters set by @option{-mtune}.
6723
6724@item -maltivec
6725@itemx -mno-altivec
6726@opindex maltivec
6727@opindex mno-altivec
6728These switches enable or disable the use of built-in functions that
6729allow access to the AltiVec instruction set.  You may also need to set
6730@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
6731enhancements.
6732
6733@item -mabi=spe
6734@opindex mabi=spe
6735Extend the current ABI with SPE ABI extensions.  This does not change
6736the default ABI, instead it adds the SPE ABI extensions to the current
6737ABI@.
6738
6739@item -mabi=no-spe
6740@opindex mabi=no-spe
6741Disable Booke SPE ABI extensions for the current ABI.
6742
6743@item -misel=@var{yes/no}
6744@itemx -misel
6745@opindex misel
6746This switch enables or disables the generation of ISEL instructions.
6747
6748@item -mfull-toc
6749@itemx -mno-fp-in-toc
6750@itemx -mno-sum-in-toc
6751@itemx -mminimal-toc
6752@opindex mfull-toc
6753@opindex mno-fp-in-toc
6754@opindex mno-sum-in-toc
6755@opindex mminimal-toc
6756Modify generation of the TOC (Table Of Contents), which is created for
6757every executable file.  The @option{-mfull-toc} option is selected by
6758default.  In that case, GCC will allocate at least one TOC entry for
6759each unique non-automatic variable reference in your program.  GCC
6760will also place floating-point constants in the TOC@.  However, only
676116,384 entries are available in the TOC@.
6762
6763If you receive a linker error message that saying you have overflowed
6764the available TOC space, you can reduce the amount of TOC space used
6765with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
6766@option{-mno-fp-in-toc} prevents GCC from putting floating-point
6767constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
6768generate code to calculate the sum of an address and a constant at
6769run-time instead of putting that sum into the TOC@.  You may specify one
6770or both of these options.  Each causes GCC to produce very slightly
6771slower and larger code at the expense of conserving TOC space.
6772
6773If you still run out of space in the TOC even when you specify both of
6774these options, specify @option{-mminimal-toc} instead.  This option causes
6775GCC to make only one TOC entry for every file.  When you specify this
6776option, GCC will produce code that is slower and larger but which
6777uses extremely little TOC space.  You may wish to use this option
6778only on files that contain less frequently executed code.
6779
6780@item -maix64
6781@itemx -maix32
6782@opindex maix64
6783@opindex maix32
6784Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
6785@code{long} type, and the infrastructure needed to support them.
6786Specifying @option{-maix64} implies @option{-mpowerpc64} and
6787@option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
6788implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
6789
6790@item -mxl-call
6791@itemx -mno-xl-call
6792@opindex mxl-call
6793@opindex mno-xl-call
6794On AIX, pass floating-point arguments to prototyped functions beyond the
6795register save area (RSA) on the stack in addition to argument FPRs.  The
6796AIX calling convention was extended but not initially documented to
6797handle an obscure K&R C case of calling a function that takes the
6798address of its arguments with fewer arguments than declared.  AIX XL
6799compilers access floating point arguments which do not fit in the
6800RSA from the stack when a subroutine is compiled without
6801optimization.  Because always storing floating-point arguments on the
6802stack is inefficient and rarely needed, this option is not enabled by
6803default and only is necessary when calling subroutines compiled by AIX
6804XL compilers without optimization.
6805
6806@item -mpe
6807@opindex mpe
6808Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
6809application written to use message passing with special startup code to
6810enable the application to run.  The system must have PE installed in the
6811standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
6812must be overridden with the @option{-specs=} option to specify the
6813appropriate directory location.  The Parallel Environment does not
6814support threads, so the @option{-mpe} option and the @option{-pthread}
6815option are incompatible.
6816
6817@item -msoft-float
6818@itemx -mhard-float
6819@opindex msoft-float
6820@opindex mhard-float
6821Generate code that does not use (uses) the floating-point register set.
6822Software floating point emulation is provided if you use the
6823@option{-msoft-float} option, and pass the option to GCC when linking.
6824
6825@item -mmultiple
6826@itemx -mno-multiple
6827@opindex mmultiple
6828@opindex mno-multiple
6829Generate code that uses (does not use) the load multiple word
6830instructions and the store multiple word instructions.  These
6831instructions are generated by default on POWER systems, and not
6832generated on PowerPC systems.  Do not use @option{-mmultiple} on little
6833endian PowerPC systems, since those instructions do not work when the
6834processor is in little endian mode.  The exceptions are PPC740 and
6835PPC750 which permit the instructions usage in little endian mode.
6836
6837@item -mstring
6838@itemx -mno-string
6839@opindex mstring
6840@opindex mno-string
6841Generate code that uses (does not use) the load string instructions
6842and the store string word instructions to save multiple registers and
6843do small block moves.  These instructions are generated by default on
6844POWER systems, and not generated on PowerPC systems.  Do not use
6845@option{-mstring} on little endian PowerPC systems, since those
6846instructions do not work when the processor is in little endian mode.
6847The exceptions are PPC740 and PPC750 which permit the instructions
6848usage in little endian mode.
6849
6850@item -mupdate
6851@itemx -mno-update
6852@opindex mupdate
6853@opindex mno-update
6854Generate code that uses (does not use) the load or store instructions
6855that update the base register to the address of the calculated memory
6856location.  These instructions are generated by default.  If you use
6857@option{-mno-update}, there is a small window between the time that the
6858stack pointer is updated and the address of the previous frame is
6859stored, which means code that walks the stack frame across interrupts or
6860signals may get corrupted data.
6861
6862@item -mfused-madd
6863@itemx -mno-fused-madd
6864@opindex mfused-madd
6865@opindex mno-fused-madd
6866Generate code that uses (does not use) the floating point multiply and
6867accumulate instructions.  These instructions are generated by default if
6868hardware floating is used.
6869
6870@item -mno-bit-align
6871@itemx -mbit-align
6872@opindex mno-bit-align
6873@opindex mbit-align
6874On System V.4 and embedded PowerPC systems do not (do) force structures
6875and unions that contain bit-fields to be aligned to the base type of the
6876bit-field.
6877
6878For example, by default a structure containing nothing but 8
6879@code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
6880boundary and have a size of 4 bytes.  By using @option{-mno-bit-align},
6881the structure would be aligned to a 1 byte boundary and be one byte in
6882size.
6883
6884@item -mno-strict-align
6885@itemx -mstrict-align
6886@opindex mno-strict-align
6887@opindex mstrict-align
6888On System V.4 and embedded PowerPC systems do not (do) assume that
6889unaligned memory references will be handled by the system.
6890
6891@item -mrelocatable
6892@itemx -mno-relocatable
6893@opindex mrelocatable
6894@opindex mno-relocatable
6895On embedded PowerPC systems generate code that allows (does not allow)
6896the program to be relocated to a different address at runtime.  If you
6897use @option{-mrelocatable} on any module, all objects linked together must
6898be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
6899
6900@item -mrelocatable-lib
6901@itemx -mno-relocatable-lib
6902@opindex mrelocatable-lib
6903@opindex mno-relocatable-lib
6904On embedded PowerPC systems generate code that allows (does not allow)
6905the program to be relocated to a different address at runtime.  Modules
6906compiled with @option{-mrelocatable-lib} can be linked with either modules
6907compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
6908with modules compiled with the @option{-mrelocatable} options.
6909
6910@item -mno-toc
6911@itemx -mtoc
6912@opindex mno-toc
6913@opindex mtoc
6914On System V.4 and embedded PowerPC systems do not (do) assume that
6915register 2 contains a pointer to a global area pointing to the addresses
6916used in the program.
6917
6918@item -mlittle
6919@itemx -mlittle-endian
6920@opindex mlittle
6921@opindex mlittle-endian
6922On System V.4 and embedded PowerPC systems compile code for the
6923processor in little endian mode.  The @option{-mlittle-endian} option is
6924the same as @option{-mlittle}.
6925
6926@item -mbig
6927@itemx -mbig-endian
6928@opindex mbig
6929@opindex mbig-endian
6930On System V.4 and embedded PowerPC systems compile code for the
6931processor in big endian mode.  The @option{-mbig-endian} option is
6932the same as @option{-mbig}.
6933
6934@item -mcall-sysv
6935@opindex mcall-sysv
6936On System V.4 and embedded PowerPC systems compile code using calling
6937conventions that adheres to the March 1995 draft of the System V
6938Application Binary Interface, PowerPC processor supplement.  This is the
6939default unless you configured GCC using @samp{powerpc-*-eabiaix}.
6940
6941@item -mcall-sysv-eabi
6942@opindex mcall-sysv-eabi
6943Specify both @option{-mcall-sysv} and @option{-meabi} options.
6944
6945@item -mcall-sysv-noeabi
6946@opindex mcall-sysv-noeabi
6947Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
6948
6949@item -mcall-aix
6950@opindex mcall-aix
6951On System V.4 and embedded PowerPC systems compile code using calling
6952conventions that are similar to those used on AIX@.  This is the
6953default if you configured GCC using @samp{powerpc-*-eabiaix}.
6954
6955@item -mcall-solaris
6956@opindex mcall-solaris
6957On System V.4 and embedded PowerPC systems compile code for the Solaris
6958operating system.
6959
6960@item -mcall-linux
6961@opindex mcall-linux
6962On System V.4 and embedded PowerPC systems compile code for the
6963Linux-based GNU system.
6964
6965@item -mcall-gnu
6966@opindex mcall-gnu
6967On System V.4 and embedded PowerPC systems compile code for the
6968Hurd-based GNU system.
6969
6970@item -mcall-netbsd
6971@opindex mcall-netbsd
6972On System V.4 and embedded PowerPC systems compile code for the
6973NetBSD operating system.
6974
6975@item -maix-struct-return
6976@opindex maix-struct-return
6977Return all structures in memory (as specified by the AIX ABI)@.
6978
6979@item -msvr4-struct-return
6980@opindex msvr4-struct-return
6981Return structures smaller than 8 bytes in registers (as specified by the
6982SVR4 ABI)@.
6983
6984@item -mabi=altivec
6985@opindex mabi=altivec
6986Extend the current ABI with AltiVec ABI extensions.  This does not
6987change the default ABI, instead it adds the AltiVec ABI extensions to
6988the current ABI@.
6989
6990@item -mabi=no-altivec
6991@opindex mabi=no-altivec
6992Disable AltiVec ABI extensions for the current ABI.
6993
6994@item -mprototype
6995@itemx -mno-prototype
6996@opindex mprototype
6997@opindex mno-prototype
6998On System V.4 and embedded PowerPC systems assume that all calls to
6999variable argument functions are properly prototyped.  Otherwise, the
7000compiler must insert an instruction before every non prototyped call to
7001set or clear bit 6 of the condition code register (@var{CR}) to
7002indicate whether floating point values were passed in the floating point
7003registers in case the function takes a variable arguments.  With
7004@option{-mprototype}, only calls to prototyped variable argument functions
7005will set or clear the bit.
7006
7007@item -msim
7008@opindex msim
7009On embedded PowerPC systems, assume that the startup module is called
7010@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
7011@file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}.
7012configurations.
7013
7014@item -mmvme
7015@opindex mmvme
7016On embedded PowerPC systems, assume that the startup module is called
7017@file{crt0.o} and the standard C libraries are @file{libmvme.a} and
7018@file{libc.a}.
7019
7020@item -mads
7021@opindex mads
7022On embedded PowerPC systems, assume that the startup module is called
7023@file{crt0.o} and the standard C libraries are @file{libads.a} and
7024@file{libc.a}.
7025
7026@item -myellowknife
7027@opindex myellowknife
7028On embedded PowerPC systems, assume that the startup module is called
7029@file{crt0.o} and the standard C libraries are @file{libyk.a} and
7030@file{libc.a}.
7031
7032@item -mvxworks
7033@opindex mvxworks
7034On System V.4 and embedded PowerPC systems, specify that you are
7035compiling for a VxWorks system.
7036
7037@item -mwindiss
7038@opindex mwindiss
7039Specify that you are compiling for the WindISS simulation environment.
7040
7041@item -memb
7042@opindex memb
7043On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
7044header to indicate that @samp{eabi} extended relocations are used.
7045
7046@item -meabi
7047@itemx -mno-eabi
7048@opindex meabi
7049@opindex mno-eabi
7050On System V.4 and embedded PowerPC systems do (do not) adhere to the
7051Embedded Applications Binary Interface (eabi) which is a set of
7052modifications to the System V.4 specifications.  Selecting @option{-meabi}
7053means that the stack is aligned to an 8 byte boundary, a function
7054@code{__eabi} is called to from @code{main} to set up the eabi
7055environment, and the @option{-msdata} option can use both @code{r2} and
7056@code{r13} to point to two separate small data areas.  Selecting
7057@option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
7058do not call an initialization function from @code{main}, and the
7059@option{-msdata} option will only use @code{r13} to point to a single
7060small data area.  The @option{-meabi} option is on by default if you
7061configured GCC using one of the @samp{powerpc*-*-eabi*} options.
7062
7063@item -msdata=eabi
7064@opindex msdata=eabi
7065On System V.4 and embedded PowerPC systems, put small initialized
7066@code{const} global and static data in the @samp{.sdata2} section, which
7067is pointed to by register @code{r2}.  Put small initialized
7068non-@code{const} global and static data in the @samp{.sdata} section,
7069which is pointed to by register @code{r13}.  Put small uninitialized
7070global and static data in the @samp{.sbss} section, which is adjacent to
7071the @samp{.sdata} section.  The @option{-msdata=eabi} option is
7072incompatible with the @option{-mrelocatable} option.  The
7073@option{-msdata=eabi} option also sets the @option{-memb} option.
7074
7075@item -msdata=sysv
7076@opindex msdata=sysv
7077On System V.4 and embedded PowerPC systems, put small global and static
7078data in the @samp{.sdata} section, which is pointed to by register
7079@code{r13}.  Put small uninitialized global and static data in the
7080@samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
7081The @option{-msdata=sysv} option is incompatible with the
7082@option{-mrelocatable} option.
7083
7084@item -msdata=default
7085@itemx -msdata
7086@opindex msdata=default
7087@opindex msdata
7088On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
7089compile code the same as @option{-msdata=eabi}, otherwise compile code the
7090same as @option{-msdata=sysv}.
7091
7092@item -msdata-data
7093@opindex msdata-data
7094On System V.4 and embedded PowerPC systems, put small global and static
7095data in the @samp{.sdata} section.  Put small uninitialized global and
7096static data in the @samp{.sbss} section.  Do not use register @code{r13}
7097to address small data however.  This is the default behavior unless
7098other @option{-msdata} options are used.
7099
7100@item -msdata=none
7101@itemx -mno-sdata
7102@opindex msdata=none
7103@opindex mno-sdata
7104On embedded PowerPC systems, put all initialized global and static data
7105in the @samp{.data} section, and all uninitialized data in the
7106@samp{.bss} section.
7107
7108@item -G @var{num}
7109@opindex G
7110@cindex smaller data references (PowerPC)
7111@cindex .sdata/.sdata2 references (PowerPC)
7112On embedded PowerPC systems, put global and static items less than or
7113equal to @var{num} bytes into the small data or bss sections instead of
7114the normal data or bss section.  By default, @var{num} is 8.  The
7115@option{-G @var{num}} switch is also passed to the linker.
7116All modules should be compiled with the same @option{-G @var{num}} value.
7117
7118@item -mregnames
7119@itemx -mno-regnames
7120@opindex mregnames
7121@opindex mno-regnames
7122On System V.4 and embedded PowerPC systems do (do not) emit register
7123names in the assembly language output using symbolic forms.
7124
7125@item -mlongcall
7126@itemx -mno-longcall
7127@opindex mlongcall
7128@opindex mno-longcall
7129Default to making all function calls via pointers, so that functions
7130which reside further than 64 megabytes (67,108,864 bytes) from the
7131current location can be called.  This setting can be overridden by the
7132@code{shortcall} function attribute, or by @code{#pragma longcall(0)}.
7133
7134Some linkers are capable of detecting out-of-range calls and generating
7135glue code on the fly.  On these systems, long calls are unnecessary and
7136generate slower code.  As of this writing, the AIX linker can do this,
7137as can the GNU linker for PowerPC/64.  It is planned to add this feature
7138to the GNU linker for 32-bit PowerPC systems as well.
7139
7140In the future, we may cause GCC to ignore all longcall specifications
7141when the linker is known to generate glue.
7142
7143@item -pthread
7144@opindex pthread
7145Adds support for multithreading with the @dfn{pthreads} library.
7146This option sets flags for both the preprocessor and linker.
7147
7148@end table
7149
7150@node Darwin Options
7151@subsection Darwin Options
7152@cindex Darwin options
7153
7154These options are defined for all architectures running the Darwin operating
7155system.  They are useful for compatibility with other Mac OS compilers.
7156
7157@table @gcctabopt
7158@item -all_load
7159@opindex all_load
7160Loads all members of static archive libraries.
7161See man ld(1) for more information.
7162
7163@item -arch_errors_fatal
7164@opindex arch_errors_fatal
7165Cause the errors having to do with files that have the wrong architecture
7166to be fatal.
7167
7168@item -bind_at_load
7169@opindex bind_at_load
7170Causes the output file to be marked such that the dynamic linker will
7171bind all undefined references when the file is loaded or launched.
7172
7173@item -bundle
7174@opindex bundle
7175Produce a Mach-o bundle format file.
7176See man ld(1) for more information.
7177
7178@item -bundle_loader @var{executable}
7179@opindex bundle_loader
7180This specifies the @var{executable} that will be loading the build
7181output file being linked. See man ld(1) for more information.
7182
7183@item -allowable_client  @var{client_name}
7184@itemx -arch_only
7185
7186@itemx -client_name
7187@itemx -compatibility_version
7188@itemx -current_version
7189@itemx -dependency-file
7190@itemx -dylib_file
7191@itemx -dylinker_install_name
7192@itemx -dynamic
7193@itemx -dynamiclib
7194@itemx -exported_symbols_list
7195@itemx -filelist
7196@itemx -flat_namespace
7197@itemx -force_cpusubtype_ALL
7198@itemx -force_flat_namespace
7199@itemx -headerpad_max_install_names
7200@itemx -image_base
7201@itemx -init
7202@itemx -install_name
7203@itemx -keep_private_externs
7204@itemx -multi_module
7205@itemx -multiply_defined
7206@itemx -multiply_defined_unused
7207@itemx -noall_load
7208@itemx -nomultidefs
7209@itemx -noprebind
7210@itemx -noseglinkedit
7211@itemx -pagezero_size
7212@itemx -prebind
7213@itemx -prebind_all_twolevel_modules
7214@itemx -private_bundle
7215@itemx -read_only_relocs
7216@itemx -sectalign
7217@itemx -sectobjectsymbols
7218@itemx -whyload
7219@itemx -seg1addr
7220@itemx -sectcreate
7221@itemx -sectobjectsymbols
7222@itemx -sectorder
7223@itemx -seg_addr_table
7224@itemx -seg_addr_table_filename
7225@itemx -seglinkedit
7226@itemx -segprot
7227@itemx -segs_read_only_addr
7228@itemx -segs_read_write_addr
7229@itemx -single_module
7230@itemx -static
7231@itemx -sub_library
7232@itemx -sub_umbrella
7233@itemx -twolevel_namespace
7234@itemx -umbrella
7235@itemx -undefined
7236@itemx -unexported_symbols_list
7237@itemx -weak_reference_mismatches
7238@itemx -whatsloaded
7239
7240@opindex allowable_client
7241@opindex arch_only
7242@opindex client_name
7243@opindex compatibility_version
7244@opindex current_version
7245@opindex dependency-file
7246@opindex dylib_file
7247@opindex dylinker_install_name
7248@opindex dynamic
7249@opindex dynamiclib
7250@opindex exported_symbols_list
7251@opindex filelist
7252@opindex flat_namespace
7253@opindex force_cpusubtype_ALL
7254@opindex force_flat_namespace
7255@opindex headerpad_max_install_names
7256@opindex image_base
7257@opindex init
7258@opindex install_name
7259@opindex keep_private_externs
7260@opindex multi_module
7261@opindex multiply_defined
7262@opindex multiply_defined_unused
7263@opindex noall_load
7264@opindex nomultidefs
7265@opindex noprebind
7266@opindex noseglinkedit
7267@opindex pagezero_size
7268@opindex prebind
7269@opindex prebind_all_twolevel_modules
7270@opindex private_bundle
7271@opindex read_only_relocs
7272@opindex sectalign
7273@opindex sectobjectsymbols
7274@opindex whyload
7275@opindex seg1addr
7276@opindex sectcreate
7277@opindex sectobjectsymbols
7278@opindex sectorder
7279@opindex seg_addr_table
7280@opindex seg_addr_table_filename
7281@opindex seglinkedit
7282@opindex segprot
7283@opindex segs_read_only_addr
7284@opindex segs_read_write_addr
7285@opindex single_module
7286@opindex static
7287@opindex sub_library
7288@opindex sub_umbrella
7289@opindex twolevel_namespace
7290@opindex umbrella
7291@opindex undefined
7292@opindex unexported_symbols_list
7293@opindex weak_reference_mismatches
7294@opindex whatsloaded
7295
7296This options are available for Darwin linker. Darwin linker man page
7297describes them in detail.
7298@end table
7299
7300
7301@node RT Options
7302@subsection IBM RT Options
7303@cindex RT options
7304@cindex IBM RT options
7305
7306These @samp{-m} options are defined for the IBM RT PC:
7307
7308@table @gcctabopt
7309@item -min-line-mul
7310@opindex min-line-mul
7311Use an in-line code sequence for integer multiplies.  This is the
7312default.
7313
7314@item -mcall-lib-mul
7315@opindex mcall-lib-mul
7316Call @code{lmul$$} for integer multiples.
7317
7318@item -mfull-fp-blocks
7319@opindex mfull-fp-blocks
7320Generate full-size floating point data blocks, including the minimum
7321amount of scratch space recommended by IBM@.  This is the default.
7322
7323@item -mminimum-fp-blocks
7324@opindex mminimum-fp-blocks
7325Do not include extra scratch space in floating point data blocks.  This
7326results in smaller code, but slower execution, since scratch space must
7327be allocated dynamically.
7328
7329@cindex @file{stdarg.h} and RT PC
7330@item -mfp-arg-in-fpregs
7331@opindex mfp-arg-in-fpregs
7332Use a calling sequence incompatible with the IBM calling convention in
7333which floating point arguments are passed in floating point registers.
7334Note that @code{stdarg.h} will not work with floating point operands
7335if this option is specified.
7336
7337@item -mfp-arg-in-gregs
7338@opindex mfp-arg-in-gregs
7339Use the normal calling convention for floating point arguments.  This is
7340the default.
7341
7342@item -mhc-struct-return
7343@opindex mhc-struct-return
7344Return structures of more than one word in memory, rather than in a
7345register.  This provides compatibility with the MetaWare HighC (hc)
7346compiler.  Use the option @option{-fpcc-struct-return} for compatibility
7347with the Portable C Compiler (pcc).
7348
7349@item -mnohc-struct-return
7350@opindex mnohc-struct-return
7351Return some structures of more than one word in registers, when
7352convenient.  This is the default.  For compatibility with the
7353IBM-supplied compilers, use the option @option{-fpcc-struct-return} or the
7354option @option{-mhc-struct-return}.
7355@end table
7356
7357@node MIPS Options
7358@subsection MIPS Options
7359@cindex MIPS options
7360
7361These @samp{-m} options are defined for the MIPS family of computers:
7362
7363@table @gcctabopt
7364
7365@item -march=@var{arch}
7366@opindex march
7367Generate code that will run on @var{arch}, which can be the name of a
7368generic MIPS ISA, or the name of a particular processor.  The ISA names
7369are: @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4}, @samp{mips32}
7370and @samp{mips64}.  The processor names are: @samp{r2000},
7371@samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{vr4100}, @samp{vr4300},
7372@samp{r4400}, @samp{r4600}, @samp{r4650}, @samp{vr5000}, @samp{r6000},
7373@samp{r8000}, @samp{4kc}, @samp{4kp}, @samp{5kc}, @samp{20kc},
7374@samp{orion}, and @samp{sb1}.  The special value @samp{from-abi} selects the
7375most compatible architecture for the selected ABI (that is,
7376@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
7377
7378In processor names, a final @samp{000} can be abbreviated as @samp{k}
7379(for example, @samp{-march=r2k}).  Prefixes are optional, and
7380@samp{vr} may be written @samp{r}.
7381
7382GCC defines two macros based on the value of this option.  The first
7383is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
7384a string.  The second has the form @samp{_MIPS_ARCH_@var{foo}},
7385where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
7386For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
7387to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
7388
7389Note that the @samp{_MIPS_ARCH} macro uses the processor names given
7390above.  In other words, it will have the full prefix and will not
7391abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
7392the macro names the resolved architecture (either @samp{"mips1"} or
7393@samp{"mips3"}).  It names the default architecture when no
7394@option{-march} option is given.
7395
7396@item -mtune=@var{arch}
7397@opindex mtune
7398Optimize for @var{arch}.  Among other things, this option controls
7399the way instructions are scheduled, and the perceived cost of arithmetic
7400operations.  The list of @var{arch} values is the same as for
7401@option{-march}.
7402
7403When this option is not used, GCC will optimize for the processor
7404specified by @option{-march}.  By using @option{-march} and
7405@option{-mtune} together, it is possible to generate code that will
7406run on a family of processors, but optimize the code for one
7407particular member of that family.
7408
7409@samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
7410@samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
7411@samp{-march} ones described above.
7412
7413@item -mips1
7414@opindex mips1
7415Equivalent to @samp{-march=mips1}.
7416
7417@item -mips2
7418@opindex mips2
7419Equivalent to @samp{-march=mips2}.
7420
7421@item -mips3
7422@opindex mips3
7423Equivalent to @samp{-march=mips3}.
7424
7425@item -mips4
7426@opindex mips4
7427Equivalent to @samp{-march=mips4}.
7428
7429@item -mips32
7430@opindex mips32
7431Equivalent to @samp{-march=mips32}.
7432
7433@item -mips64
7434@opindex mips64
7435Equivalent to @samp{-march=mips64}.
7436
7437@item -mfused-madd
7438@itemx -mno-fused-madd
7439@opindex mfused-madd
7440@opindex mno-fused-madd
7441Generate code that uses (does not use) the floating point multiply and
7442accumulate instructions, when they are available.  These instructions
7443are generated by default if they are available, but this may be
7444undesirable if the extra precision causes problems or on certain chips
7445in the mode where denormals are rounded to zero where denormals
7446generated by multiply and accumulate instructions cause exceptions
7447anyway.
7448
7449@item -mfp32
7450@opindex mfp32
7451Assume that floating point registers are 32 bits wide.
7452
7453@item -mfp64
7454@opindex mfp64
7455Assume that floating point registers are 64 bits wide.
7456
7457@item -mgp32
7458@opindex mgp32
7459Assume that general purpose registers are 32 bits wide.
7460
7461@item -mgp64
7462@opindex mgp64
7463Assume that general purpose registers are 64 bits wide.
7464
7465@item -mint64
7466@opindex mint64
7467Force int and long types to be 64 bits wide.  See @option{-mlong32} for an
7468explanation of the default, and the width of pointers.
7469
7470@item -mlong64
7471@opindex mlong64
7472Force long types to be 64 bits wide.  See @option{-mlong32} for an
7473explanation of the default, and the width of pointers.
7474
7475@item -mlong32
7476@opindex mlong32
7477Force long, int, and pointer types to be 32 bits wide.
7478
7479The default size of ints, longs and pointers depends on the ABI@.  All
7480the supported ABIs use 32-bit ints.  The n64 ABI uses 64-bit longs, as
7481does the 64-bit Cygnus EABI; the others use 32-bit longs.  Pointers
7482are the same size as longs, or the same size as integer registers,
7483whichever is smaller.
7484
7485@item -mabi=32
7486@itemx -mabi=o64
7487@itemx -mabi=n32
7488@itemx -mabi=64
7489@itemx -mabi=eabi
7490@itemx -mabi=meabi
7491@opindex mabi=32
7492@opindex mabi=o64
7493@opindex mabi=n32
7494@opindex mabi=64
7495@opindex mabi=eabi
7496@opindex mabi=meabi
7497Generate code for the given ABI@.
7498
7499Note that there are two embedded ABIs: @option{-mabi=eabi}
7500selects the one defined by Cygnus while @option{-meabi=meabi}
7501selects the one defined by MIPS@.  Both these ABIs have
750232-bit and 64-bit variants.  Normally, GCC will generate
750364-bit code when you select a 64-bit architecture, but you
7504can use @option{-mgp32} to get 32-bit code instead.
7505
7506@item -mmips-as
7507@opindex mmips-as
7508Generate code for the MIPS assembler, and invoke @file{mips-tfile} to
7509add normal debug information.  This is the default for all
7510platforms except for the OSF/1 reference platform, using the OSF/rose
7511object format.  If the either of the @option{-gstabs} or @option{-gstabs+}
7512switches are used, the @file{mips-tfile} program will encapsulate the
7513stabs within MIPS ECOFF@.
7514
7515@item -mgas
7516@opindex mgas
7517Generate code for the GNU assembler.  This is the default on the OSF/1
7518reference platform, using the OSF/rose object format.  Also, this is
7519the default if the configure option @option{--with-gnu-as} is used.
7520
7521@item -msplit-addresses
7522@itemx -mno-split-addresses
7523@opindex msplit-addresses
7524@opindex mno-split-addresses
7525Generate code to load the high and low parts of address constants separately.
7526This allows GCC to optimize away redundant loads of the high order
7527bits of addresses.  This optimization requires GNU as and GNU ld.
7528This optimization is enabled by default for some embedded targets where
7529GNU as and GNU ld are standard.
7530
7531@item -mrnames
7532@itemx -mno-rnames
7533@opindex mrnames
7534@opindex mno-rnames
7535The @option{-mrnames} switch says to output code using the MIPS software
7536names for the registers, instead of the hardware names (ie, @var{a0}
7537instead of @var{$4}).  The only known assembler that supports this option
7538is the Algorithmics assembler.
7539
7540@item -mgpopt
7541@itemx -mno-gpopt
7542@opindex mgpopt
7543@opindex mno-gpopt
7544The @option{-mgpopt} switch says to write all of the data declarations
7545before the instructions in the text section, this allows the MIPS
7546assembler to generate one word memory references instead of using two
7547words for short global or static data items.  This is on by default if
7548optimization is selected.
7549
7550@item -mstats
7551@itemx -mno-stats
7552@opindex mstats
7553@opindex mno-stats
7554For each non-inline function processed, the @option{-mstats} switch
7555causes the compiler to emit one line to the standard error file to
7556print statistics about the program (number of registers saved, stack
7557size, etc.).
7558
7559@item -mmemcpy
7560@itemx -mno-memcpy
7561@opindex mmemcpy
7562@opindex mno-memcpy
7563The @option{-mmemcpy} switch makes all block moves call the appropriate
7564string function (@samp{memcpy} or @samp{bcopy}) instead of possibly
7565generating inline code.
7566
7567@item -mmips-tfile
7568@itemx -mno-mips-tfile
7569@opindex mmips-tfile
7570@opindex mno-mips-tfile
7571The @option{-mno-mips-tfile} switch causes the compiler not
7572postprocess the object file with the @file{mips-tfile} program,
7573after the MIPS assembler has generated it to add debug support.  If
7574@file{mips-tfile} is not run, then no local variables will be
7575available to the debugger.  In addition, @file{stage2} and
7576@file{stage3} objects will have the temporary file names passed to the
7577assembler embedded in the object file, which means the objects will
7578not compare the same.  The @option{-mno-mips-tfile} switch should only
7579be used when there are bugs in the @file{mips-tfile} program that
7580prevents compilation.
7581
7582@item -msoft-float
7583@opindex msoft-float
7584Generate output containing library calls for floating point.
7585@strong{Warning:} the requisite libraries are not part of GCC@.
7586Normally the facilities of the machine's usual C compiler are used, but
7587this can't be done directly in cross-compilation.  You must make your
7588own arrangements to provide suitable library functions for
7589cross-compilation.
7590
7591@item -mhard-float
7592@opindex mhard-float
7593Generate output containing floating point instructions.  This is the
7594default if you use the unmodified sources.
7595
7596@item -mabicalls
7597@itemx -mno-abicalls
7598@opindex mabicalls
7599@opindex mno-abicalls
7600Emit (or do not emit) the pseudo operations @samp{.abicalls},
7601@samp{.cpload}, and @samp{.cprestore} that some System V.4 ports use for
7602position independent code.
7603
7604@item -mlong-calls
7605@itemx -mno-long-calls
7606@opindex mlong-calls
7607@opindex mno-long-calls
7608Do all calls with the @samp{JALR} instruction, which requires
7609loading up a function's address into a register before the call.
7610You need to use this switch, if you call outside of the current
7611512 megabyte segment to functions that are not through pointers.
7612
7613@item -mhalf-pic
7614@itemx -mno-half-pic
7615@opindex mhalf-pic
7616@opindex mno-half-pic
7617Put pointers to extern references into the data section and load them
7618up, rather than put the references in the text section.
7619
7620@item -membedded-pic
7621@itemx -mno-embedded-pic
7622@opindex membedded-pic
7623@opindex mno-embedded-pic
7624Generate PIC code suitable for some embedded systems.  All calls are
7625made using PC relative address, and all data is addressed using the $gp
7626register.  No more than 65536 bytes of global data may be used.  This
7627requires GNU as and GNU ld which do most of the work.  This currently
7628only works on targets which use ECOFF; it does not work with ELF@.
7629
7630@item -membedded-data
7631@itemx -mno-embedded-data
7632@opindex membedded-data
7633@opindex mno-embedded-data
7634Allocate variables to the read-only data section first if possible, then
7635next in the small data section if possible, otherwise in data.  This gives
7636slightly slower code than the default, but reduces the amount of RAM required
7637when executing, and thus may be preferred for some embedded systems.
7638
7639@item -muninit-const-in-rodata
7640@itemx -mno-uninit-const-in-rodata
7641@opindex muninit-const-in-rodata
7642@opindex mno-uninit-const-in-rodata
7643When used together with @option{-membedded-data}, it will always store uninitialized
7644const variables in the read-only data section.
7645
7646@item -msingle-float
7647@itemx -mdouble-float
7648@opindex msingle-float
7649@opindex mdouble-float
7650The @option{-msingle-float} switch tells gcc to assume that the floating
7651point coprocessor only supports single precision operations, as on the
7652@samp{r4650} chip.  The @option{-mdouble-float} switch permits gcc to use
7653double precision operations.  This is the default.
7654
7655@item -mmad
7656@itemx -mno-mad
7657@opindex mmad
7658@opindex mno-mad
7659Permit use of the @samp{mad}, @samp{madu} and @samp{mul} instructions,
7660as on the @samp{r4650} chip.
7661
7662@item -m4650
7663@opindex m4650
7664Turns on @option{-msingle-float}, @option{-mmad}, and, at least for now,
7665@option{-mcpu=r4650}.
7666
7667@item -mips16
7668@itemx -mno-mips16
7669@opindex mips16
7670@opindex mno-mips16
7671Enable 16-bit instructions.
7672
7673@item -mentry
7674@opindex mentry
7675Use the entry and exit pseudo ops.  This option can only be used with
7676@option{-mips16}.
7677
7678@item -EL
7679@opindex EL
7680Compile code for the processor in little endian mode.
7681The requisite libraries are assumed to exist.
7682
7683@item -EB
7684@opindex EB
7685Compile code for the processor in big endian mode.
7686The requisite libraries are assumed to exist.
7687
7688@item -G @var{num}
7689@opindex G
7690@cindex smaller data references (MIPS)
7691@cindex gp-relative references (MIPS)
7692Put global and static items less than or equal to @var{num} bytes into
7693the small data or bss sections instead of the normal data or bss
7694section.  This allows the assembler to emit one word memory reference
7695instructions based on the global pointer (@var{gp} or @var{$28}),
7696instead of the normal two words used.  By default, @var{num} is 8 when
7697the MIPS assembler is used, and 0 when the GNU assembler is used.  The
7698@option{-G @var{num}} switch is also passed to the assembler and linker.
7699All modules should be compiled with the same @option{-G @var{num}}
7700value.
7701
7702@item -nocpp
7703@opindex nocpp
7704Tell the MIPS assembler to not run its preprocessor over user
7705assembler files (with a @samp{.s} suffix) when assembling them.
7706
7707@item -mfix7000
7708@opindex mfix7000
7709Pass an option to gas which will cause nops to be inserted if
7710the read of the destination register of an mfhi or mflo instruction
7711occurs in the following two instructions.
7712
7713@item -no-crt0
7714@opindex no-crt0
7715Do not include the default crt0.
7716
7717@item -mflush-func=@var{func}
7718@itemx -mno-flush-func
7719@opindex mflush-func
7720Specifies the function to call to flush the I and D caches, or to not
7721call any such function.  If called, the function must take the same
7722arguments as the common @code{_flush_func()}, that is, the address of the
7723memory range for which the cache is being flushed, the size of the
7724memory range, and the number 3 (to flush both caches).  The default
7725depends on the target gcc was configured for, but commonly is either
7726@samp{_flush_func} or @samp{__cpu_flush}.
7727
7728@item -mbranch-likely
7729@itemx -mno-branch-likely
7730@opindex mbranch-likely
7731@opindex mno-branch-likely
7732Enable or disable use of Branch Likely instructions, regardless of the
7733default for the selected architecture.  By default, Branch Likely
7734instructions may be generated if they are supported by the selected
7735architecture.  An exception is for the MIPS32 and MIPS64 architectures
7736and processors which implement those architectures; for those, Branch
7737Likely instructions will not be generated by default because the MIPS32
7738and MIPS64 architectures specifically deprecate their use.
7739@end table
7740
7741@node i386 and x86-64 Options
7742@subsection Intel 386 and AMD x86-64 Options
7743@cindex i386 Options
7744@cindex x86-64 Options
7745@cindex Intel 386 Options
7746@cindex AMD x86-64 Options
7747
7748These @samp{-m} options are defined for the i386 and x86-64 family of
7749computers:
7750
7751@table @gcctabopt
7752@item -mcpu=@var{cpu-type}
7753@opindex mcpu
7754Tune to @var{cpu-type} everything applicable about the generated code, except
7755for the ABI and the set of available instructions.  The choices for
7756@var{cpu-type} are @samp{i386}, @samp{i486}, @samp{i586}, @samp{i686},
7757@samp{pentium}, @samp{pentium-mmx}, @samp{pentiumpro}, @samp{pentium2},
7758@samp{pentium3}, @samp{pentium4}, @samp{prescott}, @samp{nocona},
7759@samp{k6}, @samp{k6-2}, @samp{k6-3},
7760@samp{athlon}, @samp{athlon-tbird}, @samp{athlon-4}, @samp{athlon-xp},
7761@samp{athlon-mp}, @samp{winchip-c6}, @samp{winchip2} and @samp{c3}.
7762
7763While picking a specific @var{cpu-type} will schedule things appropriately
7764for that particular chip, the compiler will not generate any code that
7765does not run on the i386 without the @option{-march=@var{cpu-type}} option
7766being used.  @samp{i586} is equivalent to @samp{pentium} and @samp{i686}
7767is equivalent to @samp{pentiumpro}.  @samp{k6} and @samp{athlon} are the
7768AMD chips as opposed to the Intel ones.
7769
7770@item -march=@var{cpu-type}
7771@opindex march
7772Generate instructions for the machine type @var{cpu-type}.  The choices
7773for @var{cpu-type} are the same as for @option{-mcpu}.  Moreover,
7774specifying @option{-march=@var{cpu-type}} implies @option{-mcpu=@var{cpu-type}}.
7775
7776@item -m386
7777@itemx -m486
7778@itemx -mpentium
7779@itemx -mpentiumpro
7780@opindex m386
7781@opindex m486
7782@opindex mpentium
7783@opindex mpentiumpro
7784These options are synonyms for @option{-mcpu=i386}, @option{-mcpu=i486},
7785@option{-mcpu=pentium}, and @option{-mcpu=pentiumpro} respectively.
7786These synonyms are deprecated.
7787
7788@item -mfpmath=@var{unit}
7789@opindex march
7790Generate floating point arithmetics for selected unit @var{unit}.  The choices
7791for @var{unit} are:
7792
7793@table @samp
7794@item 387
7795Use the standard 387 floating point coprocessor present majority of chips and
7796emulated otherwise.  Code compiled with this option will run almost everywhere.
7797The temporary results are computed in 80bit precision instead of precision
7798specified by the type resulting in slightly different results compared to most
7799of other chips. See @option{-ffloat-store} for more detailed description.
7800
7801This is the default choice for i386 compiler.
7802
7803@item sse
7804Use scalar floating point instructions present in the SSE instruction set.
7805This instruction set is supported by Pentium3 and newer chips, in the AMD line
7806by Athlon-4, Athlon-xp and Athlon-mp chips.  The earlier version of SSE
7807instruction set supports only single precision arithmetics, thus the double and
7808extended precision arithmetics is still done using 387.  Later version, present
7809only in Pentium4 and the future AMD x86-64 chips supports double precision
7810arithmetics too.
7811
7812For i387 you need to use @option{-march=@var{cpu-type}}, @option{-msse} or
7813@option{-msse2} switches to enable SSE extensions and make this option
7814effective.  For x86-64 compiler, these extensions are enabled by default.
7815
7816The resulting code should be considerably faster in the majority of cases and avoid
7817the numerical instability problems of 387 code, but may break some existing
7818code that expects temporaries to be 80bit.
7819
7820This is the default choice for the x86-64 compiler.
7821
7822@item sse,387
7823Attempt to utilize both instruction sets at once.  This effectively double the
7824amount of available registers and on chips with separate execution units for
7825387 and SSE the execution resources too.  Use this option with care, as it is
7826still experimental, because the gcc register allocator does not model separate
7827functional units well.
7828@end table
7829
7830@item -masm=@var{dialect}
7831@opindex masm=@var{dialect}
7832Output asm instructions using selected @var{dialect}. Supported choices are
7833@samp{intel} or @samp{att} (the default one).
7834
7835@item -mieee-fp
7836@itemx -mno-ieee-fp
7837@opindex mieee-fp
7838@opindex mno-ieee-fp
7839Control whether or not the compiler uses IEEE floating point
7840comparisons.  These handle correctly the case where the result of a
7841comparison is unordered.
7842
7843@item -msoft-float
7844@opindex msoft-float
7845Generate output containing library calls for floating point.
7846@strong{Warning:} the requisite libraries are not part of GCC@.
7847Normally the facilities of the machine's usual C compiler are used, but
7848this can't be done directly in cross-compilation.  You must make your
7849own arrangements to provide suitable library functions for
7850cross-compilation.
7851
7852On machines where a function returns floating point results in the 80387
7853register stack, some floating point opcodes may be emitted even if
7854@option{-msoft-float} is used.
7855
7856@item -mno-fp-ret-in-387
7857@opindex mno-fp-ret-in-387
7858Do not use the FPU registers for return values of functions.
7859
7860The usual calling convention has functions return values of types
7861@code{float} and @code{double} in an FPU register, even if there
7862is no FPU@.  The idea is that the operating system should emulate
7863an FPU@.
7864
7865The option @option{-mno-fp-ret-in-387} causes such values to be returned
7866in ordinary CPU registers instead.
7867
7868@item -mno-fancy-math-387
7869@opindex mno-fancy-math-387
7870Some 387 emulators do not support the @code{sin}, @code{cos} and
7871@code{sqrt} instructions for the 387.  Specify this option to avoid
7872generating those instructions.  This option is the default on FreeBSD,
7873OpenBSD and NetBSD@.  This option is overridden when @option{-march}
7874indicates that the target cpu will always have an FPU and so the
7875instruction will not need emulation.  As of revision 2.6.1, these
7876instructions are not generated unless you also use the
7877@option{-funsafe-math-optimizations} switch.
7878
7879@item -malign-double
7880@itemx -mno-align-double
7881@opindex malign-double
7882@opindex mno-align-double
7883Control whether GCC aligns @code{double}, @code{long double}, and
7884@code{long long} variables on a two word boundary or a one word
7885boundary.  Aligning @code{double} variables on a two word boundary will
7886produce code that runs somewhat faster on a @samp{Pentium} at the
7887expense of more memory.
7888
7889@strong{Warning:} if you use the @option{-malign-double} switch,
7890structures containing the above types will be aligned differently than
7891the published application binary interface specifications for the 386
7892and will not be binary compatible with structures in code compiled
7893without that switch.
7894
7895@item -m96bit-long-double
7896@itemx -m128bit-long-double
7897@opindex m96bit-long-double
7898@opindex m128bit-long-double
7899These switches control the size of @code{long double} type. The i386
7900application binary interface specifies the size to be 96 bits,
7901so @option{-m96bit-long-double} is the default in 32 bit mode.
7902
7903Modern architectures (Pentium and newer) would prefer @code{long double}
7904to be aligned to an 8 or 16 byte boundary.  In arrays or structures
7905conforming to the ABI, this would not be possible.  So specifying a
7906@option{-m128bit-long-double} will align @code{long double}
7907to a 16 byte boundary by padding the @code{long double} with an additional
790832 bit zero.
7909
7910In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
7911its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
7912
7913Notice that neither of these options enable any extra precision over the x87
7914standard of 80 bits for a @code{long double}.
7915
7916@strong{Warning:} if you override the default value for your target ABI, the
7917structures and arrays containing @code{long double} variables will change their size as
7918well as function calling convention for function taking @code{long double}
7919will be modified.  Hence they will not be binary compatible with arrays or
7920structures in code compiled without that switch.
7921
7922
7923@item -msvr3-shlib
7924@itemx -mno-svr3-shlib
7925@opindex msvr3-shlib
7926@opindex mno-svr3-shlib
7927Control whether GCC places uninitialized local variables into the
7928@code{bss} or @code{data} segments.  @option{-msvr3-shlib} places them
7929into @code{bss}.  These options are meaningful only on System V Release 3.
7930
7931@item -mrtd
7932@opindex mrtd
7933Use a different function-calling convention, in which functions that
7934take a fixed number of arguments return with the @code{ret} @var{num}
7935instruction, which pops their arguments while returning.  This saves one
7936instruction in the caller since there is no need to pop the arguments
7937there.
7938
7939You can specify that an individual function is called with this calling
7940sequence with the function attribute @samp{stdcall}.  You can also
7941override the @option{-mrtd} option by using the function attribute
7942@samp{cdecl}.  @xref{Function Attributes}.
7943
7944@strong{Warning:} this calling convention is incompatible with the one
7945normally used on Unix, so you cannot use it if you need to call
7946libraries compiled with the Unix compiler.
7947
7948Also, you must provide function prototypes for all functions that
7949take variable numbers of arguments (including @code{printf});
7950otherwise incorrect code will be generated for calls to those
7951functions.
7952
7953In addition, seriously incorrect code will result if you call a
7954function with too many arguments.  (Normally, extra arguments are
7955harmlessly ignored.)
7956
7957@item -mregparm=@var{num}
7958@opindex mregparm
7959Control how many registers are used to pass integer arguments.  By
7960default, no registers are used to pass arguments, and at most 3
7961registers can be used.  You can control this behavior for a specific
7962function by using the function attribute @samp{regparm}.
7963@xref{Function Attributes}.
7964
7965@strong{Warning:} if you use this switch, and
7966@var{num} is nonzero, then you must build all modules with the same
7967value, including any libraries.  This includes the system libraries and
7968startup modules.
7969
7970@item -mpreferred-stack-boundary=@var{num}
7971@opindex mpreferred-stack-boundary
7972Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
7973byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
7974the default is 4 (16 bytes or 128 bits), except when optimizing for code
7975size (@option{-Os}), in which case the default is the minimum correct
7976alignment (4 bytes for x86, and 8 bytes for x86-64).
7977
7978On Pentium and PentiumPro, @code{double} and @code{long double} values
7979should be aligned to an 8 byte boundary (see @option{-malign-double}) or
7980suffer significant run time performance penalties.  On Pentium III, the
7981Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar
7982penalties if it is not 16 byte aligned.
7983
7984To ensure proper alignment of this values on the stack, the stack boundary
7985must be as aligned as that required by any value stored on the stack.
7986Further, every function must be generated such that it keeps the stack
7987aligned.  Thus calling a function compiled with a higher preferred
7988stack boundary from a function compiled with a lower preferred stack
7989boundary will most likely misalign the stack.  It is recommended that
7990libraries that use callbacks always use the default setting.
7991
7992This extra alignment does consume extra stack space, and generally
7993increases code size.  Code that is sensitive to stack space usage, such
7994as embedded systems and operating system kernels, may want to reduce the
7995preferred alignment to @option{-mpreferred-stack-boundary=2}.
7996
7997@item -mmmx
7998@itemx -mno-mmx
7999@item -msse
8000@itemx -mno-sse
8001@item -msse2
8002@itemx -mno-sse2
8003@item -msse3
8004@itemx -mno-sse3
8005@item -m3dnow
8006@itemx -mno-3dnow
8007@opindex mmmx
8008@opindex mno-mmx
8009@opindex msse
8010@opindex mno-sse
8011@opindex m3dnow
8012@opindex mno-3dnow
8013These switches enable or disable the use of built-in functions that allow
8014direct access to the MMX, SSE, SSE2, SSE3 and 3Dnow extensions of the
8015instruction set.
8016
8017@xref{X86 Built-in Functions}, for details of the functions enabled
8018and disabled by these switches.
8019
8020To have SSE/SSE2 instructions generated automatically from floating-point
8021code, see @option{-mfpmath=sse}.
8022
8023@item -mpush-args
8024@itemx -mno-push-args
8025@opindex mpush-args
8026@opindex mno-push-args
8027Use PUSH operations to store outgoing parameters.  This method is shorter
8028and usually equally fast as method using SUB/MOV operations and is enabled
8029by default.  In some cases disabling it may improve performance because of
8030improved scheduling and reduced dependencies.
8031
8032@item -maccumulate-outgoing-args
8033@opindex maccumulate-outgoing-args
8034If enabled, the maximum amount of space required for outgoing arguments will be
8035computed in the function prologue.  This is faster on most modern CPUs
8036because of reduced dependencies, improved scheduling and reduced stack usage
8037when preferred stack boundary is not equal to 2.  The drawback is a notable
8038increase in code size.  This switch implies @option{-mno-push-args}.
8039
8040@item -mthreads
8041@opindex mthreads
8042Support thread-safe exception handling on @samp{Mingw32}.  Code that relies
8043on thread-safe exception handling must compile and link all code with the
8044@option{-mthreads} option.  When compiling, @option{-mthreads} defines
8045@option{-D_MT}; when linking, it links in a special thread helper library
8046@option{-lmingwthrd} which cleans up per thread exception handling data.
8047
8048@item -mno-align-stringops
8049@opindex mno-align-stringops
8050Do not align destination of inlined string operations.  This switch reduces
8051code size and improves performance in case the destination is already aligned,
8052but gcc don't know about it.
8053
8054@item -minline-all-stringops
8055@opindex minline-all-stringops
8056By default GCC inlines string operations only when destination is known to be
8057aligned at least to 4 byte boundary.  This enables more inlining, increase code
8058size, but may improve performance of code that depends on fast memcpy, strlen
8059and memset for short lengths.
8060
8061@item -momit-leaf-frame-pointer
8062@opindex momit-leaf-frame-pointer
8063Don't keep the frame pointer in a register for leaf functions.  This
8064avoids the instructions to save, set up and restore frame pointers and
8065makes an extra register available in leaf functions.  The option
8066@option{-fomit-frame-pointer} removes the frame pointer for all functions
8067which might make debugging harder.
8068@end table
8069
8070These @samp{-m} switches are supported in addition to the above
8071on AMD x86-64 processors in 64-bit environments.
8072
8073@table @gcctabopt
8074@item -m32
8075@itemx -m64
8076@opindex m32
8077@opindex m64
8078Generate code for a 32-bit or 64-bit environment.
8079The 32-bit environment sets int, long and pointer to 32 bits and
8080generates code that runs on any i386 system.
8081The 64-bit environment sets int to 32 bits and long and pointer
8082to 64 bits and generates code for AMD's x86-64 architecture.
8083
8084@item -mno-red-zone
8085@opindex no-red-zone
8086Do not use a so called red zone for x86-64 code.  The red zone is mandated
8087by the x86-64 ABI, it is a 128-byte area beyond the location of the
8088stack pointer that will not be modified by signal or interrupt handlers
8089and therefore can be used for temporary data without adjusting the stack
8090pointer.  The flag @option{-mno-red-zone} disables this red zone.
8091
8092@item -mcmodel=small
8093@opindex mcmodel=small
8094Generate code for the small code model: the program and its symbols must
8095be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
8096Programs can be statically or dynamically linked.  This is the default
8097code model.
8098
8099@item -mcmodel=kernel
8100@opindex mcmodel=kernel
8101Generate code for the kernel code model.  The kernel runs in the
8102negative 2 GB of the address space.
8103This model has to be used for Linux kernel code.
8104
8105@item -mcmodel=medium
8106@opindex mcmodel=medium
8107Generate code for the medium model: The program is linked in the lower 2
8108GB of the address space but symbols can be located anywhere in the
8109address space.  Programs can be statically or dynamically linked, but
8110building of shared libraries are not supported with the medium model.
8111
8112@item -mcmodel=large
8113@opindex mcmodel=large
8114Generate code for the large model: This model makes no assumptions
8115about addresses and sizes of sections.  Currently GCC does not implement
8116this model.
8117@end table
8118
8119@node HPPA Options
8120@subsection HPPA Options
8121@cindex HPPA Options
8122
8123These @samp{-m} options are defined for the HPPA family of computers:
8124
8125@table @gcctabopt
8126@item -march=@var{architecture-type}
8127@opindex march
8128Generate code for the specified architecture.  The choices for
8129@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
81301.1, and @samp{2.0} for PA 2.0 processors.  Refer to
8131@file{/usr/lib/sched.models} on an HP-UX system to determine the proper
8132architecture option for your machine.  Code compiled for lower numbered
8133architectures will run on higher numbered architectures, but not the
8134other way around.
8135
8136PA 2.0 support currently requires gas snapshot 19990413 or later.  The
8137next release of binutils (current is 2.9.1) will probably contain PA 2.0
8138support.
8139
8140@item -mpa-risc-1-0
8141@itemx -mpa-risc-1-1
8142@itemx -mpa-risc-2-0
8143@opindex mpa-risc-1-0
8144@opindex mpa-risc-1-1
8145@opindex mpa-risc-2-0
8146Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
8147
8148@item -mbig-switch
8149@opindex mbig-switch
8150Generate code suitable for big switch tables.  Use this option only if
8151the assembler/linker complain about out of range branches within a switch
8152table.
8153
8154@item -mjump-in-delay
8155@opindex mjump-in-delay
8156Fill delay slots of function calls with unconditional jump instructions
8157by modifying the return pointer for the function call to be the target
8158of the conditional jump.
8159
8160@item -mdisable-fpregs
8161@opindex mdisable-fpregs
8162Prevent floating point registers from being used in any manner.  This is
8163necessary for compiling kernels which perform lazy context switching of
8164floating point registers.  If you use this option and attempt to perform
8165floating point operations, the compiler will abort.
8166
8167@item -mdisable-indexing
8168@opindex mdisable-indexing
8169Prevent the compiler from using indexing address modes.  This avoids some
8170rather obscure problems when compiling MIG generated code under MACH@.
8171
8172@item -mno-space-regs
8173@opindex mno-space-regs
8174Generate code that assumes the target has no space registers.  This allows
8175GCC to generate faster indirect calls and use unscaled index address modes.
8176
8177Such code is suitable for level 0 PA systems and kernels.
8178
8179@item -mfast-indirect-calls
8180@opindex mfast-indirect-calls
8181Generate code that assumes calls never cross space boundaries.  This
8182allows GCC to emit code which performs faster indirect calls.
8183
8184This option will not work in the presence of shared libraries or nested
8185functions.
8186
8187@item -mlong-load-store
8188@opindex mlong-load-store
8189Generate 3-instruction load and store sequences as sometimes required by
8190the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
8191the HP compilers.
8192
8193@item -mportable-runtime
8194@opindex mportable-runtime
8195Use the portable calling conventions proposed by HP for ELF systems.
8196
8197@item -mgas
8198@opindex mgas
8199Enable the use of assembler directives only GAS understands.
8200
8201@item -mschedule=@var{cpu-type}
8202@opindex mschedule
8203Schedule code according to the constraints for the machine type
8204@var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
8205@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
8206to @file{/usr/lib/sched.models} on an HP-UX system to determine the
8207proper scheduling option for your machine.  The default scheduling is
8208@samp{8000}.
8209
8210@item -mlinker-opt
8211@opindex mlinker-opt
8212Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
8213debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
8214linkers in which they give bogus error messages when linking some programs.
8215
8216@item -msoft-float
8217@opindex msoft-float
8218Generate output containing library calls for floating point.
8219@strong{Warning:} the requisite libraries are not available for all HPPA
8220targets.  Normally the facilities of the machine's usual C compiler are
8221used, but this cannot be done directly in cross-compilation.  You must make
8222your own arrangements to provide suitable library functions for
8223cross-compilation.  The embedded target @samp{hppa1.1-*-pro}
8224does provide software floating point support.
8225
8226@option{-msoft-float} changes the calling convention in the output file;
8227therefore, it is only useful if you compile @emph{all} of a program with
8228this option.  In particular, you need to compile @file{libgcc.a}, the
8229library that comes with GCC, with @option{-msoft-float} in order for
8230this to work.
8231
8232@item -msio
8233@opindex msio
8234Generate the predefine, @code{_SIO}, for server IO.  The default is
8235@option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
8236@code{__hp9000s700__} and @code{_WSIO}, for workstation IO.  These
8237options are available under HP-UX and HI-UX.
8238
8239@item -mgnu-ld
8240@opindex gnu-ld
8241Use GNU ld specific options.  This passes @option{-shared} to ld when
8242building a shared library.  It is the default when GCC is configured,
8243explicitly or implicitly, with the GNU linker.  This option does not
8244have any affect on which ld is called, it only changes what parameters
8245are passed to that ld.  The ld that is called is determined by the
8246@option{--with-ld} configure option, gcc's program search path, and
8247finally by the user's @env{PATH}.  The linker used by GCC can be printed
8248using @samp{which `gcc -print-prog-name=ld`}.
8249
8250@item -mhp-ld
8251@opindex hp-ld
8252Use HP ld specific options.  This passes @option{-b} to ld when building
8253a shared library and passes @option{+Accept TypeMismatch} to ld on all
8254links.  It is the default when GCC is configured, explicitly or
8255implicitly, with the HP linker.  This option does not have any affect on
8256which ld is called, it only changes what parameters are passed to that
8257ld.  The ld that is called is determined by the @option{--with-ld}
8258configure option, gcc's program search path, and finally by the user's
8259@env{PATH}.  The linker used by GCC can be printed using @samp{which
8260`gcc -print-prog-name=ld`}.
8261
8262@item -mlong-calls
8263@opindex mno-long-calls
8264Generate code that uses long call sequences.  This ensures that a call
8265is always able to reach linker generated stubs.  The default is to generate
8266long calls only when the distance from the call site to the beginning
8267of the function or translation unit, as the case may be, exceeds a
8268predefined limit set by the branch type being used.  The limits for
8269normal calls are 7,600,000 and 240,000 bytes, respectively for the
8270PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
8271240,000 bytes.
8272
8273Distances are measured from the beginning of functions when using the
8274@option{-ffunction-sections} option, or when using the @option{-mgas}
8275and @option{-mno-portable-runtime} options together under HP-UX with
8276the SOM linker.
8277
8278It is normally not desirable to use this option as it will degrade
8279performance.  However, it may be useful in large applications,
8280particularly when partial linking is used to build the application.
8281
8282The types of long calls used depends on the capabilities of the
8283assembler and linker, and the type of code being generated.  The
8284impact on systems that support long absolute calls, and long pic
8285symbol-difference or pc-relative calls should be relatively small.
8286However, an indirect call is used on 32-bit ELF systems in pic code
8287and it is quite long.
8288
8289@item -nolibdld
8290@opindex nolibdld
8291Suppress the generation of link options to search libdld.sl when the
8292@option{-static} option is specified on HP-UX 10 and later.
8293
8294@item -static
8295@opindex static
8296The HP-UX implementation of setlocale in libc has a dependency on
8297libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
8298when the @option{-static} option is specified, special link options
8299are needed to resolve this dependency.
8300
8301On HP-UX 10 and later, the GCC driver adds the necessary options to
8302link with libdld.sl when the @option{-static} option is specified.
8303This causes the resulting binary to be dynamic.  On the 64-bit port,
8304the linkers generate dynamic binaries by default in any case.  The
8305@option{-nolibdld} option can be used to prevent the GCC driver from
8306adding these link options.
8307
8308@item -threads
8309@opindex threads
8310Add support for multithreading with the @dfn{dce thread} library
8311under HP-UX.  This option sets flags for both the preprocessor and
8312linker.
8313@end table
8314
8315@node Intel 960 Options
8316@subsection Intel 960 Options
8317
8318These @samp{-m} options are defined for the Intel 960 implementations:
8319
8320@table @gcctabopt
8321@item -m@var{cpu-type}
8322@opindex mka
8323@opindex mkb
8324@opindex mmc
8325@opindex mca
8326@opindex mcf
8327@opindex msa
8328@opindex msb
8329Assume the defaults for the machine type @var{cpu-type} for some of
8330the other options, including instruction scheduling, floating point
8331support, and addressing modes.  The choices for @var{cpu-type} are
8332@samp{ka}, @samp{kb}, @samp{mc}, @samp{ca}, @samp{cf},
8333@samp{sa}, and @samp{sb}.
8334The default is
8335@samp{kb}.
8336
8337@item -mnumerics
8338@itemx -msoft-float
8339@opindex mnumerics
8340@opindex msoft-float
8341The @option{-mnumerics} option indicates that the processor does support
8342floating-point instructions.  The @option{-msoft-float} option indicates
8343that floating-point support should not be assumed.
8344
8345@item -mleaf-procedures
8346@itemx -mno-leaf-procedures
8347@opindex mleaf-procedures
8348@opindex mno-leaf-procedures
8349Do (or do not) attempt to alter leaf procedures to be callable with the
8350@code{bal} instruction as well as @code{call}.  This will result in more
8351efficient code for explicit calls when the @code{bal} instruction can be
8352substituted by the assembler or linker, but less efficient code in other
8353cases, such as calls via function pointers, or using a linker that doesn't
8354support this optimization.
8355
8356@item -mtail-call
8357@itemx -mno-tail-call
8358@opindex mtail-call
8359@opindex mno-tail-call
8360Do (or do not) make additional attempts (beyond those of the
8361machine-independent portions of the compiler) to optimize tail-recursive
8362calls into branches.  You may not want to do this because the detection of
8363cases where this is not valid is not totally complete.  The default is
8364@option{-mno-tail-call}.
8365
8366@item -mcomplex-addr
8367@itemx -mno-complex-addr
8368@opindex mcomplex-addr
8369@opindex mno-complex-addr
8370Assume (or do not assume) that the use of a complex addressing mode is a
8371win on this implementation of the i960.  Complex addressing modes may not
8372be worthwhile on the K-series, but they definitely are on the C-series.
8373The default is currently @option{-mcomplex-addr} for all processors except
8374the CB and CC@.
8375
8376@item -mcode-align
8377@itemx -mno-code-align
8378@opindex mcode-align
8379@opindex mno-code-align
8380Align code to 8-byte boundaries for faster fetching (or don't bother).
8381Currently turned on by default for C-series implementations only.
8382
8383@ignore
8384@item -mclean-linkage
8385@itemx -mno-clean-linkage
8386@opindex mclean-linkage
8387@opindex mno-clean-linkage
8388These options are not fully implemented.
8389@end ignore
8390
8391@item -mic-compat
8392@itemx -mic2.0-compat
8393@itemx -mic3.0-compat
8394@opindex mic-compat
8395@opindex mic2.0-compat
8396@opindex mic3.0-compat
8397Enable compatibility with iC960 v2.0 or v3.0.
8398
8399@item -masm-compat
8400@itemx -mintel-asm
8401@opindex masm-compat
8402@opindex mintel-asm
8403Enable compatibility with the iC960 assembler.
8404
8405@item -mstrict-align
8406@itemx -mno-strict-align
8407@opindex mstrict-align
8408@opindex mno-strict-align
8409Do not permit (do permit) unaligned accesses.
8410
8411@item -mold-align
8412@opindex mold-align
8413Enable structure-alignment compatibility with Intel's gcc release version
84141.3 (based on gcc 1.37).  This option implies @option{-mstrict-align}.
8415
8416@item -mlong-double-64
8417@opindex mlong-double-64
8418Implement type @samp{long double} as 64-bit floating point numbers.
8419Without the option @samp{long double} is implemented by 80-bit
8420floating point numbers.  The only reason we have it because there is
8421no 128-bit @samp{long double} support in @samp{fp-bit.c} yet.  So it
8422is only useful for people using soft-float targets.  Otherwise, we
8423should recommend against use of it.
8424
8425@end table
8426
8427@node DEC Alpha Options
8428@subsection DEC Alpha Options
8429
8430These @samp{-m} options are defined for the DEC Alpha implementations:
8431
8432@table @gcctabopt
8433@item -mno-soft-float
8434@itemx -msoft-float
8435@opindex mno-soft-float
8436@opindex msoft-float
8437Use (do not use) the hardware floating-point instructions for
8438floating-point operations.  When @option{-msoft-float} is specified,
8439functions in @file{libgcc.a} will be used to perform floating-point
8440operations.  Unless they are replaced by routines that emulate the
8441floating-point operations, or compiled in such a way as to call such
8442emulations routines, these routines will issue floating-point
8443operations.   If you are compiling for an Alpha without floating-point
8444operations, you must ensure that the library is built so as not to call
8445them.
8446
8447Note that Alpha implementations without floating-point operations are
8448required to have floating-point registers.
8449
8450@item -mfp-reg
8451@itemx -mno-fp-regs
8452@opindex mfp-reg
8453@opindex mno-fp-regs
8454Generate code that uses (does not use) the floating-point register set.
8455@option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
8456register set is not used, floating point operands are passed in integer
8457registers as if they were integers and floating-point results are passed
8458in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
8459so any function with a floating-point argument or return value called by code
8460compiled with @option{-mno-fp-regs} must also be compiled with that
8461option.
8462
8463A typical use of this option is building a kernel that does not use,
8464and hence need not save and restore, any floating-point registers.
8465
8466@item -mieee
8467@opindex mieee
8468The Alpha architecture implements floating-point hardware optimized for
8469maximum performance.  It is mostly compliant with the IEEE floating
8470point standard.  However, for full compliance, software assistance is
8471required.  This option generates code fully IEEE compliant code
8472@emph{except} that the @var{inexact-flag} is not maintained (see below).
8473If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
8474defined during compilation.  The resulting code is less efficient but is
8475able to correctly support denormalized numbers and exceptional IEEE
8476values such as not-a-number and plus/minus infinity.  Other Alpha
8477compilers call this option @option{-ieee_with_no_inexact}.
8478
8479@item -mieee-with-inexact
8480@opindex mieee-with-inexact
8481This is like @option{-mieee} except the generated code also maintains
8482the IEEE @var{inexact-flag}.  Turning on this option causes the
8483generated code to implement fully-compliant IEEE math.  In addition to
8484@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
8485macro.  On some Alpha implementations the resulting code may execute
8486significantly slower than the code generated by default.  Since there is
8487very little code that depends on the @var{inexact-flag}, you should
8488normally not specify this option.  Other Alpha compilers call this
8489option @option{-ieee_with_inexact}.
8490
8491@item -mfp-trap-mode=@var{trap-mode}
8492@opindex mfp-trap-mode
8493This option controls what floating-point related traps are enabled.
8494Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
8495The trap mode can be set to one of four values:
8496
8497@table @samp
8498@item n
8499This is the default (normal) setting.  The only traps that are enabled
8500are the ones that cannot be disabled in software (e.g., division by zero
8501trap).
8502
8503@item u
8504In addition to the traps enabled by @samp{n}, underflow traps are enabled
8505as well.
8506
8507@item su
8508Like @samp{su}, but the instructions are marked to be safe for software
8509completion (see Alpha architecture manual for details).
8510
8511@item sui
8512Like @samp{su}, but inexact traps are enabled as well.
8513@end table
8514
8515@item -mfp-rounding-mode=@var{rounding-mode}
8516@opindex mfp-rounding-mode
8517Selects the IEEE rounding mode.  Other Alpha compilers call this option
8518@option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
8519of:
8520
8521@table @samp
8522@item n
8523Normal IEEE rounding mode.  Floating point numbers are rounded towards
8524the nearest machine number or towards the even machine number in case
8525of a tie.
8526
8527@item m
8528Round towards minus infinity.
8529
8530@item c
8531Chopped rounding mode.  Floating point numbers are rounded towards zero.
8532
8533@item d
8534Dynamic rounding mode.  A field in the floating point control register
8535(@var{fpcr}, see Alpha architecture reference manual) controls the
8536rounding mode in effect.  The C library initializes this register for
8537rounding towards plus infinity.  Thus, unless your program modifies the
8538@var{fpcr}, @samp{d} corresponds to round towards plus infinity.
8539@end table
8540
8541@item -mtrap-precision=@var{trap-precision}
8542@opindex mtrap-precision
8543In the Alpha architecture, floating point traps are imprecise.  This
8544means without software assistance it is impossible to recover from a
8545floating trap and program execution normally needs to be terminated.
8546GCC can generate code that can assist operating system trap handlers
8547in determining the exact location that caused a floating point trap.
8548Depending on the requirements of an application, different levels of
8549precisions can be selected:
8550
8551@table @samp
8552@item p
8553Program precision.  This option is the default and means a trap handler
8554can only identify which program caused a floating point exception.
8555
8556@item f
8557Function precision.  The trap handler can determine the function that
8558caused a floating point exception.
8559
8560@item i
8561Instruction precision.  The trap handler can determine the exact
8562instruction that caused a floating point exception.
8563@end table
8564
8565Other Alpha compilers provide the equivalent options called
8566@option{-scope_safe} and @option{-resumption_safe}.
8567
8568@item -mieee-conformant
8569@opindex mieee-conformant
8570This option marks the generated code as IEEE conformant.  You must not
8571use this option unless you also specify @option{-mtrap-precision=i} and either
8572@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
8573is to emit the line @samp{.eflag 48} in the function prologue of the
8574generated assembly file.  Under DEC Unix, this has the effect that
8575IEEE-conformant math library routines will be linked in.
8576
8577@item -mbuild-constants
8578@opindex mbuild-constants
8579Normally GCC examines a 32- or 64-bit integer constant to
8580see if it can construct it from smaller constants in two or three
8581instructions.  If it cannot, it will output the constant as a literal and
8582generate code to load it from the data segment at runtime.
8583
8584Use this option to require GCC to construct @emph{all} integer constants
8585using code, even if it takes more instructions (the maximum is six).
8586
8587You would typically use this option to build a shared library dynamic
8588loader.  Itself a shared library, it must relocate itself in memory
8589before it can find the variables and constants in its own data segment.
8590
8591@item -malpha-as
8592@itemx -mgas
8593@opindex malpha-as
8594@opindex mgas
8595Select whether to generate code to be assembled by the vendor-supplied
8596assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
8597
8598@item -mbwx
8599@itemx -mno-bwx
8600@itemx -mcix
8601@itemx -mno-cix
8602@itemx -mfix
8603@itemx -mno-fix
8604@itemx -mmax
8605@itemx -mno-max
8606@opindex mbwx
8607@opindex mno-bwx
8608@opindex mcix
8609@opindex mno-cix
8610@opindex mfix
8611@opindex mno-fix
8612@opindex mmax
8613@opindex mno-max
8614Indicate whether GCC should generate code to use the optional BWX,
8615CIX, FIX and MAX instruction sets.  The default is to use the instruction
8616sets supported by the CPU type specified via @option{-mcpu=} option or that
8617of the CPU on which GCC was built if none was specified.
8618
8619@item -mfloat-vax
8620@itemx -mfloat-ieee
8621@opindex mfloat-vax
8622@opindex mfloat-ieee
8623Generate code that uses (does not use) VAX F and G floating point
8624arithmetic instead of IEEE single and double precision.
8625
8626@item -mexplicit-relocs
8627@itemx -mno-explicit-relocs
8628@opindex mexplicit-relocs
8629@opindex mno-explicit-relocs
8630Older Alpha assemblers provided no way to generate symbol relocations
8631except via assembler macros.  Use of these macros does not allow
8632optimal instruction scheduling.  GNU binutils as of version 2.12
8633supports a new syntax that allows the compiler to explicitly mark
8634which relocations should apply to which instructions.  This option
8635is mostly useful for debugging, as GCC detects the capabilities of
8636the assembler when it is built and sets the default accordingly.
8637
8638@item -msmall-data
8639@itemx -mlarge-data
8640@opindex msmall-data
8641@opindex mlarge-data
8642When @option{-mexplicit-relocs} is in effect, static data is
8643accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
8644is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
8645(the @code{.sdata} and @code{.sbss} sections) and are accessed via
864616-bit relocations off of the @code{$gp} register.  This limits the
8647size of the small data area to 64KB, but allows the variables to be
8648directly accessed via a single instruction.
8649
8650The default is @option{-mlarge-data}.  With this option the data area
8651is limited to just below 2GB.  Programs that require more than 2GB of
8652data must use @code{malloc} or @code{mmap} to allocate the data in the
8653heap instead of in the program's data segment.
8654
8655When generating code for shared libraries, @option{-fpic} implies
8656@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
8657
8658@item -mcpu=@var{cpu_type}
8659@opindex mcpu
8660Set the instruction set and instruction scheduling parameters for
8661machine type @var{cpu_type}.  You can specify either the @samp{EV}
8662style name or the corresponding chip number.  GCC supports scheduling
8663parameters for the EV4, EV5 and EV6 family of processors and will
8664choose the default values for the instruction set from the processor
8665you specify.  If you do not specify a processor type, GCC will default
8666to the processor on which the compiler was built.
8667
8668Supported values for @var{cpu_type} are
8669
8670@table @samp
8671@item ev4
8672@itemx ev45
8673@itemx 21064
8674Schedules as an EV4 and has no instruction set extensions.
8675
8676@item ev5
8677@itemx 21164
8678Schedules as an EV5 and has no instruction set extensions.
8679
8680@item ev56
8681@itemx 21164a
8682Schedules as an EV5 and supports the BWX extension.
8683
8684@item pca56
8685@itemx 21164pc
8686@itemx 21164PC
8687Schedules as an EV5 and supports the BWX and MAX extensions.
8688
8689@item ev6
8690@itemx 21264
8691Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
8692
8693@item ev67
8694@itemx 21264a
8695Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
8696@end table
8697
8698@item -mtune=@var{cpu_type}
8699@opindex mtune
8700Set only the instruction scheduling parameters for machine type
8701@var{cpu_type}.  The instruction set is not changed.
8702
8703@item -mmemory-latency=@var{time}
8704@opindex mmemory-latency
8705Sets the latency the scheduler should assume for typical memory
8706references as seen by the application.  This number is highly
8707dependent on the memory access patterns used by the application
8708and the size of the external cache on the machine.
8709
8710Valid options for @var{time} are
8711
8712@table @samp
8713@item @var{number}
8714A decimal number representing clock cycles.
8715
8716@item L1
8717@itemx L2
8718@itemx L3
8719@itemx main
8720The compiler contains estimates of the number of clock cycles for
8721``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
8722(also called Dcache, Scache, and Bcache), as well as to main memory.
8723Note that L3 is only valid for EV5.
8724
8725@end table
8726@end table
8727
8728@node DEC Alpha/VMS Options
8729@subsection DEC Alpha/VMS Options
8730
8731These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
8732
8733@table @gcctabopt
8734@item -mvms-return-codes
8735@opindex mvms-return-codes
8736Return VMS condition codes from main.  The default is to return POSIX
8737style condition (e.g.@ error) codes.
8738@end table
8739
8740@node H8/300 Options
8741@subsection H8/300 Options
8742
8743These @samp{-m} options are defined for the H8/300 implementations:
8744
8745@table @gcctabopt
8746@item -mrelax
8747@opindex mrelax
8748Shorten some address references at link time, when possible; uses the
8749linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
8750ld, Using ld}, for a fuller description.
8751
8752@item -mh
8753@opindex mh
8754Generate code for the H8/300H@.
8755
8756@item -ms
8757@opindex ms
8758Generate code for the H8S@.
8759
8760@item -mn
8761@opindex mn
8762Generate code for the H8S and H8/300H in the normal mode.  This switch
8763must be used either with -mh or -ms.
8764
8765@item -ms2600
8766@opindex ms2600
8767Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
8768
8769@item -mint32
8770@opindex mint32
8771Make @code{int} data 32 bits by default.
8772
8773@item -malign-300
8774@opindex malign-300
8775On the H8/300H and H8S, use the same alignment rules as for the H8/300.
8776The default for the H8/300H and H8S is to align longs and floats on 4
8777byte boundaries.
8778@option{-malign-300} causes them to be aligned on 2 byte boundaries.
8779This option has no effect on the H8/300.
8780@end table
8781
8782@node SH Options
8783@subsection SH Options
8784
8785These @samp{-m} options are defined for the SH implementations:
8786
8787@table @gcctabopt
8788@item -m1
8789@opindex m1
8790Generate code for the SH1.
8791
8792@item -m2
8793@opindex m2
8794Generate code for the SH2.
8795
8796@item -m3
8797@opindex m3
8798Generate code for the SH3.
8799
8800@item -m3e
8801@opindex m3e
8802Generate code for the SH3e.
8803
8804@item -m4-nofpu
8805@opindex m4-nofpu
8806Generate code for the SH4 without a floating-point unit.
8807
8808@item -m4-single-only
8809@opindex m4-single-only
8810Generate code for the SH4 with a floating-point unit that only
8811supports single-precision arithmetic.
8812
8813@item -m4-single
8814@opindex m4-single
8815Generate code for the SH4 assuming the floating-point unit is in
8816single-precision mode by default.
8817
8818@item -m4
8819@opindex m4
8820Generate code for the SH4.
8821
8822@item -mb
8823@opindex mb
8824Compile code for the processor in big endian mode.
8825
8826@item -ml
8827@opindex ml
8828Compile code for the processor in little endian mode.
8829
8830@item -mdalign
8831@opindex mdalign
8832Align doubles at 64-bit boundaries.  Note that this changes the calling
8833conventions, and thus some functions from the standard C library will
8834not work unless you recompile it first with @option{-mdalign}.
8835
8836@item -mrelax
8837@opindex mrelax
8838Shorten some address references at link time, when possible; uses the
8839linker option @option{-relax}.
8840
8841@item -mbigtable
8842@opindex mbigtable
8843Use 32-bit offsets in @code{switch} tables.  The default is to use
884416-bit offsets.
8845
8846@item -mfmovd
8847@opindex mfmovd
8848Enable the use of the instruction @code{fmovd}.
8849
8850@item -mhitachi
8851@opindex mhitachi
8852Comply with the calling conventions defined by Renesas.
8853
8854@item -mnomacsave
8855@opindex mnomacsave
8856Mark the @code{MAC} register as call-clobbered, even if
8857@option{-mhitachi} is given.
8858
8859@item -mieee
8860@opindex mieee
8861Increase IEEE-compliance of floating-point code.
8862
8863@item -misize
8864@opindex misize
8865Dump instruction size and location in the assembly code.
8866
8867@item -mpadstruct
8868@opindex mpadstruct
8869This option is deprecated.  It pads structures to multiple of 4 bytes,
8870which is incompatible with the SH ABI@.
8871
8872@item -mspace
8873@opindex mspace
8874Optimize for space instead of speed.  Implied by @option{-Os}.
8875
8876@item -mprefergot
8877@opindex mprefergot
8878When generating position-independent code, emit function calls using
8879the Global Offset Table instead of the Procedure Linkage Table.
8880
8881@item -musermode
8882@opindex musermode
8883Generate a library function call to invalidate instruction cache
8884entries, after fixing up a trampoline.  This library function call
8885doesn't assume it can write to the whole memory address space.  This
8886is the default when the target is @code{sh-*-linux*}.
8887@end table
8888
8889@node System V Options
8890@subsection Options for System V
8891
8892These additional options are available on System V Release 4 for
8893compatibility with other compilers on those systems:
8894
8895@table @gcctabopt
8896@item -G
8897@opindex G
8898Create a shared object.
8899It is recommended that @option{-symbolic} or @option{-shared} be used instead.
8900
8901@item -Qy
8902@opindex Qy
8903Identify the versions of each tool used by the compiler, in a
8904@code{.ident} assembler directive in the output.
8905
8906@item -Qn
8907@opindex Qn
8908Refrain from adding @code{.ident} directives to the output file (this is
8909the default).
8910
8911@item -YP,@var{dirs}
8912@opindex YP
8913Search the directories @var{dirs}, and no others, for libraries
8914specified with @option{-l}.
8915
8916@item -Ym,@var{dir}
8917@opindex Ym
8918Look in the directory @var{dir} to find the M4 preprocessor.
8919The assembler uses this option.
8920@c This is supposed to go with a -Yd for predefined M4 macro files, but
8921@c the generic assembler that comes with Solaris takes just -Ym.
8922@end table
8923
8924@node TMS320C3x/C4x Options
8925@subsection TMS320C3x/C4x Options
8926@cindex TMS320C3x/C4x Options
8927
8928These @samp{-m} options are defined for TMS320C3x/C4x implementations:
8929
8930@table @gcctabopt
8931
8932@item -mcpu=@var{cpu_type}
8933@opindex mcpu
8934Set the instruction set, register set, and instruction scheduling
8935parameters for machine type @var{cpu_type}.  Supported values for
8936@var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
8937@samp{c44}.  The default is @samp{c40} to generate code for the
8938TMS320C40.
8939
8940@item -mbig-memory
8941@itemx -mbig
8942@itemx -msmall-memory
8943@itemx -msmall
8944@opindex mbig-memory
8945@opindex mbig
8946@opindex msmall-memory
8947@opindex msmall
8948Generates code for the big or small memory model.  The small memory
8949model assumed that all data fits into one 64K word page.  At run-time
8950the data page (DP) register must be set to point to the 64K page
8951containing the .bss and .data program sections.  The big memory model is
8952the default and requires reloading of the DP register for every direct
8953memory access.
8954
8955@item -mbk
8956@itemx -mno-bk
8957@opindex mbk
8958@opindex mno-bk
8959Allow (disallow) allocation of general integer operands into the block
8960count register BK@.
8961
8962@item -mdb
8963@itemx -mno-db
8964@opindex mdb
8965@opindex mno-db
8966Enable (disable) generation of code using decrement and branch,
8967DBcond(D), instructions.  This is enabled by default for the C4x.  To be
8968on the safe side, this is disabled for the C3x, since the maximum
8969iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than
8970@math{2^{23}} times on the C3x?).  Note that GCC will try to reverse a loop so
8971that it can utilize the decrement and branch instruction, but will give
8972up if there is more than one memory reference in the loop.  Thus a loop
8973where the loop counter is decremented can generate slightly more
8974efficient code, in cases where the RPTB instruction cannot be utilized.
8975
8976@item -mdp-isr-reload
8977@itemx -mparanoid
8978@opindex mdp-isr-reload
8979@opindex mparanoid
8980Force the DP register to be saved on entry to an interrupt service
8981routine (ISR), reloaded to point to the data section, and restored on
8982exit from the ISR@.  This should not be required unless someone has
8983violated the small memory model by modifying the DP register, say within
8984an object library.
8985
8986@item -mmpyi
8987@itemx -mno-mpyi
8988@opindex mmpyi
8989@opindex mno-mpyi
8990For the C3x use the 24-bit MPYI instruction for integer multiplies
8991instead of a library call to guarantee 32-bit results.  Note that if one
8992of the operands is a constant, then the multiplication will be performed
8993using shifts and adds.  If the @option{-mmpyi} option is not specified for the C3x,
8994then squaring operations are performed inline instead of a library call.
8995
8996@item -mfast-fix
8997@itemx -mno-fast-fix
8998@opindex mfast-fix
8999@opindex mno-fast-fix
9000The C3x/C4x FIX instruction to convert a floating point value to an
9001integer value chooses the nearest integer less than or equal to the
9002floating point value rather than to the nearest integer.  Thus if the
9003floating point number is negative, the result will be incorrectly
9004truncated an additional code is necessary to detect and correct this
9005case.  This option can be used to disable generation of the additional
9006code required to correct the result.
9007
9008@item -mrptb
9009@itemx -mno-rptb
9010@opindex mrptb
9011@opindex mno-rptb
9012Enable (disable) generation of repeat block sequences using the RPTB
9013instruction for zero overhead looping.  The RPTB construct is only used
9014for innermost loops that do not call functions or jump across the loop
9015boundaries.  There is no advantage having nested RPTB loops due to the
9016overhead required to save and restore the RC, RS, and RE registers.
9017This is enabled by default with @option{-O2}.
9018
9019@item -mrpts=@var{count}
9020@itemx -mno-rpts
9021@opindex mrpts
9022@opindex mno-rpts
9023Enable (disable) the use of the single instruction repeat instruction
9024RPTS@.  If a repeat block contains a single instruction, and the loop
9025count can be guaranteed to be less than the value @var{count}, GCC will
9026emit a RPTS instruction instead of a RPTB@.  If no value is specified,
9027then a RPTS will be emitted even if the loop count cannot be determined
9028at compile time.  Note that the repeated instruction following RPTS does
9029not have to be reloaded from memory each iteration, thus freeing up the
9030CPU buses for operands.  However, since interrupts are blocked by this
9031instruction, it is disabled by default.
9032
9033@item -mloop-unsigned
9034@itemx -mno-loop-unsigned
9035@opindex mloop-unsigned
9036@opindex mno-loop-unsigned
9037The maximum iteration count when using RPTS and RPTB (and DB on the C40)
9038is @math{2^{31} + 1} since these instructions test if the iteration count is
9039negative to terminate the loop.  If the iteration count is unsigned
9040there is a possibility than the @math{2^{31} + 1} maximum iteration count may be
9041exceeded.  This switch allows an unsigned iteration count.
9042
9043@item -mti
9044@opindex mti
9045Try to emit an assembler syntax that the TI assembler (asm30) is happy
9046with.  This also enforces compatibility with the API employed by the TI
9047C3x C compiler.  For example, long doubles are passed as structures
9048rather than in floating point registers.
9049
9050@item -mregparm
9051@itemx -mmemparm
9052@opindex mregparm
9053@opindex mmemparm
9054Generate code that uses registers (stack) for passing arguments to functions.
9055By default, arguments are passed in registers where possible rather
9056than by pushing arguments on to the stack.
9057
9058@item -mparallel-insns
9059@itemx -mno-parallel-insns
9060@opindex mparallel-insns
9061@opindex mno-parallel-insns
9062Allow the generation of parallel instructions.  This is enabled by
9063default with @option{-O2}.
9064
9065@item -mparallel-mpy
9066@itemx -mno-parallel-mpy
9067@opindex mparallel-mpy
9068@opindex mno-parallel-mpy
9069Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
9070provided @option{-mparallel-insns} is also specified.  These instructions have
9071tight register constraints which can pessimize the code generation
9072of large functions.
9073
9074@end table
9075
9076@node V850 Options
9077@subsection V850 Options
9078@cindex V850 Options
9079
9080These @samp{-m} options are defined for V850 implementations:
9081
9082@table @gcctabopt
9083@item -mlong-calls
9084@itemx -mno-long-calls
9085@opindex mlong-calls
9086@opindex mno-long-calls
9087Treat all calls as being far away (near).  If calls are assumed to be
9088far away, the compiler will always load the functions address up into a
9089register, and call indirect through the pointer.
9090
9091@item -mno-ep
9092@itemx -mep
9093@opindex mno-ep
9094@opindex mep
9095Do not optimize (do optimize) basic blocks that use the same index
9096pointer 4 or more times to copy pointer into the @code{ep} register, and
9097use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
9098option is on by default if you optimize.
9099
9100@item -mno-prolog-function
9101@itemx -mprolog-function
9102@opindex mno-prolog-function
9103@opindex mprolog-function
9104Do not use (do use) external functions to save and restore registers
9105at the prologue and epilogue of a function.  The external functions
9106are slower, but use less code space if more than one function saves
9107the same number of registers.  The @option{-mprolog-function} option
9108is on by default if you optimize.
9109
9110@item -mspace
9111@opindex mspace
9112Try to make the code as small as possible.  At present, this just turns
9113on the @option{-mep} and @option{-mprolog-function} options.
9114
9115@item -mtda=@var{n}
9116@opindex mtda
9117Put static or global variables whose size is @var{n} bytes or less into
9118the tiny data area that register @code{ep} points to.  The tiny data
9119area can hold up to 256 bytes in total (128 bytes for byte references).
9120
9121@item -msda=@var{n}
9122@opindex msda
9123Put static or global variables whose size is @var{n} bytes or less into
9124the small data area that register @code{gp} points to.  The small data
9125area can hold up to 64 kilobytes.
9126
9127@item -mzda=@var{n}
9128@opindex mzda
9129Put static or global variables whose size is @var{n} bytes or less into
9130the first 32 kilobytes of memory.
9131
9132@item -mv850
9133@opindex mv850
9134Specify that the target processor is the V850.
9135
9136@item -mbig-switch
9137@opindex mbig-switch
9138Generate code suitable for big switch tables.  Use this option only if
9139the assembler/linker complain about out of range branches within a switch
9140table.
9141
9142@item -mapp-regs
9143@opindex mapp-regs
9144This option will cause r2 and r5 to be used in the code generated by
9145the compiler.  This setting is the default.
9146
9147@item -mno-app-regs
9148@opindex mno-app-regs
9149This option will cause r2 and r5 to be treated as fixed registers.
9150
9151@item -mv850e
9152@opindex mv850e
9153Specify that the target processor is the V850E.  The preprocessor
9154constant @samp{__v850e__} will be defined if this option is used.
9155
9156If neither @option{-mv850} nor @option{-mv850e} are defined
9157then a default target processor will be chosen and the relevant
9158@samp{__v850*__} preprocessor constant will be defined.
9159
9160The preprocessor constants @samp{__v850} and @samp{__v851__} are always
9161defined, regardless of which processor variant is the target.
9162
9163@item -mdisable-callt
9164@opindex mdisable-callt
9165This option will suppress generation of the CALLT instruction for the
9166v850e flavors of the v850 architecture.  The default is
9167@option{-mno-disable-callt} which allows the CALLT instruction to be used.
9168
9169@end table
9170
9171@node ARC Options
9172@subsection ARC Options
9173@cindex ARC Options
9174
9175These options are defined for ARC implementations:
9176
9177@table @gcctabopt
9178@item -EL
9179@opindex EL
9180Compile code for little endian mode.  This is the default.
9181
9182@item -EB
9183@opindex EB
9184Compile code for big endian mode.
9185
9186@item -mmangle-cpu
9187@opindex mmangle-cpu
9188Prepend the name of the cpu to all public symbol names.
9189In multiple-processor systems, there are many ARC variants with different
9190instruction and register set characteristics.  This flag prevents code
9191compiled for one cpu to be linked with code compiled for another.
9192No facility exists for handling variants that are ``almost identical''.
9193This is an all or nothing option.
9194
9195@item -mcpu=@var{cpu}
9196@opindex mcpu
9197Compile code for ARC variant @var{cpu}.
9198Which variants are supported depend on the configuration.
9199All variants support @option{-mcpu=base}, this is the default.
9200
9201@item -mtext=@var{text-section}
9202@itemx -mdata=@var{data-section}
9203@itemx -mrodata=@var{readonly-data-section}
9204@opindex mtext
9205@opindex mdata
9206@opindex mrodata
9207Put functions, data, and readonly data in @var{text-section},
9208@var{data-section}, and @var{readonly-data-section} respectively
9209by default.  This can be overridden with the @code{section} attribute.
9210@xref{Variable Attributes}.
9211
9212@end table
9213
9214@node NS32K Options
9215@subsection NS32K Options
9216@cindex NS32K options
9217
9218These are the @samp{-m} options defined for the 32000 series.  The default
9219values for these options depends on which style of 32000 was selected when
9220the compiler was configured; the defaults for the most common choices are
9221given below.
9222
9223@table @gcctabopt
9224@item -m32032
9225@itemx -m32032
9226@opindex m32032
9227@opindex m32032
9228Generate output for a 32032.  This is the default
9229when the compiler is configured for 32032 and 32016 based systems.
9230
9231@item -m32332
9232@itemx -m32332
9233@opindex m32332
9234@opindex m32332
9235Generate output for a 32332.  This is the default
9236when the compiler is configured for 32332-based systems.
9237
9238@item -m32532
9239@itemx -m32532
9240@opindex m32532
9241@opindex m32532
9242Generate output for a 32532.  This is the default
9243when the compiler is configured for 32532-based systems.
9244
9245@item -m32081
9246@opindex m32081
9247Generate output containing 32081 instructions for floating point.
9248This is the default for all systems.
9249
9250@item -m32381
9251@opindex m32381
9252Generate output containing 32381 instructions for floating point.  This
9253also implies @option{-m32081}.  The 32381 is only compatible with the 32332
9254and 32532 cpus.  This is the default for the pc532-netbsd configuration.
9255
9256@item -mmulti-add
9257@opindex mmulti-add
9258Try and generate multiply-add floating point instructions @code{polyF}
9259and @code{dotF}.  This option is only available if the @option{-m32381}
9260option is in effect.  Using these instructions requires changes to
9261register allocation which generally has a negative impact on
9262performance.  This option should only be enabled when compiling code
9263particularly likely to make heavy use of multiply-add instructions.
9264
9265@item -mnomulti-add
9266@opindex mnomulti-add
9267Do not try and generate multiply-add floating point instructions
9268@code{polyF} and @code{dotF}.  This is the default on all platforms.
9269
9270@item -msoft-float
9271@opindex msoft-float
9272Generate output containing library calls for floating point.
9273@strong{Warning:} the requisite libraries may not be available.
9274
9275@item -mieee-compare
9276@itemx -mno-ieee-compare
9277@opindex mieee-compare
9278@opindex mno-ieee-compare
9279Control whether or not the compiler uses IEEE floating point
9280comparisons.  These handle correctly the case where the result of a
9281comparison is unordered.
9282@strong{Warning:} the requisite kernel support may not be available.
9283
9284@item -mnobitfield
9285@opindex mnobitfield
9286Do not use the bit-field instructions.  On some machines it is faster to
9287use shifting and masking operations.  This is the default for the pc532.
9288
9289@item -mbitfield
9290@opindex mbitfield
9291Do use the bit-field instructions.  This is the default for all platforms
9292except the pc532.
9293
9294@item -mrtd
9295@opindex mrtd
9296Use a different function-calling convention, in which functions
9297that take a fixed number of arguments return pop their
9298arguments on return with the @code{ret} instruction.
9299
9300This calling convention is incompatible with the one normally
9301used on Unix, so you cannot use it if you need to call libraries
9302compiled with the Unix compiler.
9303
9304Also, you must provide function prototypes for all functions that
9305take variable numbers of arguments (including @code{printf});
9306otherwise incorrect code will be generated for calls to those
9307functions.
9308
9309In addition, seriously incorrect code will result if you call a
9310function with too many arguments.  (Normally, extra arguments are
9311harmlessly ignored.)
9312
9313This option takes its name from the 680x0 @code{rtd} instruction.
9314
9315
9316@item -mregparam
9317@opindex mregparam
9318Use a different function-calling convention where the first two arguments
9319are passed in registers.
9320
9321This calling convention is incompatible with the one normally
9322used on Unix, so you cannot use it if you need to call libraries
9323compiled with the Unix compiler.
9324
9325@item -mnoregparam
9326@opindex mnoregparam
9327Do not pass any arguments in registers.  This is the default for all
9328targets.
9329
9330@item -msb
9331@opindex msb
9332It is OK to use the sb as an index register which is always loaded with
9333zero.  This is the default for the pc532-netbsd target.
9334
9335@item -mnosb
9336@opindex mnosb
9337The sb register is not available for use or has not been initialized to
9338zero by the run time system.  This is the default for all targets except
9339the pc532-netbsd.  It is also implied whenever @option{-mhimem} or
9340@option{-fpic} is set.
9341
9342@item -mhimem
9343@opindex mhimem
9344Many ns32000 series addressing modes use displacements of up to 512MB@.
9345If an address is above 512MB then displacements from zero can not be used.
9346This option causes code to be generated which can be loaded above 512MB@.
9347This may be useful for operating systems or ROM code.
9348
9349@item -mnohimem
9350@opindex mnohimem
9351Assume code will be loaded in the first 512MB of virtual address space.
9352This is the default for all platforms.
9353
9354
9355@end table
9356
9357@node AVR Options
9358@subsection AVR Options
9359@cindex AVR Options
9360
9361These options are defined for AVR implementations:
9362
9363@table @gcctabopt
9364@item -mmcu=@var{mcu}
9365@opindex mmcu
9366Specify ATMEL AVR instruction set or MCU type.
9367
9368Instruction set avr1 is for the minimal AVR core, not supported by the C
9369compiler, only for assembler programs (MCU types: at90s1200, attiny10,
9370attiny11, attiny12, attiny15, attiny28).
9371
9372Instruction set avr2 (default) is for the classic AVR core with up to
93738K program memory space (MCU types: at90s2313, at90s2323, attiny22,
9374at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
9375at90c8534, at90s8535).
9376
9377Instruction set avr3 is for the classic AVR core with up to 128K program
9378memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
9379
9380Instruction set avr4 is for the enhanced AVR core with up to 8K program
9381memory space (MCU types: atmega8, atmega83, atmega85).
9382
9383Instruction set avr5 is for the enhanced AVR core with up to 128K program
9384memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
9385atmega64, atmega128, at43usb355, at94k).
9386
9387@item -msize
9388@opindex msize
9389Output instruction sizes to the asm file.
9390
9391@item -minit-stack=@var{N}
9392@opindex minit-stack
9393Specify the initial stack address, which may be a symbol or numeric value,
9394@samp{__stack} is the default.
9395
9396@item -mno-interrupts
9397@opindex mno-interrupts
9398Generated code is not compatible with hardware interrupts.
9399Code size will be smaller.
9400
9401@item -mcall-prologues
9402@opindex mcall-prologues
9403Functions prologues/epilogues expanded as call to appropriate
9404subroutines.  Code size will be smaller.
9405
9406@item -mno-tablejump
9407@opindex mno-tablejump
9408Do not generate tablejump insns which sometimes increase code size.
9409
9410@item -mtiny-stack
9411@opindex mtiny-stack
9412Change only the low 8 bits of the stack pointer.
9413@end table
9414
9415@node MCore Options
9416@subsection MCore Options
9417@cindex MCore options
9418
9419These are the @samp{-m} options defined for the Motorola M*Core
9420processors.
9421
9422@table @gcctabopt
9423
9424@item -mhardlit
9425@itemx -mno-hardlit
9426@opindex mhardlit
9427@opindex mno-hardlit
9428Inline constants into the code stream if it can be done in two
9429instructions or less.
9430
9431@item -mdiv
9432@itemx -mno-div
9433@opindex mdiv
9434@opindex mno-div
9435Use the divide instruction.  (Enabled by default).
9436
9437@item -mrelax-immediate
9438@itemx -mno-relax-immediate
9439@opindex mrelax-immediate
9440@opindex mno-relax-immediate
9441Allow arbitrary sized immediates in bit operations.
9442
9443@item -mwide-bitfields
9444@itemx -mno-wide-bitfields
9445@opindex mwide-bitfields
9446@opindex mno-wide-bitfields
9447Always treat bit-fields as int-sized.
9448
9449@item -m4byte-functions
9450@itemx -mno-4byte-functions
9451@opindex m4byte-functions
9452@opindex mno-4byte-functions
9453Force all functions to be aligned to a four byte boundary.
9454
9455@item -mcallgraph-data
9456@itemx -mno-callgraph-data
9457@opindex mcallgraph-data
9458@opindex mno-callgraph-data
9459Emit callgraph information.
9460
9461@item -mslow-bytes
9462@itemx -mno-slow-bytes
9463@opindex mslow-bytes
9464@opindex mno-slow-bytes
9465Prefer word access when reading byte quantities.
9466
9467@item -mlittle-endian
9468@itemx -mbig-endian
9469@opindex mlittle-endian
9470@opindex mbig-endian
9471Generate code for a little endian target.
9472
9473@item -m210
9474@itemx -m340
9475@opindex m210
9476@opindex m340
9477Generate code for the 210 processor.
9478@end table
9479
9480@node IA-64 Options
9481@subsection IA-64 Options
9482@cindex IA-64 Options
9483
9484These are the @samp{-m} options defined for the Intel IA-64 architecture.
9485
9486@table @gcctabopt
9487@item -mbig-endian
9488@opindex mbig-endian
9489Generate code for a big endian target.  This is the default for HP-UX@.
9490
9491@item -mlittle-endian
9492@opindex mlittle-endian
9493Generate code for a little endian target.  This is the default for AIX5
9494and Linux.
9495
9496@item -mgnu-as
9497@itemx -mno-gnu-as
9498@opindex mgnu-as
9499@opindex mno-gnu-as
9500Generate (or don't) code for the GNU assembler.  This is the default.
9501@c Also, this is the default if the configure option @option{--with-gnu-as}
9502@c is used.
9503
9504@item -mgnu-ld
9505@itemx -mno-gnu-ld
9506@opindex mgnu-ld
9507@opindex mno-gnu-ld
9508Generate (or don't) code for the GNU linker.  This is the default.
9509@c Also, this is the default if the configure option @option{--with-gnu-ld}
9510@c is used.
9511
9512@item -mno-pic
9513@opindex mno-pic
9514Generate code that does not use a global pointer register.  The result
9515is not position independent code, and violates the IA-64 ABI@.
9516
9517@item -mvolatile-asm-stop
9518@itemx -mno-volatile-asm-stop
9519@opindex mvolatile-asm-stop
9520@opindex mno-volatile-asm-stop
9521Generate (or don't) a stop bit immediately before and after volatile asm
9522statements.
9523
9524@item -mb-step
9525@opindex mb-step
9526Generate code that works around Itanium B step errata.
9527
9528@item -mregister-names
9529@itemx -mno-register-names
9530@opindex mregister-names
9531@opindex mno-register-names
9532Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
9533the stacked registers.  This may make assembler output more readable.
9534
9535@item -mno-sdata
9536@itemx -msdata
9537@opindex mno-sdata
9538@opindex msdata
9539Disable (or enable) optimizations that use the small data section.  This may
9540be useful for working around optimizer bugs.
9541
9542@item -mconstant-gp
9543@opindex mconstant-gp
9544Generate code that uses a single constant global pointer value.  This is
9545useful when compiling kernel code.
9546
9547@item -mauto-pic
9548@opindex mauto-pic
9549Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
9550This is useful when compiling firmware code.
9551
9552@item -minline-float-divide-min-latency
9553@opindex minline-float-divide-min-latency
9554Generate code for inline divides of floating point values
9555using the minimum latency algorithm.
9556
9557@item -minline-float-divide-max-throughput
9558@opindex minline-float-divide-max-throughput
9559Generate code for inline divides of floating point values
9560using the maximum throughput algorithm.
9561
9562@item -minline-int-divide-min-latency
9563@opindex minline-int-divide-min-latency
9564Generate code for inline divides of integer values
9565using the minimum latency algorithm.
9566
9567@item -minline-int-divide-max-throughput
9568@opindex minline-int-divide-max-throughput
9569Generate code for inline divides of integer values
9570using the maximum throughput algorithm.
9571
9572@item -mno-dwarf2-asm
9573@itemx -mdwarf2-asm
9574@opindex mno-dwarf2-asm
9575@opindex mdwarf2-asm
9576Don't (or do) generate assembler code for the DWARF2 line number debugging
9577info.  This may be useful when not using the GNU assembler.
9578
9579@item -mfixed-range=@var{register-range}
9580@opindex mfixed-range
9581Generate code treating the given register range as fixed registers.
9582A fixed register is one that the register allocator can not use.  This is
9583useful when compiling kernel code.  A register range is specified as
9584two registers separated by a dash.  Multiple register ranges can be
9585specified separated by a comma.
9586@end table
9587
9588@node D30V Options
9589@subsection D30V Options
9590@cindex D30V Options
9591
9592These @samp{-m} options are defined for D30V implementations:
9593
9594@table @gcctabopt
9595@item -mextmem
9596@opindex mextmem
9597Link the @samp{.text}, @samp{.data}, @samp{.bss}, @samp{.strings},
9598@samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections into external
9599memory, which starts at location @code{0x80000000}.
9600
9601@item -mextmemory
9602@opindex mextmemory
9603Same as the @option{-mextmem} switch.
9604
9605@item -monchip
9606@opindex monchip
9607Link the @samp{.text} section into onchip text memory, which starts at
9608location @code{0x0}.  Also link @samp{.data}, @samp{.bss},
9609@samp{.strings}, @samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections
9610into onchip data memory, which starts at location @code{0x20000000}.
9611
9612@item -mno-asm-optimize
9613@itemx -masm-optimize
9614@opindex mno-asm-optimize
9615@opindex masm-optimize
9616Disable (enable) passing @option{-O} to the assembler when optimizing.
9617The assembler uses the @option{-O} option to automatically parallelize
9618adjacent short instructions where possible.
9619
9620@item -mbranch-cost=@var{n}
9621@opindex mbranch-cost
9622Increase the internal costs of branches to @var{n}.  Higher costs means
9623that the compiler will issue more instructions to avoid doing a branch.
9624The default is 2.
9625
9626@item -mcond-exec=@var{n}
9627@opindex mcond-exec
9628Specify the maximum number of conditionally executed instructions that
9629replace a branch.  The default is 4.
9630@end table
9631
9632@node S/390 and zSeries Options
9633@subsection S/390 and zSeries Options
9634@cindex S/390 and zSeries Options
9635
9636These are the @samp{-m} options defined for the S/390 and zSeries architecture.
9637
9638@table @gcctabopt
9639@item -mhard-float
9640@itemx -msoft-float
9641@opindex mhard-float
9642@opindex msoft-float
9643Use (do not use) the hardware floating-point instructions and registers
9644for floating-point operations.  When @option{-msoft-float} is specified,
9645functions in @file{libgcc.a} will be used to perform floating-point
9646operations.  When @option{-mhard-float} is specified, the compiler
9647generates IEEE floating-point instructions.  This is the default.
9648
9649@item -mbackchain
9650@itemx -mno-backchain
9651@opindex mbackchain
9652@opindex mno-backchain
9653Generate (or do not generate) code which maintains an explicit
9654backchain within the stack frame that points to the caller's frame.
9655This is currently needed to allow debugging.  The default is to
9656generate the backchain.
9657
9658@item -msmall-exec
9659@itemx -mno-small-exec
9660@opindex msmall-exec
9661@opindex mno-small-exec
9662Generate (or do not generate) code using the @code{bras} instruction
9663to do subroutine calls.
9664This only works reliably if the total executable size does not
9665exceed 64k.  The default is to use the @code{basr} instruction instead,
9666which does not have this limitation.
9667
9668@item -m64
9669@itemx -m31
9670@opindex m64
9671@opindex m31
9672When @option{-m31} is specified, generate code compliant to the
9673Linux for S/390 ABI@.  When @option{-m64} is specified, generate
9674code compliant to the Linux for zSeries ABI@.  This allows GCC in
9675particular to generate 64-bit instructions.  For the @samp{s390}
9676targets, the default is @option{-m31}, while the @samp{s390x}
9677targets default to @option{-m64}.
9678
9679@item -mmvcle
9680@itemx -mno-mvcle
9681@opindex mmvcle
9682@opindex mno-mvcle
9683Generate (or do not generate) code using the @code{mvcle} instruction
9684to perform block moves.  When @option{-mno-mvcle} is specified,
9685use a @code{mvc} loop instead.  This is the default.
9686
9687@item -mdebug
9688@itemx -mno-debug
9689@opindex mdebug
9690@opindex mno-debug
9691Print (or do not print) additional debug information when compiling.
9692The default is to not print debug information.
9693
9694@end table
9695
9696@node CRIS Options
9697@subsection CRIS Options
9698@cindex CRIS Options
9699
9700These options are defined specifically for the CRIS ports.
9701
9702@table @gcctabopt
9703@item -march=@var{architecture-type}
9704@itemx -mcpu=@var{architecture-type}
9705@opindex march
9706@opindex mcpu
9707Generate code for the specified architecture.  The choices for
9708@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
9709respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX.
9710Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
9711@samp{v10}.
9712
9713@item -mtune=@var{architecture-type}
9714@opindex mtune
9715Tune to @var{architecture-type} everything applicable about the generated
9716code, except for the ABI and the set of available instructions.  The
9717choices for @var{architecture-type} are the same as for
9718@option{-march=@var{architecture-type}}.
9719
9720@item -mmax-stack-frame=@var{n}
9721@opindex mmax-stack-frame
9722Warn when the stack frame of a function exceeds @var{n} bytes.
9723
9724@item -melinux-stacksize=@var{n}
9725@opindex melinux-stacksize
9726Only available with the @samp{cris-axis-aout} target.  Arranges for
9727indications in the program to the kernel loader that the stack of the
9728program should be set to @var{n} bytes.
9729
9730@item -metrax4
9731@itemx -metrax100
9732@opindex metrax4
9733@opindex metrax100
9734The options @option{-metrax4} and @option{-metrax100} are synonyms for
9735@option{-march=v3} and @option{-march=v8} respectively.
9736
9737@item -mmul-bug-workaround
9738@itemx -mno-mul-bug-workaround
9739@opindex mmul-bug-workaround
9740@opindex mno-mul-bug-workaround
9741Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
9742models where it applies.  This option is active by default.
9743
9744@item -mpdebug
9745@opindex mpdebug
9746Enable CRIS-specific verbose debug-related information in the assembly
9747code.  This option also has the effect to turn off the @samp{#NO_APP}
9748formatted-code indicator to the assembler at the beginning of the
9749assembly file.
9750
9751@item -mcc-init
9752@opindex mcc-init
9753Do not use condition-code results from previous instruction; always emit
9754compare and test instructions before use of condition codes.
9755
9756@item -mno-side-effects
9757@opindex mno-side-effects
9758Do not emit instructions with side-effects in addressing modes other than
9759post-increment.
9760
9761@item -mstack-align
9762@itemx -mno-stack-align
9763@itemx -mdata-align
9764@itemx -mno-data-align
9765@itemx -mconst-align
9766@itemx -mno-const-align
9767@opindex mstack-align
9768@opindex mno-stack-align
9769@opindex mdata-align
9770@opindex mno-data-align
9771@opindex mconst-align
9772@opindex mno-const-align
9773These options (no-options) arranges (eliminate arrangements) for the
9774stack-frame, individual data and constants to be aligned for the maximum
9775single data access size for the chosen CPU model.  The default is to
9776arrange for 32-bit alignment.  ABI details such as structure layout are
9777not affected by these options.
9778
9779@item -m32-bit
9780@itemx -m16-bit
9781@itemx -m8-bit
9782@opindex m32-bit
9783@opindex m16-bit
9784@opindex m8-bit
9785Similar to the stack- data- and const-align options above, these options
9786arrange for stack-frame, writable data and constants to all be 32-bit,
978716-bit or 8-bit aligned.  The default is 32-bit alignment.
9788
9789@item -mno-prologue-epilogue
9790@itemx -mprologue-epilogue
9791@opindex mno-prologue-epilogue
9792@opindex mprologue-epilogue
9793With @option{-mno-prologue-epilogue}, the normal function prologue and
9794epilogue that sets up the stack-frame are omitted and no return
9795instructions or return sequences are generated in the code.  Use this
9796option only together with visual inspection of the compiled code: no
9797warnings or errors are generated when call-saved registers must be saved,
9798or storage for local variable needs to be allocated.
9799
9800@item -mno-gotplt
9801@itemx -mgotplt
9802@opindex mno-gotplt
9803@opindex mgotplt
9804With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
9805instruction sequences that load addresses for functions from the PLT part
9806of the GOT rather than (traditional on other architectures) calls to the
9807PLT.  The default is @option{-mgotplt}.
9808
9809@item -maout
9810@opindex maout
9811Legacy no-op option only recognized with the cris-axis-aout target.
9812
9813@item -melf
9814@opindex melf
9815Legacy no-op option only recognized with the cris-axis-elf and
9816cris-axis-linux-gnu targets.
9817
9818@item -melinux
9819@opindex melinux
9820Only recognized with the cris-axis-aout target, where it selects a
9821GNU/linux-like multilib, include files and instruction set for
9822@option{-march=v8}.
9823
9824@item -mlinux
9825@opindex mlinux
9826Legacy no-op option only recognized with the cris-axis-linux-gnu target.
9827
9828@item -sim
9829@opindex sim
9830This option, recognized for the cris-axis-aout and cris-axis-elf arranges
9831to link with input-output functions from a simulator library.  Code,
9832initialized data and zero-initialized data are allocated consecutively.
9833
9834@item -sim2
9835@opindex sim2
9836Like @option{-sim}, but pass linker options to locate initialized data at
98370x40000000 and zero-initialized data at 0x80000000.
9838@end table
9839
9840@node MMIX Options
9841@subsection MMIX Options
9842@cindex MMIX Options
9843
9844These options are defined for the MMIX:
9845
9846@table @gcctabopt
9847@item -mlibfuncs
9848@itemx -mno-libfuncs
9849@opindex mlibfuncs
9850@opindex mno-libfuncs
9851Specify that intrinsic library functions are being compiled, passing all
9852values in registers, no matter the size.
9853
9854@item -mepsilon
9855@itemx -mno-epsilon
9856@opindex mepsilon
9857@opindex mno-epsilon
9858Generate floating-point comparison instructions that compare with respect
9859to the @code{rE} epsilon register.
9860
9861@item -mabi=mmixware
9862@itemx -mabi=gnu
9863@opindex mabi-mmixware
9864@opindex mabi=gnu
9865Generate code that passes function parameters and return values that (in
9866the called function) are seen as registers @code{$0} and up, as opposed to
9867the GNU ABI which uses global registers @code{$231} and up.
9868
9869@item -mzero-extend
9870@itemx -mno-zero-extend
9871@opindex mzero-extend
9872@opindex mno-zero-extend
9873When reading data from memory in sizes shorter than 64 bits, use (do not
9874use) zero-extending load instructions by default, rather than
9875sign-extending ones.
9876
9877@item -mknuthdiv
9878@itemx -mno-knuthdiv
9879@opindex mknuthdiv
9880@opindex mno-knuthdiv
9881Make the result of a division yielding a remainder have the same sign as
9882the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
9883remainder follows the sign of the dividend.  Both methods are
9884arithmetically valid, the latter being almost exclusively used.
9885
9886@item -mtoplevel-symbols
9887@itemx -mno-toplevel-symbols
9888@opindex mtoplevel-symbols
9889@opindex mno-toplevel-symbols
9890Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
9891code can be used with the @code{PREFIX} assembly directive.
9892
9893@item -melf
9894@opindex melf
9895Generate an executable in the ELF format, rather than the default
9896@samp{mmo} format used by the @command{mmix} simulator.
9897
9898@item -mbranch-predict
9899@itemx -mno-branch-predict
9900@opindex mbranch-predict
9901@opindex mno-branch-predict
9902Use (do not use) the probable-branch instructions, when static branch
9903prediction indicates a probable branch.
9904
9905@item -mbase-addresses
9906@itemx -mno-base-addresses
9907@opindex mbase-addresses
9908@opindex mno-base-addresses
9909Generate (do not generate) code that uses @emph{base addresses}.  Using a
9910base address automatically generates a request (handled by the assembler
9911and the linker) for a constant to be set up in a global register.  The
9912register is used for one or more base address requests within the range 0
9913to 255 from the value held in the register.  The generally leads to short
9914and fast code, but the number of different data items that can be
9915addressed is limited.  This means that a program that uses lots of static
9916data may require @option{-mno-base-addresses}.
9917
9918@item -msingle-exit
9919@itemx -mno-single-exit
9920@opindex msingle-exit
9921@opindex mno-single-exit
9922Force (do not force) generated code to have a single exit point in each
9923function.
9924@end table
9925
9926@node PDP-11 Options
9927@subsection PDP-11 Options
9928@cindex PDP-11 Options
9929
9930These options are defined for the PDP-11:
9931
9932@table @gcctabopt
9933@item -mfpu
9934@opindex mfpu
9935Use hardware FPP floating point.  This is the default.  (FIS floating
9936point on the PDP-11/40 is not supported.)
9937
9938@item -msoft-float
9939@opindex msoft-float
9940Do not use hardware floating point.
9941
9942@item -mac0
9943@opindex mac0
9944Return floating-point results in ac0 (fr0 in Unix assembler syntax).
9945
9946@item -mno-ac0
9947@opindex mno-ac0
9948Return floating-point results in memory.  This is the default.
9949
9950@item -m40
9951@opindex m40
9952Generate code for a PDP-11/40.
9953
9954@item -m45
9955@opindex m45
9956Generate code for a PDP-11/45.  This is the default.
9957
9958@item -m10
9959@opindex m10
9960Generate code for a PDP-11/10.
9961
9962@item -mbcopy-builtin
9963@opindex bcopy-builtin
9964Use inline @code{movstrhi} patterns for copying memory.  This is the
9965default.
9966
9967@item -mbcopy
9968@opindex mbcopy
9969Do not use inline @code{movstrhi} patterns for copying memory.
9970
9971@item -mint16
9972@itemx -mno-int32
9973@opindex mint16
9974@opindex mno-int32
9975Use 16-bit @code{int}.  This is the default.
9976
9977@item -mint32
9978@itemx -mno-int16
9979@opindex mint32
9980@opindex mno-int16
9981Use 32-bit @code{int}.
9982
9983@item -mfloat64
9984@itemx -mno-float32
9985@opindex mfloat64
9986@opindex mno-float32
9987Use 64-bit @code{float}.  This is the default.
9988
9989@item -mfloat32
9990@itemx -mno-float64
9991@opindex mfloat32
9992@opindex mno-float64
9993Use 32-bit @code{float}.
9994
9995@item -mabshi
9996@opindex mabshi
9997Use @code{abshi2} pattern.  This is the default.
9998
9999@item -mno-abshi
10000@opindex mno-abshi
10001Do not use @code{abshi2} pattern.
10002
10003@item -mbranch-expensive
10004@opindex mbranch-expensive
10005Pretend that branches are expensive.  This is for experimenting with
10006code generation only.
10007
10008@item -mbranch-cheap
10009@opindex mbranch-cheap
10010Do not pretend that branches are expensive.  This is the default.
10011
10012@item -msplit
10013@opindex msplit
10014Generate code for a system with split I&D.
10015
10016@item -mno-split
10017@opindex mno-split
10018Generate code for a system without split I&D.  This is the default.
10019
10020@item -munix-asm
10021@opindex munix-asm
10022Use Unix assembler syntax.  This is the default when configured for
10023@samp{pdp11-*-bsd}.
10024
10025@item -mdec-asm
10026@opindex mdec-asm
10027Use DEC assembler syntax.  This is the default when configured for any
10028PDP-11 target other than @samp{pdp11-*-bsd}.
10029@end table
10030
10031@node Xstormy16 Options
10032@subsection Xstormy16 Options
10033@cindex Xstormy16 Options
10034
10035These options are defined for Xstormy16:
10036
10037@table @gcctabopt
10038@item -msim
10039@opindex msim
10040Choose startup files and linker script suitable for the simulator.
10041@end table
10042
10043@node FRV Options
10044@subsection FRV Options
10045@cindex FRV Options
10046
10047@table @gcctabopt
10048@item -mgpr-32
10049@opindex mgpr-32
10050
10051Only use the first 32 general purpose registers.
10052
10053@item -mgpr-64
10054@opindex mgpr-64
10055
10056Use all 64 general purpose registers.
10057
10058@item -mfpr-32
10059@opindex mfpr-32
10060
10061Use only the first 32 floating point registers.
10062
10063@item -mfpr-64
10064@opindex mfpr-64
10065
10066Use all 64 floating point registers
10067
10068@item -mhard-float
10069@opindex mhard-float
10070
10071Use hardware instructions for floating point operations.
10072
10073@item -msoft-float
10074@opindex msoft-float
10075
10076Use library routines for floating point operations.
10077
10078@item -malloc-cc
10079@opindex malloc-cc
10080
10081Dynamically allocate condition code registers.
10082
10083@item -mfixed-cc
10084@opindex mfixed-cc
10085
10086Do not try to dynamically allocate condition code registers, only
10087use @code{icc0} and @code{fcc0}.
10088
10089@item -mdword
10090@opindex mdword
10091
10092Change ABI to use double word insns.
10093
10094@item -mno-dword
10095@opindex mno-dword
10096
10097Do not use double word instructions.
10098
10099@item -mdouble
10100@opindex mdouble
10101
10102Use floating point double instructions.
10103
10104@item -mno-double
10105@opindex mno-double
10106
10107Do not use floating point double instructions.
10108
10109@item -mmedia
10110@opindex mmedia
10111
10112Use media instructions.
10113
10114@item -mno-media
10115@opindex mno-media
10116
10117Do not use media instructions.
10118
10119@item -mmuladd
10120@opindex mmuladd
10121
10122Use multiply and add/subtract instructions.
10123
10124@item -mno-muladd
10125@opindex mno-muladd
10126
10127Do not use multiply and add/subtract instructions.
10128
10129@item -mlibrary-pic
10130@opindex mlibrary-pic
10131
10132Enable PIC support for building libraries
10133
10134@item -macc-4
10135@opindex macc-4
10136
10137Use only the first four media accumulator registers.
10138
10139@item -macc-8
10140@opindex macc-8
10141
10142Use all eight media accumulator registers.
10143
10144@item -mpack
10145@opindex mpack
10146
10147Pack VLIW instructions.
10148
10149@item -mno-pack
10150@opindex mno-pack
10151
10152Do not pack VLIW instructions.
10153
10154@item -mno-eflags
10155@opindex mno-eflags
10156
10157Do not mark ABI switches in e_flags.
10158
10159@item -mcond-move
10160@opindex mcond-move
10161
10162Enable the use of conditional-move instructions (default).
10163
10164This switch is mainly for debugging the compiler and will likely be removed
10165in a future version.
10166
10167@item -mno-cond-move
10168@opindex mno-cond-move
10169
10170Disable the use of conditional-move instructions.
10171
10172This switch is mainly for debugging the compiler and will likely be removed
10173in a future version.
10174
10175@item -mscc
10176@opindex mscc
10177
10178Enable the use of conditional set instructions (default).
10179
10180This switch is mainly for debugging the compiler and will likely be removed
10181in a future version.
10182
10183@item -mno-scc
10184@opindex mno-scc
10185
10186Disable the use of conditional set instructions.
10187
10188This switch is mainly for debugging the compiler and will likely be removed
10189in a future version.
10190
10191@item -mcond-exec
10192@opindex mcond-exec
10193
10194Enable the use of conditional execution (default).
10195
10196This switch is mainly for debugging the compiler and will likely be removed
10197in a future version.
10198
10199@item -mno-cond-exec
10200@opindex mno-cond-exec
10201
10202Disable the use of conditional execution.
10203
10204This switch is mainly for debugging the compiler and will likely be removed
10205in a future version.
10206
10207@item -mvliw-branch
10208@opindex mvliw-branch
10209
10210Run a pass to pack branches into VLIW instructions (default).
10211
10212This switch is mainly for debugging the compiler and will likely be removed
10213in a future version.
10214
10215@item -mno-vliw-branch
10216@opindex mno-vliw-branch
10217
10218Do not run a pass to pack branches into VLIW instructions.
10219
10220This switch is mainly for debugging the compiler and will likely be removed
10221in a future version.
10222
10223@item -mmulti-cond-exec
10224@opindex mmulti-cond-exec
10225
10226Enable optimization of @code{&&} and @code{||} in conditional execution
10227(default).
10228
10229This switch is mainly for debugging the compiler and will likely be removed
10230in a future version.
10231
10232@item -mno-multi-cond-exec
10233@opindex mno-multi-cond-exec
10234
10235Disable optimization of @code{&&} and @code{||} in conditional execution.
10236
10237This switch is mainly for debugging the compiler and will likely be removed
10238in a future version.
10239
10240@item -mnested-cond-exec
10241@opindex mnested-cond-exec
10242
10243Enable nested conditional execution optimizations (default).
10244
10245This switch is mainly for debugging the compiler and will likely be removed
10246in a future version.
10247
10248@item -mno-nested-cond-exec
10249@opindex mno-nested-cond-exec
10250
10251Disable nested conditional execution optimizations.
10252
10253This switch is mainly for debugging the compiler and will likely be removed
10254in a future version.
10255
10256@item -mtomcat-stats
10257@opindex mtomcat-stats
10258
10259Cause gas to print out tomcat statistics.
10260
10261@item -mcpu=@var{cpu}
10262@opindex mcpu
10263
10264Select the processor type for which to generate code.  Possible values are
10265@samp{simple}, @samp{tomcat}, @samp{fr500}, @samp{fr400}, @samp{fr300},
10266@samp{frv}.
10267
10268@end table
10269
10270@node Xtensa Options
10271@subsection Xtensa Options
10272@cindex Xtensa Options
10273
10274The Xtensa architecture is designed to support many different
10275configurations.  The compiler's default options can be set to match a
10276particular Xtensa configuration by copying a configuration file into the
10277GCC sources when building GCC@.  The options below may be used to
10278override the default options.
10279
10280@table @gcctabopt
10281@item -mbig-endian
10282@itemx -mlittle-endian
10283@opindex mbig-endian
10284@opindex mlittle-endian
10285Specify big-endian or little-endian byte ordering for the target Xtensa
10286processor.
10287
10288@item -mdensity
10289@itemx -mno-density
10290@opindex mdensity
10291@opindex mno-density
10292Enable or disable use of the optional Xtensa code density instructions.
10293
10294@item -mmac16
10295@itemx -mno-mac16
10296@opindex mmac16
10297@opindex mno-mac16
10298Enable or disable use of the Xtensa MAC16 option.  When enabled, GCC
10299will generate MAC16 instructions from standard C code, with the
10300limitation that it will use neither the MR register file nor any
10301instruction that operates on the MR registers.  When this option is
10302disabled, GCC will translate 16-bit multiply/accumulate operations to a
10303combination of core instructions and library calls, depending on whether
10304any other multiplier options are enabled.
10305
10306@item -mmul16
10307@itemx -mno-mul16
10308@opindex mmul16
10309@opindex mno-mul16
10310Enable or disable use of the 16-bit integer multiplier option.  When
10311enabled, the compiler will generate 16-bit multiply instructions for
10312multiplications of 16 bits or smaller in standard C code.  When this
10313option is disabled, the compiler will either use 32-bit multiply or
10314MAC16 instructions if they are available or generate library calls to
10315perform the multiply operations using shifts and adds.
10316
10317@item -mmul32
10318@itemx -mno-mul32
10319@opindex mmul32
10320@opindex mno-mul32
10321Enable or disable use of the 32-bit integer multiplier option.  When
10322enabled, the compiler will generate 32-bit multiply instructions for
10323multiplications of 32 bits or smaller in standard C code.  When this
10324option is disabled, the compiler will generate library calls to perform
10325the multiply operations using either shifts and adds or 16-bit multiply
10326instructions if they are available.
10327
10328@item -mnsa
10329@itemx -mno-nsa
10330@opindex mnsa
10331@opindex mno-nsa
10332Enable or disable use of the optional normalization shift amount
10333(@code{NSA}) instructions to implement the built-in @code{ffs} function.
10334
10335@item -mminmax
10336@itemx -mno-minmax
10337@opindex mminmax
10338@opindex mno-minmax
10339Enable or disable use of the optional minimum and maximum value
10340instructions.
10341
10342@item -msext
10343@itemx -mno-sext
10344@opindex msext
10345@opindex mno-sext
10346Enable or disable use of the optional sign extend (@code{SEXT})
10347instruction.
10348
10349@item -mbooleans
10350@itemx -mno-booleans
10351@opindex mbooleans
10352@opindex mno-booleans
10353Enable or disable support for the boolean register file used by Xtensa
10354coprocessors.  This is not typically useful by itself but may be
10355required for other options that make use of the boolean registers (e.g.,
10356the floating-point option).
10357
10358@item -mhard-float
10359@itemx -msoft-float
10360@opindex mhard-float
10361@opindex msoft-float
10362Enable or disable use of the floating-point option.  When enabled, GCC
10363generates floating-point instructions for 32-bit @code{float}
10364operations.  When this option is disabled, GCC generates library calls
10365to emulate 32-bit floating-point operations using integer instructions.
10366Regardless of this option, 64-bit @code{double} operations are always
10367emulated with calls to library functions.
10368
10369@item -mfused-madd
10370@itemx -mno-fused-madd
10371@opindex mfused-madd
10372@opindex mno-fused-madd
10373Enable or disable use of fused multiply/add and multiply/subtract
10374instructions in the floating-point option.  This has no effect if the
10375floating-point option is not also enabled.  Disabling fused multiply/add
10376and multiply/subtract instructions forces the compiler to use separate
10377instructions for the multiply and add/subtract operations.  This may be
10378desirable in some cases where strict IEEE 754-compliant results are
10379required: the fused multiply add/subtract instructions do not round the
10380intermediate result, thereby producing results with @emph{more} bits of
10381precision than specified by the IEEE standard.  Disabling fused multiply
10382add/subtract instructions also ensures that the program output is not
10383sensitive to the compiler's ability to combine multiply and add/subtract
10384operations.
10385
10386@item -mserialize-volatile
10387@itemx -mno-serialize-volatile
10388@opindex mserialize-volatile
10389@opindex mno-serialize-volatile
10390When this option is enabled, GCC inserts @code{MEMW} instructions before
10391@code{volatile} memory references to guarantee sequential consistency.
10392The default is @option{-mserialize-volatile}.  Use
10393@option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
10394
10395@item -mtext-section-literals
10396@itemx -mno-text-section-literals
10397@opindex mtext-section-literals
10398@opindex mno-text-section-literals
10399Control the treatment of literal pools.  The default is
10400@option{-mno-text-section-literals}, which places literals in a separate
10401section in the output file.  This allows the literal pool to be placed
10402in a data RAM/ROM, and it also allows the linker to combine literal
10403pools from separate object files to remove redundant literals and
10404improve code size.  With @option{-mtext-section-literals}, the literals
10405are interspersed in the text section in order to keep them as close as
10406possible to their references.  This may be necessary for large assembly
10407files.
10408
10409@item -mtarget-align
10410@itemx -mno-target-align
10411@opindex mtarget-align
10412@opindex mno-target-align
10413When this option is enabled, GCC instructs the assembler to
10414automatically align instructions to reduce branch penalties at the
10415expense of some code density.  The assembler attempts to widen density
10416instructions to align branch targets and the instructions following call
10417instructions.  If there are not enough preceding safe density
10418instructions to align a target, no widening will be performed.  The
10419default is @option{-mtarget-align}.  These options do not affect the
10420treatment of auto-aligned instructions like @code{LOOP}, which the
10421assembler will always align, either by widening density instructions or
10422by inserting no-op instructions.
10423
10424@item -mlongcalls
10425@itemx -mno-longcalls
10426@opindex mlongcalls
10427@opindex mno-longcalls
10428When this option is enabled, GCC instructs the assembler to translate
10429direct calls to indirect calls unless it can determine that the target
10430of a direct call is in the range allowed by the call instruction.  This
10431translation typically occurs for calls to functions in other source
10432files.  Specifically, the assembler translates a direct @code{CALL}
10433instruction into an @code{L32R} followed by a @code{CALLX} instruction.
10434The default is @option{-mno-longcalls}.  This option should be used in
10435programs where the call target can potentially be out of range.  This
10436option is implemented in the assembler, not the compiler, so the
10437assembly code generated by GCC will still show direct call
10438instructions---look at the disassembled object code to see the actual
10439instructions.  Note that the assembler will use an indirect call for
10440every cross-file call, not just those that really will be out of range.
10441@end table
10442
10443@node Code Gen Options
10444@section Options for Code Generation Conventions
10445@cindex code generation conventions
10446@cindex options, code generation
10447@cindex run-time options
10448
10449These machine-independent options control the interface conventions
10450used in code generation.
10451
10452Most of them have both positive and negative forms; the negative form
10453of @option{-ffoo} would be @option{-fno-foo}.  In the table below, only
10454one of the forms is listed---the one which is not the default.  You
10455can figure out the other form by either removing @samp{no-} or adding
10456it.
10457
10458@table @gcctabopt
10459@item -fbounds-check
10460@opindex fbounds-check
10461For front-ends that support it, generate additional code to check that
10462indices used to access arrays are within the declared range.  This is
10463currently only supported by the Java and Fortran 77 front-ends, where
10464this option defaults to true and false respectively.
10465
10466@item -ftrapv
10467@opindex ftrapv
10468This option generates traps for signed overflow on addition, subtraction,
10469multiplication operations.
10470
10471@item -fexceptions
10472@opindex fexceptions
10473Enable exception handling.  Generates extra code needed to propagate
10474exceptions.  For some targets, this implies GCC will generate frame
10475unwind information for all functions, which can produce significant data
10476size overhead, although it does not affect execution.  If you do not
10477specify this option, GCC will enable it by default for languages like
10478C++ which normally require exception handling, and disable it for
10479languages like C that do not normally require it.  However, you may need
10480to enable this option when compiling C code that needs to interoperate
10481properly with exception handlers written in C++.  You may also wish to
10482disable this option if you are compiling older C++ programs that don't
10483use exception handling.
10484
10485@item -fnon-call-exceptions
10486@opindex fnon-call-exceptions
10487Generate code that allows trapping instructions to throw exceptions.
10488Note that this requires platform-specific runtime support that does
10489not exist everywhere.  Moreover, it only allows @emph{trapping}
10490instructions to throw exceptions, i.e.@: memory references or floating
10491point instructions.  It does not allow exceptions to be thrown from
10492arbitrary signal handlers such as @code{SIGALRM}.
10493
10494@item -funwind-tables
10495@opindex funwind-tables
10496Similar to @option{-fexceptions}, except that it will just generate any needed
10497static data, but will not affect the generated code in any other way.
10498You will normally not enable this option; instead, a language processor
10499that needs this handling would enable it on your behalf.
10500
10501@item -fasynchronous-unwind-tables
10502@opindex funwind-tables
10503Generate unwind table in dwarf2 format, if supported by target machine.  The
10504table is exact at each instruction boundary, so it can be used for stack
10505unwinding from asynchronous events (such as debugger or garbage collector).
10506
10507@item -fpcc-struct-return
10508@opindex fpcc-struct-return
10509Return ``short'' @code{struct} and @code{union} values in memory like
10510longer ones, rather than in registers.  This convention is less
10511efficient, but it has the advantage of allowing intercallability between
10512GCC-compiled files and files compiled with other compilers, particularly
10513the Portable C Compiler (pcc).
10514
10515The precise convention for returning structures in memory depends
10516on the target configuration macros.
10517
10518Short structures and unions are those whose size and alignment match
10519that of some integer type.
10520
10521@strong{Warning:} code compiled with the @option{-fpcc-struct-return}
10522switch is not binary compatible with code compiled with the
10523@option{-freg-struct-return} switch.
10524Use it to conform to a non-default application binary interface.
10525
10526@item -freg-struct-return
10527@opindex freg-struct-return
10528Return @code{struct} and @code{union} values in registers when possible.
10529This is more efficient for small structures than
10530@option{-fpcc-struct-return}.
10531
10532If you specify neither @option{-fpcc-struct-return} nor
10533@option{-freg-struct-return}, GCC defaults to whichever convention is
10534standard for the target.  If there is no standard convention, GCC
10535defaults to @option{-fpcc-struct-return}, except on targets where GCC is
10536the principal compiler.  In those cases, we can choose the standard, and
10537we chose the more efficient register return alternative.
10538
10539@strong{Warning:} code compiled with the @option{-freg-struct-return}
10540switch is not binary compatible with code compiled with the
10541@option{-fpcc-struct-return} switch.
10542Use it to conform to a non-default application binary interface.
10543
10544@item -fshort-enums
10545@opindex fshort-enums
10546Allocate to an @code{enum} type only as many bytes as it needs for the
10547declared range of possible values.  Specifically, the @code{enum} type
10548will be equivalent to the smallest integer type which has enough room.
10549
10550@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
10551code that is not binary compatible with code generated without that switch.
10552Use it to conform to a non-default application binary interface.
10553
10554@item -fshort-double
10555@opindex fshort-double
10556Use the same size for @code{double} as for @code{float}.
10557
10558@strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
10559code that is not binary compatible with code generated without that switch.
10560Use it to conform to a non-default application binary interface.
10561
10562@item -fshort-wchar
10563@opindex fshort-wchar
10564Override the underlying type for @samp{wchar_t} to be @samp{short
10565unsigned int} instead of the default for the target.  This option is
10566useful for building programs to run under WINE@.
10567
10568@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
10569code that is not binary compatible with code generated without that switch.
10570Use it to conform to a non-default application binary interface.
10571
10572@item -fshared-data
10573@opindex fshared-data
10574Requests that the data and non-@code{const} variables of this
10575compilation be shared data rather than private data.  The distinction
10576makes sense only on certain operating systems, where shared data is
10577shared between processes running the same program, while private data
10578exists in one copy per process.
10579
10580@item -fno-common
10581@opindex fno-common
10582In C, allocate even uninitialized global variables in the data section of the
10583object file, rather than generating them as common blocks.  This has the
10584effect that if the same variable is declared (without @code{extern}) in
10585two different compilations, you will get an error when you link them.
10586The only reason this might be useful is if you wish to verify that the
10587program will work on other systems which always work this way.
10588
10589@item -fno-ident
10590@opindex fno-ident
10591Ignore the @samp{#ident} directive.
10592
10593@item -fno-gnu-linker
10594@opindex fno-gnu-linker
10595Do not output global initializations (such as C++ constructors and
10596destructors) in the form used by the GNU linker (on systems where the GNU
10597linker is the standard method of handling them).  Use this option when
10598you want to use a non-GNU linker, which also requires using the
10599@command{collect2} program to make sure the system linker includes
10600constructors and destructors.  (@command{collect2} is included in the GCC
10601distribution.)  For systems which @emph{must} use @command{collect2}, the
10602compiler driver @command{gcc} is configured to do this automatically.
10603
10604@item -finhibit-size-directive
10605@opindex finhibit-size-directive
10606Don't output a @code{.size} assembler directive, or anything else that
10607would cause trouble if the function is split in the middle, and the
10608two halves are placed at locations far apart in memory.  This option is
10609used when compiling @file{crtstuff.c}; you should not need to use it
10610for anything else.
10611
10612@item -fverbose-asm
10613@opindex fverbose-asm
10614Put extra commentary information in the generated assembly code to
10615make it more readable.  This option is generally only of use to those
10616who actually need to read the generated assembly code (perhaps while
10617debugging the compiler itself).
10618
10619@option{-fno-verbose-asm}, the default, causes the
10620extra information to be omitted and is useful when comparing two assembler
10621files.
10622
10623@item -fvolatile
10624@opindex fvolatile
10625Consider all memory references through pointers to be volatile.
10626
10627@item -fvolatile-global
10628@opindex fvolatile-global
10629Consider all memory references to extern and global data items to
10630be volatile.  GCC does not consider static data items to be volatile
10631because of this switch.
10632
10633@item -fvolatile-static
10634@opindex fvolatile-static
10635Consider all memory references to static data to be volatile.
10636
10637@item -fpic
10638@opindex fpic
10639@cindex global offset table
10640@cindex PIC
10641Generate position-independent code (PIC) suitable for use in a shared
10642library, if supported for the target machine.  Such code accesses all
10643constant addresses through a global offset table (GOT)@.  The dynamic
10644loader resolves the GOT entries when the program starts (the dynamic
10645loader is not part of GCC; it is part of the operating system).  If
10646the GOT size for the linked executable exceeds a machine-specific
10647maximum size, you get an error message from the linker indicating that
10648@option{-fpic} does not work; in that case, recompile with @option{-fPIC}
10649instead.  (These maximums are 16k on the m88k, 8k on the SPARC, and 32k
10650on the m68k and RS/6000.  The 386 has no such limit.)
10651
10652Position-independent code requires special support, and therefore works
10653only on certain machines.  For the 386, GCC supports PIC for System V
10654but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
10655position-independent.
10656
10657@item -fPIC
10658@opindex fPIC
10659If supported for the target machine, emit position-independent code,
10660suitable for dynamic linking and avoiding any limit on the size of the
10661global offset table.  This option makes a difference on the m68k, m88k,
10662and the SPARC.
10663
10664Position-independent code requires special support, and therefore works
10665only on certain machines.
10666
10667@item -fpie
10668@itemx -fPIE
10669@opindex fpie
10670@opindex fPIE
10671These options are similar to @option{-fpic} and @option{-fPIC}, but
10672generated position independent code can be only linked into executables.
10673Usually these options are used when @option{-pie} GCC option will be
10674used during linking.
10675
10676@item -ffixed-@var{reg}
10677@opindex ffixed
10678Treat the register named @var{reg} as a fixed register; generated code
10679should never refer to it (except perhaps as a stack pointer, frame
10680pointer or in some other fixed role).
10681
10682@var{reg} must be the name of a register.  The register names accepted
10683are machine-specific and are defined in the @code{REGISTER_NAMES}
10684macro in the machine description macro file.
10685
10686This flag does not have a negative form, because it specifies a
10687three-way choice.
10688
10689@item -fcall-used-@var{reg}
10690@opindex fcall-used
10691Treat the register named @var{reg} as an allocable register that is
10692clobbered by function calls.  It may be allocated for temporaries or
10693variables that do not live across a call.  Functions compiled this way
10694will not save and restore the register @var{reg}.
10695
10696It is an error to used this flag with the frame pointer or stack pointer.
10697Use of this flag for other registers that have fixed pervasive roles in
10698the machine's execution model will produce disastrous results.
10699
10700This flag does not have a negative form, because it specifies a
10701three-way choice.
10702
10703@item -fcall-saved-@var{reg}
10704@opindex fcall-saved
10705Treat the register named @var{reg} as an allocable register saved by
10706functions.  It may be allocated even for temporaries or variables that
10707live across a call.  Functions compiled this way will save and restore
10708the register @var{reg} if they use it.
10709
10710It is an error to used this flag with the frame pointer or stack pointer.
10711Use of this flag for other registers that have fixed pervasive roles in
10712the machine's execution model will produce disastrous results.
10713
10714A different sort of disaster will result from the use of this flag for
10715a register in which function values may be returned.
10716
10717This flag does not have a negative form, because it specifies a
10718three-way choice.
10719
10720@item -fpack-struct
10721@opindex fpack-struct
10722Pack all structure members together without holes.
10723
10724@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
10725code that is not binary compatible with code generated without that switch.
10726Additionally, it makes the code suboptimal.
10727Use it to conform to a non-default application binary interface.
10728
10729@item -finstrument-functions
10730@opindex finstrument-functions
10731Generate instrumentation calls for entry and exit to functions.  Just
10732after function entry and just before function exit, the following
10733profiling functions will be called with the address of the current
10734function and its call site.  (On some platforms,
10735@code{__builtin_return_address} does not work beyond the current
10736function, so the call site information may not be available to the
10737profiling functions otherwise.)
10738
10739@example
10740void __cyg_profile_func_enter (void *this_fn,
10741                               void *call_site);
10742void __cyg_profile_func_exit  (void *this_fn,
10743                               void *call_site);
10744@end example
10745
10746The first argument is the address of the start of the current function,
10747which may be looked up exactly in the symbol table.
10748
10749This instrumentation is also done for functions expanded inline in other
10750functions.  The profiling calls will indicate where, conceptually, the
10751inline function is entered and exited.  This means that addressable
10752versions of such functions must be available.  If all your uses of a
10753function are expanded inline, this may mean an additional expansion of
10754code size.  If you use @samp{extern inline} in your C code, an
10755addressable version of such functions must be provided.  (This is
10756normally the case anyways, but if you get lucky and the optimizer always
10757expands the functions inline, you might have gotten away without
10758providing static copies.)
10759
10760A function may be given the attribute @code{no_instrument_function}, in
10761which case this instrumentation will not be done.  This can be used, for
10762example, for the profiling functions listed above, high-priority
10763interrupt routines, and any functions from which the profiling functions
10764cannot safely be called (perhaps signal handlers, if the profiling
10765routines generate output or allocate memory).
10766
10767@item -fstack-check
10768@opindex fstack-check
10769Generate code to verify that you do not go beyond the boundary of the
10770stack.  You should specify this flag if you are running in an
10771environment with multiple threads, but only rarely need to specify it in
10772a single-threaded environment since stack overflow is automatically
10773detected on nearly all systems if there is only one stack.
10774
10775Note that this switch does not actually cause checking to be done; the
10776operating system must do that.  The switch causes generation of code
10777to ensure that the operating system sees the stack being extended.
10778
10779@item -fstack-limit-register=@var{reg}
10780@itemx -fstack-limit-symbol=@var{sym}
10781@itemx -fno-stack-limit
10782@opindex fstack-limit-register
10783@opindex fstack-limit-symbol
10784@opindex fno-stack-limit
10785Generate code to ensure that the stack does not grow beyond a certain value,
10786either the value of a register or the address of a symbol.  If the stack
10787would grow beyond the value, a signal is raised.  For most targets,
10788the signal is raised before the stack overruns the boundary, so
10789it is possible to catch the signal without taking special precautions.
10790
10791For instance, if the stack starts at absolute address @samp{0x80000000}
10792and grows downwards, you can use the flags
10793@option{-fstack-limit-symbol=__stack_limit} and
10794@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
10795of 128KB@.  Note that this may only work with the GNU linker.
10796
10797@cindex aliasing of parameters
10798@cindex parameters, aliased
10799@item -fargument-alias
10800@itemx -fargument-noalias
10801@itemx -fargument-noalias-global
10802@opindex fargument-alias
10803@opindex fargument-noalias
10804@opindex fargument-noalias-global
10805Specify the possible relationships among parameters and between
10806parameters and global data.
10807
10808@option{-fargument-alias} specifies that arguments (parameters) may
10809alias each other and may alias global storage.@*
10810@option{-fargument-noalias} specifies that arguments do not alias
10811each other, but may alias global storage.@*
10812@option{-fargument-noalias-global} specifies that arguments do not
10813alias each other and do not alias global storage.
10814
10815Each language will automatically use whatever option is required by
10816the language standard.  You should not need to use these options yourself.
10817
10818@item -fleading-underscore
10819@opindex fleading-underscore
10820This option and its counterpart, @option{-fno-leading-underscore}, forcibly
10821change the way C symbols are represented in the object file.  One use
10822is to help link with legacy assembly code.
10823
10824@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
10825generate code that is not binary compatible with code generated without that
10826switch.  Use it to conform to a non-default application binary interface.
10827Not all targets provide complete support for this switch.
10828
10829@item -ftls-model=@var{model}
10830Alter the thread-local storage model to be used (@pxref{Thread-Local}).
10831The @var{model} argument should be one of @code{global-dynamic},
10832@code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
10833
10834The default without @option{-fpic} is @code{initial-exec}; with
10835@option{-fpic} the default is @code{global-dynamic}.
10836@end table
10837
10838@c man end
10839
10840@node Environment Variables
10841@section Environment Variables Affecting GCC
10842@cindex environment variables
10843
10844@c man begin ENVIRONMENT
10845This section describes several environment variables that affect how GCC
10846operates.  Some of them work by specifying directories or prefixes to use
10847when searching for various kinds of files.  Some are used to specify other
10848aspects of the compilation environment.
10849
10850Note that you can also specify places to search using options such as
10851@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
10852take precedence over places specified using environment variables, which
10853in turn take precedence over those specified by the configuration of GCC@.
10854@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
10855GNU Compiler Collection (GCC) Internals}.
10856
10857@table @env
10858@item LANG
10859@itemx LC_CTYPE
10860@c @itemx LC_COLLATE
10861@itemx LC_MESSAGES
10862@c @itemx LC_MONETARY
10863@c @itemx LC_NUMERIC
10864@c @itemx LC_TIME
10865@itemx LC_ALL
10866@findex LANG
10867@findex LC_CTYPE
10868@c @findex LC_COLLATE
10869@findex LC_MESSAGES
10870@c @findex LC_MONETARY
10871@c @findex LC_NUMERIC
10872@c @findex LC_TIME
10873@findex LC_ALL
10874@cindex locale
10875These environment variables control the way that GCC uses
10876localization information that allow GCC to work with different
10877national conventions.  GCC inspects the locale categories
10878@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
10879so.  These locale categories can be set to any value supported by your
10880installation.  A typical value is @samp{en_UK} for English in the United
10881Kingdom.
10882
10883The @env{LC_CTYPE} environment variable specifies character
10884classification.  GCC uses it to determine the character boundaries in
10885a string; this is needed for some multibyte encodings that contain quote
10886and escape characters that would otherwise be interpreted as a string
10887end or escape.
10888
10889The @env{LC_MESSAGES} environment variable specifies the language to
10890use in diagnostic messages.
10891
10892If the @env{LC_ALL} environment variable is set, it overrides the value
10893of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
10894and @env{LC_MESSAGES} default to the value of the @env{LANG}
10895environment variable.  If none of these variables are set, GCC
10896defaults to traditional C English behavior.
10897
10898@item TMPDIR
10899@findex TMPDIR
10900If @env{TMPDIR} is set, it specifies the directory to use for temporary
10901files.  GCC uses temporary files to hold the output of one stage of
10902compilation which is to be used as input to the next stage: for example,
10903the output of the preprocessor, which is the input to the compiler
10904proper.
10905
10906@item GCC_EXEC_PREFIX
10907@findex GCC_EXEC_PREFIX
10908If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
10909names of the subprograms executed by the compiler.  No slash is added
10910when this prefix is combined with the name of a subprogram, but you can
10911specify a prefix that ends with a slash if you wish.
10912
10913If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
10914an appropriate prefix to use based on the pathname it was invoked with.
10915
10916If GCC cannot find the subprogram using the specified prefix, it
10917tries looking in the usual places for the subprogram.
10918
10919The default value of @env{GCC_EXEC_PREFIX} is
10920@file{@var{prefix}/lib/gcc-lib/} where @var{prefix} is the value
10921of @code{prefix} when you ran the @file{configure} script.
10922
10923Other prefixes specified with @option{-B} take precedence over this prefix.
10924
10925This prefix is also used for finding files such as @file{crt0.o} that are
10926used for linking.
10927
10928In addition, the prefix is used in an unusual way in finding the
10929directories to search for header files.  For each of the standard
10930directories whose name normally begins with @samp{/usr/local/lib/gcc-lib}
10931(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
10932replacing that beginning with the specified prefix to produce an
10933alternate directory name.  Thus, with @option{-Bfoo/}, GCC will search
10934@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
10935These alternate directories are searched first; the standard directories
10936come next.
10937
10938@item COMPILER_PATH
10939@findex COMPILER_PATH
10940The value of @env{COMPILER_PATH} is a colon-separated list of
10941directories, much like @env{PATH}.  GCC tries the directories thus
10942specified when searching for subprograms, if it can't find the
10943subprograms using @env{GCC_EXEC_PREFIX}.
10944
10945@item LIBRARY_PATH
10946@findex LIBRARY_PATH
10947The value of @env{LIBRARY_PATH} is a colon-separated list of
10948directories, much like @env{PATH}.  When configured as a native compiler,
10949GCC tries the directories thus specified when searching for special
10950linker files, if it can't find them using @env{GCC_EXEC_PREFIX}.  Linking
10951using GCC also uses these directories when searching for ordinary
10952libraries for the @option{-l} option (but directories specified with
10953@option{-L} come first).
10954
10955@item LANG
10956@findex LANG
10957@cindex locale definition
10958This variable is used to pass locale information to the compiler.  One way in
10959which this information is used is to determine the character set to be used
10960when character literals, string literals and comments are parsed in C and C++.
10961When the compiler is configured to allow multibyte characters,
10962the following values for @env{LANG} are recognized:
10963
10964@table @samp
10965@item C-JIS
10966Recognize JIS characters.
10967@item C-SJIS
10968Recognize SJIS characters.
10969@item C-EUCJP
10970Recognize EUCJP characters.
10971@end table
10972
10973If @env{LANG} is not defined, or if it has some other value, then the
10974compiler will use mblen and mbtowc as defined by the default locale to
10975recognize and translate multibyte characters.
10976@end table
10977
10978@noindent
10979Some additional environments variables affect the behavior of the
10980preprocessor.
10981
10982@include cppenv.texi
10983
10984@c man end
10985
10986@node Running Protoize
10987@section Running Protoize
10988
10989The program @code{protoize} is an optional part of GCC@.  You can use
10990it to add prototypes to a program, thus converting the program to ISO
10991C in one respect.  The companion program @code{unprotoize} does the
10992reverse: it removes argument types from any prototypes that are found.
10993
10994When you run these programs, you must specify a set of source files as
10995command line arguments.  The conversion programs start out by compiling
10996these files to see what functions they define.  The information gathered
10997about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
10998
10999After scanning comes actual conversion.  The specified files are all
11000eligible to be converted; any files they include (whether sources or
11001just headers) are eligible as well.
11002
11003But not all the eligible files are converted.  By default,
11004@code{protoize} and @code{unprotoize} convert only source and header
11005files in the current directory.  You can specify additional directories
11006whose files should be converted with the @option{-d @var{directory}}
11007option.  You can also specify particular files to exclude with the
11008@option{-x @var{file}} option.  A file is converted if it is eligible, its
11009directory name matches one of the specified directory names, and its
11010name within the directory has not been excluded.
11011
11012Basic conversion with @code{protoize} consists of rewriting most
11013function definitions and function declarations to specify the types of
11014the arguments.  The only ones not rewritten are those for varargs
11015functions.
11016
11017@code{protoize} optionally inserts prototype declarations at the
11018beginning of the source file, to make them available for any calls that
11019precede the function's definition.  Or it can insert prototype
11020declarations with block scope in the blocks where undeclared functions
11021are called.
11022
11023Basic conversion with @code{unprotoize} consists of rewriting most
11024function declarations to remove any argument types, and rewriting
11025function definitions to the old-style pre-ISO form.
11026
11027Both conversion programs print a warning for any function declaration or
11028definition that they can't convert.  You can suppress these warnings
11029with @option{-q}.
11030
11031The output from @code{protoize} or @code{unprotoize} replaces the
11032original source file.  The original file is renamed to a name ending
11033with @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
11034without the original @samp{.c} suffix).  If the @samp{.save} (@samp{.sav}
11035for DOS) file already exists, then the source file is simply discarded.
11036
11037@code{protoize} and @code{unprotoize} both depend on GCC itself to
11038scan the program and collect information about the functions it uses.
11039So neither of these programs will work until GCC is installed.
11040
11041Here is a table of the options you can use with @code{protoize} and
11042@code{unprotoize}.  Each option works with both programs unless
11043otherwise stated.
11044
11045@table @code
11046@item -B @var{directory}
11047Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
11048usual directory (normally @file{/usr/local/lib}).  This file contains
11049prototype information about standard system functions.  This option
11050applies only to @code{protoize}.
11051
11052@item -c @var{compilation-options}
11053Use @var{compilation-options} as the options when running @command{gcc} to
11054produce the @samp{.X} files.  The special option @option{-aux-info} is
11055always passed in addition, to tell @command{gcc} to write a @samp{.X} file.
11056
11057Note that the compilation options must be given as a single argument to
11058@code{protoize} or @code{unprotoize}.  If you want to specify several
11059@command{gcc} options, you must quote the entire set of compilation options
11060to make them a single word in the shell.
11061
11062There are certain @command{gcc} arguments that you cannot use, because they
11063would produce the wrong kind of output.  These include @option{-g},
11064@option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
11065the @var{compilation-options}, they are ignored.
11066
11067@item -C
11068Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file
11069systems) instead of @samp{.c}.  This is convenient if you are converting
11070a C program to C++.  This option applies only to @code{protoize}.
11071
11072@item -g
11073Add explicit global declarations.  This means inserting explicit
11074declarations at the beginning of each source file for each function
11075that is called in the file and was not declared.  These declarations
11076precede the first function definition that contains a call to an
11077undeclared function.  This option applies only to @code{protoize}.
11078
11079@item -i @var{string}
11080Indent old-style parameter declarations with the string @var{string}.
11081This option applies only to @code{protoize}.
11082
11083@code{unprotoize} converts prototyped function definitions to old-style
11084function definitions, where the arguments are declared between the
11085argument list and the initial @samp{@{}.  By default, @code{unprotoize}
11086uses five spaces as the indentation.  If you want to indent with just
11087one space instead, use @option{-i " "}.
11088
11089@item -k
11090Keep the @samp{.X} files.  Normally, they are deleted after conversion
11091is finished.
11092
11093@item -l
11094Add explicit local declarations.  @code{protoize} with @option{-l} inserts
11095a prototype declaration for each function in each block which calls the
11096function without any declaration.  This option applies only to
11097@code{protoize}.
11098
11099@item -n
11100Make no real changes.  This mode just prints information about the conversions
11101that would have been done without @option{-n}.
11102
11103@item -N
11104Make no @samp{.save} files.  The original files are simply deleted.
11105Use this option with caution.
11106
11107@item -p @var{program}
11108Use the program @var{program} as the compiler.  Normally, the name
11109@file{gcc} is used.
11110
11111@item -q
11112Work quietly.  Most warnings are suppressed.
11113
11114@item -v
11115Print the version number, just like @option{-v} for @command{gcc}.
11116@end table
11117
11118If you need special compiler options to compile one of your program's
11119source files, then you should generate that file's @samp{.X} file
11120specially, by running @command{gcc} on that source file with the
11121appropriate options and the option @option{-aux-info}.  Then run
11122@code{protoize} on the entire set of files.  @code{protoize} will use
11123the existing @samp{.X} file because it is newer than the source file.
11124For example:
11125
11126@example
11127gcc -Dfoo=bar file1.c -aux-info file1.X
11128protoize *.c
11129@end example
11130
11131@noindent
11132You need to include the special files along with the rest in the
11133@code{protoize} command, even though their @samp{.X} files already
11134exist, because otherwise they won't get converted.
11135
11136@xref{Protoize Caveats}, for more information on how to use
11137@code{protoize} successfully.
11138